diff --git a/.ci/bb/breeze-mpim/init.sh b/.ci/bb/breeze-mpim/init.sh new file mode 100644 index 0000000000000000000000000000000000000000..bc419103fb804d48a2dc0eeae1919eb90d12bc65 --- /dev/null +++ b/.ci/bb/breeze-mpim/init.sh @@ -0,0 +1,132 @@ +# Initialize utility functions: +. "$(cd "$(dirname "${BASH_SOURCE}")"; pwd)/../common_utils.sh" + +# +# Initializes the environment. +# +init_env () +{ + switch_for_module automake autoconf libtool swig ruby python +} + +# +# Initializes the Debian libtool +init_debian_libtool () +{ + export PATH="/usr/bin:${PATH-}" + export ACLOCAL_PATH="/usr/share/aclocal:${ACLOCAL_PATH-}" + + # Prepend ACLOCAL_PATH with the path to Automake: + module unload automake + switch_for_module automake +} + +# +# Sets variables for tests with GCC. +# +init_gcc () +{ + init_env + + switch_for_module gcc/12.1.0 mpich/3.4.3-gcc-12.1.0 + + CC=gcc + CXX=g++ + FC=gfortran + MPICC=mpicc + MPIFC=mpif90 + MPI_LAUNCH="$(which mpirun)" + + ECCODES_ROOT='/sw/bullseye-x64/packages/gcc-12.1.0/eccodes-2.26.0' + NETCDF_ROOT='/sw/bullseye-x64/packages/gcc-12.1.0/netcdf-c-4.9.0' + PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/ppm-1.0.8.1-gcc-12.1.0' + YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/yaxt-0.9.3.1-gcc-12.1.0' + + # The installations of NetCDF and ecCodes libraries do not provide '*.la' + # files, which would trigger the RPATH injection: + export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib:${NETCDF_ROOT}/lib:${LD_LIBRARY_PATH-}" +} + +# +# Sets variables for tests with NVHPC. +# +init_nvhpc () +{ + init_env + + switch_for_module nvhpc/22.3 mpich/3.4.3-nvhpc-22.3 + + CC=nvc + CXX=nvc++ + FC=nvfortran + MPICC=mpicc + MPIFC=mpif90 + MPI_LAUNCH="$(which mpirun)" + + ECCODES_ROOT='/sw/bullseye-x64/packages/nvhpc-22.3/eccodes-2.26.0' + NETCDF_ROOT='/sw/bullseye-x64/packages/nvhpc-22.3/netcdf-c-4.9.0' + PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/ppm-1.0.8.1-nvhpc-22.3' + YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/yaxt-0.9.3.1-nvhpc-22.3' + + # The installations of NetCDF and ecCodes libraries do not provide '*.la' + # files, which would trigger the RPATH injection: + export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib:${NETCDF_ROOT}/lib:${LD_LIBRARY_PATH-}" +} + +# +# Sets variables for tests with Clang. +# +init_clang () +{ + # Make the system gfortran the first gfortran in the PATH: + export PATH="/usr/bin:${PATH-}" + + init_env + + switch_for_module clang/14.0.6 openmpi/4.1.3-clang-14.0.6 + + CC=clang + CXX=clang++ + FC=gfortran + MPICC=mpicc + MPIFC=mpif90 + MPI_LAUNCH="$(which mpirun) --oversubscribe" + + ECCODES_ROOT='/sw/bullseye-x64/packages/clang-14.0.6/eccodes-2.26.0' + NETCDF_ROOT='/sw/bullseye-x64/packages/clang-14.0.6/netcdf-c-4.9.0-openmpi-4.1.3' + PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/ppm-1.0.8.1-clang-14.0.6' + YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/yaxt-0.9.3.1-clang-14.0.6' + + # The installations of NetCDF and ecCodes libraries do not provide '*.la' + # files, which would trigger the RPATH injection: + export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib:${NETCDF_ROOT}/lib:${LD_LIBRARY_PATH-}" +} + +# +# Sets variables for tests with NAG. +# +init_nag () +{ + # Make the system gcc the first gcc in the PATH: + export PATH="/usr/bin:${PATH-}" + + init_env + + switch_for_module nag/7.1 mpich/3.4.3-nag-7.1 + + CC=gcc + CXX=g++ + FC=nagfor + MPICC=mpicc + MPIFC=mpif90 + MPI_LAUNCH="$(which mpirun)" + + ECCODES_ROOT='/sw/bullseye-x64/packages/nag-7.1/eccodes-2.26.0' + NETCDF_ROOT='/sw/bullseye-x64/packages/nag-7.1/netcdf-c-4.9.0-mpich-3.4.3' + PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/ppm-1.0.8.1-nag-7.1' + YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/yaxt-0.9.3.1-nag-7.1' + + # The installations of NetCDF and ecCodes libraries do not provide '*.la' + # files, which would trigger the RPATH injection: + export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib:${NETCDF_ROOT}/lib:${LD_LIBRARY_PATH-}" +} diff --git a/.ci/bb/breeze-mpim/install_prerequisites.sh b/.ci/bb/breeze-mpim/install_prerequisites.sh new file mode 100755 index 0000000000000000000000000000000000000000..a6cc27b07f3ccb5113a8daf123c0237dc8dffe99 --- /dev/null +++ b/.ci/bb/breeze-mpim/install_prerequisites.sh @@ -0,0 +1,126 @@ +#!/bin/bash + +set -eu +unset CDPATH + +module purge +module load git + +install_dir='/data/mpi/sclab/sip/m300488/libcdi-ci-sw' +work_dir="$(pwd)/build" +make_cmd='make -j22' + +mkdir -p "${work_dir}" && cd "${work_dir}" + +# Get PPM: +wget https://swprojects.dkrz.de/redmine/attachments/download/521/ppm-1.0.8.1.tar.gz +tar xvf ppm-1.0.8.1.tar.gz +ppm_src_dir="${work_dir}/ppm-1.0.8.1" +ppm_name_tag='ppm-1.0.8.1' +ppm_config_args='--enable-MPI --disable-netcdf --disable-hdf5 --disable-parmetis --disable-metis --disable-crypto' + +# Get YAXT: +git clone -b release-0.9.3.1 https://gitlab.dkrz.de/dkrz-sw/yaxt.git +git -C yaxt cherry-pick 8c1b18bc9cfb3c7185017e37f8b39f7a61c94259 +yaxt_src_dir="${work_dir}/yaxt" +yaxt_name_tag='yaxt-0.9.3.1' +yaxt_config_args='' + +export CC='mpicc' +export FC='mpif90' + +# Install for GCC 12.1.0: +compiler_name_tag='gcc-12.1.0' +module load mpich/3.4.3-gcc-12.1.0 + +# Install PPM: +build_dir="${ppm_name_tag}-${compiler_name_tag}" +mkdir "${build_dir}" +( cd "${build_dir}" + "${ppm_src_dir}/configure" ${ppm_config_args} --prefix="${install_dir}/${ppm_name_tag}-${compiler_name_tag}" FCFLAGS='-g -O2 -fallow-argument-mismatch' + $make_cmd + $make_cmd check + $make_cmd install ) + +# Install YAXT: +build_dir="${yaxt_name_tag}-${compiler_name_tag}" +mkdir "${build_dir}" +( cd "${build_dir}" + "${yaxt_src_dir}/configure" ${yaxt_config_args} --prefix="${install_dir}/${yaxt_name_tag}-${compiler_name_tag}" + $make_cmd + $make_cmd check + $make_cmd install ) + +module unload mpich/3.4.3-gcc-12.1.0 + +# Install for NVHPC 22.3: +compiler_name_tag='nvhpc-22.3' +module load mpich/3.4.3-nvhpc-22.3 + +# Install PPM: +build_dir="${ppm_name_tag}-${compiler_name_tag}" +mkdir "${build_dir}" +( cd "${build_dir}" + "${ppm_src_dir}/configure" ${ppm_config_args} --prefix="${install_dir}/${ppm_name_tag}-${compiler_name_tag}" FCFLAGS='-g -O2 -tp sandybridge' CFLAGS='-g -O2 -tp sandybridge' + $make_cmd + $make_cmd check + $make_cmd install ) + +# Install YAXT: +build_dir="${yaxt_name_tag}-${compiler_name_tag}" +mkdir "${build_dir}" +( cd "${build_dir}" + "${yaxt_src_dir}/configure" ${yaxt_config_args} --prefix="${install_dir}/${yaxt_name_tag}-${compiler_name_tag}" FCFLAGS='-g -O2 -tp sandybridge' CFLAGS='-g -O2 -tp sandybridge' + $make_cmd + $make_cmd check + $make_cmd install ) + +module unload mpich/3.4.3-nvhpc-22.3 + +# Install for Clang 14.0.6: +compiler_name_tag='clang-14.0.6' +module load openmpi/4.1.3-clang-14.0.6 + +# Install PPM: +build_dir="${ppm_name_tag}-${compiler_name_tag}" +mkdir "${build_dir}" +( cd "${build_dir}" + "${ppm_src_dir}/configure" ${ppm_config_args} --prefix="${install_dir}/${ppm_name_tag}-${compiler_name_tag}" FCFLAGS='-g -O2 -no-pie' + $make_cmd + $make_cmd check + $make_cmd install ) + +# Install YAXT: +build_dir="${yaxt_name_tag}-${compiler_name_tag}" +mkdir "${build_dir}" +( cd "${build_dir}" + "${yaxt_src_dir}/configure" ${yaxt_config_args} --prefix="${install_dir}/${yaxt_name_tag}-${compiler_name_tag}" FCFLAGS='-g -O2 -no-pie' + $make_cmd + $make_cmd check + $make_cmd install ) + +module unload openmpi/4.1.3-clang-14.0.6 + +# Install for NAG 7.1: +compiler_name_tag='nag-7.1' +module load mpich/3.4.3-nag-7.1 + +# Install PPM: +build_dir="${ppm_name_tag}-${compiler_name_tag}" +mkdir "${build_dir}" +( cd "${build_dir}" + "${ppm_src_dir}/configure" ${ppm_config_args} --prefix="${install_dir}/${ppm_name_tag}-${compiler_name_tag}" FC=no + $make_cmd + $make_cmd check + $make_cmd install ) + +# Install YAXT: +build_dir="${yaxt_name_tag}-${compiler_name_tag}" +mkdir "${build_dir}" +( cd "${build_dir}" + "${yaxt_src_dir}/configure" ${yaxt_config_args} --prefix="${install_dir}/${yaxt_name_tag}-${compiler_name_tag}" + $make_cmd + $make_cmd check + $make_cmd install ) + +module unload mpich/3.4.3-nag-7.1 diff --git a/.ci/bb/breeze-mpim/test.all.clang b/.ci/bb/breeze-mpim/test.all.clang index 5047123ae0923edda3abb004ec63861d24dac3bd..4396928c68c250a4e4ffec8438115620d321142d 100755 --- a/.ci/bb/breeze-mpim/test.all.clang +++ b/.ci/bb/breeze-mpim/test.all.clang @@ -6,35 +6,45 @@ set -o pipefail script_dir=$(cd "$(dirname "$0")"; pwd) top_srcdir=$(cd "${script_dir}/../../.."; pwd) -. "${script_dir}/utils.sh" -init_clang1201 +. "${script_dir}/init.sh" +init_clang # Check the formatting. Note that git-clang-format might keep redundant blank # lines. Therefore, we use clang-format: -find src app \ - -name '*.h' -o -name '*.hpp' -o -name '*.c' -o -name '*.cpp' | \ - xargs -n 1 -P 8 clang-format --Werror --dry-run --verbose - -test -f "${top_srcdir}/configure" || "${top_srcdir}/autogen.sh" +find src app interfaces tests examples \ + \( -name '*.h' -o -name '*.hpp' -o -name '*.c' -o -name '*.cpp' \) -a \ + ! -path 'interfaces/python/cdi_wrapper.cpp' -a \ + ! -path 'interfaces/ruby/cdi_wrapper.cpp' -a \ + ! -path 'src/cdilib.c' \ + | xargs -n 1 -P 8 clang-format --Werror --dry-run --verbose + +enable_maintainer_mode='no' +if test ! -f "${top_srcdir}/configure"; then + "${top_srcdir}/autogen.sh" + # If there is no configure script, there are, most probably, no Fortran + # interface files, which are generated in the maintainer mode only: + enable_maintainer_mode='yes' +fi "${top_srcdir}/configure" \ ---disable-maintainer-mode \ --enable-cf-interface \ --enable-iso-c-interface \ +--enable-maintainer-mode="${enable_maintainer_mode}" \ --enable-mpi \ --enable-option-checking=fatal \ +--enable-ppm-dist-array \ --with-eccodes="${ECCODES_ROOT}" \ --with-netcdf="${NETCDF_ROOT}" \ CC="${MPICC}" \ -CPPFLAGS="-I${UUID_ROOT}/include" \ FC="${MPIFC}" \ -F77="${MPIFC}" \ -LDFLAGS="-I${UUID_ROOT}/lib" \ +FCFLAGS='-g -O2 -no-pie' \ MPI_LAUNCH="${MPI_LAUNCH}" \ PKG_CONFIG_PATH="${YAXT_ROOT}/lib/pkgconfig:${PPM_ROOT}/lib/pkgconfig" make -j8 -make -j8 check | tee tests/test-suite.log +make -j8 check || { cat tests/test-suite.log; exit 1; } check_all_tests_passed tests/test-suite.log + +check_no_git_untracked diff --git a/.ci/bb/breeze-mpim/test.all.nag b/.ci/bb/breeze-mpim/test.all.nag index 7f467bfdea3be4ce28232e90d4387dff834b6016..68b2618a265fde6e05ad92cbe541814c297926c1 100755 --- a/.ci/bb/breeze-mpim/test.all.nag +++ b/.ci/bb/breeze-mpim/test.all.nag @@ -6,53 +6,32 @@ set -o pipefail script_dir=$(cd "$(dirname "$0")"; pwd) top_srcdir=$(cd "${script_dir}/../../.."; pwd) -. "${script_dir}/utils.sh" -init_nag626223 +. "${script_dir}/init.sh" +init_nag test -f "${top_srcdir}/configure" || "${top_srcdir}/autogen.sh" -# Create a distribution file with minimalistic configuration: -"${top_srcdir}/configure" -make -j1 dist - -# Create a subdirectory for further testing and switch to it: -mkdir check_dist && cd check_dist - -# Move the distribution file to the test directory and unpack it: -mv ../cdi-*.tar.gz ./ -tar xf cdi-*.tar.gz - -# Create a subdirectory for building and switch to it: -mkdir build && cd build +"${top_srcdir}/configure" --enable-maintainer-mode # Use GCC from the path when compiling/linking Fortran code: -FCFLAGS="-O2 -g -Wc=$(which gcc)" +export FCFLAGS="-g -O2 -Wc=$(which gcc)" -# Create an out-of-source configuration: -../cdi-*/configure \ +make -j8 distcheck DISTCHECK_CONFIGURE_FLAGS=" \ --disable-maintainer-mode \ --enable-cf-interface \ --enable-iso-c-interface \ --enable-mpi \ --enable-option-checking=fatal \ ---with-eccodes="${ECCODES_ROOT}" \ ---with-netcdf="${NETCDF_ROOT}" \ -CC="${MPICC}" \ -CPPFLAGS="-I${UUID_ROOT}/include" \ -F77="${MPIFC}" \ -FC="${MPIFC}" \ -FCFLAGS="${FCFLAGS}" \ -FFLAGS="${FCFLAGS}" \ -LDFLAGS="-I${UUID_ROOT}/lib" \ -MPI_LAUNCH="${MPI_LAUNCH}" \ -PKG_CONFIG_PATH="${YAXT_ROOT}/lib/pkgconfig:${PPM_ROOT}/lib/pkgconfig" - -make -j8 - -make -j8 check | tee tests/test-suite.log +--enable-ppm-dist-array \ +--with-eccodes='${ECCODES_ROOT}' \ +--with-netcdf='${NETCDF_ROOT}' \ +CC='${MPICC}' \ +FC='${MPIFC}' \ +FCFLAGS='${FCFLAGS}' \ +MPI_LAUNCH='${MPI_LAUNCH}' \ +PKG_CONFIG_PATH='${YAXT_ROOT}/lib/pkgconfig:${PPM_ROOT}/lib/pkgconfig' \ +" | tee >(sed -n '/^Testsuite summary for cdi/,/^# ERROR:/p' > tests/test-suite.log) check_all_tests_passed tests/test-suite.log -make -j8 distclean - -check_no_files_in_cwd +check_no_git_untracked diff --git a/.ci/bb/breeze-mpim/test.all.nv b/.ci/bb/breeze-mpim/test.all.nv index 786ff18324a3a4ba029ffe9b0d9a1039575b23a7..4025ba7b5c2e8294d342e52efc9af9b294c1c34b 100755 --- a/.ci/bb/breeze-mpim/test.all.nv +++ b/.ci/bb/breeze-mpim/test.all.nv @@ -6,42 +6,43 @@ set -o pipefail script_dir=$(cd "$(dirname "$0")"; pwd) top_srcdir=$(cd "${script_dir}/../../.."; pwd) -. "${script_dir}/utils.sh" -init_nv2130 +. "${script_dir}/init.sh" +init_nvhpc + +enable_maintainer_mode='no' +if test ! -f "${top_srcdir}/configure"; then + # If there is no configure script, there are, most probably, no Fortran + # interface files, which are generated in the maintainer mode only: + enable_maintainer_mode='yes' +fi # We want to check with the Debian version of Libtool, which is patched to avoid # overlinking: -( export PATH="/usr/bin:${PATH-}" - export ACLOCAL_PATH="/usr/share/aclocal:${ACLOCAL_PATH-}" - module unload automake/1.16.1 - module load automake/1.16.1 - "${top_srcdir}/autogen.sh" ) +( init_debian_libtool; "${top_srcdir}/autogen.sh" ) "${top_srcdir}/configure" \ ---disable-maintainer-mode \ --enable-cf-interface \ --enable-iso-c-interface \ +--enable-maintainer-mode="${enable_maintainer_mode}" \ --enable-mpi \ --enable-option-checking=fatal \ +--enable-ppm-dist-array \ --with-eccodes="${ECCODES_ROOT}" \ --with-netcdf="${NETCDF_ROOT}" \ CC="${MPICC}" \ -CPPFLAGS="-I${UUID_ROOT}/include" \ -F77="${MPIFC}" \ FC="${MPIFC}" \ -FCFLAGS='-g -fPIC' \ -LDFLAGS="-I${UUID_ROOT}/lib" \ MPI_LAUNCH="${MPI_LAUNCH}" \ PKG_CONFIG_PATH="${YAXT_ROOT}/lib/pkgconfig:${PPM_ROOT}/lib/pkgconfig" make -j8 -make -j8 check | tee tests/test-suite.log +# Check that an executable is not overlinked to libscalesppmcore.so: +tested_file='examples/pio/collectData.parallel' +tested_dir=$(dirname "${tested_file}") -check_all_tests_passed tests/test-suite.log +rm -f "${tested_file}" && make -C "${tested_dir}" AM_CFLAGS=-shared +tested_file="${tested_dir}/.libs/$(basename "${tested_file}")" -# Check that an executable is not overlinked to libscalesppmcore.so: -tested_file='./examples/pio/.libs/collectData' invalid_needed=`readelf -d "${tested_file}" | sed -E -n '/\(NEEDED\).*libscalesppmcore\.so/p'` || { echo "ERROR: failed to check '${tested_file}' for ELF NEEDED entries" >&2 exit 1 @@ -53,3 +54,9 @@ if test -n "${invalid_needed}"; then } >&2 exit 1 fi + +make -j8 check || { cat tests/test-suite.log; exit 1; } + +check_all_tests_passed tests/test-suite.log + +check_no_git_untracked diff --git a/.ci/bb/breeze-mpim/test.ru-py.gcc b/.ci/bb/breeze-mpim/test.ru-py.gcc index 20d8a9a4584849af49f5ea271f983a50a39990ad..f514da1f6ca178cd888ce0a6194b04fcbf5c4bbb 100755 --- a/.ci/bb/breeze-mpim/test.ru-py.gcc +++ b/.ci/bb/breeze-mpim/test.ru-py.gcc @@ -5,29 +5,58 @@ set -o pipefail script_dir=$(cd "$(dirname "$0")"; pwd) top_srcdir=$(cd "${script_dir}/../../.."; pwd) +install_dir="$(pwd)/install" -. "${script_dir}/utils.sh" -init_gcc630 +. "${script_dir}/init.sh" +init_gcc -test -f "${top_srcdir}/configure" || "${top_srcdir}/autogen.sh" +enable_maintainer_mode='no' +if test ! -f "${top_srcdir}/configure"; then + "${top_srcdir}/autogen.sh" + # If there is no configure script, there are, most probably, no Ruby and + # Python interface files, which are generated in the maintainer mode only: + enable_maintainer_mode='yes' +fi "${top_srcdir}/configure" \ ---disable-maintainer-mode \ +--enable-maintainer-mode="${enable_maintainer_mode}" \ --enable-option-checking=fatal \ ---enable-python \ ---enable-ruby \ ---enable-swig \ +--enable-python-interface \ +--enable-ruby-interface \ +--prefix="${install_dir}" \ --with-eccodes="${ECCODES_ROOT}" \ --with-netcdf="${NETCDF_ROOT}" \ CC="${CC}" \ -CPPFLAGS="-I${UUID_ROOT}/include" \ -CXX="${CXX}" \ -LDFLAGS="-L${UUID_ROOT}/lib" +CXX="${CXX}" make -j8 -# Test the interfaces: -LD_LIBRARY_PATH="${NETCDF_ROOT}/lib:${LD_LIBRARY_PATH}" make -j8 -C interfaces test -(cd interfaces && ./CdiInfo) - -make -j8 check +make -j8 check || { cat interfaces/test-suite.log tests/test-suite.log; exit 1; } + +check_all_tests_passed interfaces/test-suite.log + +check_no_git_untracked + +# Check the installation: +make -j8 install +export RUBYLIB="$(find "${install_dir}" -name 'Cdi.so' -printf '%h'):${RUBYLIB-}" +ruby ./interfaces/ruby/test.rb ./interfaces/testdata/mulval.grb +ruby ./interfaces/ruby/test.rb ./interfaces/testdata/mulval.nc +export PYTHONPATH="$(find "${install_dir}" -name 'Cdi.py' -printf '%h'):${PYTHONPATH-}" +python ./interfaces/python/test.py ./interfaces/testdata/mulval.grb +python ./interfaces/python/test.py ./interfaces/testdata/mulval.nc + +# Check the uninstallation: +make -j8 uninstall +remaining_files=$(find "${install_dir}" -type f) || { + echo "ERROR: failed to get the list of files in the installation prefix '${install_dir}'" >&2 + exit 1 +} + +test -z "${remaining_files}" || { + cat >&2 <<_EOF +ERROR: 'make uninstall' did not remove the following files: +${remaining_files} +_EOF + exit 1 +} diff --git a/.ci/bb/breeze-mpim/utils.sh b/.ci/bb/breeze-mpim/utils.sh deleted file mode 100644 index 61868dab965ce979be23f8722e117da5b7fad95f..0000000000000000000000000000000000000000 --- a/.ci/bb/breeze-mpim/utils.sh +++ /dev/null @@ -1,259 +0,0 @@ -# -# Accepts a list of environment modules and loads them witch conflict -# resolution. -# -switch_for_module () -{ - for sfm_module in "$@"; do - sfm_module_full= - sfm_module_short= - case $sfm_module in - */*) - # The module is provided with the version part: - sfm_module_full=$sfm_module - sfm_module_short=`echo $sfm_module | sed 's%/[^/]*$%%'` ;; - *) - # Only the name of the module is provided, get the default version: - sfm_module_full=`module show $sfm_module 2>&1 | sed -n "s%^[^ \t]*/\\($sfm_module.*\\):%\\1%p"` - sfm_module_short=$sfm_module ;; - esac - - # A space-separated list of modules that are already loaded: - sfm_loaded_full=`module -t list 2>&1 | tr '\n' ' ' | sed 's/^.*Modulefiles://' | sed 's/(default)//g'` - - # Check whether the requested module if already loaded: - if test -n "$sfm_module_full"; then - case " $sfm_loaded_full " in - *" $sfm_module_full "*) - echo "module $sfm_module is already loaded" - continue ;; - esac - fi - - # A list of modules in conflict: - sfm_conflicts=`module show $sfm_module 2>&1 | sed -n 's/^conflict\(.*\)/\1/p' | tr '\n\t' ' '` - - # A list of loaded modules without version parts: - sfm_loaded_short=`echo "$sfm_loaded_full" | sed 's%\([^ ][^ ]*\)/[^ ]*%\1%g'` - - # Add the short name of the module to the list of conflicts: - sfm_conflicts="$sfm_conflicts $sfm_module_short" - - # A list of loaded modules that are in conflict with the requested module: - sfm_loaded_conflicts= - for sfm_conflict in $sfm_conflicts""; do - sfm_loaded_list= - case $sfm_conflict in - */*) - # The conflict is specified with the version part: - sfm_loaded_list=$sfm_loaded_full ;; - *) - # The conflict is specified without the version part: - sfm_loaded_list=$sfm_loaded_short ;; - esac - - # Check that the conflicted module is loaded: - case " $sfm_loaded_list " in - *" $sfm_conflict "*) - # The conflict is loaded, check whether it is already added to the - # list: - case " $sfm_loaded_conflicts " in - *" $sfm_conflict "*) ;; - *) - # The conflict is not in the list, append: - sfm_loaded_conflicts="$sfm_loaded_conflicts $sfm_conflict" ;; - esac - ;; - esac - done - - # Calculate the number of modules that must be unloaded to before loading - # the requested module: - sfm_loaded_conflicts_count=`echo $sfm_loaded_conflicts | wc -w` - - case $sfm_loaded_conflicts_count in - 0) - # None of the conflicting modules is loaded: - sfm_cmd="module load $sfm_module" ;; - 1) - # There is only one module that must be unloaded, use switch command: - sfm_cmd="module switch $sfm_loaded_conflicts $sfm_module" ;; - *) - # There is more than one module that must be unloaded, unload all of - # them and then load the requested one: - sfm_cmd="module unload $sfm_loaded_conflicts && module load $sfm_module" ;; - esac - - echo "$sfm_cmd" - eval "$sfm_cmd" - done -} - -# -# Initializes the environment. -# -init_env () -{ - saved_set=$- - set +eu - . /etc/profile.d/mpim.sh - set -${saved_set} - switch_for_module automake/1.16.1 - - # Use non-Debian libtool by default: - LIBTOOL_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/libtool-2.4.6-qdyaqqw' - export PATH="${LIBTOOL_ROOT}/bin:${PATH-}" - export ACLOCAL_PATH="${LIBTOOL_ROOT}/share/aclocal:${ACLOCAL_PATH-}" - - SWIG_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/swig-4.0.2-busrrtn' - RUBY_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/ruby-3.0.2-stqm2vj' - PYTHON_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/python-2.7.18-zqrnwom' - - export PATH="${RUBY_ROOT}/bin:${PYTHON_ROOT}/bin:${SWIG_ROOT}/bin:${PATH-}" -} - -# -# Sets variables for tests with GCC 6.3.0. -# -init_gcc630 () -{ - init_env - switch_for_module gcc/6.3.0 - - CC=gcc - CXX=g++ - FC=gfortran - - ECCODES_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/eccodes-2.21.0-3sdngaq' - NETCDF_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/netcdf-c-4.8.0-fzupaca' - UUID_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/libuuid-1.0.3-rm4kv2o' - - # Here we fix a never-ending story with Libtool overlinkning, absence of - # '*.la' files when they could help, and '-Wl,--disable/enable-new-dtags': - HDF5_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/hdf5-1.10.7-4l3frcp' - export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib:${HDF5_ROOT}/lib:${LD_LIBRARY_PATH-}" -} - -# -# Sets variables for tests with NVHPC 21.3.0. -# -init_nv2130 () -{ - init_env - switch_for_module gcc/6.3.0 - - export NVHPC='/data/mpi/sclab/sip/m300488/nvhpc' - export NVLOCALRC="${NVHPC}/Linux_x86_64/21.3/compilers/bin/localrc.60300" - export PATH="${NVHPC}/Linux_x86_64/21.3/compilers/bin:${PATH-}" - - CC=nvc - CXX=nvc++ - FC=nvfortran - - export PATH="/data/mpi/sclab/sip/m300488/libcdi-ci-sw/nvhpc-21.3-sandybridge/mpich-3.4.2-sfxulsj/bin:${PATH-}" - MPICC=mpicc - MPIFC=mpif90 - MPI_LAUNCH="$(which mpirun)" - - ECCODES_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/eccodes-2.21.0-3sdngaq' - NETCDF_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/nvhpc-21.3-sandybridge/netcdf-c-4.8.0-vjppuov' - PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/nvhpc-21.3-sandybridge/scales-ppm-1.0.7-uy4z72r' - YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/nvhpc-21.3-sandybridge/yaxt-0.9.2.1-lbqqemx' - UUID_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/libuuid-1.0.3-rm4kv2o' - - # Here we fix a never-ending story with Libtool overlinkning, absence of - # '*.la' files when they could help, and '-Wl,--disable/enable-new-dtags': - HDF5_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/nvhpc-21.3-sandybridge/hdf5-1.10.7-h7pvthl' - export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib:${HDF5_ROOT}/lib:${LD_LIBRARY_PATH-}" -} - -# -# Sets variables for tests with Clang 12.0.1. -# -init_clang1201 () -{ - init_env - switch_for_module gcc/6.3.0 - - export PATH="/data/mpi/sclab/sip/m300488/clang/12.0.1/bin:${PATH-}" - # Clang does not inject RPATHs to the standard library in use: - export LD_LIBRARY_PATH="/sw/stretch-x64/gcc/gcc-6.3.0/lib64:${LD_LIBRARY_PATH-}" - - CC=clang - CXX=clang++ - FC=gfortran - - export PATH="/data/mpi/sclab/sip/m300488/libcdi-ci-sw/clang-12.0.1-sandybridge/openmpi-4.1.1-6ydagyy/bin:${PATH-}" - MPICC=mpicc - MPIFC=mpif90 - MPI_LAUNCH="$(which mpirun) --oversubscribe" - - ECCODES_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/eccodes-2.21.0-3sdngaq' - NETCDF_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/clang-12.0.1-sandybridge/netcdf-c-4.8.0-z6r5guk' - PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/clang-12.0.1-sandybridge/scales-ppm-1.0.7-5mhatgx' - YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/clang-12.0.1-sandybridge/yaxt-0.9.2.1-cj2nf5j' - UUID_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/libuuid-1.0.3-rm4kv2o' - - # Here we fix a never-ending story with Libtool overlinkning, absence of - # '*.la' files when they could help, and '-Wl,--disable/enable-new-dtags': - HDF5_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/clang-12.0.1-sandybridge/hdf5-1.10.7-4y54xnh' - export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib:${HDF5_ROOT}/lib:${LD_LIBRARY_PATH-}" -} - -# -# Sets variables for tests with NAG 6.2.6223. -# -init_nag626223 () -{ - init_env - switch_for_module gcc/6.3.0 nag/6.2 - - CC=gcc - CXX=g++ - FC=nagfor - - export PATH="/data/mpi/sclab/sip/m300488/libcdi-ci-sw/nag-6.2-sandybridge/mpich-3.4.2-fzsvtw2/bin:${PATH-}" - MPICC=mpicc - MPIFC=mpif90 - MPI_LAUNCH="$(which mpirun)" - - ECCODES_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/eccodes-2.21.0-3sdngaq' - NETCDF_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/nag-6.2-sandybridge/netcdf-c-4.8.0-ogawg3w' - PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/nag-6.2-sandybridge/scales-ppm-1.0.7-5kdlwzv' - YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/nag-6.2-sandybridge/yaxt-0.9.2.1-rhq2ysn' - UUID_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/libuuid-1.0.3-rm4kv2o' - - # Here we fix a never-ending story with Libtool overlinkning, absence of - # '*.la' files when they could help, and '-Wl,--disable/enable-new-dtags': - HDF5_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/nag-6.2-sandybridge/hdf5-1.10.7-pltg3k4' - export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib:${HDF5_ROOT}/lib:${LD_LIBRARY_PATH-}" -} - -# -# Accepts a path to a file containing the testsuite summary (either the -# 'test-suite.log' or the standard output of the 'make check' command) and -# checks whether all tests were run and passed. -# -check_all_tests_passed () -{ - awk '/SKIP: /{ - print "ERROR: the total number of tests is not equal to the number of passed tests"; - exit 1; - }' $1 >&2 -} - -# -# Checks whether the current working directory or any of its subdirectories -# contain a file and fails with an error message if that is the case. -# -check_no_files_in_cwd () -{ - cnfic_files=`find . -type f 2>/dev/null` - if test -n "$cnfic_files"; then - { - echo "ERROR: the current working directory contains undeleted files:" - echo "$cnfic_files" - } >&2 - exit 1 - fi -} diff --git a/.ci/bb/levante-dkrz/utils.sh b/.ci/bb/common_utils.sh similarity index 51% rename from .ci/bb/levante-dkrz/utils.sh rename to .ci/bb/common_utils.sh index 0be138ae34319d65eff6ce3ac47e7566ac4006c3..c55f15c3a6d9fa7d1b0771f81191593604a79228 100644 --- a/.ci/bb/levante-dkrz/utils.sh +++ b/.ci/bb/common_utils.sh @@ -1,10 +1,45 @@ # -# Accepts a list of environment modules and loads them witch conflict -# resolution. +# Accepts a list of environment modules and makes sure that they are +# loaded/unloaded. The function makes it easier to manipulate modules in +# non-interactive shell mode while transparently accounting for several common +# defects in the configuration of the environment module system: +# +# 1) if a module's name is prepended with the exclamation mark ('!') on the +# argument list, the module is unloaded using the 'make unload' command +# (helps in preparing the environment using a single command); +# +# 2) if a module is already loaded, it does not get reloaded (some +# environments, e.g. Cray, are sensitive to the undocumented order of the +# loaded modules and keeping an already loaded module instead of reloading +# it is often safer); +# +# 3) if a module conflicts exactly one already loaded module, it gets loaded +# using the 'module switch' command (this is often the only tested and +# functional way to load a required module in some environments, e.g +# PrgEnv-* modules on Cray); +# +# 4) if a module is in conflict with several already loaded modules, all +# conflicting modules get unloaded first using the 'module unload' command +# and then the required module is loaded using the 'module load' command; +# +# 5) if a module's name starts with 'PrgEnv-', it is considered to be in +# conflict with any other module that has that prefix (on a Cray system, it +# is important that only one PrgEnv module is loaded at a time, which is +# normally covered with the mutual conflict statements in the respective +# module files, however, that is not always the case). # switch_for_module () { for sfm_module in "$@"; do + case $sfm_module in + !*) + sfm_module=`echo $sfm_module | cut -c2-` + sfm_cmd="module unload $sfm_module" + echo "$sfm_cmd" + eval "$sfm_cmd" + continue ;; + esac + sfm_module_full= sfm_module_short= case $sfm_module in @@ -39,10 +74,30 @@ switch_for_module () # Add the short name of the module to the list of conflicts: sfm_conflicts="$sfm_conflicts $sfm_module_short" + # On a Cray system, it is important that only one PrgEnv module is loaded at + # a time. This is normally covered with the mutual conflict statements in + # the respective module files. However, that is not always the case, + # therefore we introduce an additional protection against two or more PrgEnv + # modules being loaded simultaneously: if the module we are asked to switch + # for starts with PrgEnv-, each of the loaded modules that starts with + # PrgEnv- too is added to the list of conflicts: + case $sfm_module_short in + PrgEnv-*) + for sfm_loaded in $sfm_loaded_short; do + case $sfm_loaded in + PrgEnv-*) + sfm_conflicts="$sfm_conflicts $sfm_loaded" ;; + *) ;; + esac + done + ;; + *) ;; + esac + # A list of loaded modules that are in conflict with the requested module: sfm_loaded_conflicts= for sfm_conflict in $sfm_conflicts""; do - sfm_loaded_list= + sfm_loaded_list= case $sfm_conflict in */*) # The conflict is specified with the version part: @@ -89,69 +144,6 @@ switch_for_module () done } -# -# Initializes the environment. -# -init_env () -{ - : -} - -# -# Sets variables for tests with GCC 11.2.0. -# -init_gcc1120 () -{ - init_env - switch_for_module gcc/11.2.0-gcc-11.2.0 openmpi/4.1.2-gcc-11.2.0 - - CC=gcc - CXX=g++ - FC=gfortran - MPICC=mpicc - MPIFC=mpif90 - MPI_LAUNCH="$(which mpirun)" - - ECCODES_ROOT='/sw/spack-levante/eccodes-2.21.0-4ywkk4' - NETCDF_ROOT='/sw/spack-levante/netcdf-c-4.8.1-6qheqr' - PPM_ROOT='/work/mh0287/m300488/libcdi-ci-sw/install/ppm-1.0.8-gcc-11.2.0' - YAXT_ROOT='/work/mh0287/m300488/libcdi-ci-sw/install/yaxt-0.9.3-gcc-11.2.0' - - # Here we fix a never-ending story with Libtool overlinkning, absence of - # '*.la' files when they could help, and '-Wl,--disable/enable-new-dtags': - export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib64:${NETCDF_ROOT}/lib:${LD_LIBRARY_PATH-}" -} - -# -# Sets variables for tests with Intel Classic 2021.5.0. -# -init_intelclassic202150 () -{ - init_env - # Try to make sure that the compiler works with the system gcc: - module unload gcc - # For whatever reason, Intel Classic 2021.5.0 is enabled with - # intel-oneapi-compilers/2022.0.1-gcc-11.2.0: - switch_for_module intel-oneapi-compilers/2022.0.1-gcc-11.2.0 openmpi/4.1.2-intel-2021.5.0 - - AR=xiar - CC=icc - CXX=icpc - FC=ifort - MPICC=mpicc - MPIFC=mpif90 - MPI_LAUNCH="$(which mpirun)" - - ECCODES_ROOT='/sw/spack-levante/eccodes-2.21.0-3ehkbb' - NETCDF_ROOT='/sw/spack-levante/netcdf-c-4.8.1-2k3cmu' - PPM_ROOT='/work/mh0287/m300488/libcdi-ci-sw/install/ppm-1.0.8-intel-classic-2021.5.0' - YAXT_ROOT='/work/mh0287/m300488/libcdi-ci-sw/install/yaxt-0.9.3-intel-classic-2021.5.0' - - # Here we fix a never-ending story with Libtool overlinkning, absence of - # '*.la' files when they could help, and '-Wl,--disable/enable-new-dtags': - export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib64:${NETCDF_ROOT}/lib:${LD_LIBRARY_PATH-}" -} - # # Accepts a path to a file containing the testsuite summary (either the # 'test-suite.log' or the standard output of the 'make check' command) and @@ -159,9 +151,13 @@ init_intelclassic202150 () # check_all_tests_passed () { - awk '/SKIP: /{ - print "ERROR: the total number of tests is not equal to the number of passed tests"; - exit 1; + awk '/^# TOTAL: /{ total+=$3 }; + /^# PASS: /{ pass+=$3 }; + END { + if ( total == "" || total != pass ) { + print "ERROR: the total number of tests ("total") is not equal to the number of passed tests ("pass")"; + exit 1; + } }' $1 >&2 } @@ -173,10 +169,32 @@ check_no_files_in_cwd () { cnfic_files=`find . -type f 2>/dev/null` if test -n "$cnfic_files"; then - { - echo "ERROR: the current working directory contains undeleted files:" - echo "$cnfic_files" - } >&2 + cat >&2 <<_EOF +ERROR: the current working directory contains undeleted files: + +$cnfic_files + +Update the respective distclean recipes. +_EOF + exit 1 + fi +} + +# +# Checks whether the building has generated any git-untracked files and fails if +# it has. +# +check_no_git_untracked () +{ + cngu_files=`git ls-files --other --exclude-standard` + if test -n "${cngu_files}"; then + cat >&2 <<_EOF +ERROR: the building process generated untracked files in the repository: + +$cngu_files + +Update '.gitignore'. +_EOF exit 1 fi } diff --git a/.ci/bb/daint-cscs/init.sh b/.ci/bb/daint-cscs/init.sh new file mode 100644 index 0000000000000000000000000000000000000000..489b2dafdd7c269a073d1c1691a20ace4564d37b --- /dev/null +++ b/.ci/bb/daint-cscs/init.sh @@ -0,0 +1,81 @@ +# Initialize utility functions: +. "$(cd "$(dirname "${BASH_SOURCE}")"; pwd)/../common_utils.sh" + +# +# Initializes the environment. +# +init_env () +{ + AUTOMAKE_ROOT='/project/d56/libcdi-ci-sw/gcc-11.2.0-haswell/automake-1.16.3-46gthis' + export PATH="${AUTOMAKE_ROOT}/bin:${PATH-}" + # Tell the custom installation of Automake where the libtool macros are: + export ACLOCAL_PATH="/usr/share/aclocal:${ACLOCAL_PATH-}" +} + +# +# Sets variables for tests with Cray. +# +init_cray () +{ + init_env + switch_for_module craype PrgEnv-cray cce/12.0.3 cray-mpich + + # Build and test against NetCDF that does not support MPI parallel invocations + # (parallel NetCDF4 tests are known to fail in this case when run from the + # user home directory on Daint): + switch_for_module cray-netcdf + + # Uncomment the following line to test against MPI-capable NetCDF: + # switch_for_module cray-netcdf-hdf5parallel cray-hdf5-parallel + + CC=cc + CXX=CC + FC=ftn + MPI_LAUNCH="$(which srun) -p cscsci -C gpu -A d56 -t 05:00" + + ECCODES_ROOT='/project/d56/libcdi-ci-sw/cce-12.0.3-haswell/eccodes-2.24.2-o2a4fw3' + PPM_ROOT='/project/d56/libcdi-ci-sw/cce-12.0.3-haswell/scales-ppm-1.0.8-44zlrlu' + YAXT_ROOT='/project/d56/libcdi-ci-sw/cce-12.0.3-haswell/yaxt-0.9.2.1-enz3pcz' + + # The installations of ecCodes, PPM and YAXT do not provide '*.la' files, + # which would trigger the RPATH injection: + export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib64:${PPM_ROOT}/lib:${YAXT_ROOT}/lib:${LD_LIBRARY_PATH-}" +} + +# +# Sets variables for tests with PGI. +# +init_pgi () +{ + init_env + # We use deprecated versions (the most recent compatible with PGI though) of + # the Cray packages and have to make sure that the default versions are + # unloaded (otherwise, we get various warnings and errors): + module unload cray-mpich cray-netcdf cray-netcdf-hdf5parallel cray-hdf5 cray-hdf5-parallel + switch_for_module craype PrgEnv-pgi/6.0.8 pgi/20.1.1 cray-mpich/7.7.15 + + # Build and test against NetCDF that does not support MPI parallel invocations + # (parallel NetCDF4 tests are known to fail in this case when run from the + # user home directory on Daint): + switch_for_module cray-netcdf/4.7.4.0 cray-hdf5/1.12.0.0 + + # Uncomment the following line to test against MPI-capable NetCDF: + # switch_for_module cray-netcdf-hdf5parallel/4.7.4.0 cray-hdf5-parallel/1.12.0.0 + + CC=cc + CXX=CC + FC=ftn + MPI_LAUNCH="$(which srun) -p cscsci -C gpu -A d56 -t 05:00" + + ECCODES_ROOT='/project/d56/libcdi-ci-sw/pgi-20.1.1-haswell/eccodes-2.24.2-hwtl5nr' + PPM_ROOT='/project/d56/libcdi-ci-sw/pgi-20.1.1-haswell/scales-ppm-1.0.8-z2nxqya' + YAXT_ROOT='/project/d56/libcdi-ci-sw/pgi-20.1.1-haswell/yaxt-0.9.2.1-3orop7g' + + # The deprecated versions of the Cray packages are not in the default linker + # search path: + export LD_LIBRARY_PATH="${MPICH_DIR}/lib:${NETCDF_DIR}/lib:${HDF5_DIR}/lib:${LD_LIBRARY_PATH-}" + + # The installations of ecCodes, PPM and YAXT do not provide '*.la' files, + # which would trigger the RPATH injection: + export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib64:${PPM_ROOT}/lib:${YAXT_ROOT}/lib:${LD_LIBRARY_PATH}" +} diff --git a/.ci/bb/daint-cscs/test.all.cray b/.ci/bb/daint-cscs/test.all.cray index 85a961807cafca02e810076cffb4b6c446fd1f68..35921729d6a67d9cf0a23d77ff270aae9c9a7b0c 100755 --- a/.ci/bb/daint-cscs/test.all.cray +++ b/.ci/bb/daint-cscs/test.all.cray @@ -6,8 +6,8 @@ set -o pipefail script_dir=$(cd "$(dirname "$0")"; pwd) top_srcdir=$(cd "${script_dir}/../../.."; pwd) -. "${script_dir}/utils.sh" -init_cray1203 +. "${script_dir}/init.sh" +init_cray # Save time for the person running this script manually: if test "x${PE_NETCDF_MODULE_NAME}" = 'xcray-netcdf'; then @@ -18,7 +18,13 @@ if test "x${PE_NETCDF_MODULE_NAME}" = 'xcray-netcdf'; then esac fi -test -f "${top_srcdir}/configure" || "${top_srcdir}/autogen.sh" +enable_maintainer_mode='no' +if test ! -f "${top_srcdir}/configure"; then + "${top_srcdir}/autogen.sh" + # If there is no configure script, there are, most probably, no Fortran + # interface files, which are generated in the maintainer mode only: + enable_maintainer_mode='yes' +fi # The configure script does not check the 'lib64' subdirectory, therefore we # run it with '--with-eccodes' and the following flags. Note that fixing this @@ -31,16 +37,17 @@ CPPFLAGS="-I${ECCODES_ROOT}/include" LDFLAGS="-L${ECCODES_ROOT}/lib64" "${top_srcdir}/configure" \ ---disable-maintainer-mode \ --enable-cf-interface \ --enable-iso-c-interface \ +--enable-maintainer-mode="${enable_maintainer_mode}" \ --enable-mpi \ --enable-option-checking=fatal \ +--enable-ppm-dist-array \ +--with-concurrent-mpi-checks \ --with-eccodes \ --with-netcdf \ CC="${CC}" \ CPPFLAGS="${CPPFLAGS}" \ -F77="${FC}" \ FC="${FC}" \ LDFLAGS="${LDFLAGS}" \ MPI_LAUNCH="${MPI_LAUNCH}" \ @@ -48,6 +55,10 @@ PKG_CONFIG_PATH="${YAXT_ROOT}/lib/pkgconfig:${PPM_ROOT}/lib/pkgconfig:${PKG_CONF make -j8 -make -j8 check | tee tests/test-suite.log +# Run with '-j' to submit as many MPI jobs as possible +# (see '--with-concurrent-mpi-checks'): +make -j check || { cat tests/test-suite.log; exit 1; } check_all_tests_passed tests/test-suite.log + +check_no_git_untracked diff --git a/.ci/bb/daint-cscs/test.all.pgi b/.ci/bb/daint-cscs/test.all.pgi index c6d02c8521a455ba7a41f151a28964cc9b57e8cc..fde1e97b07b1a79a3bbe413a5e171df7b5696b69 100755 --- a/.ci/bb/daint-cscs/test.all.pgi +++ b/.ci/bb/daint-cscs/test.all.pgi @@ -6,8 +6,8 @@ set -o pipefail script_dir=$(cd "$(dirname "$0")"; pwd) top_srcdir=$(cd "${script_dir}/../../.."; pwd) -. "${script_dir}/utils.sh" -init_pgi2011 +. "${script_dir}/init.sh" +init_pgi # Save time for the person running this script manually: if test "x${PE_NETCDF_MODULE_NAME}" = 'xcray-netcdf'; then @@ -18,7 +18,13 @@ if test "x${PE_NETCDF_MODULE_NAME}" = 'xcray-netcdf'; then esac fi -test -f "${top_srcdir}/configure" || "${top_srcdir}/autogen.sh" +enable_maintainer_mode='no' +if test ! -f "${top_srcdir}/configure"; then + "${top_srcdir}/autogen.sh" + # If there is no configure script, there are, most probably, no Fortran + # interface files, which are generated in the maintainer mode only: + enable_maintainer_mode='yes' +fi # The configure script does not check the 'lib64' subdirectory, therefore we # run it with '--with-eccodes' and the following flags. Note that fixing this @@ -31,19 +37,18 @@ CPPFLAGS="-I${ECCODES_ROOT}/include" LDFLAGS="-L${ECCODES_ROOT}/lib64" "${top_srcdir}/configure" \ ---disable-maintainer-mode \ --enable-cf-interface \ --enable-iso-c-interface \ +--enable-maintainer-mode="${enable_maintainer_mode}" \ --enable-mpi \ --enable-option-checking=fatal \ +--enable-ppm-dist-array \ +--with-concurrent-mpi-checks \ --with-eccodes \ --with-netcdf \ CC="${CC}" \ -CFLAGS='-g -O1' \ CPPFLAGS="${CPPFLAGS}" \ -F77="${FC}" \ FC="${FC}" \ -FCFLAGS='-g -fPIC' \ LDFLAGS="${LDFLAGS}" \ MPI_LAUNCH="${MPI_LAUNCH}" \ PKG_CONFIG_PATH="${YAXT_ROOT}/lib/pkgconfig:${PPM_ROOT}/lib/pkgconfig:${PKG_CONFIG_PATH}" \ @@ -51,6 +56,10 @@ PTHREAD_LIBS='-lpthread' make -j8 -make -j8 check | tee tests/test-suite.log +# Run with '-j' to submit as many MPI jobs as possible +# (see '--with-concurrent-mpi-checks'): +make -j check || { cat tests/test-suite.log; exit 1; } check_all_tests_passed tests/test-suite.log + +check_no_git_untracked diff --git a/.ci/bb/daint-cscs/utils.sh b/.ci/bb/daint-cscs/utils.sh deleted file mode 100644 index 7fa5f17d9036a6016258c28485bb4122dcf60e7c..0000000000000000000000000000000000000000 --- a/.ci/bb/daint-cscs/utils.sh +++ /dev/null @@ -1,182 +0,0 @@ -# -# Accepts a list of environment modules and loads them witch conflict -# resolution. -# -switch_for_module () -{ - for sfm_module in "$@"; do - sfm_module_full= - sfm_module_short= - case $sfm_module in - */*) - # The module is provided with the version part: - sfm_module_full=$sfm_module - sfm_module_short=`echo $sfm_module | sed 's%/[^/]*$%%'` ;; - *) - # Only the name of the module is provided, get the default version: - sfm_module_full=`module show $sfm_module 2>&1 | sed -n "s%^[^ \t]*/\\($sfm_module.*\\):%\\1%p"` - sfm_module_short=$sfm_module ;; - esac - - # A space-separated list of modules that are already loaded: - sfm_loaded_full=`module -t list 2>&1 | tr '\n' ' ' | sed 's/^.*Modulefiles://' | sed 's/(default)//g'` - - # Check whether the requested module if already loaded: - if test -n "$sfm_module_full"; then - case " $sfm_loaded_full " in - *" $sfm_module_full "*) - echo "module $sfm_module is already loaded" - continue ;; - esac - fi - - # A list of modules in conflict: - sfm_conflicts=`module show $sfm_module 2>&1 | sed -n 's/^conflict\(.*\)/\1/p' | tr '\n\t' ' '` - - # A list of loaded modules without version parts: - sfm_loaded_short=`echo "$sfm_loaded_full" | sed 's%\([^ ][^ ]*\)/[^ ]*%\1%g'` - - # Add the short name of the module to the list of conflicts: - sfm_conflicts="$sfm_conflicts $sfm_module_short" - - # A list of loaded modules that are in conflict with the requested module: - sfm_loaded_conflicts= - for sfm_conflict in $sfm_conflicts""; do - sfm_loaded_list= - case $sfm_conflict in - */*) - # The conflict is specified with the version part: - sfm_loaded_list=$sfm_loaded_full ;; - *) - # The conflict is specified without the version part: - sfm_loaded_list=$sfm_loaded_short ;; - esac - - # Check that the conflicted module is loaded: - case " $sfm_loaded_list " in - *" $sfm_conflict "*) - # The conflict is loaded, check whether it is already added to the - # list: - case " $sfm_loaded_conflicts " in - *" $sfm_conflict "*) ;; - *) - # The conflict is not in the list, append: - sfm_loaded_conflicts="$sfm_loaded_conflicts $sfm_conflict" ;; - esac - ;; - esac - done - - # Calculate the number of modules that must be unloaded to before loading - # the requested module: - sfm_loaded_conflicts_count=`echo $sfm_loaded_conflicts | wc -w` - - case $sfm_loaded_conflicts_count in - 0) - # None of the conflicting modules is loaded: - sfm_cmd="module load $sfm_module" ;; - 1) - # There is only one module that must be unloaded, use switch command: - sfm_cmd="module switch $sfm_loaded_conflicts $sfm_module" ;; - *) - # There is more than one module that must be unloaded, unload all of - # them and then load the requested one: - sfm_cmd="module unload $sfm_loaded_conflicts && module load $sfm_module" ;; - esac - - echo "$sfm_cmd" - eval "$sfm_cmd" - done -} - -# -# Initializes the environment. -# -init_env () -{ - AUTOMAKE_ROOT='/project/d56/libcdi-ci-sw/gcc-11.2.0-haswell/automake-1.16.3-46gthis' - export PATH="${AUTOMAKE_ROOT}/bin:${PATH-}" - # Tell the custom installation of Automake where the libtool macros are: - export ACLOCAL_PATH="/usr/share/aclocal:${ACLOCAL_PATH-}" -} - -# -# Sets variables for tests with Cray 12.0.3. -# -init_cray1203 () -{ - init_env - switch_for_module craype PrgEnv-cray cce/12.0.3 cray-mpich - - # Build and test against NetCDF that does not support MPI parallel invocations - # (parallel NetCDF4 tests are known to fail in this case when run from the - # user home directory on Daint): - switch_for_module cray-netcdf - - # Uncomment the following line to test against MPI-capable NetCDF: - # switch_for_module cray-netcdf-hdf5parallel cray-hdf5-parallel - - CC=cc - CXX=CC - FC=ftn - MPI_LAUNCH="$(which srun) -p cscsci -C gpu -A d56 -t 05:00" - - ECCODES_ROOT='/project/d56/libcdi-ci-sw/cce-12.0.3-haswell/eccodes-2.24.2-o2a4fw3' - PPM_ROOT='/project/d56/libcdi-ci-sw/cce-12.0.3-haswell/scales-ppm-1.0.8-44zlrlu' - YAXT_ROOT='/project/d56/libcdi-ci-sw/cce-12.0.3-haswell/yaxt-0.9.2.1-enz3pcz' - - # Here we fix a never-ending story with Libtool overlinkning, absence of - # '*.la' files when they could help, and '-Wl,--disable/enable-new-dtags': - export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib64:${PPM_ROOT}/lib:${YAXT_ROOT}/lib:${LD_LIBRARY_PATH-}" -} - -# -# Sets variables for tests with PGI 20.1.1. -# -init_pgi2011 () -{ - init_env - # We use deprecated versions (the most recent compatible with PGI though) of - # the Cray packages and have to make sure that the default versions are - # unloaded (otherwise, we get various warnings and errors): - module unload cray-mpich cray-netcdf cray-netcdf-hdf5parallel cray-hdf5 cray-hdf5-parallel - switch_for_module craype PrgEnv-pgi/6.0.8 pgi/20.1.1 cray-mpich/7.7.15 - - # Build and test against NetCDF that does not support MPI parallel invocations - # (parallel NetCDF4 tests are known to fail in this case when run from the - # user home directory on Daint): - switch_for_module cray-netcdf/4.7.4.0 cray-hdf5/1.12.0.0 - - # Uncomment the following line to test against MPI-capable NetCDF: - # switch_for_module cray-netcdf-hdf5parallel/4.7.4.0 cray-hdf5-parallel/1.12.0.0 - - CC=cc - CXX=CC - FC=ftn - MPI_LAUNCH="$(which srun) -p cscsci -C gpu -A d56 -t 05:00" - - ECCODES_ROOT='/project/d56/libcdi-ci-sw/pgi-20.1.1-haswell/eccodes-2.24.2-hwtl5nr' - PPM_ROOT='/project/d56/libcdi-ci-sw/pgi-20.1.1-haswell/scales-ppm-1.0.8-z2nxqya' - YAXT_ROOT='/project/d56/libcdi-ci-sw/pgi-20.1.1-haswell/yaxt-0.9.2.1-3orop7g' - - # The deprecated versions of the Cray packages are not in the default linker - # search path: - export LD_LIBRARY_PATH="${MPICH_DIR}/lib:${NETCDF_DIR}/lib:${HDF5_DIR}/lib:${LD_LIBRARY_PATH-}" - - # Here we fix a never-ending story with Libtool overlinkning, absence of - # '*.la' files when they could help, and '-Wl,--disable/enable-new-dtags': - export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib64:${PPM_ROOT}/lib:${YAXT_ROOT}/lib:${LD_LIBRARY_PATH-}" -} - -# -# Accepts a path to a file containing the testsuite summary (either the -# 'test-suite.log' or the standard output of the 'make check' command) and -# checks whether all tests were run and passed. -# -check_all_tests_passed () -{ - awk '/SKIP: /{ - print "ERROR: the total number of tests is not equal to the number of passed tests"; - exit 1; - }' $1 >&2 -} diff --git a/.ci/bb/levante-dkrz/init.sh b/.ci/bb/levante-dkrz/init.sh new file mode 100644 index 0000000000000000000000000000000000000000..5cd38af4d2e0b2dd647acea3c409982019efc731 --- /dev/null +++ b/.ci/bb/levante-dkrz/init.sh @@ -0,0 +1,65 @@ +# Initialize utility functions: +. "$(cd "$(dirname "${BASH_SOURCE}")"; pwd)/../common_utils.sh" + +# +# Initializes the environment. +# +init_env () +{ + switch_for_module ruby/3.0.2-gcc-11.2.0 +} + +# +# Sets variables for tests with GCC. +# +init_gcc () +{ + init_env + switch_for_module gcc/11.2.0-gcc-11.2.0 openmpi/4.1.2-gcc-11.2.0 + + CC=gcc + CXX=g++ + FC=gfortran + MPICC=mpicc + MPIFC=mpif90 + MPI_LAUNCH="$(which mpirun)" + + ECCODES_ROOT='/sw/spack-levante/eccodes-2.21.0-4ywkk4' + NETCDF_ROOT='/sw/spack-levante/netcdf-c-4.8.1-6qheqr' + PPM_ROOT='/work/mh0287/m300488/libcdi-ci-sw/install/ppm-1.0.8-gcc-11.2.0' + YAXT_ROOT='/work/mh0287/m300488/libcdi-ci-sw/install/yaxt-0.9.3-gcc-11.2.0' + + # The installations of NetCDF and ecCodes libraries do not provide '*.la' + # files, which would trigger the RPATH injection: + export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib64:${NETCDF_ROOT}/lib:${LD_LIBRARY_PATH-}" +} + +# +# Sets variables for tests with Intel Classic. +# +init_intelclassic () +{ + init_env + # Try to make sure that the compiler works with the system gcc: + module unload gcc + # For whatever reason, Intel Classic 2021.5.0 is enabled with + # intel-oneapi-compilers/2022.0.1-gcc-11.2.0: + switch_for_module intel-oneapi-compilers/2022.0.1-gcc-11.2.0 openmpi/4.1.2-intel-2021.5.0 + + AR=xiar + CC=icc + CXX=icpc + FC=ifort + MPICC=mpicc + MPIFC=mpif90 + MPI_LAUNCH="$(which mpirun)" + + ECCODES_ROOT='/sw/spack-levante/eccodes-2.21.0-3ehkbb' + NETCDF_ROOT='/sw/spack-levante/netcdf-c-4.8.1-2k3cmu' + PPM_ROOT='/work/mh0287/m300488/libcdi-ci-sw/install/ppm-1.0.8-intel-classic-2021.5.0' + YAXT_ROOT='/work/mh0287/m300488/libcdi-ci-sw/install/yaxt-0.9.3-intel-classic-2021.5.0' + + # The installations of NetCDF and ecCodes libraries do not provide '*.la' + # files, which would trigger the RPATH injection: + export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib64:${NETCDF_ROOT}/lib:${LD_LIBRARY_PATH-}" +} diff --git a/.ci/bb/levante-dkrz/test.all.gcc b/.ci/bb/levante-dkrz/test.all.gcc index a114e52c7f04cbc7978957a774498ab6acbd6238..ac2c9d7d0641d3e4821fef3c8571d398322ac4fa 100755 --- a/.ci/bb/levante-dkrz/test.all.gcc +++ b/.ci/bb/levante-dkrz/test.all.gcc @@ -6,10 +6,16 @@ set -o pipefail script_dir=$(cd "$(dirname "$0")"; pwd) top_srcdir=$(cd "${script_dir}/../../.."; pwd) -. "${script_dir}/utils.sh" -init_gcc1120 +. "${script_dir}/init.sh" +init_gcc -test -f "${top_srcdir}/configure" || "${top_srcdir}/autogen.sh" +enable_maintainer_mode='no' +if test ! -f "${top_srcdir}/configure"; then + "${top_srcdir}/autogen.sh" + # If there is no configure script, there are, most probably, no Fortran + # interface files, which are generated in the maintainer mode only: + enable_maintainer_mode='yes' +fi # The configure script does not check the 'lib64' subdirectory, therefore we # run it with '--with-eccodes' and the following flags. Note that fixing this @@ -26,22 +32,23 @@ LDFLAGS="-L${ECCODES_ROOT}/lib64" # 'check_all_tests_passed' that we run at the end makes sure that the options # have been enabled and the corresponding tests have not been skipped. "${top_srcdir}/configure" \ ---disable-maintainer-mode \ --enable-iso-c-interface \ +--enable-maintainer-mode="${enable_maintainer_mode}" \ --enable-mpi \ --enable-option-checking=fatal \ --with-eccodes \ --with-netcdf="${NETCDF_ROOT}" \ CC="${MPICC}" \ CPPFLAGS="${CPPFLAGS}" \ -F77="${MPIFC}" \ FC="${MPIFC}" \ LDFLAGS="${LDFLAGS}" \ MPI_LAUNCH="${MPI_LAUNCH}" \ PKG_CONFIG_PATH="${YAXT_ROOT}/lib/pkgconfig:${PPM_ROOT}/lib/pkgconfig" -make -j8 +make -make -j8 check | tee tests/test-suite.log +make check || { cat tests/test-suite.log; exit 1; } check_all_tests_passed tests/test-suite.log + +check_no_git_untracked diff --git a/.ci/bb/levante-dkrz/test.all.intel-classic b/.ci/bb/levante-dkrz/test.all.intel-classic index 21c9e889d07941490439fe53b631531375a9f5c8..f1db62ec28e98fd18257c8cedf4c295fe10e12f1 100755 --- a/.ci/bb/levante-dkrz/test.all.intel-classic +++ b/.ci/bb/levante-dkrz/test.all.intel-classic @@ -6,10 +6,16 @@ set -o pipefail script_dir=$(cd "$(dirname "$0")"; pwd) top_srcdir=$(cd "${script_dir}/../../.."; pwd) -. "${script_dir}/utils.sh" -init_intelclassic202150 +. "${script_dir}/init.sh" +init_intelclassic -test -f "${top_srcdir}/configure" || "${top_srcdir}/autogen.sh" +enable_maintainer_mode='no' +if test ! -f "${top_srcdir}/configure"; then + "${top_srcdir}/autogen.sh" + # If there is no configure script, there are, most probably, no Fortran + # interface files, which are generated in the maintainer mode only: + enable_maintainer_mode='yes' +fi # Create a subdirectory for building and switch to it: mkdir build && cd build @@ -25,9 +31,9 @@ CPPFLAGS="-I${ECCODES_ROOT}/include" LDFLAGS="-L${ECCODES_ROOT}/lib64" "${top_srcdir}/configure" \ ---disable-maintainer-mode \ --enable-cf-interface \ --enable-iso-c-interface \ +--enable-maintainer-mode="${enable_maintainer_mode}" \ --enable-mpi \ --enable-option-checking=fatal \ --with-eccodes \ @@ -40,12 +46,21 @@ LDFLAGS="${LDFLAGS}" \ MPI_LAUNCH="${MPI_LAUNCH}" \ PKG_CONFIG_PATH="${YAXT_ROOT}/lib/pkgconfig:${PPM_ROOT}/lib/pkgconfig" -make -j8 +# Check whether the configure script removed the '.libs' directory: +test -e .libs && echo "ERROR: the configure script did not remove directory '.libs'" && exit 1 -make -j8 check | tee tests/test-suite.log +make + +make check || { cat tests/test-suite.log; exit 1; } check_all_tests_passed tests/test-suite.log -make -j8 distclean +if test "x${enable_maintainer_mode}" = 'xyes'; then + make maintainer-clean +else + make distclean +fi check_no_files_in_cwd + +cd "${top_srcdir}" && check_no_git_untracked diff --git a/.ci/bb/levante-dkrz/test.icon-pio.intel-classic b/.ci/bb/levante-dkrz/test.icon-pio.intel-classic index b99b4bb9ba71c84cf583cdacf69ff9b6b1846b11..92227811ba0cbf12274243a8f6882a95be5adc8b 100755 --- a/.ci/bb/levante-dkrz/test.icon-pio.intel-classic +++ b/.ci/bb/levante-dkrz/test.icon-pio.intel-classic @@ -1,4 +1,249 @@ #!/bin/bash -echo "WARNING: the current version of CDI-PIO is incompatible with the build system if ICON" >&2 -exit 0 +set -eu +set -o pipefail + +script_dir=$(cd "$(dirname "$0")"; pwd) +top_srcdir=$(cd "${script_dir}/../../.."; pwd) + +. "${script_dir}/init.sh" +init_intelclassic + +# The following compiler flags are used by the respective ICON configure +# wrapper. They are not set into stone and can be changed if needed. It is just +# important to keep them the same as in the wrapper. +CFLAGS='-g -gdwarf-4 -qno-opt-dynamic-align -m64 -march=core-avx2 -mtune=core-avx2 -fma -ip -pc64 -std=gnu99 -O2 -ftz' +FCFLAGS='-m64 -march=core-avx2 -mtune=core-avx2 -g -gdwarf-4 -pc64 -fp-model source -O3 -ftz -qoverride-limits -assume realloc_lhs -align array64byte -fma -ip' + +if test ! -f "${top_srcdir}/configure"; then + "${top_srcdir}/autogen.sh" + # If there is no configure script, there are, most probably, no Fortran + # interface files, which are generated in the maintainer mode only. Therefore, + # we have to generate them before testing: + "${top_srcdir}/configure" --enable-maintainer-mode && make -C src mo_cdi.f90 cdi.inc cdipio.inc && make distclean +fi + +# Make sure that the libtool script has a chance to erroneously link to the +# shared versions of YAXT and PPM: +for file in \ + "${PPM_ROOT}/lib/libscalesppmcore.so" \ + "${YAXT_ROOT}/lib/libyaxt.so" \ + "${YAXT_ROOT}/lib/libyaxt_c.so"; do + test -r "${file}" || { + echo "ERROR: file '${file}' not found" >&2 + exit 1 + } +done + +# When configured as part of ICON, C headers, Fortran modules and library files +# of YAXT and PPM become available only at the build time. We mock that by +# creating two empty directories for YAXT and PPM before running the configure +# script of CDI and copy the required files into them before running make: +LOCAL_YAXT_ROOT="$(pwd)/build/cdi-test-yaxt" +LOCAL_PPM_ROOT="$(pwd)/build/cdi-test-ppm" +rm -rf "${LOCAL_YAXT_ROOT}" "${LOCAL_PPM_ROOT}" +mkdir -p "${LOCAL_YAXT_ROOT}" "${LOCAL_PPM_ROOT}" + +# Make sure that CDI gets linked to the right instances of YAXT even if certain +# environment variables and linker flags point to the wrong existing instance: +WRONG_YAXT_LIBDIR="$(init_gcc >/dev/null && echo "${YAXT_ROOT}")/lib" + +for file in \ + "${WRONG_YAXT_LIBDIR}/libyaxt.la" \ + "${WRONG_YAXT_LIBDIR}/libyaxt_c.la" \ + "${WRONG_YAXT_LIBDIR}/pkgconfig/yaxt.pc" \ + "${WRONG_YAXT_LIBDIR}/pkgconfig/yaxt_c.pc"; do + test -f "${file}" || { + echo "ERROR: file '${file}' not found" >&2 + exit 1 + } +done + +export PKG_CONFIG_PATH="${WRONG_YAXT_LIBDIR}/pkgconfig" +export LD_LIBRARY_PATH="${WRONG_YAXT_LIBDIR}:${LD_LIBRARY_PATH-}" +LDFLAGS="-L${WRONG_YAXT_LIBDIR}" + +# There is no way for the configure script of ICON to provide the configure +# script of CDI with the path to the installation of NetCDF in use. Here we +# imitate a situation when 'nc-config' from another (wrong) installation of +# NetCDF is in the ${PATH}. +WRONG_NETCDF_ROOT=$(init_gcc >/dev/null && echo "${NETCDF_ROOT}") +WRONG_NETCDF_BINDIR="${WRONG_NETCDF_ROOT}/bin" + +# It looks like we cannot properly check whether the wrong 'nc-config' in the +# ${PATH} causes any inconsistency. All we can do is run a not very reliable +# indirect check of whether CDI gets built without the unwanted dependency on +# cURL: +nc_has_dap=`"${WRONG_NETCDF_BINDIR}/nc-config" --has-dap` || { + echo "ERROR: failed to check whether NetCDF in '${WRONG_NETCDF_ROOT}' is built with DAP support" >&2 + exit 1 +} +test "x${nc_has_dap}" = 'xyes' || { + echo "ERROR: NetCDF in '${WRONG_NETCDF_ROOT}' is built without DAP support" >&2 + exit 1 +} + +export PATH="${WRONG_NETCDF_BINDIR}:${PATH-}" + +# Make sure we do not need RUBY, i.e. the Fortran interface files are not +# re-generated: +export RUBY=$(which false) + +"${top_srcdir}/configure" \ +--disable-across \ +--disable-cdi-app \ +--disable-maintainer-mode \ +--disable-openmp \ +--disable-python-interface \ +--disable-ruby-interface \ +--disable-shared \ +--enable-cf-interface=yes \ +--enable-cgribex \ +--enable-grib \ +--enable-iso-c-interface \ +--enable-mpi=yes \ +--enable-ppm-dist-array=yes \ +--enable-silent-rules=yes \ +--enable-static \ +--with-eccodes=yes \ +--with-netcdf \ +--with-on-demand-check-programs \ +--without-dce-uuid \ +--without-example-programs \ +--without-fdb5 \ +--without-grib_api \ +--without-ossp-uuid \ +--without-szlib \ +--without-threads \ +--without-util-linux-uuid \ +AR="${AR}" \ +BUILD_CC= \ +BUILD_CFLAGS= \ +BUILD_CXX= \ +BUILD_F77= \ +BUILD_FC= \ +BUILD_FCFLAGS= \ +BUILD_LDFLAGS= \ +BUILD_LIBS= \ +BUILD_MPI_C_LIB= \ +BUILD_MPI_FC_LIB= \ +CC="${MPICC}" \ +CFLAGS="${CFLAGS}" \ +CPPFLAGS="-I${NETCDF_ROOT}/include -I${ECCODES_ROOT}/include" \ +CXX=no \ +DCE_UUID_C_INCLUDE= \ +DCE_UUID_C_LIB= \ +F77=no \ +FC="${MPIFC}" \ +FCFLAGS="${FCFLAGS}" \ +LDFLAGS="${LDFLAGS} -L${NETCDF_ROOT}/lib -L${ECCODES_ROOT}/lib64" \ +LIBS='-Wl,--disable-new-dtags -Wl,--as-needed -lnetcdf -leccodes' \ +MPIROOT= \ +MPI_C_INCLUDE= \ +MPI_C_LIB= \ +MPI_FC_LIB= \ +MPI_FC_MOD= \ +MPI_LAUNCH="${MPI_LAUNCH}" \ +OSSP_UUID_C_INCLUDE= \ +OSSP_UUID_C_LIB= \ +PKG_CONFIG= \ +PPM_CORE_C_INCLUDE= \ +PPM_CORE_C_LIB= \ +UTIL_LINUX_UUID_C_INCLUDE= \ +UTIL_LINUX_UUID_C_LIB= \ +YAXT_C_INCLUDE= \ +YAXT_C_LIB= \ +YAXT_FC_LIB= \ +YAXT_FC_MOD= \ +ac_cv_header_ppm_dist_array_h=yes \ +acx_cv_c_include_ppm_ppm_h="-I${LOCAL_PPM_ROOT}/include" \ +acx_cv_c_include_yaxt_h="-I${LOCAL_YAXT_ROOT}/include" \ +acx_cv_fortran_mod_yaxt="-I${LOCAL_YAXT_ROOT}/include" \ +acx_cv_have_libnc_dap=no \ +acx_cv_have_nc4hdf5=no \ +acx_cv_have_netcdf2=yes \ +acx_cv_have_netcdf4=yes \ +acx_cv_have_pnetcdf=no \ +acx_cv_option_search_PPM_initialize_c="${LOCAL_PPM_ROOT}/lib/libscalesppmcore.la" \ +acx_cv_option_search_xt_initialized_c="${LOCAL_YAXT_ROOT}/lib/libyaxt_c.la" \ +acx_cv_option_search_xt_initialized_fc="${LOCAL_YAXT_ROOT}/lib/libyaxt.la ${LOCAL_YAXT_ROOT}/lib/libyaxt_c.la" + +# Create local copies of YAXT and PPM and make them similar to what they look like +# when the libraries are built inside the build system of ICON: +rsync -uavz "${YAXT_ROOT}/" "${LOCAL_YAXT_ROOT}/" --exclude='*.pc' --exclude='*.so' --exclude='*.so.*' +rsync -uavz "${PPM_ROOT}/" "${LOCAL_PPM_ROOT}/" --exclude='*.pc' --exclude='*.so' --exclude='*.so.*' +sed -i -E -e "{ +# The build system of ICON disables the shared versions of the libraries +# (i.e. configures them with '--disable-shared'): +s/^dlname=.*/dlname=''/ +s/^library_names=.*/library_names=''/ +# The linking to the libraries is done without installing them: +s/^installed=.*/installed=no/ +}" `find "${LOCAL_YAXT_ROOT}" "${LOCAL_PPM_ROOT}" -name '*.la'` + +make + +# The current general approach in the build system of ICON is to avoid building +# the shared versions of the bundled libraries and link to the static ones +# without -L and -l flags. Instead, to avoid possible ambiguity, the linking is +# done by passing paths to static library as positional arguments for the +# linker. That, however, does not work well with libtool scripts as they inject +# all files referred by the positional arguments into the generated static +# libraries (archives). That is usually fine with the GNU linker but is a +# problem for the MacOS one, which might ignore the whole library file: +# ld: warning: ignoring file libcdipio.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64 +# To circumvent the problem, we tell the configure of CDI to link to YAXT and +# PPM using libtool .la files and check that libcdipio.a does not contain any +# other archive files, which the linker might potentially not be able to handle: +tested_file='src/.libs/libcdipio.a' +invalid_entries=`ar t "${tested_file}" | sed -n '/\.a$/p'` || { + echo "ERROR: failed to check $1 for invalid entries" >&2 + exit 1 +} +if test -n "${invalid_entries}"; then + { + echo "ERROR: '${tested_file}' has invalid entries:" >&2 + echo "${invalid_entries}" >&2 + } >&2 + exit 1 +fi + +make check TESTS= XFAIL_TESTS= + +# Check that a test program is linked to YAXT and PPM statically as it should +# when built inside the build system of ICON: +tested_file='tests/pio_write.parallel' +invalid_deps=`ldd "${tested_file}" | sed -E -n '/libscalesppmcore|libyaxt/p'` || { + echo "ERROR: failed to check '${tested_file}' for invalid dependencies" >&2 + exit 1 +} +if test -n "${invalid_deps}"; then + { + echo "ERROR: '${tested_file}' has invalid dependencies:" >&2 + echo "${invalid_deps}" >&2 + } >&2 + exit 1 +fi + +# Check that we do not link to the instance of YAXT from ${WRONG_YAXT_LIBDIR} +# (we might fail earlier if ${WRONG_YAXT_LIBDIR} contains the shared version of +# the library): +make -C examples/pio collectData2003.parallel + +# Check whether CDI is built without the unwanted dependency on cURL: +tested_file='./app/cdi' +cdi_features=`"${tested_file}" -d 2>&1 | grep '^Features: '` || { + echo "ERROR: failed to get the expected debug output from '${tested_file}'" >&2 + exit 1 +} +case " ${cdi_features} " in + *' OPeNDAP '*) + echo "ERROR: CDI is built with the unwanted dependency on cURL (i.e. OPeNDAP support is enabled)" 2>&1 + exit 1 ;; +esac + +make check || { cat tests/test-suite.log; exit 1; } + +check_all_tests_passed tests/test-suite.log + +check_no_git_untracked diff --git a/.ci/bb/levante-dkrz/test.icon.gcc b/.ci/bb/levante-dkrz/test.icon.gcc index 0b1a23e46f403a41360796d06441f4f7bf5fc581..5e205659607bfc32892c9dcbf41b9d6e810cf2d4 100755 --- a/.ci/bb/levante-dkrz/test.icon.gcc +++ b/.ci/bb/levante-dkrz/test.icon.gcc @@ -5,8 +5,8 @@ set -eu script_dir=$(cd "$(dirname "$0")"; pwd) top_srcdir=$(cd "${script_dir}/../../.."; pwd) -. "${script_dir}/utils.sh" -init_gcc1120 +. "${script_dir}/init.sh" +init_gcc # The following compiler flags are used by the respective ICON configure # wrapper. They are not set into stone and can be changed if needed. It is just @@ -14,11 +14,25 @@ init_gcc1120 CFLAGS='-g -gdwarf-4 -march=native -mpc64 -O2' FCFLAGS='-fmodule-private -fimplicit-none -fmax-identifier-length=63 -Wall -Wcharacter-truncation -Wconversion -Wunderflow -Wunused-parameter -Wno-surprising -fall-intrinsics -g -march=native -mpc64 -fbacktrace -fbounds-check -fstack-protector-all -finit-real=nan -finit-integer=-2147483648 -finit-character=127 -O2 -std=f2008' -test -f "${top_srcdir}/configure" || "${top_srcdir}/autogen.sh" +if test ! -f "${top_srcdir}/configure"; then + "${top_srcdir}/autogen.sh" + # If there is no configure script, there are, most probably, no Fortran + # interface files, which are generated in the maintainer mode only. Therefore, + # we have to generate them before testing: + "${top_srcdir}/configure" --enable-maintainer-mode && make -C src mo_cdi.f90 && make distclean +fi + +# Make sure we do not need RUBY, i.e. the Fortran interface files are not +# re-generated: +export RUBY=$(which false) "${top_srcdir}/configure" \ +--disable-across \ --disable-cdi-app \ --disable-maintainer-mode \ +--disable-openmp \ +--disable-python-interface \ +--disable-ruby-interface \ --disable-shared \ --enable-cf-interface=no \ --enable-cgribex \ @@ -26,15 +40,19 @@ test -f "${top_srcdir}/configure" || "${top_srcdir}/autogen.sh" --enable-iso-c-interface \ --enable-mpi=no \ --enable-ppm-dist-array=no \ ---enable-silent-rules=no \ +--enable-silent-rules=yes \ --enable-static \ --with-eccodes=yes \ --with-netcdf \ --with-on-demand-check-programs \ +--without-dce-uuid \ --without-example-programs \ +--without-fdb5 \ --without-grib_api \ +--without-ossp-uuid \ --without-szlib \ --without-threads \ +--without-util-linux-uuid \ BUILD_CC= \ BUILD_CFLAGS= \ BUILD_CXX= \ @@ -49,32 +67,38 @@ CC="${MPICC}" \ CFLAGS="${CFLAGS}" \ CPPFLAGS="-I${NETCDF_ROOT}/include -I${ECCODES_ROOT}/include" \ CXX=no \ +DCE_UUID_C_INCLUDE= \ +DCE_UUID_C_LIB= \ F77=no \ FC="${MPIFC}" \ FCFLAGS="${FCFLAGS}" \ LDFLAGS="-L${NETCDF_ROOT}/lib -L${ECCODES_ROOT}/lib64" \ -LIBS='-leccodes -lnetcdf' \ +LIBS='-Wl,--disable-new-dtags -Wl,--as-needed -leccodes -lnetcdf' \ MPIROOT= \ MPI_C_INCLUDE= \ MPI_C_LIB= \ MPI_FC_LIB= \ MPI_FC_MOD= \ MPI_LAUNCH="${MPI_LAUNCH}" \ +OSSP_UUID_C_INCLUDE= \ +OSSP_UUID_C_LIB= \ PKG_CONFIG= \ PPM_CORE_C_INCLUDE= \ PPM_CORE_C_LIB= \ +UTIL_LINUX_UUID_C_INCLUDE= \ +UTIL_LINUX_UUID_C_LIB= \ YAXT_C_INCLUDE= \ YAXT_C_LIB= \ YAXT_FC_LIB= \ YAXT_FC_MOD= \ -ac_cv_func_uuid_create=no \ -ac_cv_lib_uuid_uuid_generate=no \ acx_cv_have_libnc_dap=no \ acx_cv_have_nc4hdf5=no \ acx_cv_have_netcdf2=yes \ acx_cv_have_netcdf4=yes \ acx_cv_have_pnetcdf=no -make -j8 +make + +make check || { cat tests/test-suite.log; exit 1; } -make -j8 check +check_no_git_untracked diff --git a/.ci/bb/run_all.sh b/.ci/bb/run_all.sh index 583e36a23de183b73984ada54a427ebe65dada46..bba02cd2629b4f76830910b0153bba47acea8712 100755 --- a/.ci/bb/run_all.sh +++ b/.ci/bb/run_all.sh @@ -14,7 +14,7 @@ case $(uname -s) in mpipc*.mpimet.mpg.de\ * | \ breeze*.mpimet.mpg.de\ *) test_environment='breeze-mpim' ;; - levante*.atos.local\ *) + levante*.lvt.dkrz.de\ *) test_environment='levante-dkrz' ;; daint*.login.cscs.ch\ *) test_environment='daint-cscs' ;; diff --git a/.gitignore b/.gitignore index f2ac0960b87e759d37b61f585be43a41a69876b0..a0acb6ced52d7f6ec77f0ac44576e9e6e7bea362 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ # Autoreconf stage files: -/aclocal.m4 /autom4te.cache +/src/config.h.in~ + +# Distributed autoreconf stage files: +/aclocal.m4 /config/compile /config/config.guess /config/config.sub @@ -8,6 +11,8 @@ /config/install-sh /config/ltmain.sh /config/missing +/config/py-compile +/config/test-driver /configure /m4/libtool.m4 /m4/ltoptions.m4 @@ -15,7 +20,6 @@ /m4/ltversion.m4 /m4/lt~obsolete.m4 /src/config.h.in -/src/config.h.in~ Makefile.in # Configure stage files: @@ -24,61 +28,29 @@ Makefile.in /config.log /config.lt /config.status +/examples/pio/collectData +/examples/pio/collectData.parallel +/interfaces/*.run /libtool +/src/cmake/cdi/*.cmake /src/config.h -/src/cmake/cdi-config-version.cmake -/src/cmake/cdi-config.cmake -/src/pkgconfig/cdi.pc -/src/pkgconfig/cdi_f2003.pc -/src/pkgconfig/cdipio.pc +/src/pkgconfig/*.pc /src/stamp-h1 /tables/gen_tableheaderfile -/tests/*.log -/tests/pio_cksum_asynch -/tests/pio_cksum_cdf -/tests/pio_cksum_fpguard -/tests/pio_cksum_mpi_fw_at_all -/tests/pio_cksum_mpi_fw_at_reblock -/tests/pio_cksum_mpi_fw_ordered -/tests/pio_cksum_mpinonb -/tests/pio_cksum_writer -/tests/pio_write_deco2d_run -/tests/pio_write_run -/tests/test_byteswap_run -/tests/test_cdf_const -/tests/test_cdf_transformation -/tests/test_chunk_cksum -/tests/test_cksum_extra -/tests/test_cksum_grib -/tests/test_cksum_ieg -/tests/test_cksum_nc -/tests/test_cksum_nc2 -/tests/test_cksum_nc4 -/tests/test_cksum_service -/tests/test_f2003 -/tests/test_resource_copy_mpi_run -/tests/test_resource_copy_run -/tests/test_table_run -/util/serialrun +/tests/*.run +/tests/test_cksum_base Makefile # Build stage files: -*.i *.la *.lo *.mod *.o -.libs -/a.out +.dirstamp +/*/**/.libs /app/cdi /app/createtable /build - -# Documentation stage files: -/doc/cdi_cman.pdf -/doc/cdi_fman.pdf - -# Test stage files: /examples/cdi_append /examples/cdi_copy /examples/cdi_read @@ -90,41 +62,72 @@ Makefile /examples/cdi_write_hybrid /examples/cdi_write_local /examples/cdi_write_relativ -/examples/pio/collectData +/examples/pio/*.parallel.F90 +/examples/pio/*.parallel.c /examples/pio/collectData2003 +/examples/pio/collectData2003.parallel /examples/pio/collectDataNStreams +/examples/pio/collectDataNStreams.parallel /examples/pio/compareResourcesArray +/interfaces/CdiInfo +/interfaces/python/Cdi.py +/interfaces/python/cdi_wrapper.cpp +/interfaces/ruby/cdi_wrapper.cpp +/src/cdi.inc +/src/cdiFortran.c +/src/cdipio.inc +/src/cdipioFortran.c +/src/make_fint +/src/mo_cdi.f90 +/tests/*.parallel.c +/tests/calendar_test1 /tests/cksum_read /tests/cksum_verify /tests/cksum_write /tests/cksum_write_chunk -/tests/example.cksum -/tests/example.ext -/tests/example.grb -/tests/example.ieg -/tests/example.nc -/tests/example.nc2 -/tests/example.nc4 -/tests/example.svc -/tests/example_0.cksum -/tests/example_0.grb -/tests/example_0.nc4 -/tests/example_1.cksum -/tests/example_1.grb -/tests/example_1.nc4 /tests/pio_write +/tests/pio_write.parallel /tests/pio_write_deco2d +/tests/pio_write_deco2d.parallel /tests/test_byteswap -/tests/test_cdf_const.d /tests/test_cdf_read /tests/test_cdf_write /tests/test_grib +/tests/test_month_adjust /tests/test_resource_copy -/tests/test_resource_copy_mpi +/tests/test_resource_copy.parallel /tests/test_table +# Test stage files: +/examples/**/*.grb +/examples/**/*.grb2 +/examples/**/*.nc +/interfaces/*.log +/interfaces/*.trs +/interfaces/python/*.pyc +/interfaces/python/*.pyo +/interfaces/python/__pycache__ +/tests/*.cksum +/tests/*.ext +/tests/*.grb +/tests/*.grb2 +/tests/*.ieg +/tests/*.log +/tests/*.nc +/tests/*.nc2 +/tests/*.nc4 +/tests/*.srv +/tests/*.stderr +/tests/*.stdout +/tests/*.trs + +# Documentation stage files: +/doc/cdi_cman.pdf +/doc/cdi_fman.pdf + # Dist stage files: -/cdi-*.tar.gz +/cdi-[0-9].[0-9].[0-9]* +/cdi-[0-9].[0-9][0-9].[0-9]* /src/cdilib.c # Mac OS files: diff --git a/COPYING b/COPYING index d102eb890ce4b84c06369f50b80f700b5f7eaa1f..8dbf1fb97431cded9cadda09fe8e0f10976ac39c 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -Copyright 2002-2022, MPI für Meteorologie +Copyright 2002-2023, MPI für Meteorologie Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -11,4 +11,4 @@ Redistribution and use in source and binary forms, with or without modification, THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copyright notice - ©2002-2022 MPI-M, see list in the AUTHORS file + ©2002-2023 MPI-M, see list in the AUTHORS file diff --git a/ChangeLog b/ChangeLog index eabd831a278ae6e167b2da86477aa5c25978c1c9..5c440bcf53d054c838b6ee6d953ae5bc4f7feade 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,82 @@ +2023-02-23 Uwe Schulzweida + + * using CGRIBEX library version 2.1.0 + * using EXSE library version 1.5.0 + * Version 2.2.0 released + +2023-02-05 Uwe Schulzweida + + * changed chunkSizeLim from 16777216 to 1048576 + * NetCDF: added query support for grid cells + +2023-02-02 Uwe Schulzweida + + * NetCDF: added query support for timesteps + +2023-01-27 Uwe Schulzweida + + * NetCDF: added query support for variable names + +2023-01-25 Uwe Schulzweida + + * Added support for NetCDF4/HDF5 filter + +2023-01-06 Uwe Schulzweida + + * vlistDefVarDatatype: refactor handling of missing value (bug fix) + +2022-12-06 Uwe Schulzweida + + * Version 2.1.1 released + +2022-11-29 Uwe Schulzweida + + * cdf_def_mapping: add support for datatype NC_STRING (bug fix) + +2022-11-18 Uwe Schulzweida + + * grid module: remove initialization of CDI_KEY_SCANNINGMODE (bug fix) + +2022-11-16 Uwe Schulzweida + + * cdf_read_xcoord: skip char coordinates only if ndims=1 (bug fix) + +2022-11-13 Uwe Schulzweida + + * Added interface function streamOpenReadQuery(); + * Added module cdiQuery + +2022-11-09 Uwe Schulzweida + + * async_worker: remove syncronization at end of timesteps + +2022-11-05 Uwe Schulzweida + + * NetCDF output: adde compression support for data on GRID_GENERIC + +2022-10-19 Uwe Schulzweida + + * Replaced CDI function vlistDefVarExtra() by cdiDefKeyString() with CDI_KEY_CHUNKS + * Replaced CDI function vlistInqVarExtra() by cdiInqKeyString() with CDI_KEY_CHUNKS + * Replaced CDI function vlistDefVarScalefactor() by cdiDefKeyFloat() with CDI_KEY_SCALEFACTOR + * Replaced CDI function vlistInqVarScalefactor() by cdiDefKeyFloat () with CDI_KEY_SCALEFACTOR + * Replaced CDI function vlistDefVarAddoffset() by cdiDefKeyFloat () with CDI_KEY_ADDOFFSET + * Replaced CDI function vlistInqVarAddoffset() by cdiDefKeyFloat () with CDI_KEY_ADDOFFSET + +2022-10-17 Uwe Schulzweida + + * Added environment variable CDI_SHUFFLE to set shuffle option to NetCDF4 deflation compression + +2022-10-16 Uwe Schulzweida + + * Improved read performance of temporal chunked NetCDF4 data + * Added environment variable CDI_CHUNK_CACHE to set the NetCDF4 chunk cache size + * Added environment variable CDI_CHUNK_CACHE_MAX to set the maximum chunk cache size + +2022-10-14 Uwe Schulzweida + + * NetCDF: reading of lower time bounds is wrong since 2.0.6 (bug fix) + 2022-10-06 Uwe Schulzweida * Version 2.1.0 released @@ -72,7 +151,7 @@ 2022-01-28 Uwe Schulzweida - * cdf_read_coordinates: check that bounds have only 2 dimensions [Bug #10575] + * cdf_read_coordinates: check that grid cell bounds have only 2 dimensions [Bug #10575] * gribIterator::gridGenerate: copy CDI_KEY_UUID (bug fix) 2022-01-12 Uwe Schulzweida @@ -2368,7 +2447,7 @@ * timeval2vtime: bug fix for timeunit TUNIT_MONTH * streamSync: extent to non netCDF files * Version 1.3.2 released - + 2009-04-16 Uwe Schulzweida * using GRIB library version 1.3.0 @@ -2700,14 +2779,14 @@ grbScanTimestep, varscan, stream_var, stream_record * vlist: initialize ntsteps * Version 0.8.5 released - + 2004-10-12 Uwe Schulzweida * netCDF2 support * cdfDefVars: Bug fix (vlistInqNgrids) * stream_grb: check also leveltype to find different variables * Version 0.8.4 released - + 2004-09-08 Uwe Schulzweida * griblib: version 0.5.6 diff --git a/LICENSE b/LICENSE index d102eb890ce4b84c06369f50b80f700b5f7eaa1f..8dbf1fb97431cded9cadda09fe8e0f10976ac39c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2002-2022, MPI für Meteorologie +Copyright 2002-2023, MPI für Meteorologie Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -11,4 +11,4 @@ Redistribution and use in source and binary forms, with or without modification, THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copyright notice - ©2002-2022 MPI-M, see list in the AUTHORS file + ©2002-2023 MPI-M, see list in the AUTHORS file diff --git a/Makefile.am b/Makefile.am index ada7e0050a1c2cc4f068672d927a7db4d5603054..e6b9801be55fe18fe099d3ac1734f03f7f994bc1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,23 +1,19 @@ -## Process this file with automake to produce Makefile.in -# -SUBDIRS = src interfaces app examples examples/pio tests -# -EXTRA_DIST=config/default \ - LICENSE \ - doc/cdi_cman.pdf \ - doc/cdi_fman.pdf \ - src/cfortran.doc \ - util/sunf95preproc-wrapper \ - util/sxpreproc-wrapper \ - util/xlfpreproc-wrapper \ - config/interface.rb -# +SUBDIRS = src interfaces app examples tests + +# The pdf files below cannot be created in parallel: +doc/cdi_cman.pdf: doc/cdi_fman.pdf + +doc/cdi_cman.pdf: + $(AM_V_GEN)$(am__cd) $(top_srcdir)/doc/tex && ./makepdf_c && mv cdi_cman.pdf .. && ./cleanup + +doc/cdi_fman.pdf: + $(AM_V_GEN)$(am__cd) $(top_srcdir)/doc/tex && ./makepdf_f && mv cdi_fman.pdf .. && ./cleanup + +EXTRA_DIST = \ + LICENSE \ + config/interface.rb \ + doc/cdi_cman.pdf \ + doc/cdi_fman.pdf \ + src/cfortran.doc + ACLOCAL_AMFLAGS = -I m4 -# -CLEANFILES = `ls *~` -# -doc/cdi_cman.pdf: - (cd $(top_srcdir)/doc/tex ; ./makepdf_c ; mv cdi_cman.pdf .. ; ./cleanup) -# -doc/cdi_fman.pdf: - (cd $(top_srcdir)/doc/tex ; ./makepdf_f ; mv cdi_fman.pdf .. ; ./cleanup) diff --git a/NEWS b/NEWS index f424f07c0b0a6ac2fbefc2729a5a18a4bbe44f8f..e7651359afb18235073517555a60b665a672c2ea 100644 --- a/NEWS +++ b/NEWS @@ -1,16 +1,35 @@ CDI NEWS -------- -Version 2.1.0 (11 October 2021): +Version 2.2.0 (23 February 2023): + + New features: + * Improve read performance of temporal chunked NetCDF4 data + * Support for NetCDF4/HDF5 filter + * async_worker: remove syncronization at end of timesteps + New interface function + * streamOpenReadQuery() + Fixed bugs: + * cdf_def_mapping: add support for datatype NC_STRING + * grid module: remove initialization of CDI_KEY_SCANNINGMODE + * cdf_read_xcoord: skip char coordinates only if ndims=1 + * NetCDF: reading of lower time bounds is wrong since 2.0.6 + +Version 2.1.0 (6 October 2022): New features: * Added support for NCZarr * Set number of significant bits used for NetCDF 4.9.0 bit-roundung: vlistDefVarNSB()/vlistInqVarNSB() * Added support for milli seconds * Changed DateType back to int + * Made CDI compatible to revision 1.8.3 used in ICON Fixed bugs: + * recalculate optimal chunk_size if gridsize is > chunk_size_lim + * ecCodes encode: fix problem with startStep for step type MIN/MAX + * GRIB read: recalculate start date/time for every record and timestep + * changed chunk_size_lim from 1073741823 to 16777216 * compareXYvals failed for unstructured grids (segmentation fault) [Bug #10632] - * cdf_read_coordinates: check that bounds have only 2 dimensions [Bug #10575] + * cdf_read_coordinates: check that grid cell bounds have only 2 dimensions [Bug #10575] Version 2.0.0 (11 October 2021): diff --git a/app/Makefile.am b/app/Makefile.am index d1ac609117afb73965736d8cdb9e81cafc4c5f7a..421e8d9f5c74e39f0394204dbcf0f789c8166422 100644 --- a/app/Makefile.am +++ b/app/Makefile.am @@ -1,8 +1,7 @@ -## Process this file with automake to produce Makefile.in -# bin_PROGRAMS = noinst_PROGRAMS = check_PROGRAMS = + if ENABLE_CDI_APP if ENABLE_CDI_LIB bin_PROGRAMS += cdi @@ -11,27 +10,46 @@ noinst_PROGRAMS += cdi endif !ENABLE_CDI_LIB noinst_PROGRAMS += createtable else !ENABLE_CDI_APP +if with_on_demand_check_programs check_PROGRAMS += cdi +else !with_on_demand_check_programs +noinst_PROGRAMS += cdi +endif !with_on_demand_check_programs endif !ENABLE_CDI_APP -# -# -cdi_SOURCES = cdi.c printinfo.c printinfo.h -cdi_LDADD = $(top_builddir)/src/libcdi.la @LIBS@ + +AM_CPPFLAGS = -I$(top_srcdir)/src + +AM_LDFLAGS = if ENABLE_ALL_STATIC -cdi_LDFLAGS = -all-static +AM_LDFLAGS += -all-static endif -# + +LDADD = $(top_builddir)/src/libcdi.la + +cdi_SOURCES = \ + cdi.c \ + printinfo.c \ + printinfo.h + createtable_SOURCES = createtable.c -createtable_LDADD = $(top_builddir)/src/libcdi.la -if ENABLE_ALL_STATIC -createtable_LDFLAGS = -all-static -endif -# -AM_CPPFLAGS = -I$(top_srcdir)/src -# -CLEANFILES = `ls *~` -# -clean-local: clean-local-dirs -.PHONY: clean-local-dirs -clean-local-dirs: + +clean-local: -rm -rf *.dSYM + +# Compile programs using Libtool: +COMPILE = $(LTCOMPILE) +FCCOMPILE = $(LTFCCOMPILE) +PPFCCOMPILE = $(LTPPFCCOMPILE) +CXXCOMPILE = $(LTCXXCOMPILE) + +# Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler +# and might not be compatible with the Fortran compiler: +LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) + +# Avoid compiling twice by running Libtool with '-static' +# This is safe because all Libtool libraries in this directory are +# static-only and contain PIC objects: +AM_CFLAGS = -static +AM_FCFLAGS = -static +AM_CXXFLAGS = -static diff --git a/app/cdi.c b/app/cdi.c index 689bba083f0e534ed88a4fb9ceadee76f76a3deb..18df1e676aeb51f4f54822d0ae7b8e491127dacd 100644 --- a/app/cdi.c +++ b/app/cdi.c @@ -65,6 +65,10 @@ static int DefaultFileType = CDI_UNDEFID; static int DefaultDataType = CDI_UNDEFID; static int DefaultByteorder = CDI_UNDEFID; +static int filterId = 0; +static int params[8]; +static int maxParams = sizeof(params) / sizeof(params[0]); +static int numParams = 0; static int comptype = CDI_COMPRESS_NONE; // Compression type static int complevel = 0; // Compression level @@ -185,6 +189,7 @@ usage(void) fprintf(stderr, " -z szip SZIP compression of GRIB1 records\n"); fprintf(stderr, " jpeg JPEG compression of GRIB2 records\n"); fprintf(stderr, " zip[_1-9] Deflate compression of netCDF4 variables\n"); + fprintf(stderr, " zstd[_1-19] zstandard compression of netCDF4 variables\n"); fprintf(stderr, "\n"); fprintf(stderr, " Report bugs to <https://code.mpimet.mpg.de/projects/cdi>\n"); } @@ -323,7 +328,7 @@ static void limit_string_length(char *string, size_t maxlen) { string[maxlen - 1] = 0; - const size_t len = strlen(string); + size_t len = strlen(string); if (len > 10) { @@ -349,8 +354,8 @@ printShortinfo(int streamID, int vlistID, int vardis) printFiletype(streamID, vlistID); // vlistPrint(vlistID); - const int nvars = vlistNvars(vlistID); - const int nsubtypes = vlistNsubtypes(vlistID); + int nvars = vlistNvars(vlistID); + int nsubtypes = vlistNsubtypes(vlistID); if (nsubtypes > 0) fprintf(stdout, " Var : Institut Source T Steptype Subtypes Levels Num Points Num Dtype : "); @@ -364,9 +369,9 @@ printShortinfo(int streamID, int vlistID, int vardis) for (int varID = 0; varID < nvars; varID++) { - const int param = vlistInqVarParam(vlistID, varID); - const int gridID = vlistInqVarGrid(vlistID, varID); - const int zaxisID = vlistInqVarZaxis(vlistID, varID); + int param = vlistInqVarParam(vlistID, varID); + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); fprintf(stdout, "%6d : ", varID + 1); @@ -385,11 +390,11 @@ printShortinfo(int streamID, int vlistID, int vardis) fprintf(stdout, "%-8s ", tmpname); // timetype - const int timetype = vlistInqVarTimetype(vlistID, varID); + int timetype = vlistInqVarTimetype(vlistID, varID); fprintf(stdout, "%c ", timetype == TIME_CONSTANT ? 'c' : 'v'); // tsteptype - const int tsteptype = vlistInqVarTsteptype(vlistID, varID); + int tsteptype = vlistInqVarTsteptype(vlistID, varID); // clang-format off if (tsteptype == TSTEP_INSTANT ) fprintf(stdout, "%-8s ", "instant"); else if (tsteptype == TSTEP_INSTANT2) fprintf(stdout, "%-8s ", "instant"); @@ -406,46 +411,45 @@ printShortinfo(int streamID, int vlistID, int vardis) if (nsubtypes > 0) { - const int subtypeID = vlistInqVarSubtype(vlistID, varID); - const int subtypesize = subtypeInqSize(subtypeID); + int subtypeID = vlistInqVarSubtype(vlistID, varID); + int subtypesize = subtypeInqSize(subtypeID); fprintf(stdout, " %6d ", subtypesize); fprintf(stdout, "%3d ", vlistSubtypeIndex(vlistID, subtypeID) + 1); } // layer info - const int levelsize = zaxisInqSize(zaxisID); + int levelsize = zaxisInqSize(zaxisID); fprintf(stdout, "%6d ", levelsize); fprintf(stdout, "%3d ", vlistZaxisIndex(vlistID, zaxisID) + 1); // grid info - const size_t gridsize = gridInqSize(gridID); + size_t gridsize = gridInqSize(gridID); fprintf(stdout, "%9zu ", gridsize); fprintf(stdout, "%3d ", vlistGridIndex(vlistID, gridID) + 1); // datatype - const int datatype = vlistInqVarDatatype(vlistID, varID); + int datatype = vlistInqVarDatatype(vlistID, varID); // clang-format off - if (datatype == CDI_DATATYPE_PACK ) strcpy(pstr, "P0"); - else if (datatype > 0 && datatype <= 32 ) sprintf(pstr, "P%d", datatype); - else if (datatype == CDI_DATATYPE_CPX32 ) strcpy(pstr, "C32"); - else if (datatype == CDI_DATATYPE_CPX64 ) strcpy(pstr, "C64"); - else if (datatype == CDI_DATATYPE_FLT32 ) strcpy(pstr, "F32"); - else if (datatype == CDI_DATATYPE_FLT64 ) strcpy(pstr, "F64"); - else if (datatype == CDI_DATATYPE_INT8 ) strcpy(pstr, "I8"); - else if (datatype == CDI_DATATYPE_INT16 ) strcpy(pstr, "I16"); - else if (datatype == CDI_DATATYPE_INT32 ) strcpy(pstr, "I32"); - else if (datatype == CDI_DATATYPE_UINT8 ) strcpy(pstr, "U8"); - else if (datatype == CDI_DATATYPE_UINT16) strcpy(pstr, "U16"); - else if (datatype == CDI_DATATYPE_UINT32) strcpy(pstr, "U32"); - else strcpy(pstr, "-1"); + if (datatype == CDI_DATATYPE_PACK ) strcpy(pstr, "P0"); + else if (datatype > 0 && datatype <= 32 ) sprintf(pstr, "P%d", datatype); + else if (datatype == CDI_DATATYPE_CPX32 ) strcpy(pstr, "C32"); + else if (datatype == CDI_DATATYPE_CPX64 ) strcpy(pstr, "C64"); + else if (datatype == CDI_DATATYPE_FLT32 ) strcpy(pstr, "F32"); + else if (datatype == CDI_DATATYPE_FLT64 ) strcpy(pstr, "F64"); + else if (datatype == CDI_DATATYPE_INT8 ) strcpy(pstr, "I8"); + else if (datatype == CDI_DATATYPE_INT16 ) strcpy(pstr, "I16"); + else if (datatype == CDI_DATATYPE_INT32 ) strcpy(pstr, "I32"); + else if (datatype == CDI_DATATYPE_UINT8 ) strcpy(pstr, "U8"); + else if (datatype == CDI_DATATYPE_UINT16) strcpy(pstr, "U16"); + else if (datatype == CDI_DATATYPE_UINT32) strcpy(pstr, "U32"); + else strcpy(pstr, "-1"); // clang-format on fprintf(stdout, " %-3s", pstr); - if (vlistInqVarCompType(vlistID, varID) == CDI_COMPRESS_NONE) - fprintf(stdout, " "); - else - fprintf(stdout, "z "); + int compType = vlistInqVarCompType(vlistID, varID); + bool isCompressed = (compType != CDI_COMPRESS_NONE); + fprintf(stdout, "%c ", isCompressed ? (int) comptype_to_name(compType)[0] : ' '); // parameter info fprintf(stdout, ": "); @@ -481,8 +485,8 @@ printShortinfo(int streamID, int vlistID, int vardis) printSubtypeInfo(vlistID); } - const int taxisID = vlistInqTaxis(vlistID); - const int ntsteps = vlistNtsteps(vlistID); + int taxisID = vlistInqTaxis(vlistID); + int ntsteps = vlistNtsteps(vlistID); if (ntsteps != 0) { @@ -495,16 +499,16 @@ printShortinfo(int streamID, int vlistID, int vardis) { if (taxisInqType(taxisID) == TAXIS_RELATIVE) { - const CdiDateTime dt = taxisInqRdatetime(taxisID); + CdiDateTime dt = taxisInqRdatetime(taxisID); fprintf(stdout, " RefTime = %4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d", dt.date.year, dt.date.month, dt.date.day, dt.time.hour, dt.time.minute, dt.time.second); if (dt.time.ms) fprintf(stdout, ".%d", dt.time.ms); - const int tunits = taxisInqTunit(taxisID); + int tunits = taxisInqTunit(taxisID); if (tunits != CDI_UNDEFID) fprintf(stdout, " Units = %s", tunit2str(tunits)); - const int calendar = taxisInqCalendar(taxisID); + int calendar = taxisInqCalendar(taxisID); if (calendar != CDI_UNDEFID) fprintf(stdout, " Calendar = %s", calendar2str(calendar)); if (taxisHasBounds(taxisID)) fprintf(stdout, " Bounds = true"); @@ -534,7 +538,7 @@ setDefaultDataType(char *datatypestr) }; int dtype = -1; - const int datatype = tolower(*datatypestr); + int datatype = tolower(*datatypestr); // clang-format off if (datatype == 'i') { dtype = D_INT; datatypestr++; } else if (datatype == 'u') { dtype = D_UINT; datatypestr++; } @@ -648,19 +652,19 @@ setDefaultFileType(char *filetypestr) char *ftstr = filetypestr; // clang-format off - if ( memcmp(filetypestr, "grb2", 4) == 0 ) { ftstr += 4; DefaultFileType = CDI_FILETYPE_GRB2;} - else if ( memcmp(filetypestr, "grb1", 4) == 0 ) { ftstr += 4; DefaultFileType = CDI_FILETYPE_GRB; } - else if ( memcmp(filetypestr, "grb", 3) == 0 ) { ftstr += 3; DefaultFileType = CDI_FILETYPE_GRB; } - else if ( memcmp(filetypestr, "nc2", 3) == 0 ) { ftstr += 3; DefaultFileType = CDI_FILETYPE_NC2; } - else if ( memcmp(filetypestr, "nc4c", 4) == 0 ) { ftstr += 4; DefaultFileType = CDI_FILETYPE_NC4C;} - else if ( memcmp(filetypestr, "nc4", 3) == 0 ) { ftstr += 3; DefaultFileType = CDI_FILETYPE_NC4; } - else if ( memcmp(filetypestr, "nc5", 3) == 0 ) { ftstr += 3; DefaultFileType = CDI_FILETYPE_NC5; } - else if ( memcmp(filetypestr, "nc1", 3) == 0 ) { ftstr += 3; DefaultFileType = CDI_FILETYPE_NC; } - else if ( memcmp(filetypestr, "nczarr", 6) == 0 ) { ftstr += 6; DefaultFileType = CDI_FILETYPE_NCZARR; } - else if ( memcmp(filetypestr, "nc", 2) == 0 ) { ftstr += 2; DefaultFileType = CDI_FILETYPE_NC2; } - else if ( memcmp(filetypestr, "srv", 3) == 0 ) { ftstr += 3; DefaultFileType = CDI_FILETYPE_SRV; } - else if ( memcmp(filetypestr, "ext", 3) == 0 ) { ftstr += 3; DefaultFileType = CDI_FILETYPE_EXT; } - else if ( memcmp(filetypestr, "ieg", 3) == 0 ) { ftstr += 3; DefaultFileType = CDI_FILETYPE_IEG; } + if (memcmp(filetypestr, "grb2", 4) == 0) { ftstr += 4; DefaultFileType = CDI_FILETYPE_GRB2;} + else if (memcmp(filetypestr, "grb1", 4) == 0) { ftstr += 4; DefaultFileType = CDI_FILETYPE_GRB; } + else if (memcmp(filetypestr, "grb", 3) == 0) { ftstr += 3; DefaultFileType = CDI_FILETYPE_GRB; } + else if (memcmp(filetypestr, "nc2", 3) == 0) { ftstr += 3; DefaultFileType = CDI_FILETYPE_NC2; } + else if (memcmp(filetypestr, "nc4c", 4) == 0) { ftstr += 4; DefaultFileType = CDI_FILETYPE_NC4C;} + else if (memcmp(filetypestr, "nc4", 3) == 0) { ftstr += 3; DefaultFileType = CDI_FILETYPE_NC4; } + else if (memcmp(filetypestr, "nc5", 3) == 0) { ftstr += 3; DefaultFileType = CDI_FILETYPE_NC5; } + else if (memcmp(filetypestr, "nc1", 3) == 0) { ftstr += 3; DefaultFileType = CDI_FILETYPE_NC; } + else if (memcmp(filetypestr, "nczarr", 6) == 0) { ftstr += 6; DefaultFileType = CDI_FILETYPE_NCZARR; } + else if (memcmp(filetypestr, "nc", 2) == 0) { ftstr += 2; DefaultFileType = CDI_FILETYPE_NC2; } + else if (memcmp(filetypestr, "srv", 3) == 0) { ftstr += 3; DefaultFileType = CDI_FILETYPE_SRV; } + else if (memcmp(filetypestr, "ext", 3) == 0) { ftstr += 3; DefaultFileType = CDI_FILETYPE_EXT; } + else if (memcmp(filetypestr, "ieg", 3) == 0) { ftstr += 3; DefaultFileType = CDI_FILETYPE_IEG; } else { fprintf(stderr, "Unsupported filetype %s!\n", filetypestr); @@ -710,7 +714,7 @@ handle_error(int cdiErrno, const char *fmt, ...) static void defineCompress(const char *arg) { - const size_t len = strlen(arg); + size_t len = strlen(arg); if (strncmp(arg, "szip", len) == 0) { @@ -725,10 +729,55 @@ defineCompress(const char *arg) comptype = CDI_COMPRESS_ZIP; complevel = (len == 5 && arg[3] == '_' && isdigit(arg[4])) ? atoi(&arg[4]) : 1; } + else if (strncmp(arg, "zstd", 4) == 0) + { + if (filterId == 0) + { + filterId = 32015; + numParams = 1; + params[0] = (len >= 6 && len <= 7 && arg[4] == '_' && isdigit(arg[5])) ? atoi(&arg[5]) : 1; + } + else + { + fprintf(stderr, "Filter already defined!\n"); + } + } else fprintf(stderr, "%s compression unsupported!\n", arg); } +static void +defineFilter(const char *arg) +{ + size_t len = strlen(arg); + + if (len > 0 && isdigit(arg[0])) + { + filterId = atoi(arg); + const char *next; + const char *parg = arg; + while ((next = strchr(parg, ','))) + { + parg = ++next; + len = strlen(parg); + if (len > 0 && isdigit(parg[0])) + { + if (numParams >= maxParams) + { + fprintf(stderr, "Too many filter parameter (max=%d)!\n", maxParams); + return; + } + params[numParams] = atoi(parg); + numParams++; + } + } + } + else + { + fprintf(stderr, "Filter id missing!\n"); + } +} + int main(int argc, char *argv[]) { @@ -741,7 +790,6 @@ main(int argc, char *argv[]) int Record = 0; int Variable = 0; int Debug = 0; - /* int Quiet = 0; */ int Vardis = 0; int Version = 0; int Longinfo = 0; @@ -754,6 +802,14 @@ main(int argc, char *argv[]) int numWorkerOut = 0; char varname[CDI_MAX_NAME]; char paramstr[32]; + char *queryNames[256]; + int numQueryNames = 0; + size_t queryCellidx[256]; + int numQueryCellidx = 0; + int queryLevidx[256]; + int numQueryLevidx = 0; + int queryStepidx[256]; + int numQueryStepidx = 0; Progname = strrchr(argv[0], '/'); if (Progname == 0) @@ -762,24 +818,27 @@ main(int argc, char *argv[]) Progname++; // clang-format off - while ((c = getopt(argc, argv, "b:f:i:o:t:w:z:cdhlMmnqRrsvVxXZ")) != EOF) + while ((c = getopt(argc, argv, "b:C:F:f:i:L:o:N:S:t:w:z:cdhlMmnRrsvVxXZ")) != EOF) { switch (c) { case 'b': setDefaultDataType(optarg); break; + case 'C': queryCellidx[numQueryCellidx++] = atol(optarg); break; case 'd': Debug = 1; break; case 'f': setDefaultFileType(optarg); break; case 'h': usage(); exit (0); case 'i': numWorkerIn = atoi(optarg); break; case 'o': numWorkerOut = atoi(optarg); break; + case 'L': queryLevidx[numQueryLevidx++] = atoi(optarg); break; case 'l': Longinfo = 1; break; case 'M': cdiDefGlobal("HAVE_MISSVAL", 1); break; case 'm': Move = 1; break; + case 'N': queryNames[numQueryNames++] = strdup(optarg); break; case 'n': Info = 0; NoInfo = 1; break; - case 'q': /* Quiet = 1; */ break; case 'R': cdiDefGlobal("REGULARGRID", 1); break; case 'r': Record = 1; break; case 'X': Variable = 1; break; + case 'S': queryStepidx[numQueryStepidx++] = atoi(optarg); break; case 's': Shortinfo = 1; break; case 't': rTable = optarg; break; case 'v': Vardis = 1; break; @@ -787,6 +846,7 @@ main(int argc, char *argv[]) case 'w': wTable = optarg; break; case 'x': datamode = SP_MODE; break; case 'z': defineCompress(optarg); break; + case 'F': defineFilter(optarg); break; } } // clang-format on @@ -812,6 +872,8 @@ main(int argc, char *argv[]) exit(0); } + // for (int i = 0; i < numQueryNames; ++i) printf("queryName[%d] = %s\n", i+1, queryNames[i]); + if (fname1) { SizeType nmiss; @@ -826,18 +888,33 @@ main(int argc, char *argv[]) int taxisID2 = CDI_UNDEFID; int vlistID2 = CDI_UNDEFID; - const int streamID1 = streamOpenRead(fname1); + bool useQuery = (numQueryNames > 0) || (numQueryCellidx > 0) || (numQueryLevidx > 0) || (numQueryStepidx > 0); + CdiQuery *query = NULL; + if (useQuery) + { + query = cdiQueryCreate(); + if (numQueryNames) cdiQuerySetNames(query, numQueryNames, queryNames); + if (numQueryCellidx) cdiQuerySetCellidx(query, numQueryCellidx, queryCellidx); + if (numQueryLevidx) cdiQuerySetLevidx(query, numQueryLevidx, queryLevidx); + if (numQueryStepidx) cdiQuerySetStepidx(query, numQueryStepidx, queryStepidx); + if (Debug) cdiQueryPrint(query); + } + + int streamID1 = useQuery ? streamOpenReadQuery(fname1, query) : streamOpenRead(fname1); if (streamID1 < 0) return handle_error(streamID1, "Open failed on %s", fname1); + if (useQuery) cdiQueryPrintEntriesNotFound(query); + if (query) cdiQueryDelete(query); + if (numWorkerIn > 0) streamDefNumWorker(streamID1, numWorkerIn); - const int vlistID1 = streamInqVlist(streamID1); + int vlistID1 = streamInqVlist(streamID1); if (Longinfo) vlistPrint(vlistID1); - const int nvars = vlistNvars(vlistID1); - const int taxisID1 = vlistInqTaxis(vlistID1); - const int ntsteps = vlistNtsteps(vlistID1); + int nvars = vlistNvars(vlistID1); + int taxisID1 = vlistInqTaxis(vlistID1); + int ntsteps = vlistNtsteps(vlistID1); if (Debug) fprintf(stderr, "nvars = %d\nntsteps = %d\n", nvars, ntsteps); @@ -850,11 +927,11 @@ main(int argc, char *argv[]) for (varID = 0; varID < nvars; varID++) { - const int gridID = vlistInqVarGrid(vlistID1, varID); - const size_t gridsize = gridInqSize(gridID); + int gridID = vlistInqVarGrid(vlistID1, varID); + size_t gridsize = gridInqSize(gridID); if (gridsize > datasize) datasize = gridsize; - const int zaxisID = vlistInqVarZaxis(vlistID1, varID); - const size_t nlev = zaxisInqSize(zaxisID); + int zaxisID = vlistInqVarZaxis(vlistID1, varID); + size_t nlev = zaxisInqSize(zaxisID); if (nlev > maxlev) maxlev = nlev; if (fname2) { @@ -872,12 +949,17 @@ main(int argc, char *argv[]) streamID2 = streamOpenWrite(fname2, filetype); if (streamID2 < 0) return handle_error(streamID2, "Open failed on %s", fname2); - const int maxSteps = vlistNtsteps(vlistID1); + int maxSteps = vlistNtsteps(vlistID1); if (filetype == CDI_FILETYPE_NCZARR && maxSteps >= 0) streamDefMaxSteps(streamID2, maxSteps); if (numWorkerOut > 0) streamDefNumWorker(streamID2, numWorkerOut); if (DefaultByteorder != CDI_UNDEFID) streamDefByteorder(streamID2, DefaultByteorder); + if (filterId != 0) + { + streamDefFilter(streamID2, filterId, numParams, params); + } + if (comptype != CDI_COMPRESS_NONE) { streamDefCompType(streamID2, comptype); @@ -912,7 +994,7 @@ main(int argc, char *argv[]) streamDefTimestep(streamID2, tsID); } - const CdiDateTime vdatetime = taxisInqVdatetime(taxisID1); + CdiDateTime vdatetime = taxisInqVdatetime(taxisID1); if (Record) { @@ -921,10 +1003,10 @@ main(int argc, char *argv[]) streamInqRecord(streamID1, &varID, &levelID); streamReadRecord(streamID1, data, &nmiss); - const int number = vlistInqVarNumber(vlistID1, varID); - const int gridID = vlistInqVarGrid(vlistID1, varID); - const int zaxisID = vlistInqVarZaxis(vlistID1, varID); - const int param = vlistInqVarParam(vlistID1, varID); + int number = vlistInqVarNumber(vlistID1, varID); + int gridID = vlistInqVarGrid(vlistID1, varID); + int zaxisID = vlistInqVarZaxis(vlistID1, varID); + int param = vlistInqVarParam(vlistID1, varID); cdiParamToString(param, paramstr, sizeof(paramstr)); @@ -935,9 +1017,9 @@ main(int argc, char *argv[]) // printf("varID=%d, param=%d, gridID=%d, zaxisID=%d levelID=%d\n", varID, param, gridID, zaxisID, levelID); - const SizeType gridsize = gridInqSize(gridID); - const double level = zaxisInqLevels(zaxisID, NULL) ? zaxisInqLevel(zaxisID, levelID) : levelID + 1; - const double missval = vlistInqVarMissval(vlistID1, varID); + SizeType gridsize = gridInqSize(gridID); + double level = zaxisInqLevels(zaxisID, NULL) ? zaxisInqLevel(zaxisID, levelID) : levelID + 1; + double missval = vlistInqVarMissval(vlistID1, varID); if (Info) printInfo(vdatetime, varname, level, (size_t) gridsize, number, (size_t) nmiss, missval, data, Vardis); @@ -958,10 +1040,10 @@ main(int argc, char *argv[]) { if (vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT && tsID > 0) continue; - const int number = vlistInqVarNumber(vlistID1, varID); - const int gridID = vlistInqVarGrid(vlistID1, varID); - const int zaxisID = vlistInqVarZaxis(vlistID1, varID); - const int param = vlistInqVarParam(vlistID1, varID); + int number = vlistInqVarNumber(vlistID1, varID); + int gridID = vlistInqVarGrid(vlistID1, varID); + int zaxisID = vlistInqVarZaxis(vlistID1, varID); + int param = vlistInqVarParam(vlistID1, varID); cdiParamToString(param, paramstr, sizeof(paramstr)); @@ -972,16 +1054,16 @@ main(int argc, char *argv[]) if (Debug) fprintf(stdout, "varID = %d param = %d gridID = %d zaxisID = %d\n", varID, param, gridID, zaxisID); - const size_t gridsize = gridInqSize(gridID); - const double missval = vlistInqVarMissval(vlistID1, varID); + size_t gridsize = gridInqSize(gridID); + double missval = vlistInqVarMissval(vlistID1, varID); streamReadVar(streamID1, varID, data, &nmiss); - const int nlevs = zaxisInqSize(zaxisID); + int nlevs = zaxisInqSize(zaxisID); for (levelID = 0; levelID < nlevs; levelID++) { - const double level = zaxisInqLevels(zaxisID, NULL) ? zaxisInqLevel(zaxisID, levelID) : levelID + 1; - const size_t offset = levelID * gridsize; + double level = zaxisInqLevels(zaxisID, NULL) ? zaxisInqLevel(zaxisID, levelID) : levelID + 1; + size_t offset = levelID * gridsize; if (Info) printInfo(vdatetime, varname, level, gridsize, number, nmiss, missval, data + offset, Vardis); } @@ -994,10 +1076,10 @@ main(int argc, char *argv[]) { if (vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT && tsID > 0) continue; - const int number = vlistInqVarNumber(vlistID1, varID); - const int gridID = vlistInqVarGrid(vlistID1, varID); - const int zaxisID = vlistInqVarZaxis(vlistID1, varID); - const int param = vlistInqVarParam(vlistID1, varID); + int number = vlistInqVarNumber(vlistID1, varID); + int gridID = vlistInqVarGrid(vlistID1, varID); + int zaxisID = vlistInqVarZaxis(vlistID1, varID); + int param = vlistInqVarParam(vlistID1, varID); cdiParamToString(param, paramstr, sizeof(paramstr)); @@ -1008,13 +1090,13 @@ main(int argc, char *argv[]) if (Debug) fprintf(stdout, "varID = %d param = %d gridID = %d zaxisID = %d\n", varID, param, gridID, zaxisID); - const size_t gridsize = gridInqSize(gridID); - const double missval = vlistInqVarMissval(vlistID1, varID); + size_t gridsize = gridInqSize(gridID); + double missval = vlistInqVarMissval(vlistID1, varID); - const int nlevs = zaxisInqSize(zaxisID); + int nlevs = zaxisInqSize(zaxisID); for (levelID = 0; levelID < nlevs; levelID++) { - const double level = zaxisInqLevels(zaxisID, NULL) ? zaxisInqLevel(zaxisID, levelID) : levelID + 1; + double level = zaxisInqLevels(zaxisID, NULL) ? zaxisInqLevel(zaxisID, levelID) : levelID + 1; streamReadVarSlice(streamID1, varID, levelID, data, &nmiss); if (Info) printInfo(vdatetime, varname, level, gridsize, number, nmiss, missval, data, Vardis); @@ -1040,6 +1122,8 @@ main(int argc, char *argv[]) streamClose(streamID1); } + for (int i = 0; i < numQueryNames; ++i) free(queryNames[i]); + if (wTable) tableWrite(wTable, itableID); return 0; diff --git a/app/printinfo.c b/app/printinfo.c index 21f1b26734f0b782de437012aa45f1f273937aa8..51cbd1866408195b1c1fbeeef2587d2e9d604e19 100644 --- a/app/printinfo.c +++ b/app/printinfo.c @@ -36,7 +36,7 @@ time2str(CdiTime time, char *timestr, int maxlen) char *envString = getenv("CDI_MS_DIGITS"); if (envString) { - const int ival = atol(envString); + int ival = atol(envString); if (ival > 0) msDigitsNum = ival; if (ival > 3) msDigitsNum = 3; } @@ -50,22 +50,26 @@ time2str(CdiTime time, char *timestr, int maxlen) } const char * -comp_name(int comptype) +comptype_to_name(int compType) { - if (comptype == CDI_COMPRESS_SZIP) return "szip"; - if (comptype == CDI_COMPRESS_ZIP) return "zip"; - if (comptype == CDI_COMPRESS_JPEG) return "jpeg"; - if (comptype == CDI_COMPRESS_AEC) return "aec"; + switch (compType) + { + case CDI_COMPRESS_SZIP: return "szip"; + case CDI_COMPRESS_AEC: return "aec"; + case CDI_COMPRESS_ZIP: return "zip"; + case CDI_COMPRESS_JPEG: return "jpeg"; + case CDI_COMPRESS_FILTER: return "filter"; + } return " "; } void printFiletype(int streamID, int vlistID) { - const int filetype = streamInqFiletype(streamID); + int filetype = streamInqFiletype(streamID); // clang-format off - switch ( filetype ) + switch (filetype) { case CDI_FILETYPE_GRB: printf("GRIB"); break; case CDI_FILETYPE_GRB2: printf("GRIB2"); break; @@ -81,9 +85,9 @@ printFiletype(int streamID, int vlistID) default: printf(" File format: unsupported filetype %d" , filetype); break; } - if ( filetype == CDI_FILETYPE_SRV || filetype == CDI_FILETYPE_EXT || filetype == CDI_FILETYPE_IEG ) + if (filetype == CDI_FILETYPE_SRV || filetype == CDI_FILETYPE_EXT || filetype == CDI_FILETYPE_IEG) { - switch ( streamInqByteorder(streamID) ) + switch (streamInqByteorder(streamID)) { case CDI_BIGENDIAN: printf(" BIGENDIAN"); break; case CDI_LITTLEENDIAN: printf(" LITTLEENDIAN"); break; @@ -92,16 +96,16 @@ printFiletype(int streamID, int vlistID) } // clang-format on - const int nvars = vlistNvars(vlistID); - const int comps[] = { CDI_COMPRESS_ZIP, CDI_COMPRESS_JPEG, CDI_COMPRESS_SZIP, CDI_COMPRESS_AEC }; + int nvars = vlistNvars(vlistID); + const int comps[] = { CDI_COMPRESS_SZIP, CDI_COMPRESS_AEC, CDI_COMPRESS_ZIP, CDI_COMPRESS_JPEG, CDI_COMPRESS_FILTER }; unsigned kk = 0; for (unsigned k = 0; k < sizeof(comps) / sizeof(int); ++k) for (int varID = 0; varID < nvars; varID++) { - const int comptype = vlistInqVarCompType(vlistID, varID); + int comptype = vlistInqVarCompType(vlistID, varID); if (comptype == comps[k]) { - printf("%c%s", (kk++ == 0) ? ' ' : '/', comp_name(comptype)); + printf("%c%s", (kk++ == 0) ? ' ' : '/', comptype_to_name(comptype)); break; } } @@ -112,7 +116,7 @@ printFiletype(int streamID, int vlistID) static void print_xvals(int gridID, int dig) { - const size_t xsize = gridInqXsize(gridID); + size_t xsize = gridInqXsize(gridID); if (xsize > 0 && gridInqXvals(gridID, NULL)) { char xname[CDI_MAX_NAME], xunits[CDI_MAX_NAME]; @@ -130,16 +134,14 @@ print_xvals(int gridID, int dig) fprintf(stdout, " to %.*g", dig, xlast); if (IS_NOT_EQUAL(xinc, 0)) fprintf(stdout, " by %.*g", dig, xinc); } - fprintf(stdout, " %s", xunits); - if (gridIsCircular(gridID)) fprintf(stdout, " circular"); - fprintf(stdout, "\n"); + fprintf(stdout, " %s%s\n", xunits, gridIsCircular(gridID) ? " circular" : ""); } } static void print_yvals(int gridID, int dig) { - const size_t ysize = gridInqYsize(gridID); + size_t ysize = gridInqYsize(gridID); if (ysize > 0 && gridInqYvals(gridID, NULL)) { char yname[CDI_MAX_NAME], yunits[CDI_MAX_NAME]; @@ -154,13 +156,12 @@ print_yvals(int gridID, int dig) fprintf(stdout, "%33s : %.*g", yname, dig, yfirst); if (ysize > 1) { - const int gridtype = gridInqType(gridID); + int gridtype = gridInqType(gridID); fprintf(stdout, " to %.*g", dig, ylast); if (IS_NOT_EQUAL(yinc, 0) && gridtype != GRID_GAUSSIAN && gridtype != GRID_GAUSSIAN_REDUCED) fprintf(stdout, " by %.*g", dig, yinc); } - fprintf(stdout, " %s", yunits); - fprintf(stdout, "\n"); + fprintf(stdout, " %s\n", yunits); } } @@ -179,7 +180,7 @@ print_xyvals2D(int gridID, int dig) length = CDI_MAX_NAME; cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_UNITS, yunits, &length); - const size_t gridsize = gridInqSize(gridID); + size_t gridsize = gridInqSize(gridID); double *xvals2D = (double *) malloc(gridsize * sizeof(double)); double *yvals2D = (double *) malloc(gridsize * sizeof(double)); @@ -203,8 +204,8 @@ print_xyvals2D(int gridID, int dig) int gridtype = gridInqType(gridID); if (gridtype == GRID_CURVILINEAR) { - const size_t xsize = gridInqXsize(gridID); - const size_t ysize = gridInqYsize(gridID); + size_t xsize = gridInqXsize(gridID); + size_t ysize = gridInqYsize(gridID); if (xsize > 1) { double *xvals = (double *) malloc((size_t) xsize * sizeof(double)); @@ -256,14 +257,11 @@ print_xyvals2D(int gridID, int dig) fprintf(stdout, "%33s : %.*g", xname, dig, xfirst); if (gridsize > 1) fprintf(stdout, " to %.*g", dig, xlast); if (IS_NOT_EQUAL(xinc, 0)) fprintf(stdout, " by %.*g", dig, xinc); - fprintf(stdout, " %s", xunits); - if (gridIsCircular(gridID)) fprintf(stdout, " circular"); - fprintf(stdout, "\n"); + fprintf(stdout, " %s%s\n", xunits, gridIsCircular(gridID) ? " circular" : ""); fprintf(stdout, "%33s : %.*g", yname, dig, yfirst); if (gridsize > 1) fprintf(stdout, " to %.*g", dig, ylast); if (IS_NOT_EQUAL(yinc, 0)) fprintf(stdout, " by %.*g", dig, yinc); - fprintf(stdout, " %s", yunits); - fprintf(stdout, "\n"); + fprintf(stdout, " %s\n", yunits); free(xvals2D); free(yvals2D); @@ -279,7 +277,7 @@ printGridNp(int gridtype, int gridID, size_t gridsize, size_t xsize, size_t ysiz else if (xsize && ysize) fprintf(stdout, " (%zux%zu)", xsize, ysize); - const int numLPE = gridInqNP(gridID); + int numLPE = gridInqNP(gridID); if (numLPE > 0) { if (gridtype == GRID_GAUSSIAN) fprintf(stdout, " F%d", numLPE); @@ -297,10 +295,10 @@ printGridInfoKernel(int gridID, int index, bool lproj) if (lproj && gridtype != GRID_PROJECTION) fprintf(stderr, "Internal problem (%s): sub grid not equal GRID_PROJECTION!\n", __func__); - const int trunc = gridInqTrunc(gridID); - const size_t gridsize = gridInqSize(gridID); - const size_t xsize = gridInqXsize(gridID); - const size_t ysize = gridInqYsize(gridID); + int trunc = gridInqTrunc(gridID); + size_t gridsize = gridInqSize(gridID); + size_t xsize = gridInqXsize(gridID); + size_t ysize = gridInqYsize(gridID); // int prec = gridInqDatatype(gridID); // int dig = (prec == CDI_DATATYPE_FLT64) ? 15 : 7; @@ -337,18 +335,15 @@ printGridInfoKernel(int gridID, int index, bool lproj) if (gridInqXbounds(gridID, NULL) || gridInqYbounds(gridID, NULL)) { - fprintf(stdout, "%33s :", "available"); - if (gridInqXbounds(gridID, NULL) && gridInqYbounds(gridID, NULL)) fprintf(stdout, " cellbounds"); - if (gridHasArea(gridID)) fprintf(stdout, " area"); - if (gridInqMask(gridID, NULL)) fprintf(stdout, " mask"); - fprintf(stdout, "\n"); + fprintf(stdout, "%33s :%s%s%s\n", "available", + (gridInqXbounds(gridID, NULL) && gridInqYbounds(gridID, NULL) ? " cellbounds" : ""), + gridHasArea(gridID) ? " area" : "", gridInqMask(gridID, NULL) ? " mask" : ""); } } else if (gridtype == GRID_SPECTRAL) { - fprintf(stdout, "points=%zu nsp=%zu T%d", gridsize, gridsize / 2, trunc); - if (gridInqComplexPacking(gridID)) fprintf(stdout, " complexPacking"); - fprintf(stdout, "\n"); + fprintf(stdout, "points=%zu nsp=%zu T%d%s\n", gridsize, gridsize / 2, trunc, + gridInqComplexPacking(gridID) ? " complexPacking" : ""); } else if (gridtype == GRID_FOURIER) { @@ -373,8 +368,8 @@ printGridInfoKernel(int gridID, int index, bool lproj) if (gridtype == GRID_UNSTRUCTURED) { - const int number = gridInqNumber(gridID); - const int position = gridInqPosition(gridID); + int number = gridInqNumber(gridID); + int position = gridInqPosition(gridID); if (number > 0) fprintf(stdout, "%33s : number=%d position=%d\n", "grid", number, position); if (gridInqReference(gridID, NULL)) @@ -399,11 +394,9 @@ printGridInfoKernel(int gridID, int index, bool lproj) { if (gridHasArea(gridID) || gridInqXbounds(gridID, NULL) || gridInqYbounds(gridID, NULL)) { - fprintf(stdout, "%33s :", "available"); - if (gridInqXbounds(gridID, NULL) && gridInqYbounds(gridID, NULL)) fprintf(stdout, " cellbounds"); - if (gridHasArea(gridID)) fprintf(stdout, " area"); - if (gridInqMask(gridID, NULL)) fprintf(stdout, " mask"); - fprintf(stdout, "\n"); + fprintf(stdout, "%33s :%s%s%s\n", "available", + (gridInqXbounds(gridID, NULL) && gridInqYbounds(gridID, NULL)) ? " cellbounds" : "", + gridHasArea(gridID) ? " area" : "", gridInqMask(gridID, NULL) ? " mask" : ""); } } @@ -423,24 +416,22 @@ printGridInfoKernel(int gridID, int index, bool lproj) void printGridInfo(int vlistID) { - const int ngrids = vlistNgrids(vlistID); + int ngrids = vlistNgrids(vlistID); for (int index = 0; index < ngrids; index++) { - const int gridID = vlistGrid(vlistID, index); + int gridID = vlistGrid(vlistID, index); printGridInfoKernel(gridID, index, false); - const int projID = gridInqProj(gridID); + int projID = gridInqProj(gridID); if (projID != CDI_UNDEFID) printGridInfoKernel(projID, index, true); } } static void -printZaxisBoundsInfo(const int zaxisID, const int dig, const int levelsize, const double zinc, const char *zunits) +printZaxisBoundsInfo(int zaxisID, int dig, int levelsize, const double zinc, const char *zunits) { - fprintf(stdout, "%33s : ", "bounds"); - double level1 = zaxisInqLbound(zaxisID, 0); double level2 = zaxisInqUbound(zaxisID, 0); - fprintf(stdout, "%.*g-%.*g", dig, level1, dig, level2); + fprintf(stdout, "%33s : %.*g-%.*g", "bounds", dig, level1, dig, level2); if (levelsize > 1) { level1 = zaxisInqLbound(zaxisID, levelsize - 1); @@ -448,13 +439,11 @@ printZaxisBoundsInfo(const int zaxisID, const int dig, const int levelsize, cons fprintf(stdout, " to %.*g-%.*g", dig, level1, dig, level2); if (IS_NOT_EQUAL(zinc, 0)) fprintf(stdout, " by %.*g", dig, zinc); } - fprintf(stdout, " %s", zunits); - fprintf(stdout, "\n"); + fprintf(stdout, " %s\n", zunits); } static void -printZaxisLevelInfo(const int levelsize, const int zaxisID, const int zaxistype, double zinc, const int dig, const char *zname, - const char *zunits) +printZaxisLevelInfo(int levelsize, int zaxisID, int zaxistype, double zinc, int dig, const char *zname, const char *zunits) { double *levels = (double *) malloc((size_t) levelsize * sizeof(double)); zaxisInqLevels(zaxisID, levels); @@ -480,31 +469,27 @@ printZaxisLevelInfo(const int levelsize, const int zaxisID, const int zaxistype, fprintf(stdout, " to %.*g", dig, zlast); if (IS_NOT_EQUAL(zinc, 0)) fprintf(stdout, " by %.*g", dig, zinc); } - fprintf(stdout, " %s", zunits); - fprintf(stdout, "\n"); + fprintf(stdout, " %s\n", zunits); } free(levels); } static void -printZaxisHybridInfo(const int zaxisID) +printZaxisHybridInfo(int zaxisID) { char psname[CDI_MAX_NAME]; int length = CDI_MAX_NAME; cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_PSNAME, psname, &length); - const int vctsize = zaxisInqVctSize(zaxisID); + int vctsize = zaxisInqVctSize(zaxisID); if (vctsize || psname[0]) { - fprintf(stdout, "%33s :", "available"); - if (vctsize) fprintf(stdout, " vct"); - if (psname[0]) fprintf(stdout, " ps: %s", psname); - fprintf(stdout, "\n"); + fprintf(stdout, "%33s :%s%s%s\n", "available", vctsize ? " vct" : "", psname[0] ? " ps: " : "", psname); } } static void -printZaxisGenericInfo(const int ltype, const int zaxistype, const char *zaxisname) +printZaxisGenericInfo(int ltype, int zaxistype, const char *zaxisname) { if (zaxistype == ZAXIS_GENERIC && ltype != 0) fprintf(stdout, "%-12s (ltype=%3d)", zaxisname, ltype); @@ -513,14 +498,13 @@ printZaxisGenericInfo(const int ltype, const int zaxistype, const char *zaxisnam } static void -printZaxisReferenceInfo(const int zaxisID) +printZaxisReferenceInfo(int zaxisID) { int referenceNumber = 0; cdiInqKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_NUMBEROFVGRIDUSED, &referenceNumber); if (referenceNumber > 0) { - fprintf(stdout, "%33s : ", "zaxis"); - fprintf(stdout, "number=%d\n", referenceNumber); + fprintf(stdout, "%33s : number=%d\n", "zaxis", referenceNumber); } unsigned char uuidOfVGrid[CDI_UUID_SIZE]; @@ -532,8 +516,7 @@ printZaxisReferenceInfo(const int zaxisID) cdiUUID2Str(uuidOfVGrid, uuidOfVGridStr); if (uuidOfVGridStr[0] != 0 && strlen(uuidOfVGridStr) == 36) { - fprintf(stdout, "%33s : ", "uuid"); - fprintf(stdout, "%s\n", uuidOfVGridStr); + fprintf(stdout, "%33s : %s\n", "uuid", uuidOfVGridStr); } } } @@ -543,17 +526,17 @@ printZaxisInfo(int vlistID) { char zaxisname[CDI_MAX_NAME], zname[CDI_MAX_NAME], zunits[CDI_MAX_NAME]; - const int nzaxis = vlistNzaxis(vlistID); + int nzaxis = vlistNzaxis(vlistID); for (int index = 0; index < nzaxis; index++) { int dig = 7; //______________________________________________________-- double zinc = 0; - const int zaxisID = vlistZaxis(vlistID, index); - const int zaxistype = zaxisInqType(zaxisID); + int zaxisID = vlistZaxis(vlistID, index); + int zaxistype = zaxisInqType(zaxisID); int ltype = 0; cdiInqKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_TYPEOFFIRSTFIXEDSURFACE, <ype); - const int levelsize = zaxisInqSize(zaxisID); + int levelsize = zaxisInqSize(zaxisID); // int prec = zaxisInqDatatype(zaxisID); // int dig = (prec == CDI_DATATYPE_FLT64) ? 15 : 7; @@ -570,10 +553,8 @@ printZaxisInfo(int vlistID) fprintf(stdout, " :"); - fprintf(stdout, " levels=%d", levelsize); const bool zscalar = (levelsize == 1) ? zaxisInqScalar(zaxisID) : false; - if (zscalar) fprintf(stdout, " scalar"); - fprintf(stdout, "\n"); + fprintf(stdout, " levels=%d%s\n", levelsize, zscalar ? " scalar" : ""); if (zaxisInqLevels(zaxisID, NULL)) { @@ -594,15 +575,13 @@ printZaxisInfo(int vlistID) void printSubtypeInfo(int vlistID) { - const int nsubtypes = vlistNsubtypes(vlistID); + int nsubtypes = vlistNsubtypes(vlistID); for (int index = 0; index < nsubtypes; index++) { - const int subtypeID = vlistSubtype(vlistID, index); - const int subtypesize = subtypeInqSize(subtypeID); + int subtypeID = vlistSubtype(vlistID, index); + int subtypesize = subtypeInqSize(subtypeID); // subtypePrint(subtypeID); - fprintf(stdout, " %4d : %-24s :", vlistSubtypeIndex(vlistID, subtypeID) + 1, "tiles"); - fprintf(stdout, " ntiles=%d", subtypesize); - fprintf(stdout, "\n"); + fprintf(stdout, " %4d : %-24s : ntiles=%d\n", vlistSubtypeIndex(vlistID, subtypeID) + 1, "tiles", subtypesize); } } @@ -674,7 +653,7 @@ printTimesteps(int streamID, int taxisID, int verbose) while (true) { - const int nrecs = streamInqTimestep(streamID, tsID); + int nrecs = streamInqTimestep(streamID, tsID); if (nrecs == 0) break; const CdiDateTime vdatetime = taxisInqVdatetime(taxisID); diff --git a/app/printinfo.h b/app/printinfo.h index 69a30c96384a225a3f600e02cbf0423019e25fad..3b14dfff4e4e6640b9d8fb758d5b1ee844c2ac52 100644 --- a/app/printinfo.h +++ b/app/printinfo.h @@ -7,7 +7,7 @@ void datetime2str(CdiDateTime dt, char *datetimestr, int maxlen); void date2str(CdiDate date, char *datestr, int maxlen); void time2str(CdiTime time, char *timestr, int maxlen); -const char *comp_name(int comptype); +const char *comptype_to_name(int comptype); void printFiletype(int streamID, int vlistID); void printGridInfo(int vlistID); diff --git a/autogen.sh b/autogen.sh index 3ddd2e4d6cd1e95349f7a7a8fd371a5e5f4637c0..a3bec6b48bff99448d489073c147ea92e0a9ff50 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,23 +1,7 @@ #!/bin/sh -autoreconf -fvi || exit $? -patch --forward --no-backup-if-mismatch -p1 -r - -i patch/libtool.m4.nag_wrapper.patch -# The program 'patch' exits with exitcode=1 if the patch has already been applied. -# Consider this a normal scenario: -exitcode=$?; test $exitcode -ne 0 && test $exitcode -ne 1 && exit $exitcode - -patch --forward --no-backup-if-mismatch -p1 -r - -i patch/libtool.m4.arg_spaces.patch -exitcode=$?; test $exitcode -ne 0 && test $exitcode -ne 1 && exit $exitcode - -# Rebuild configure if you need to patch M4 macros: -autoconf -f || exit $? - -# Reset libtool.m4 timestamps to avoid confusing make: -touch -r m4/ltversion.m4 m4/libtool.m4 || exit $? - -patch --forward --no-backup-if-mismatch -p1 -r - -i patch/ltmain.sh.nag_pthread.patch -exitcode=$?; test $exitcode -ne 0 && test $exitcode -ne 1 && exit $exitcode - -# All went fine since we have not exited before: -exit 0 +script_dir=`echo "$0" | sed 's@[^/]*$@@'` +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +cd "$script_dir" +./scripts/reconfigure diff --git a/cdi.settings.in b/cdi.settings.in index 92f27e2e5520c0c2ce8fee9fbde86b0e0b6e552d..cc428d1f74930e962bf8bd803bda6f956865ec28 100644 --- a/cdi.settings.in +++ b/cdi.settings.in @@ -13,7 +13,6 @@ "LD" : "@LD@", "NM" : "@NM@", "AR" : "@AR@", - "AS" : "@AS@", "DLLTOOL" : "@DLLTOOL@", "OBJDUMP" : "@OBJDUMP@", "STRIP" : "@STRIP@", @@ -29,7 +28,7 @@ "libs" : "@MPI_C_LIB@", "cflags" : "@MPI_C_INCLUDE@", "fclibs" : "@MPI_FC_LIB@", - "fcflags" : "@MPI_FC_INCLUDE@" + "fcflags" : "@MPI_FC_MOD@" }, "fdb5" : { "lib" : "@FDB5_LIBS@", @@ -65,8 +64,8 @@ "ieg" : "@ENABLE_IEG@", "enable_mpi" : @ENABLE_MPI@, "parallel_nc4" : @HAVE_PARALLEL_NC4@, - "enable_python" : @ENABLE_PYTHON@, - "enable_ruby" : @ENABLE_RUBY@ + "enable_python" : @ENABLE_PYTHON_INTERFACE@, + "enable_ruby" : @ENABLE_RUBY_INTERFACE@ "across" : "@ENABLE_ACROSS@", } } diff --git a/config/default b/config/default index 78cba4d32d89e306d3b3a300a331e5b72463cd74..3d31761c7b6c2958de70cd6c18d30ab30918450b 100755 --- a/config/default +++ b/config/default @@ -41,7 +41,7 @@ case "${HOSTNAME}" in --with-szlib=$HOME/local \ CC=icc CFLAGS="-g -D_REENTRANT -Wall -Wwrite-strings -O3 -march=native -fp-model source" ;; - bailung*|d133*|d134*) + bailung*|d146*) ${CONFPATH}configure --prefix=$HOME/local/cdi \ --enable-maintainer-mode \ --enable-iso-c-interface \ @@ -67,10 +67,10 @@ case "${HOSTNAME}" in --enable-maintainer-mode \ --with-szlib=$HOME/local \ --with-fdb5=$HOME/src/fdb \ - --with-eccodes=$HOME/local/eccodes-2.22.0 \ + --with-eccodes=$HOME/local/eccodes-2.27 \ --with-netcdf=$HOME/local/netcdf-c-4.9.0" PREFIX="--prefix=$HOME/local/cdi" - LD_ADD="-Wl,-rpath,$HOME/local/eccodes-2.22.0/lib -Wl,-rpath,$HOME/src/fdb/lib" + LD_ADD="-Wl,-rpath,$HOME/local/eccodes-2.27/lib -Wl,-rpath,$HOME/src/fdb/lib" if test "$COMP" = clang ; then ${CONFPATH}configure $CONFIG_OPTS $PREFIX $CDILIBS LDFLAGS="$LD_ADD $LDFLAGS" \ CC=clang CFLAGS="-g -pipe -D_REENTRANT -Wall -Wwrite-strings -W -Wfloat-equal -pedantic -O3" @@ -79,13 +79,6 @@ case "${HOSTNAME}" in CC=gcc CFLAGS="-g -pipe -D_REENTRANT -Wall -Wwrite-strings -W -Wfloat-equal -pedantic -O3" fi; ;; -# x86_64-squeeze-x64-linux - thunder*) - ${CONFPATH}configure --with-grib_api=/sw/squeeze-x64/grib_api-1.13.0-static-gccsys \ - --with-netcdf=/sw/squeeze-x64/netcdf-4.2-static \ - --disable-cf-interface \ - CC=gcc CFLAGS="-g -Wall -O3" - ;; # ia64-nec-linux ds*) ${CONFPATH}configure --prefix=$HOME/local \ @@ -123,17 +116,6 @@ case "${HOSTNAME}" in LD=/SX/opt/crosskit/inst/bin/sxld AR=/SX/opt/crosskit/inst/bin/sxar \ RANLIB=echo ;; -# powerpc-ibm-aix6.1.0.0 - blizzard*) - CONFIG_SHELL=/bin/bash /bin/bash \ - ${CONFPATH}configure --prefix=$HOME/local \ - --with-netcdf=/sw/aix61/netcdf-4.2 \ - --with-szlib=/sw/aix61/szip-2.1-threadsafe \ - AR="ar -X 64" LDFLAGS="-brtl" FC=xlf2003_r CC=xlc_r \ - CFLAGS="-g -O3 -qhot -q64 -qarch=auto -qtune=auto -qlistfmt=html=transforms -DHAVE_MMAP" \ - FCFLAGS="-qsuffix=cpp=f90 -qextname" \ - SHELL=/bin/bash - ;; breeze*) CDILIBS="--with-eccodes=/sw/jessie-x64/eccodes/eccodes-2.4.1-gccsys \ --with-netcdf=/sw/jessie-x64/netcdf-4.3.3.1-gccsys" diff --git a/config/default-mpi b/config/default-mpi index 61205eced05cb9ad42edfe9a8bfdc1a3bcfdd508..9ececd41655127a7f6a0d01d01a3973a4365694c 100755 --- a/config/default-mpi +++ b/config/default-mpi @@ -2,27 +2,52 @@ # # default configuration options and compiler flags for different hosts # +CONFPATH=`echo $0 | cut -c 1-6` +if [ "$CONFPATH" != "../../" ] ; then + CONFPATH='./' +fi +# +set -x + if test -z "$1" ; then HOSTNAME=`hostname` else HOSTNAME=$1 fi -set -x -cwd=`pwd -P` -srcd="$(readlink -f ${0})" -srcd="${srcd%/config/default-mpi}" -if [[ "$cwd" =~ "^${srcd}/.\+" ]]; then - echo "A build directory that is a sub-directory of the source directory is unsupported!" >&2 - exit 1 -elif [[ "$srcd" = "$cwd" ]]; then - confpath=. -else - confpath="${srcd}" -fi # case "${HOSTNAME}" in + hama*) + YAXT_ROOT=/Users/m214003/local/yaxt + MPI_LAUNCH="$(which mpirun)" + CDILIBS="--disable-iso-c-interface \ + --enable-maintainer-mode \ + --enable-mpi \ + --enable-option-checking=fatal \ + --with-szlib=$HOME/local \ + --with-fdb5=$HOME/src/fdb \ + --with-eccodes=$HOME/local/eccodes-2.27 \ + --with-netcdf=$HOME/local/netcdf-c-4.9.0" + PREFIX="--prefix=$HOME/local/cdi" + LD_ADD="-Wl,-rpath,$HOME/local/eccodes-2.27/lib -Wl,-rpath,$HOME/src/fdb/lib" + ${CONFPATH}configure $CONFIG_OPTS $PREFIX $CDILIBS LDFLAGS="$LD_ADD $LDFLAGS" \ + MPI_LAUNCH="${MPI_LAUNCH}" \ + PKG_CONFIG_PATH="${YAXT_ROOT}/lib/pkgconfig" \ + FC=mpif90 \ + CC=mpicc CFLAGS="-g -pipe -D_REENTRANT -Wall -Wwrite-strings -W -Wfloat-equal -pedantic -O3" + ;; # powerpc-ibm-aix6.1.0.0 blizzard*|passat*) + cwd=`pwd -P` + srcd="$(readlink -f ${0})" + srcd="${srcd%/config/default-mpi}" + if [[ "$cwd" =~ "^${srcd}/.\+" ]]; then + echo "A build directory that is a sub-directory of the source directory is unsupported!" >&2 + exit 1 + elif [[ "$srcd" = "$cwd" ]]; then + confpath=. + else + confpath="${srcd}" + fi export MP_PROCS=1 export MP_HOSTFILE="${cwd}/hostfile" hostname >"$MP_HOSTFILE" diff --git a/config/interface.rb b/config/interface.rb index 7ebab59168ddb0a03c62dd6fada9f92d4779f1cb..1885a108f8418ecd42e68e5ac8cb86da2ac7b4a6 100644 --- a/config/interface.rb +++ b/config/interface.rb @@ -2,6 +2,8 @@ require 'mkmf' require 'rbconfig' if RUBY_VERSION[0,3] == '1.8' puts "-I#{Config::expand(CONFIG['archdir'])}" +elsif RbConfig::CONFIG['MAJOR'].to_i >= 2 + puts "-I#{RbConfig::CONFIG['rubyhdrdir']} -I#{RbConfig::CONFIG['rubyarchhdrdir']}" else puts "-I#{RbConfig::CONFIG['rubyhdrdir']} -I#{RbConfig::CONFIG['rubyhdrdir']}/#{RbConfig::CONFIG['arch']}" end diff --git a/configure.ac b/configure.ac index 806de20376c21709c5ae6ddd7ee772252b0b707f..1b35faae57dda95b2a755bfabf824b416bbcd8f3 100644 --- a/configure.ac +++ b/configure.ac @@ -7,13 +7,9 @@ AC_PREREQ([2.69]) LT_PREREQ([2.4.6]) -AC_INIT([cdi],[2.1.0],[https://mpimet.mpg.de/cdi]) - +AC_INIT([cdi],[2.2.0],[https://mpimet.mpg.de/cdi]) AC_DEFINE_UNQUOTED(CDI, ["$PACKAGE_VERSION"], [CDI version]) -echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}" - -CONFIG_ABORT=yes AC_CONFIG_AUX_DIR([config]) AC_CONFIG_MACRO_DIR([m4]) dnl forbid acx macro names from remaining unexpanded @@ -21,378 +17,652 @@ m4_pattern_forbid([^ACX_]) AC_CANONICAL_HOST AC_CANONICAL_BUILD -AM_INIT_AUTOMAKE([1.16.1 foreign serial-tests]) -AC_CONFIG_HEADERS([src/config.h]) -AM_MAINTAINER_MODE([disable]) - -# Check building environment -AC_PROG_CC_C99 -dnl The check above forgets to delete the following directory -dnl generated by the MacOS linker, which results in multiple -dnl annoying messages from the rm utility: -rm -rf conftest.dSYM -dnl verify the setup supports POSIX 2001 +AM_INIT_AUTOMAKE([1.16.1 foreign]) +AM_MAINTAINER_MODE([enable]) +AM_EXTRA_RECURSIVE_TARGETS([examples]) + +m4_pushdef([_AC_PROG_CC_C89], + [rm -rf conftest.dSYM # needed when configured on MacOS with CFLAGS='-g' + _AC_PROG_CC_C99([], [AC_MSG_FAILURE([C compiler does not support ISO C99])])])dnl +AC_PROG_CC +m4_popdef([_AC_PROG_CC_C89])dnl ACX_PROG_CC_POSIX([2001]) AC_C_RESTRICT -AC_PROG_FC -AS_IF([test -n "$FC" && test "X$FC" != Xno], - [AC_FC_SRCEXT([f90]) - AC_LANG_PUSH([Fortran]) - AC_PROG_FPP - AC_LANG_POP([Fortran])]) -AC_PROG_F77 -AC_PROG_CXX + +dnl Compile with MPI support (we declare the option here because its value +dnl affects values of the auto options below): +AC_ARG_ENABLE([mpi], + [AS_HELP_STRING([--enable-mpi], + [enable parallel I/O with MPI @<:@default=no@:>@])], + [test "x$enableval" != xno && enable_mpi=yes], + [enable_mpi=no]) + +AC_ARG_ENABLE([iso-c-interface], + [AS_HELP_STRING([--enable-iso-c-interface], + [create Fortran 90 interface using Fortran 2003 ISO_C_BINDING facility ]dnl +[@<:@default=no@:>@])], + [test "x$enableval" != xno && enable_iso_c_interface=yes], + [enable_iso_c_interface=no]) +AM_CONDITIONAL([ENABLE_ISOC_INTERFACE], + [test "x$enable_iso_c_interface" = xyes]) + +AC_ARG_ENABLE([cf-interface], + [AS_HELP_STRING([--enable-cf-interface], + [create Fortran 77 interface using cfortran.h @<:@default=auto@:>@])], + [AS_IF([test "x$enableval" != xno && test "x$enableval" != xauto], + [enable_cf_interface=yes])], + [enable_cf_interface=auto]) +AS_IF([test "x${enable_mpi}${enable_cf_interface}" = xnoauto], + [enable_cf_interface=no]) + +dnl We need FC for the Fortran 90 and for the Fortran 77 interfaces. In the +dnl latter case, the compiler is used for testing. Note that we use neither +dnl AS_IF nor AS_VAR_IF here to prevent checking for FC when we do not need it: +if test "x$enable_iso_c_interface" = xyes || \ + test "x$enable_cf_interface" != xno; then + if test "x$FC" != xno; then + AC_PROG_FC + test -z $FC 2>/dev/null && FC=no + AS_IF([test "x$FC" != xno], [AC_FC_SRCEXT([f90], [], [FC=no])]) + AS_IF([test "x$FC" != xno], + [AC_CACHE_CHECK([whether the Fortran compiler works], + [acx_cv_fc_works], + [acx_cv_fc_works=no + AC_LANG_PUSH([Fortran]) + AC_RUN_IFELSE([AC_LANG_PROGRAM], + [acx_cv_fc_works=yes], [], [acx_cv_fc_works=yes]) + AC_LANG_POP([Fortran])]) + AS_VAR_IF([acx_cv_fc_works], [no], [FC=no])]) +dnl Additional tests with fallback values: + AS_IF([test "x$FC" != xno], + [AC_LANG_PUSH([Fortran]) + ACX_SL_FC_CHECK_MOD_PATH_FLAG([], [FC_MOD_FLAG=-I]) + ACX_FORTRAN_INCLUDE_FLAG( + [AC_SUBST([FC_OPTINC], [$acx_cv_fc_ftn_include_flag])], + [FC_OPTINC=-I]) + ACX_SL_FC_MOD_SUFFIX([], [FCMODEXT=mod]) +dnl Find the Fortran compiler flag needed to specify a preprocessor macro +dnl definition for *.F90 source files: + m4_pushdef([AC_FC_PP_SRCEXT])dnl + saved_ac_fc_srcext=$ac_fc_srcext + ac_fc_srcext='F90' + AC_FC_PP_DEFINE([], [FC_DEFINE=-D]) + ac_fc_srcext=$saved_ac_fc_srcext + m4_popdef([AC_FC_PP_DEFINE]) + AC_LANG_POP([Fortran])]) + fi +else + FC=no +fi +AM_CONDITIONAL([FC_MOD_UPPERCASE], [test "x$FCMODCASE" = xuc]) +dnl Additional checks required for the Fortran 2003 interface: +AS_VAR_IF([enable_iso_c_interface], [yes], + [AS_IF([test "x$FC" != xno], [ACX_FC_CHECK_STRPTR_CONVERT([], [FC=no])]) + AS_VAR_IF([FC], [no], + [AC_MSG_FAILURE([the Fortran 2003 interface is requested but the ]dnl +[Fortran compiler is disabled, missing or lacks the required features])])]) +AM_CONDITIONAL([BUILD_FC_PROGRAMS], [test "x$FC" != xno]) + +dnl We need Fortran 77 if either FC is not available or the user has specified +dnl F77 explicitly to make sure that the generated Fortran 77 interface is +dnl compatible with it: +if test "x$enable_cf_interface" != xno; then + AS_IF([test -n "$F77" && test "x$F77" != xno], + [requested_F77=yes], [requested_F77=no]) + if test "x$FC" = xno || test "x$requested_F77" = xyes; then + AC_PROG_F77 + test -z $F77 2>/dev/null && F77=no + AS_IF([test "x$F77" != xno], + [AC_CACHE_CHECK([whether the Fortran 77 compiler works], + [acx_cv_f77_works], + [acx_cv_f77_works=no + AC_LANG_PUSH([Fortran 77]) + AC_RUN_IFELSE([AC_LANG_PROGRAM], + [acx_cv_f77_works=yes], [], [acx_cv_f77_works=yes]) + AC_LANG_POP([Fortran 77])]) + AS_VAR_IF([acx_cv_f77_works], [no], [F77=no])]) + else + F77=no + fi + AS_IF([test "x$F77" = xno && test "x$requested_F77" = xyes], + [AC_MSG_FAILURE([the explicitly requested Fortran 77 compiler is ]dnl +[missing or lacks the required features])]) + AS_UNSET([requested_F77]) +else + F77=no +fi +dnl Additional checks required for the Fortran 77 interface: +AS_IF([test "x$enable_cf_interface" != xno], + [dnl +dnl The following macro make sure that the user's request for the Fortran 77 +dnl interface compatibility is fulfilled: + ACX_FIND_CFORTRAN_DEF + ACX_XLF_QEXTNAME_ADD_APPENDUS + ACX_CHECK_CFORTRAN([$srcdir/src], + [AC_DEFINE([HAVE_CF_INTERFACE], [1], + [Defined to 1 if C / Fortran interface cfortran.h works])]) + AS_IF([test "x$F77" != xno], + [AC_LANG_PUSH([Fortran 77]) + ACX_FORTRAN_INCLUDE_FLAG + AC_LANG_POP([Fortran 77]) + AS_IF([test "x$FC" != xno && dnl +test "x$acx_cv_f77_ftn_include_flag" != "x$FC_OPTINC"], + [AC_MSG_ERROR([Fortran and Fortran 77 compilers require different ]dnl +[flags needed to specify search paths for the "INCLUDE" statements])])]) + AS_IF([test "x$FC" = xno && test "x$F77" = xno], + [AS_VAR_IF([enable_cf_interface], [auto], [enable_cf_interface=no], + [AC_MSG_FAILURE([the Fortran 77 interface is requested but both ]dnl +[Fortran and Fortran 77 compilers are disabled, missing or lack the ]dnl +[required features])])])]) +AS_VAR_IF([enable_cf_interface], [auto], [enable_cf_interface=yes]) +AM_CONDITIONAL([ENABLE_CF_INTERFACE], [test "x$enable_cf_interface" = xyes]) + +AC_ARG_ENABLE([ruby-interface], + [AS_HELP_STRING([--enable-ruby-interface], + [create Ruby language interface (EXPERIMENTAL) @<:@default=no@:>@])], + [test "x$enableval" != xno && enable_ruby_interface=yes], + [enable_ruby_interface=no]) + +AC_ARG_ENABLE([python-interface], + [AS_HELP_STRING([--enable-python-interface], + [create Python language interface (EXPERIMENTAL) @<:@default=no@:>@])], + [test "x$enableval" != xno && enable_python_interface=yes], + [enable_python_interface=no]) + +if test "x$enable_ruby_interface" = xyes || \ + test "x$enable_python_interface" = xyes; then + if test "x$CXX" != xno; then + AC_PROG_CXX + test -z $CXX 2>/dev/null && CXX=no + AS_IF([test "x$CXX" != xno], + [AC_CACHE_CHECK([whether the C++ compiler works], + [acx_cv_cxx_works], + [acx_cv_cxx_works=no + AC_LANG_PUSH([C++]) +dnl Do not use AC_RUN_IFELSE for now: + AC_LINK_IFELSE([AC_LANG_PROGRAM], [acx_cv_cxx_works=yes]) + AC_LANG_POP([C++])]) + AS_VAR_IF([acx_cv_cxx_works], [no], [CXX=no])]) + fi + AS_VAR_IF([CXX], [no], + [AC_MSG_FAILURE([either the Ruby or the Python interface is requested ]dnl +[but the C++ compiler is disabled, missing or lacks the required features])]) +else + CXX=no +dnl The Automake conditional "am__fastdepCXX" is not set in this case because +dnl we skipped the check for CXX. Prevent the configure script from failing: + AM_CONDITIONAL([am__fastdepCXX], [false]) +fi + AC_PROG_INSTALL + +dnl Override the option set by AC_OPENMP: +AC_ARG_ENABLE([openmp], + [AS_HELP_STRING([--enable-openmp], + [enable OpenMP support @<:@default=no@:>@])], + [test "x$enableval" != xno && enable_openmp=yes], +dnl TODO: decide whether we want to compile with OpenMP support by default. +dnl Before this change, we ran AC_OPENMP but did not append OPENMP_CFLAGS to +dnl CFLAGS, which resulted in no OpenMP support. We preserve that behaviour: + [enable_openmp=no]) +m4_pushdef([AC_ARG_ENABLE])dnl AC_OPENMP -# Set up libtool. +m4_popdef([AC_ARG_ENABLE])dnl +AS_IF( + [test "x$enable_openmp" = xno], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ +#ifndef _OPENMP + choke me +#endif]])], + [AC_MSG_ERROR([OpenMP support is disabled but the compiler enables it dnl +by default: change CFLAGS to disable it])])], + [test "x$ac_cv_prog_c_openmp" = xunsupported], + [AC_MSG_FAILURE([cannot link C OpenMP programs])], + [test -n "$OPENMP_CFLAGS"], + [AS_VAR_APPEND([CFLAGS], [" $OPENMP_CFLAGS"])]) + +dnl Set up libtool: AC_MSG_NOTICE([setting up libtool]) -dnl before switching on libtool, identify compilers that prevent us from -dnl certain build configurations -ACX_LT_PROBLEMS -LT_INIT([pic-only]) -dnl Clean up after Libtool checks: -rm -f a.out -dnl _KPSE_USE_LIBTOOL ensures libtool is also used for configure-time tests, -dnl which deduces dependent libraries automatically -_KPSE_USE_LIBTOOL -_KPSE_CHECK_LIBTOOL -AS_IF([test -n "$FC" && test "X$FC" != Xno], - [AC_LANG_PUSH([Fortran]) - _KPSE_CHECK_LIBTOOL - AC_LANG_POP([Fortran])]) -AS_IF([test -n "$F77" && test "X$F77" != Xno], - [AC_LANG_PUSH([Fortran 77]) - _KPSE_CHECK_LIBTOOL - AC_LANG_POP([Fortran 77])]) -AS_IF([test -n "$CXX" && test "X$CXX" != Xno], - [AC_LANG_PUSH([C++]) - _KPSE_CHECK_LIBTOOL - AC_LANG_POP([C++])]) - -# ----------------------------------------------------------------------- -# Check endianess of system +ACX_USE_LIBTOOL_CONFIGURATION([pic-only]) + +dnl Check endianess of system: AC_C_BIGENDIAN -# ---------------------------------------------------------------------- -# Check large file support on 32 bit systems +dnl Check large file support on 32 bit systems: AC_SYS_LARGEFILE -# ---------------------------------------------------------------------- -# Checks for library functions. +dnl Checks for library functions: AC_FUNC_MMAP -# ---------------------------------------------------------------------- -# Checks for structures. +dnl Check for structures: AC_CHECK_MEMBERS([struct stat.st_blksize]) -# ---------------------------------------------------------------------- -# Checks for header files +dnl Checks for header files: AC_CHECK_HEADERS([malloc.h unistd.h sys/time.h],,,[AC_INCLUDES_DEFAULT]) AX_EXECINFO -# ---------------------------------------------------------------------- -# Checks for the availability of functions -AC_CHECK_FUNCS([mallinfo]) -AC_CHECK_FUNCS([getline]) +dnl Checks for the availability of functions: +AC_CHECK_FUNCS([mallinfo pwrite]) +AC_REPLACE_FUNCS([getline]) +dnl Check for UUID library: ACX_UUID -LIBS="${LIBS+$LIBS }$UUID_C_LIB" -CPPFLAGS="${CPPFLAGS+$CPPFLAGS }$UUID_C_INCLUDE" -# ---------------------------------------------------------------------- -# Checks for the availability of ANSI-C99 functions -AC_CHECK_DECLS([isnan],,,[AC_INCLUDES_DEFAULT +AS_VAR_APPEND([CPPFLAGS], [" $UUID_C_INCLUDE"]) +LIBS="$UUID_C_LIB $LIBS" +dnl Checks for the availability of ANSI-C99 functions: +AC_CHECK_DECLS([isnan], [], [], + [AC_INCLUDES_DEFAULT @%:@include <math.h>]) - -# check for sysconf names -AC_CHECK_DECLS([_SC_LARGE_PAGESIZE, PAGESIZE, PAGE_SIZE, _SC_PAGE_SIZE, dnl -_SC_PAGESIZE, _PC_REC_XFER_ALIGN, POSIX_REC_XFER_ALIGN],,,[AC_INCLUDES_DEFAULT +dnl Check for sysconf names: +AC_CHECK_DECLS( + [_SC_LARGE_PAGESIZE, PAGESIZE, PAGE_SIZE, _SC_PAGE_SIZE, _SC_PAGESIZE, dnl +_PC_REC_XFER_ALIGN, POSIX_REC_XFER_ALIGN], [], [], + [AC_INCLUDES_DEFAULT @%:@include <limits.h> @%:@include <unistd.h>]) -# -# Check for non-standard builtin -AS_FOR([builtin_macro],[builtin],[__builtin_ctz], - [AS_VAR_PUSHDEF([builtin_cache],[acx_cv_have_decl_]builtin_macro) +dnl Check for math library: +AC_SEARCH_LIBS(floor, m) + +dnl Check for non-standard builtin: +AS_FOR([builtin_macro], [builtin], [__builtin_ctz], + [AS_VAR_PUSHDEF([builtin_cache], [acx_cv_have_decl_]builtin_macro) AC_CACHE_CHECK([whether ]builtin_macro[ is declared], [builtin_cache], - [AC_LINK_IFELSE([AC_LANG_PROGRAM(,[ unsigned lbz = builtin_macro][[(56U)]])], - [AS_VAR_SET([builtin_cache],[yes])], - [AS_VAR_SET([builtin_cache],[no])])]) - AS_VAR_IF([builtin_cache],[yes], - [AC_DEFINE_UNQUOTED([HAVE_DECL_]AS_TR_CPP([builtin_macro]),[1]) + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM([], [ unsigned lbz = builtin_macro][[(56U)]])], + [AS_VAR_SET([builtin_cache], [yes])], + [AS_VAR_SET([builtin_cache], [no])])]) + AS_VAR_IF([builtin_cache], [yes], + [AC_DEFINE_UNQUOTED([HAVE_DECL_]AS_TR_CPP([builtin_macro]), [1]) break], - [AC_DEFINE_UNQUOTED([HAVE_DECL_]AS_TR_CPP([builtin_macro]),[0])])]) + [AC_DEFINE_UNQUOTED([HAVE_DECL_]AS_TR_CPP([builtin_macro]), [0])])]) AH_TEMPLATE([HAVE_DECL___BUILTIN_CTZ], [Define to 1 if __builtin_ctz is available, 0 if not]) -# Check compiler version -case "$CC" in - pgcc*) COMP_VERSION=`$CC -V | head -2 | tail -n 1`;; - *gcc*) COMP_VERSION=`$CC --version | head -n 1`;; - g++*) COMP_VERSION=`$CC --version | head -n 1`;; - clang*) COMP_VERSION=`$CC --version | head -n 1`;; - sxc*) COMP_VERSION=`$CC -V 2>&1 | tail -n 1`;; - xlc*) COMP_VERSION=`$CC -qversion 2>&1 | head -n 1`;; - *) - # 'head -n 1' exits after printing the first line, which closes the pipe - # and kills the compiler's process leaving it no chance to clean any - # temporary files it might have created (e.g. Intel compiler creates - # 'a.out' when it is called with additional flags like -I, -L, etc., - # which is the case when $CC is an MPI wrapper). Therefore, we have to - # run the processes one after another: - COMP_VERSION=`$CC -V 2>&1` - COMP_VERSION=`echo "$COMP_VERSION" | head -n 1` ;; -esac - -if test -z "$COMP_VERSION" ; then COMP_VERSION="unknown"; fi; -AC_DEFINE_UNQUOTED(COMP_VERSION, ["$COMP_VERSION"], [Compiler version]) - -# Check for system type -AC_DEFINE_UNQUOTED([SYSTEM_TYPE],["$ac_cv_build"], [System type]) -AC_SUBST([SYSTEM_TYPE],["$ac_cv_build"]) -# ----------------------------------------------------------------------- -# Check for math library and add -lm to LIBS -AC_SEARCH_LIBS(floor, m) -# ---------------------------------------------------------------------- -# Add basic configure options +dnl TODO: add comments on why we do not have all options in one place: +dnl Add basic configure options: ACX_CDI_OPTIONS -AM_CONDITIONAL([ENABLE_NETCDF],[test x$ENABLE_NETCDF = xyes]) +AM_CONDITIONAL([ENABLE_NETCDF], [test "x$ENABLE_NETCDF" = xyes]) AC_CHECK_FUNCS([grib_get_length]) -# ---------------------------------------------------------------------- -# Compile with MPI support -AC_ARG_ENABLE([mpi], - AS_HELP_STRING([--enable-mpi], - [Compile with MPI compiler @<:@default=no@:>@]),, - [enable_mpi=no]) + +dnl TODO: check whether we really need all the following information. Is it just +dnl for 'app/cdi -d'? If so, we can skip this when we are not going to install +dnl the executable: +AC_DEFINE_UNQUOTED(COMPILER, ["$CC $CFLAGS"], [Compiler]) +dnl TODO: replace the following with a macro that can do the detection better: +dnl Check compiler version: +COMP_VERSION= +AS_CASE([$CC], + [pgcc*], [COMP_VERSION=`$CC -V | head -2 | tail -n 1`], + [*gcc*], [COMP_VERSION=`$CC --version | head -n 1`], + [g++*], [COMP_VERSION=`$CC --version | head -n 1`], + [clang*], [COMP_VERSION=`$CC --version | head -n 1`], + [sxc*], [COMP_VERSION=`$CC -V 2>&1 | tail -n 1`], + [xlc*], [COMP_VERSION=`$CC -qversion 2>&1 | head -n 1`], + [COMP_VERSION=`$CC -V 2>&1 | sed -n 1p`]) +test -z "$COMP_VERSION" && COMP_VERSION=unknown +AC_DEFINE_UNQUOTED([COMP_VERSION], ["$COMP_VERSION"], [Compiler version]) +dnl +dnl Checks for system type: +AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$ac_cv_build"], [System type]) +AC_SUBST([SYSTEM_TYPE], ["$ac_cv_build"]) + +dnl MPI-related options and checks: +AC_ARG_ENABLE([ppm-dist-array], + [AS_HELP_STRING([--enable-ppm-dist-array], + [enable usage of the PPM distributed array @<:@default=auto@:>@])], + [AS_CASE([$enableval], + [no|auto], [], + [AS_VAR_IF([enable_mpi], [no], + [AC_MSG_ERROR([usage of the PPM distributed array can be enabled dnl +(--enable-ppm-dist-array) only if the parallel I/O with MPI is enabled dnl +(--enable-mpi)])]) + enable_ppm_dist_array=yes])], + [enable_ppm_dist_array=auto]) + +build_pio_fc_programs=no +have_ppm=no +AC_SUBST([HAVE_PPM_DIST_ARRAY], [no]) +AM_SUBST_NOTMAKE([HAVE_PPM_DIST_ARRAY]) +have_parallel_nc4=no AS_VAR_IF([enable_mpi], [yes], - [ACX_C_PACKAGE([MPI],[mpi.h],,, - [AC_MSG_FAILURE([Required header mpi.h not found or not compilable.]) - enable_MPI=no], - [MPI_Waitall],[mpi mpich],,, - [AC_MSG_FAILURE([Cannot link C MPI programs.]) - enable_MPI=no]) - AS_IF([test -n "$FC" && test "X$FC" != "Xno"], - [ACX_FORTRAN_PACKAGE([MPI], [mpif.h],,, - [AC_MSG_FAILURE([Required include mpif.h not found or not compilable.]) - enable_MPI=no],[mpi_waitall], - [mpi mpi_f90 mpi_f77 mpich],[[-lmpi_f77 -lmpi],[-lmpi]],, - [AC_MSG_FAILURE([Cannot link Fortran MPI programs.]) - enable_MPI=no],[])])]) -AS_IF([test x"${enable_mpi}" = x"yes"], - [USE_MPI=yes]) -HAVE_PARALLEL_NC4=0 -enable_ppm=no -AS_IF([test x"$USE_MPI" = xyes], - [AC_DEFINE([USE_MPI],[1],[parallel I/O requested and available]) - AC_PATH_PROGS([MPI_LAUNCH],[mpirun mpiexec],[true]) - AS_IF([test x"$cross_compiling" = xno], - [AC_MSG_CHECKING([if $MPI_LAUNCH works]) - saved_CFLAGS=$CFLAGS - saved_LIBS=$LIBS - CFLAGS="$CFLAGS $MPI_C_INCLUDE" - LIBS="$LIBS $MPI_C_LIB" - AC_LINK_IFELSE([AC_LANG_SOURCE([ -@%:@include <stdio.h> -@%:@include <stdlib.h> - -@%:@include <mpi.h> - -@%:@define xmpi(ret) \\ - do { \\ - if (ret != MPI_SUCCESS) \\ - exit(EXIT_FAILURE); \\ - } while (0) - -int -main(int argc, char **argv) -{ - xmpi(MPI_Init(&argc, &argv)); - char *numarg = argv@<:@1@:>@; - int cmdnum = atoi(numarg); - int procnum = 1; - xmpi(MPI_Allreduce(MPI_IN_PLACE, &procnum, 1, MPI_INT, MPI_SUM, - MPI_COMM_WORLD)); - xmpi(MPI_Finalize()); - return (procnum == cmdnum)?EXIT_SUCCESS:EXIT_FAILURE; -} -])], - [AS_IF([$MPI_LAUNCH -n 4 ./conftest$EXEEXT 4], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_FAILURE([mpirun doesn't work])])], - [AC_MSG_FAILURE([Cannot compile simple MPI program])]) - CFLAGS=$saved_CFLAGS - LIBS=$saved_LIBS - ]) - AS_IF([test "x$MPI_LAUNCH" = xtrue], - [AC_MSG_WARN([MPI launch command unavailable])]) - - PKG_CHECK_MODULES([YAXT],[yaxt], - [AC_DEFINE([HAVE_YAXT],,[yaxt library is available])], - [AC_MSG_FAILURE([Required yaxt library unavailable.])]) - AS_IF([test x"$ENABLE_NC4" = xyes], - [AC_CHECK_HEADERS([netcdf_par.h], - [AC_CHECK_DECL([MPI_Bcast], - [HAVE_PARALLEL_NC4=1], - [AC_MSG_WARN([The supplied netCDF library does not support MPI parallel invocations])], + [dnl +dnl Check for MPI C interface: + ACX_C_PACKAGE([MPI], [mpi.h],,, + [AC_MSG_FAILURE([required header mpi.h not found or not compilable])], + [MPI_Waitall],[mpi mpich], [], [], + [AC_MSG_FAILURE([cannot link C MPI programs])]) + +dnl Check for MPI_LAUNCH command: + saved_CPPFLAGS=$CPPFLAGS + saved_LIBS=$LIBS + AS_VAR_APPEND([CPPFLAGS], [" $MPI_C_INCLUDE"]) + LIBS="$MPI_C_LIB $LIBS" + ACX_MPIRUN(,,[AC_MSG_WARN([MPI launch command not found or not compilable])]) + CPPFLAGS=$saved_CPPFLAGS + LIBS=$saved_LIBS + +dnl Check for MPI Fortran interface (if needed): + build_pio_fc_programs=$enable_cf_interface + test "x$FC" = xno && build_pio_fc_programs=no + AS_VAR_IF([build_pio_fc_programs], [yes], + [ACX_F90_PACKAGE([MPI], [mpi],,, + [AC_MSG_WARN([required Fortran module mpi not found or not compilable]) + build_pio_fc_programs=no], + [mpi_waitall], [mpi mpi_f90 mpi_f77 mpich], [[-lmpi_f77 -lmpi],[-lmpi]],, + [AC_MSG_WARN([cannot link Fortran MPI programs]) + build_pio_fc_programs=no],, + [[INTEGER :: req(1), stat(mpi_status_size, 1), ierror]], + [[(1, req, stat, ierror)]])]) + +dnl Check for YAXT C interface: +dnl +dnl Declare pkg-config precious variables: + PKG_PROG_PKG_CONFIG +dnl Set precious variables following the naming convention of ACX_C_PACKAGE: + AC_ARG_VAR([YAXT_C_INCLUDE], + [specifically set flags to use when compiling sources using YAXT ]dnl +[includes.])dnl + AC_ARG_VAR([YAXT_C_LIB], + [specifically set flags to use when linking YAXT.])dnl +dnl Prevent PKG_CHECK_MODULES from declaring package-specific precious +dnl variables, which names do not follow our convention: + m4_pushdef([AC_ARG_VAR])dnl +dnl PKG_CHECK_MODULES relies on yaxt_c_CFLAGS and yaxt_c_LIBS, which in our case +dnl have names YAXT_C_INCLUDE and YAXT_C_LIB, respectively: + yaxt_c_CFLAGS=$YAXT_C_INCLUDE + yaxt_c_LIBS=$YAXT_C_LIB + PKG_CHECK_MODULES([yaxt_c],[yaxt_c], + [YAXT_C_INCLUDE=$yaxt_c_CFLAGS + YAXT_C_LIB=$yaxt_c_LIBS], + [dnl +dnl There was no yaxt_c.pc before version 0.5.2, therefore we try with yaxt.pc. +dnl PKG_CHECK_MODULES relies on yaxt_CFLAGS and yaxt_LIBS, which in our case +dnl have names YAXT_C_INCLUDE and YAXT_C_LIB, respectively: + yaxt_CFLAGS=$YAXT_C_INCLUDE + yaxt_LIBS=$YAXT_C_LIB + PKG_CHECK_MODULES([yaxt], [yaxt], + [YAXT_VERSION=`$PKG_CONFIG --modversion yaxt` + YAXT_MAJOR_VERSION=`expr X"$YAXT_VERSION" : "X\(@<:@0-9@:>@*\)"` + YAXT_MINOR_VERSION=`echo "$YAXT_VERSION" | sed -e 's/^@<:@0-9@:>@*\.\(@<:@0-9@:>@*\).*/\1/'` + AS_IF([test "$YAXT_MAJOR_VERSION" -gt 0 -o "$YAXT_MINOR_VERSION" -gt 4], + [YAXT_C_INCLUDE=$yaxt_CFLAGS + YAXT_C_LIB=`echo "$yaxt_LIBS" | sed -e 's/-lyaxt *$/-lyaxt_c/'`])], + [:])]) + m4_popdef([AC_ARG_VAR])dnl + saved_CPPFLAGS=$CPPFLAGS + saved_LIBS=$LIBS + AS_VAR_APPEND([CPPFLAGS], [" $MPI_C_INCLUDE"]) + LIBS="$MPI_C_LIB $LIBS" +dnl The following is extracted from ACX_GENERIC_PACKAGE, which is expanded by +dnl ACX_C_PACKAGE. We do not use the latter macro here to avoid introduction of +dnl the '--with-yaxt-XXX' configure options, which might be very confusing since +dnl whatever pkg-config finds will be used instead. + ACX_LANG_CHECK_INCLUDE_PATHS_IFELSE([yaxt.h],, + [YAXT_C_INCLUDE=$acx_cv_c_include_yaxt_h + ACX_OPTION_SEARCH_LIBS_MULTI([xt_initialized], [yaxt_c yaxt], + [YAXT_C_LIB=$acx_cv_option_search_xt_initialized_c], + [AC_MSG_FAILURE([cannot link C YAXT programs])],,[$YAXT_C_LIB])], + [AC_MSG_FAILURE([required header yaxt.h not found or not compilable])],, + [$YAXT_C_INCLUDE],[[]]) +dnl + AH_TEMPLATE([YAXT_UID_DT], + [Defined to MPI datatype to be used for Xt_uid])dnl + defined_Xt_uid=no + AC_CHECK_DECL([MPI_UINT64_T], + [AC_DEFINE([YAXT_UID_DT], [MPI_UINT64_T]) + defined_Xt_uid=yes], + [AS_VAR_APPEND([CPPFLAGS], [" $YAXT_C_INCLUDE"]) + LIBS="$YAXT_C_LIB $LIBS" + AC_CHECK_SIZEOF([Xt_uid],, + [AC_INCLUDES_DEFAULT +@%:@include <yaxt.h>]) + AC_CHECK_SIZEOF([unsigned long]) + AS_IF([test "$ac_cv_sizeof_unsigned_long" -eq "$ac_cv_sizeof_Xt_uid"], + [AC_DEFINE([YAXT_UID_DT], [MPI_UNSIGNED_LONG]) + defined_Xt_uid=yes], + [AC_CHECK_DECLS([MPI_UNSIGNED_LONG_LONG], + [AC_CHECK_SIZEOF([unsigned long long]) + AS_IF([test "$ac_cv_sizeof_unsigned_long_long" -eq "$ac_cv_sizeof_Xt_uid"], + [AC_DEFINE([YAXT_UID_DT],[MPI_UNSIGNED_LONG_LONG]) + defined_Xt_uid=yes])],, [AC_INCLUDES_DEFAULT -@%:@include <netcdf.h> -@%:@include <netcdf_par.h>])], - [AC_MSG_WARN([The supplied netCDF library does not support MPI parallel invocations])], +@%:@include <mpi.h>])])], + [AC_INCLUDES_DEFAULT +@%:@include <mpi.h>]) + AS_VAR_IF([defined_Xt_uid], [no], + [AC_MSG_FAILURE([no way to communicate Xt_uid found])]) + AS_UNSET([defined_Xt_uid]) + CPPFLAGS=$saved_CPPFLAGS + LIBS=$saved_LIBS + +dnl Check for YAXT Fortran interface (if needed): + AS_VAR_IF([build_pio_fc_programs], [yes], + [dnl +dnl Set precious variables following the naming convention of ACX_F90_PACKAGE: + AC_ARG_VAR([YAXT_FC_MOD], + [flags to enable 'USE YAXT' in Fortran program.])dnl + AC_ARG_VAR([YAXT_FC_LIB], + [specifically set flags to use when linking YAXT.])dnl +dnl Prevent PKG_CHECK_MODULES from declaring package-specific precious +dnl variables, which names do not follow our convention: + m4_pushdef([AC_ARG_VAR])dnl +dnl PKG_CHECK_MODULES relies on yaxt_CFLAGS and yaxt_LIBS, which in our case +dnl have names YAXT_FC_MOD and YAXT_FC_LIB, respectively: + yaxt_CFLAGS=$YAXT_FC_MOD + yaxt_LIBS=$YAXT_FC_LIB + PKG_CHECK_MODULES([yaxt],[yaxt], + [YAXT_FC_MOD=$yaxt_CFLAGS + YAXT_FC_LIB=$yaxt_LIBS], [:]) + m4_popdef([AC_ARG_VAR])dnl + saved_FCFLAGS=$FCFLAGS + saved_LIBS=$LIBS + AS_VAR_APPEND([FCFLAGS], [" $MPI_FC_MOD"]) + LIBS="$MPI_FC_LIB $LIBS" +dnl The following is extracted from ACX_F90_PACKAGE. We do not use the +dnl aforementioned macro here to avoid introduction of the '--with-yaxt-XXX' +dnl configure options, which might be very confusing since whatever pkg-config +dnl finds will be used instead. + AC_LANG_PUSH([Fortran])dnl + ACX_FORTRAN_CHECK_MOD_PATHS_IFELSE([yaxt],, + [YAXT_FC_MOD=$acx_cv_fortran_mod_yaxt + AS_VAR_APPEND([FCFLAGS], [" $YAXT_FC_MOD"]) +dnl Note that the following test must check for a function implemented in the +dnl Fortran library, as well as for a function implemented in the C library and +dnl available via C bindings: + ACX_OPTION_SEARCH_LIBS_MULTI([xt_initialized],[yaxt], + [YAXT_FC_LIB=$acx_cv_option_search_xt_initialized_fc], + [AC_MSG_WARN([cannot link Fortran YAXT programs]) + build_pio_fc_programs=no],[[-lyaxt_c]], + [$YAXT_FC_LIB], + [[ use yaxt + logical is_initialized]], + [[ is_initialized = xt_initialized() + call xt_finalize()]])], + [AC_MSG_WARN([required Fortran module yaxt not found or not compilable]) + build_pio_fc_programs=no],, + [$YAXT_FC_MOD]) + AC_LANG_POP([Fortran])dnl + FCFLAGS=$saved_FCFLAGS + LIBS=$saved_LIBS]) + +dnl Parallel netCDF support still requires ScalES-PPM and YAXT to re-arrange the +dnl data when running with more than one collector. +dnl +dnl TODO: check whether it makes sense to check for PPM when configuring with +dnl --disable-ppm-dist-array. +dnl +dnl Set precious variables following the naming convention of ACX_C_PACKAGE: + AC_ARG_VAR([PPM_CORE_C_INCLUDE], + [specifically set flags to use when compiling sources using PPM_CORE ]dnl +[includes.])dnl + AC_ARG_VAR([PPM_CORE_C_LIB], + [specifically set flags to use when linking PPM_CODE.])dnl +dnl Prevent PKG_CHECK_MODULES from declaring package-specific precious +dnl variables, which names do not follow our convention: + m4_pushdef([AC_ARG_VAR])dnl +dnl PKG_CHECK_MODULES relies on ppm_core_CFLAGS and ppm_core_LIBS, which in our +dnl case have names PPM_CORE_C_INCLUDE and PPM_CORE_C_LIB, respectively: + ppm_core_CFLAGS=$PPM_CORE_C_INCLUDE + ppm_core_LIBS=$PPM_CORE_C_LIB + PKG_CHECK_MODULES([ppm_core],[scales-ppm-core], + [PPM_CORE_C_INCLUDE=$ppm_core_CFLAGS + PPM_CORE_C_LIB=$ppm_core_LIBS], [:]) + m4_popdef([AC_ARG_VAR])dnl + saved_CPPFLAGS=$CPPFLAGS + saved_LIBS=$LIBS + AS_VAR_APPEND([CPPFLAGS], [" $MPI_C_INCLUDE"]) + LIBS="$MPI_C_LIB $LIBS" +dnl The following is extracted from ACX_GENERIC_PACKAGE, which is expanded by +dnl ACX_C_PACKAGE. We do not use the latter macro here to avoid introduction of +dnl the '--with-ppm-core-XXX' configure options, which might be very confusing +dnl since whatever pkg-config finds will be used instead. + ACX_LANG_CHECK_INCLUDE_PATHS_IFELSE([ppm/ppm.h],, + [PPM_CORE_C_INCLUDE=$acx_cv_c_include_ppm_ppm_h + ACX_OPTION_SEARCH_LIBS_MULTI([PPM_initialize], [scalesppmcore], + [PPM_CORE_C_LIB=$acx_cv_option_search_PPM_initialize_c + have_ppm=yes + AC_DEFINE([HAVE_PPM_CORE],,[ScalES PPM C core library is available]) + AS_VAR_APPEND([CPPFLAGS], [" $PPM_CORE_C_INCLUDE"]) + AS_IF([test "x$enable_ppm_dist_array" != xno], + [AC_CHECK_HEADERS([ppm/dist_array.h], + [HAVE_PPM_DIST_ARRAY=yes], [], [AC_INCLUDES_DEFAULT])])], + [AC_MSG_WARN([cannot link C SCALES-PPM-CORE programs])],, + [$PPM_CORE_C_LIB])], + [AC_MSG_WARN([required header ppm/ppm.h not found or not compilable])],, + [$PPM_CORE_C_INCLUDE],[[]]) + CPPFLAGS=$saved_CPPFLAGS + LIBS=$saved_LIBS + +dnl NC_HAS_PNETCDF is useful when available to short-circuit some tests + AS_VAR_IF([ENABLE_NETCDF], [yes], + [AC_CHECK_HEADERS([netcdf_meta.h],,, + [AC_INCLUDES_DEFAULT +@%:@include <netcdf.h>]) +dnl The following test is relevant only for older versions of netCDF. Starting +dnl version 4.3.3, netCDF provides the NC_HAS_PNETCDF macro and its value +dnl overrides the result of the test. + AC_CACHE_CHECK([parallel netcdf's pnetcdf support], + [acx_cv_have_pnetcdf], + [acx_cv_have_pnetcdf=no + test "x$NC_CONFIG" != "x" && \ + test "x$($NC_CONFIG --has-pnetcdf)" = "xyes" && \ + acx_cv_have_pnetcdf=yes]) + AS_VAR_IF([acx_cv_have_pnetcdf], [yes], + [AC_DEFINE([HAVE_NETCDF_PAR_PNETCDF], [1], + [Defined to 1 if NetCDF parallel open supports NC_PNETCDF])])]) + +dnl If scales-ppm is not available, netcdf can only be used in serial mode: + AS_IF([test "x$ENABLE_NC4" = xyes && test "x$have_ppm" = xyes], + [saved_CPPFLAGS=$CPPFLAGS + AS_VAR_APPEND([CPPFLAGS], [" $MPI_C_INCLUDE"]) + AC_CHECK_HEADERS([netcdf_par.h],,, + [AC_INCLUDES_DEFAULT +@%:@include <netcdf.h>]) + AC_CHECK_DECL([MPI_Bcast], + [have_parallel_nc4=yes + AC_CHECK_DECLS([nc_inq_format_extended],, + [AC_MSG_NOTICE([The supplied netCDF library does not support ]dnl +[nc_inq_format_extended.])], [AC_INCLUDES_DEFAULT -@%:@ifdef HAVE_NETCDF_H +@%:@include <netcdf.h>]) + AC_DEFINE([HAVE_PARALLEL_NC4], [1], + [netCDF library does support MPI parallel invocations])], + [AC_MSG_WARN([the supplied netCDF library does not support MPI ]dnl +[parallel invocations])], + [AC_INCLUDES_DEFAULT @%:@include <netcdf.h> +@%:@ifdef HAVE_NETCDF_PAR_H +@%:@include <netcdf_par.h> @%:@endif]) - dnl parallel netCDF support still requires ScalES-PPM and YAXT to - dnl re-arrange the data when running with more than one collector - PKG_CHECK_MODULES([PPM_CORE],[scales-ppm-core], - [enable_ppm=yes - AC_DEFINE([HAVE_PPM_CORE],, - [ScalES PPM C core library is available]) - ], - [enable_ppm=no]) - dnl if not both scales-ppm and yaxt are available, netcdf can only be - dnl used in serial mode - AS_IF([test x$enable_ppm != xyes], - [HAVE_PARALLEL_NC4=0]) - ]) - ], - [MPI_LAUNCH="`pwd`/util/serialrun" - AC_SUBST([MPI_LAUNCH])]) -AS_IF([test $HAVE_PARALLEL_NC4 -gt 0], - [AC_DEFINE([HAVE_PARALLEL_NC4],[1], - [netCDF library does support MPI parallel invocations])]) -AC_SUBST([HAVE_PARALLEL_NC4]) -AM_CONDITIONAL([USE_MPI],[test x"$USE_MPI" = xyes]) -AM_CONDITIONAL([USE_PPM_CORE],[test $enable_ppm = yes]) -AM_CONDITIONAL([HAVE_PARALLEL_NC4],[test $HAVE_PARALLEL_NC4 -gt 0]) -AC_SUBST([USE_MPI]) -AC_SUBST([ENABLE_MPI],[`test x"$enable_mpi" = xyes && echo true || echo false`]) -AC_SUBST([LIBRT]) -AM_COND_IF([USE_MPI], - [LIBRT= - LIBS_save=$LIBS - AC_SEARCH_LIBS([aio_suspend], [rt], - [test "$ac_res" = "none required" || LIBRT=$ac_res]) - LIBS=$LIBS_save]) -# ---------------------------------------------------------------------- -# Create the Fortran Interface via iso_c_binding module (Fortran 2003 Standard) -# -AC_ARG_ENABLE([iso-c-interface], - [AS_HELP_STRING([--enable-iso-c-interface], - [Create Fortran Interface via iso_c_bindings facility of F2003 [default=no].])], - [enable_isoc=${enableval}],[enable_isoc=no]) -AS_IF([test x"$enable_isoc" = xyes], - [AS_IF([test -z "$FC" || test "X$FC" = "Xno"], - [AC_MSG_FAILURE([Fortran compiler not found or disabled: either disable dnl -Fortran 2003 interface (--disable-iso-c-interface) or set FC accordingly])]) - ACX_FC_CHECK_STRPTR_CONVERT([], - [AC_MSG_FAILURE([the Fortran compiler cannot handle complex CHARACTER dnl -interoperability: disable Fortran 2003 interface (--disable-iso-c-interface)])])], - [enable_isoc=no]) -AM_CONDITIONAL([CREATE_ISOC],[test "x$enable_isoc" = 'xyes']) -AC_SUBST([ENABLE_F2003_ISOC],[$enable_isoc]) -AM_SUBST_NOTMAKE([ENABLE_F2003_ISOC]) -# in case the Fortran interface uses the more modern F90-style interface, -# the FCFLAGS for users of the library have to include a switch to use the -# .mod file -CDI_F90_INTERFACE_FCFLAGS='' -AS_IF([test "x${enable_isoc}" = "xyes"], - [AC_LANG_PUSH([Fortran]) - ACX_SL_FC_CHECK_MOD_PATH_FLAG - AC_LANG_POP([Fortran]) - CDI_F90_INTERFACE_FCFLAGS="${FC_MOD_FLAG}${includedir}"]) -AC_SUBST([CDI_F90_INTERFACE_FCFLAGS]) -# Check the module extension of the fortran compiler -AS_IF([test -n "$FC" && test "X$FC" != "Xno"], - [ACX_SL_FC_MOD_SUFFIX(,[FCMODEXT=mod])]) -AM_CONDITIONAL([FORTRAN_MOD_UC],[test "x$FCMODCASE" = "xuc"]) -# ----------------------------------------------------------------------- -# Check for SWIG - Generator for script-language bindings -AC_ARG_ENABLE(swig, - [AS_HELP_STRING([--enable-swig],[use swig to create extra bindings [default=no] (EXPERIMENTAL)])], - [AC_CHECK_PROG(SWIG,swig,swig)], - [enable_swig=no]) -AM_CONDITIONAL(ENABLE_SWIG,[test "x$SWIG" != "x"]) -# ---------------------------------------------------------------------- -# Create the Ruby Interface via swig -# -AC_ARG_ENABLE([ruby], - [AS_HELP_STRING([--enable-ruby],[ruby language bindings [default=no] (EXPERIMENTAL)])], - [AC_CHECK_PROG([RUBY],[ruby],[ruby]) - RUBY_INCLUDES="$($RUBY $srcdir/config/interface.rb)" - save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $RUBY_INCLUDES" - AC_CHECK_HEADER([ruby.h],,[enable_ruby=no], [AC_INCLUDES_DEFAULT]) - CPPFLAGS=$save_CPPFLAGS - AS_IF([test "x$RUBY" != "x"], - [AS_IF([test "x$SWIG" = "x"], - [AC_MSG_ERROR([Ruby bindings: Please enable SWIG with '--enable-swig'!])])], - [AS_IF([test `$SWIG -help 2>&1 | $GREP -c '\-ruby *- Generate'` = 0], - [AC_MSG_NOTICE([No (swig does not support -ruby option)]) - enable_ruby=no - ])])], - [enable_ruby=no]) -AM_CONDITIONAL(ENABLE_RUBY,[test "x$enable_ruby" != "xno"]) -AS_IF([test "x$enable_ruby" != "xno"],[AC_SUBST([ENABLE_RUBY],[true])],[AC_SUBST([ENABLE_RUBY],[false])]) -# Ruby is also used for the Fortran 2003 ISO C generator in maintainer mode. -# Report properly if it's missing: -AS_VAR_IF([RUBY], [], [AS_UNSET([RUBY])]) -AM_MISSING_PROG([RUBY], [ruby]) -# ---------------------------------------------------------------------- -# Create the Python Interface via swig -AC_ARG_ENABLE(python, - [AS_HELP_STRING([--enable-python],[python language bindings [default=no] (EXPERIMENTAL)])], - [AC_CHECK_PROG(PYTHON,python,python) - enable_python=no - for PYTHON_INCLUDES in \ - "-I`$PYTHON -c 'from distutils import sysconfig;print(sysconfig.get_python_inc())'`" \ - "-I`$PYTHON -c 'from distutils import sysconfig;print(sysconfig.get_python_lib(1,1))' | $SED 's/lib/include/'`" - do - save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" - AC_CHECK_HEADER([Python.h],[enable_python=yes - break],,[AC_INCLUDES_DEFAULT]) - CPPFLAGS=$save_CPPFLAGS - done - AS_IF([test "x$enable_python" != "xno"], - [AS_IF([test "x$SWIG" = "x"], - [AC_MSG_ERROR([Python bindings: Please enable SWIG with '--enable-swig'!])], - [PYTHON=])], - [AS_IF([test `$SWIG -help 2>&1 | $GREP -c '\-python *- Generate'` = 0], - [AC_MSG_NOTICE([No (swig does not support -python option)]) - enable_python=no - ])])], - [enable_python=no]) -AM_CONDITIONAL(ENABLE_PYTHON, [test "x$enable_python" != "xno"]) -AS_IF([test "x$enable_python" != "xno"],[AC_SUBST([ENABLE_PYTHON],[true])],[AC_SUBST([ENABLE_PYTHON],[false])]) -# ---------------------------------------------------------------------- -AM_CONDITIONAL(CREATE_INTERFACES, [test "x$enable_ruby" = "xyes" -o "x$enable_python" = "xyes"]) -# ---------------------------------------------------------------------- -# Create the CDI Fortran77 Interface via cfortran.h -AC_ARG_ENABLE([cf-interface], - [AS_HELP_STRING([--disable-cf-interface], - [Omit building of cfortran Interface])], - [enable_cfinterface=${enableval}],[enable_cfinterface=yes]) -AS_IF([test "x${enable_cfinterface}" = "xyes"], [ -dnl ###################################################################### -dnl Test whether cfortran.h works correctly -dnl ###################################################################### -ACX_FIND_CFORTRAN_DEF -ACX_XLF_QEXTNAME_ADD_APPENDUS -AS_IF([test -n "$FC" -a X"$FC" != Xno -o -n "$F77" -a X"$F77" != Xno], - [ACX_CHECK_CFORTRAN([$srcdir/src], - [AC_DEFINE([HAVE_CF_INTERFACE],[1], - [Defined to 1 if C / Fortran interface cfortran.h works])], - [AS_CASE([x"$acx_cv_cfortran_works"], - [x"error"], - [AC_MSG_NOTICE([Linking/Running with C EXTERNAL built with cfortran.h does not work!])], - [x"compiling with cfortran.h failed"], - [AC_MSG_NOTICE([Compilation with cfortran.h is not working!])], - [x"error compiling Fortran subroutine"], - [AC_MSG_NOTICE([compilation of simple Fortran source failed!])], - [AC_MSG_NOTICE([Unexpected error when linking C and Fortran via cfortran.h!])]) - AC_MSG_NOTICE([Disabling cfortran.h bindings generation]) - acx_cv_cfortran_works=no])]) -]) -AM_CONDITIONAL([USE_FC],[test -n "$FC" -a X"$FC" != Xno -a x"$acx_cv_cfortran_works" = xyes])dnl -dnl -AC_SUBST([CPPFLAGS])dnl -dnl -m4_foreach([build_flag_var],[[BUILD_CFLAGS],[BUILD_FCFLAGS],[BUILD_LDFLAGS],[BUILD_LIBS],[BUILD_MPI_C_LIB],[BUILD_MPI_FC_LIB],[BUILD_C_INCLUDE],[BUILD_FC_INCLUDE]], + CPPFLAGS=$saved_CPPFLAGS +dnl WARNING: the following macro overwrites saved_CFLAGS shell variable and +dnl modifies CFLAGS: + ACX_TLS_XLC_RETRY]) + +dnl Check for librt: + AC_SUBST([LIBRT], ['']) + AC_CHECK_DECL([_POSIX_ASYNCHRONOUS_IO], + [saved_LIBS=$LIBS + AC_SEARCH_LIBS([aio_suspend], [rt], + [test "$ac_res" = "none required" || LIBRT=$ac_res]) + LIBS=$saved_LIBS])], + [YAXT_C_INCLUDE=; YAXT_C_LIB= + MPI_C_INCLUDE=; MPI_C_LIB=]) +AS_CASE(["$enable_ppm_dist_array$HAVE_PPM_DIST_ARRAY"], + [yesyes|no*], [], + [auto*], [enable_ppm_dist_array=$HAVE_PPM_DIST_ARRAY], + [AC_MSG_FAILURE([usage of the PPM distributed array is requested but the ]dnl +[required headers and libraries are not found])]) +AS_VAR_IF([have_ppm], [no], [PPM_CORE_C_INCLUDE=; PPM_CORE_C_LIB=]) +AS_VAR_IF([build_pio_fc_programs], [no], + [YAXT_FC_MOD=; YAXT_FC_LIB= + MPI_FC_MOD=; MPI_FC_LIB=]) +AM_CONDITIONAL([BUILD_PIO_FC_PROGRAMS], [test "x$build_pio_fc_programs" = xyes]) +AM_CONDITIONAL([ENABLE_MPI], [test "x$enable_mpi" = xyes]) +AM_CONDITIONAL([HAVE_PARALLEL_NC4], [test "x$have_parallel_nc4" = xyes]) + +AM_MISSING_PROG([SWIG], [swig]) + +AS_VAR_IF([enable_ruby_interface], [yes], + [AC_ARG_VAR([RUBY], [the Ruby interpreter]) + AC_PATH_PROGS([RUBY], [ruby]) + ruby_CPPFLAGS=`$RUBY $srcdir/config/interface.rb 2>/dev/null` + AS_IF([test $? -ne 0], + [AC_MSG_ERROR([Ruby interface is requested but the Ruby interpreter is ]dnl +[not found])]) + saved_CPPFLAGS=$CPPFLAGS + AS_VAR_APPEND([CPPFLAGS], [" $ruby_CPPFLAGS"]) + AC_CHECK_HEADER([ruby.h], [], + [AC_MSG_FAILURE([Ruby interface is requested but the required header ]dnl +[ruby.h not found or not compilable])], + [AC_INCLUDES_DEFAULT]) + CPPFLAGS=$saved_CPPFLAGS], + [AM_MISSING_PROG([RUBY], [ruby])]) +AM_CONDITIONAL([ENABLE_RUBY_INTERFACE], [test "x$enable_ruby_interface" = xyes]) + +AS_VAR_IF([enable_python_interface], [yes], + [dnl +dnl For consistency with the other commands (MPI_LAUNCH, SWIG, RUBY, etc.), we +dnl ignore $PYTHON if it is not an absolute path: + AS_VAR_SET_IF([PYTHON], + [AS_CASE([$PYTHON], + [[[\\/]]* | ?:[[\\/]]*], [], + [PYTHON=])]) + AM_PATH_PYTHON([], [], [:]) +dnl AM_PATH_PYTHON does not check whether $PYTHON really works and +dnl AX_PYTHON_DEVEL fails with a misleading message if it doesn't: + AS_IF([$PYTHON -c 'import sys' >/dev/null 2>&1], [], + [AC_MSG_ERROR([Python interface is requested but the Python ]dnl +[interpreter is not found])]) +dnl Do not check for extra flags by default: + PYTHON_EXTRA_LDFLAGS=${PYTHON_EXTRA_LDFLAGS-' '} + PYTHON_EXTRA_LIBS=${PYTHON_EXTRA_LIBS-' '} + AX_PYTHON_DEVEL]) +AM_CONDITIONAL([ENABLE_PYTHON_INTERFACE], + [test "x$enable_python_interface" = xyes]) + +AC_ARG_WITH([on-demand-check-programs], + [AS_HELP_STRING([--with-on-demand-check-programs], + [only build test programs when calling 'make check' @<:@default: build ]dnl +[during 'make all'@:>@])], + [test "x$withval" != xno && with_on_demand_check_programs=yes], + [with_on_demand_check_programs=no]) +AM_CONDITIONAL([with_on_demand_check_programs], + [test "x$with_on_demand_check_programs" = xyes]) + +AC_ARG_WITH([concurrent-mpi-checks], + [AS_HELP_STRING([--with-concurrent-mpi-checks], + [allow for simultaneous runs of MPI tests @<:@default: run MPI test ]dnl +[programs one after another@:>@])], + [test "x$withval" != xno && with_concurrent_mpi_checks=yes], + [with_concurrent_mpi_checks=no]) +AM_CONDITIONAL([with_concurrent_mpi_checks], + [test "x$with_concurrent_mpi_checks" = xyes]) + +AC_ARG_WITH([example-programs], + [AS_HELP_STRING([--without-example-programs], + [only build example programs when calling 'make examples' ]dnl +[@<:@default: build during 'make all'@:>@])], + [test "x$withval" != xno && with_example_programs=yes], + [with_example_programs=yes]) +AM_CONDITIONAL([with_example_programs], [test "x$with_example_programs" = xyes]) + +m4_foreach([build_flag_var],[[BUILD_CFLAGS],[BUILD_FCFLAGS],[BUILD_LDFLAGS],[BUILD_LIBS],[BUILD_MPI_C_LIB],[BUILD_MPI_FC_LIB]], [AC_ARG_VAR(build_flag_var, [append to ]m4_bpatsubst(build_flag_var, [BUILD_], [])[ during build but not in configure phase])dnl AC_CONFIG_COMMANDS_PRE(m4_bpatsubst(build_flag_var, [BUILD_], [])[="$]m4_bpatsubst(build_flag_var, [BUILD_], [])[$]{build_flag_var:+ $build_flag_var[}"])dnl @@ -403,61 +673,97 @@ m4_foreach([build_tool_var],[[BUILD_CC],[BUILD_CXX],[BUILD_FC],[BUILD_F77]], [replace ]m4_bpatsubst(build_tool_var, [BUILD_], [])[ with expansion of $]build_tool_var[ during build but not in configure phase])dnl AC_CONFIG_COMMANDS_PRE(m4_bpatsubst(build_tool_var, [BUILD_], [])[="$]{build_tool_var:-$[]m4_bpatsubst(build_tool_var, [BUILD_], [])}["])dnl AM_SUBST_NOTMAKE(build_tool_var)])dnl -dnl -dnl -dnl -# Checks for compiler -COMPILER="$CC $CFLAGS" -AC_DEFINE_UNQUOTED(COMPILER, ["$COMPILER"], [Compiler]) - -AC_CONFIG_FILES([tests/test_cksum_grib \ - tests/test_cksum_nc \ - tests/test_cksum_nc2 \ - tests/test_cksum_nc4 \ - tests/test_cksum_extra \ - tests/test_cksum_service \ - tests/test_cksum_ieg \ - tests/test_chunk_cksum \ - tests/test_f2003 \ - tests/pio_write_run \ - tests/pio_write_deco2d_run \ - tests/pio_cksum_mpinonb \ - tests/pio_cksum_mpi_fw_ordered \ - tests/pio_cksum_mpi_fw_at_all \ - tests/pio_cksum_mpi_fw_at_reblock \ - tests/pio_cksum_fpguard \ - tests/pio_cksum_asynch \ - tests/pio_cksum_writer \ - tests/pio_cksum_cdf \ - tests/test_byteswap_run \ - tests/test_resource_copy_run \ - tests/test_resource_copy_mpi_run \ - tests/test_cdf_transformation \ - tests/test_cdf_const \ - tests/test_table_run \ - tables/gen_tableheaderfile \ - util/serialrun],[chmod a+x "$ac_file"]) - -AC_CONFIG_FILES([Makefile src/Makefile interfaces/Makefile app/Makefile \ - tests/Makefile examples/Makefile cdi.settings \ - examples/pio/Makefile src/cmake/cdi/cdi-config.cmake src/cmake/cdi/cdi-config-version.cmake \ - src/pkgconfig/cdi.pc src/pkgconfig/cdipio.pc src/pkgconfig/cdi_f2003.pc]) + +dnl Additional output variables for cdi.settings: +AS_VAR_IF([enable_mpi],[yes], + [ENABLE_MPI=true], + [ENABLE_MPI=false]) +AC_SUBST([ENABLE_MPI]) +AM_SUBST_NOTMAKE([ENABLE_MPI)]) +AS_VAR_IF([have_parallel_nc4],[yes], + [HAVE_PARALLEL_NC4=1], + [HAVE_PARALLEL_NC4=0]) +AC_SUBST([HAVE_PARALLEL_NC4]) +AM_SUBST_NOTMAKE([HAVE_PARALLEL_NC4]) +AS_VAR_IF([enable_ruby_interface],[yes], + [ENABLE_RUBY_INTERFACE=true], + [ENABLE_RUBY_INTERFACE=false]) +AC_SUBST([ENABLE_RUBY_INTERFACE]) +AM_SUBST_NOTMAKE([ENABLE_RUBY_INTERFACE]) +AS_VAR_IF([enable_python_interface],[yes], + [ENABLE_PYTHON_INTERFACE=true], + [ENABLE_PYTHON_INTERFACE=false]) +AC_SUBST([ENABLE_PYTHON_INTERFACE]) +AM_SUBST_NOTMAKE([ENABLE_PYTHON_INTERFACE]) + +AC_CONFIG_HEADERS([src/config.h]) +AC_CONFIG_FILES([ + Makefile + app/Makefile + cdi.settings + examples/Makefile + examples/pio/Makefile + interfaces/Makefile + src/Makefile + src/cmake/cdi/cdi-config-version.cmake + src/cmake/cdi/cdi-config.cmake + src/pkgconfig/cdi.pc + src/pkgconfig/cdi_f2003.pc + src/pkgconfig/cdipio.pc + tests/Makefile + tests/test_cksum_base +]) +AC_CONFIG_FILES([ + interfaces/test_cpp_nc.run + interfaces/test_python_grb.run + interfaces/test_python_nc.run + interfaces/test_ruby_grb.run + interfaces/test_ruby_nc.run + tables/gen_tableheaderfile + tests/pio_cksum_asynch.run + tests/pio_cksum_fpguard.run + tests/pio_cksum_grb2.run + tests/pio_cksum_mpi_fw_at_all.run + tests/pio_cksum_mpi_fw_at_reblock.run + tests/pio_cksum_mpi_fw_ordered.run + tests/pio_cksum_mpinonb.run + tests/pio_cksum_nc.run + tests/pio_cksum_nc2.run + tests/pio_cksum_nc4.run + tests/pio_cksum_writer.run + tests/pio_write.parallel.run + tests/pio_write.run + tests/pio_write_deco2d.parallel.run + tests/pio_write_deco2d.run + tests/pio_write_dist_array.run + tests/test_byteswap.run + tests/test_cdf_const.run + tests/test_cdf_transformation.run + tests/test_cksum_ext.run + tests/test_cksum_grb.run + tests/test_cksum_grb2.run + tests/test_cksum_ieg.run + tests/test_cksum_nc.run + tests/test_cksum_nc2.run + tests/test_cksum_nc4.run + tests/test_cksum_nc_chunk.run + tests/test_cksum_srv.run + tests/test_f2003.run + tests/test_grib.run + tests/test_resource_copy.parallel.run + tests/test_resource_copy.run + tests/test_table.run +], +[chmod a+x "$ac_file"]) + AC_OUTPUT -# ---------------------------------------------------------------------- -# Show configuration AC_MSG_NOTICE([CDI is configured with the following options:]) -./config.status cdi.settings -cat cdi.settings - -AS_IF([test "$ac_cv_prog_cc_c99" = "no"], - [AC_MSG_NOTICE([ +cat cdi.settings >&AS_MESSAGE_FD - Warning: The C compiler does not accept ANSI C99 source code! -])]) AC_MSG_NOTICE([ Configuration completed. - You can now say 'make' to compile the CDI package and 'make install' to install it afterwards. + You can now run 'make' to compile the CDI package and 'make install' to install it afterwards. ]) diff --git a/contrib/00nagfor-libtool-patch/README.txt b/contrib/00nagfor-libtool-patch/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..660461961f5f238f040cd17c0c62a1586bbb32cd --- /dev/null +++ b/contrib/00nagfor-libtool-patch/README.txt @@ -0,0 +1,9 @@ +This patch is needed so that -Wl,-rpath option arguments make it into +the dependent libraries of a library and also ensures that -Wl,-Wl,, +options are passed to the compiler unaltered. + +It is intended for libtool 2.4.2 and can be applied after +e.g. autoreconf by + +$ patch -p1 <contrib/nagfor-libtool-patch/nagfor-libtool.patch + diff --git a/contrib/00nagfor-libtool-patch/nagfor-libtool-2.4.2.patch b/contrib/00nagfor-libtool-patch/nagfor-libtool-2.4.2.patch new file mode 100644 index 0000000000000000000000000000000000000000..5a5a4af38a4ef1c4e770a283d63813ba3c0aa51d --- /dev/null +++ b/contrib/00nagfor-libtool-patch/nagfor-libtool-2.4.2.patch @@ -0,0 +1,137 @@ +--- a/config/ltmain.sh 2012-06-12 00:20:43.000000000 +0200 ++++ b/config/ltmain.sh 2014-08-19 16:34:48.161235251 +0200 +@@ -3229,6 +3229,25 @@ + + test "$opt_mode" = install && func_mode_install ${1+"$@"} + ++func_add2xrpath () ++{ ++ dir="$1" ++ # We need an absolute path. ++ case $dir in ++ [\\/]* | [A-Za-z]:[\\/]*) ;; ++ =*) ++ func_stripname '=' '' "$dir" ++ dir=$lt_sysroot$func_stripname_result ++ ;; ++ *) ++ func_fatal_error "only absolute run-paths are allowed" ++ ;; ++ esac ++ case "$xrpath " in ++ *" $dir "*) ;; ++ *) func_append xrpath " $dir" ;; ++ esac ++} + + # func_generate_dlsyms outputname originator pic_p + # Extract symbols from dlprefiles and create ${outputname}S.o with +@@ -5727,20 +5746,7 @@ + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. +- case $dir in +- [\\/]* | [A-Za-z]:[\\/]*) ;; +- =*) +- func_stripname '=' '' "$dir" +- dir=$lt_sysroot$func_stripname_result +- ;; +- *) +- func_fatal_error "only absolute run-paths are allowed" +- ;; +- esac +- case "$xrpath " in +- *" $dir "*) ;; +- *) func_append xrpath " $dir" ;; +- esac ++ func_add2xrpath "$dir" + continue + ;; + +@@ -5801,18 +5807,58 @@ + ;; + + -Wl,*) ++ wlprefix=`expr x"$wl" : '.*' - 1` ++ wlprefix=`expr x"$arg" : 'x\(.\{'"$wlprefix"'\}\)'` ++ if test x"$wlprefix" = x"$wl" -a x"$wl" != x"-Wl,"; then ++ func_append compiler_flags " $arg" ++ func_append compile_command " $arg" ++ func_append finalize_command " $arg" ++ if expr "x$arg" : '^x'"$wl"'-rpath,,' >/dev/null ; then ++ func_stripname "$wl"'-rpath,,' '' "$arg" ++ dir=$func_stripname_result ++ func_add2xrpath "$dir" ++ elif expr "x$arg" : '^x'"$wl"'-rpath$' >/dev/null ; then ++ func_stripname "$wl" '' "$1" ++ dir=$func_stripname_result ++ if ! expr "x$1" : '^x'"$wl" >/dev/null \ ++ || ! test -d "$dir" ; then ++ func_fatal_error "$wl"'-rpath must be followed by '"$wl"'-escaped directory' ++ fi ++ shift ++ func_add2xrpath "$dir" ++ continue ++ else ++ func_stripname "$wl" '' "$arg" ++ func_append new_inherited_linker_flags " -Wl,$func_stripname_result" ++ fi ++ continue ++ elif expr "x$arg" : '^x-Wl,-rpath,' >/dev/null ; then ++ func_stripname '-Wl,-rpath,' '' "$arg" ++ dir=$func_stripname_result ++ func_add2xrpath "$dir" ++ continue ++ elif expr "x$arg" : '^x-Wl,-rpath$' >/dev/null ; then ++ func_stripname '-Wl,' '' "$1" ++ dir=$func_stripname_result ++ if ! expr "x$1" : '^x-Wl,' >/dev/null \ ++ || ! test -d "$dir" ; then ++ func_fatal_error '-Wl,-rpath must be followed by -Wl-escaped directory' ++ fi ++ func_quote_for_eval "$1" ++ func_append libtool_args " $func_quote_for_eval_result" ++ shift ++ func_add2xrpath "$dir" ++ continue ++ fi + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= +- save_ifs="$IFS"; IFS=',' ++ save_ifs=$IFS; IFS=, + for flag in $args; do +- IFS="$save_ifs" ++ IFS=$save_ifs + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" + done +- IFS="$save_ifs" ++ IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; +@@ -9515,6 +9562,10 @@ + *) func_append new_libs " $deplib" ;; + esac + ;; ++ -Wl,*) ++ func_stripname -Wl, '' "$deplib" ++ func_append new_libs " $wl$func_stripname_result" ++ ;; + *) func_append new_libs " $deplib" ;; + esac + done +@@ -10247,6 +10298,10 @@ + *) func_append new_libs " $deplib" ;; + esac + ;; ++ -Wl,*) ++ func_stripname -Wl, '' "$deplib" ++ func_append new_libs " $wl$func_stripname_result" ++ ;; + *) func_append new_libs " $deplib" ;; + esac + done diff --git a/contrib/00nagfor-libtool-patch/nagfor-libtool-2.4.6.patch b/contrib/00nagfor-libtool-patch/nagfor-libtool-2.4.6.patch new file mode 100644 index 0000000000000000000000000000000000000000..32d0f1e6d772536a57f25ce3699d915889171606 --- /dev/null +++ b/contrib/00nagfor-libtool-patch/nagfor-libtool-2.4.6.patch @@ -0,0 +1,122 @@ +--- a/config/ltmain.sh 2012-06-12 00:20:43.000000000 +0200 ++++ b/config/ltmain.sh 2014-08-19 16:34:48.161235251 +0200 +@@ -3217,6 +3217,25 @@ + } + # end func_convert_path_msys_to_cygwin + ++func_add2xrpath () ++{ ++ dir="$1" ++ # We need an absolute path. ++ case $dir in ++ [\\/]* | [A-Za-z]:[\\/]*) ;; ++ =*) ++ func_stripname '=' '' "$dir" ++ dir=$lt_sysroot$func_stripname_result ++ ;; ++ *) ++ func_fatal_error "only absolute run-paths are allowed" ++ ;; ++ esac ++ case "$xrpath " in ++ *" $dir "*) ;; ++ *) func_append xrpath " $dir" ;; ++ esac ++} + + # func_convert_path_nix_to_cygwin ARG + # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +@@ -7147,20 +7166,7 @@ + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. +- case $dir in +- [\\/]* | [A-Za-z]:[\\/]*) ;; +- =*) +- func_stripname '=' '' "$dir" +- dir=$lt_sysroot$func_stripname_result +- ;; +- *) +- func_fatal_error "only absolute run-paths are allowed" +- ;; +- esac +- case "$xrpath " in +- *" $dir "*) ;; +- *) func_append xrpath " $dir" ;; +- esac ++ func_add2xrpath "$dir" + continue + ;; + +@@ -7221,6 +7227,49 @@ + ;; + + -Wl,*) ++ wlprefix=`expr x"$wl" : '.*' - 1` ++ wlprefix=`expr x"$arg" : 'x\(.\{'"$wlprefix"'\}\)'` ++ if test x"$wlprefix" = x"$wl" -a x"$wl" != x"-Wl,"; then ++ func_append compiler_flags " $arg" ++ func_append compile_command " $arg" ++ func_append finalize_command " $arg" ++ if expr "x$arg" : '^x'"$wl"'-rpath,,' >/dev/null ; then ++ func_stripname "$wl"'-rpath,,' '' "$arg" ++ dir=$func_stripname_result ++ func_add2xrpath "$dir" ++ elif expr "x$arg" : '^x'"$wl"'-rpath$' >/dev/null ; then ++ func_stripname "$wl" '' "$1" ++ dir=$func_stripname_result ++ if ! expr "x$1" : '^x'"$wl" >/dev/null \ ++ || ! test -d "$dir" ; then ++ func_fatal_error "$wl"'-rpath must be followed by '"$wl"'-escaped directory' ++ fi ++ shift ++ func_add2xrpath "$dir" ++ continue ++ else ++ func_stripname "$wl" '' "$arg" ++ func_append new_inherited_linker_flags " -Wl,$func_stripname_result" ++ fi ++ continue ++ elif expr "x$arg" : '^x-Wl,-rpath,' >/dev/null ; then ++ func_stripname '-Wl,-rpath,' '' "$arg" ++ dir=$func_stripname_result ++ func_add2xrpath "$dir" ++ continue ++ elif expr "x$arg" : '^x-Wl,-rpath$' >/dev/null ; then ++ func_stripname '-Wl,' '' "$1" ++ dir=$func_stripname_result ++ if ! expr "x$1" : '^x-Wl,' >/dev/null \ ++ || ! test -d "$dir" ; then ++ func_fatal_error '-Wl,-rpath must be followed by -Wl-escaped directory' ++ fi ++ func_quote_for_eval "$1" ++ func_append libtool_args " $func_quote_for_eval_result" ++ shift ++ func_add2xrpath "$dir" ++ continue ++ fi + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= +@@ -9515,6 +9562,10 @@ + *) func_append new_libs " $deplib" ;; + esac + ;; ++ -Wl,*) ++ func_stripname -Wl, '' "$deplib" ++ func_append new_libs " $wl$func_stripname_result" ++ ;; + *) func_append new_libs " $deplib" ;; + esac + done +@@ -10247,6 +10298,10 @@ + *) func_append new_libs " $deplib" ;; + esac + ;; ++ -Wl,*) ++ func_stripname -Wl, '' "$deplib" ++ func_append new_libs " $wl$func_stripname_result" ++ ;; + *) func_append new_libs " $deplib" ;; + esac + done diff --git a/contrib/00nagfor-libtool-patch/nagfor-libtool.patch b/contrib/00nagfor-libtool-patch/nagfor-libtool.patch new file mode 100644 index 0000000000000000000000000000000000000000..9677b1666963501864636f115774ed319fff844c --- /dev/null +++ b/contrib/00nagfor-libtool-patch/nagfor-libtool.patch @@ -0,0 +1,112 @@ +--- a/config/ltmain.sh 2012-06-12 00:20:43.000000000 +0200 ++++ b/config/ltmain.sh 2014-08-19 16:34:48.161235251 +0200 +@@ -3229,6 +3229,25 @@ + + test "$opt_mode" = install && func_mode_install ${1+"$@"} + ++func_add2xrpath () ++{ ++ dir="$1" ++ # We need an absolute path. ++ case $dir in ++ [\\/]* | [A-Za-z]:[\\/]*) ;; ++ =*) ++ func_stripname '=' '' "$dir" ++ dir=$lt_sysroot$func_stripname_result ++ ;; ++ *) ++ func_fatal_error "only absolute run-paths are allowed" ++ ;; ++ esac ++ case "$xrpath " in ++ *" $dir "*) ;; ++ *) func_append xrpath " $dir" ;; ++ esac ++} + + # func_generate_dlsyms outputname originator pic_p + # Extract symbols from dlprefiles and create ${outputname}S.o with +@@ -5727,20 +5746,7 @@ + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. +- case $dir in +- [\\/]* | [A-Za-z]:[\\/]*) ;; +- =*) +- func_stripname '=' '' "$dir" +- dir=$lt_sysroot$func_stripname_result +- ;; +- *) +- func_fatal_error "only absolute run-paths are allowed" +- ;; +- esac +- case "$xrpath " in +- *" $dir "*) ;; +- *) func_append xrpath " $dir" ;; +- esac ++ func_add2xrpath "$dir" + continue + ;; + +@@ -5801,18 +5807,58 @@ + ;; + + -Wl,*) ++ wlprefix=`expr x"$wl" : '.*' - 1` ++ wlprefix=`expr x"$arg" : 'x\(.\{'"$wlprefix"'\}\)'` ++ if test x"$wlprefix" = x"$wl" -a x"$wl" != x"-Wl,"; then ++ func_append compiler_flags " $arg" ++ func_append compile_command " $arg" ++ func_append finalize_command " $arg" ++ if expr "x$arg" : '^x'"$wl"'-rpath,,' >/dev/null ; then ++ func_stripname "$wl"'-rpath,,' '' "$arg" ++ dir=$func_stripname_result ++ func_add2xrpath "$dir" ++ elif expr "x$arg" : '^x'"$wl"'-rpath$' >/dev/null ; then ++ func_stripname "$wl" '' "$1" ++ dir=$func_stripname_result ++ if ! expr "x$1" : '^x'"$wl" >/dev/null \ ++ || ! test -d "$dir" ; then ++ func_fatal_error "$wl"'-rpath must be followed by '"$wl"'-escaped directory' ++ fi ++ shift ++ func_add2xrpath "$dir" ++ continue ++ else ++ func_append new_inherited_linker_flags " $arg" ++ fi ++ continue ++ elif expr "x$arg" : '^x-Wl,-rpath,' >/dev/null ; then ++ func_stripname '-Wl,-rpath,' '' "$arg" ++ dir=$func_stripname_result ++ func_add2xrpath "$dir" ++ continue ++ elif expr "x$arg" : '^x-Wl,-rpath$' >/dev/null ; then ++ func_stripname '-Wl,' '' "$1" ++ dir=$func_stripname_result ++ if ! expr "x$1" : '^x-Wl,' >/dev/null \ ++ || ! test -d "$dir" ; then ++ func_fatal_error '-Wl,-rpath must be followed by -Wl-escaped directory' ++ fi ++ shift ++ func_add2xrpath "$dir" ++ continue ++ fi + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= +- save_ifs="$IFS"; IFS=',' ++ save_ifs=$IFS; IFS=, + for flag in $args; do +- IFS="$save_ifs" ++ IFS=$save_ifs + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" + done +- IFS="$save_ifs" ++ IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; diff --git a/contrib/01aix-deplib-rpath-patch/README b/contrib/01aix-deplib-rpath-patch/README new file mode 100644 index 0000000000000000000000000000000000000000..02a80684038b4c5dd1a9645e0af14dc9dbdb3062 --- /dev/null +++ b/contrib/01aix-deplib-rpath-patch/README @@ -0,0 +1,4 @@ +This patch changes ltmain.sh to add directories found in -R options of +dependent libraries to the final link command, such that non-libtool +dynamic libraries (which are a shared object inside the .a file on AIX) are +handled appropriately. diff --git a/contrib/01aix-deplib-rpath-patch/aix-deplib-libtool.patch b/contrib/01aix-deplib-rpath-patch/aix-deplib-libtool.patch new file mode 100644 index 0000000000000000000000000000000000000000..ce07d8d99a037b71fd09ea170db2979bff3e0f60 --- /dev/null +++ b/contrib/01aix-deplib-rpath-patch/aix-deplib-libtool.patch @@ -0,0 +1,15 @@ +patching file /tmp/tmp.fUvdRDtWV1 +--- /tmp/tmp.fUvdRDtWV1 2012-11-16 13:56:40.799501409 +0100 ++++ b/config/ltmain.sh 2012-11-16 13:27:39.657253614 +0100 +@@ -7171,7 +7171,10 @@ + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; +- -R*) ;; ++ -R*) ++ func_stripname '-R' '' "$deplib" ++ func_add2xrpath "$func_stripname_result" ++ ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or diff --git a/contrib/02nagfor53-shared-patch/README.txt b/contrib/02nagfor53-shared-patch/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..4fb7b1a1fd1b62ea33b1a70a4e178471c32e1a81 --- /dev/null +++ b/contrib/02nagfor53-shared-patch/README.txt @@ -0,0 +1,3 @@ +This patch changes NAG Fortran (nagfor) compilations of shared +libraries to correctly pass the -shared flag to the underlying +compiler. diff --git a/contrib/02nagfor53-shared-patch/nagfor53-shared.patch b/contrib/02nagfor53-shared-patch/nagfor53-shared.patch new file mode 100644 index 0000000000000000000000000000000000000000..fbf69f01f1db14b4435df119763bc4c8fd7f7366 --- /dev/null +++ b/contrib/02nagfor53-shared-patch/nagfor53-shared.patch @@ -0,0 +1,11 @@ +--- a/m4/libtool.m4 2013-08-01 11:23:32.749610298 +0200 ++++ b/m4/libtool.m4 2014-04-04 15:30:02.855209645 +0200 +@@ -4817,6 +4817,8 @@ + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; ++ nagfor*) # NAGFOR 5.3 ++ tmp_sharedflag='-Wl,-shared' ;; + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; diff --git a/contrib/03ltmain-ld-groups-patch/README b/contrib/03ltmain-ld-groups-patch/README new file mode 100644 index 0000000000000000000000000000000000000000..5d8cb262f2efc4d2818deb523036a9ceca278b8e --- /dev/null +++ b/contrib/03ltmain-ld-groups-patch/README @@ -0,0 +1,4 @@ +This patch changes ltmain.sh to keep the GNU ld library grouping options +-- -(, --start-group, -), and --end-group -- in the list of dependency +libraries so that the desired behaviour is retained (i.e. libraries with +cyclic dependencies can be linked). diff --git a/contrib/03ltmain-ld-groups-patch/ltmain-ld-groups-libtool-2.4.2.patch b/contrib/03ltmain-ld-groups-patch/ltmain-ld-groups-libtool-2.4.2.patch new file mode 100644 index 0000000000000000000000000000000000000000..c319cb66497fe06022d626571fc39139cc2bc12f --- /dev/null +++ b/contrib/03ltmain-ld-groups-patch/ltmain-ld-groups-libtool-2.4.2.patch @@ -0,0 +1,30 @@ +--- a/config/ltmain.sh 2016-10-27 18:58:49.860787638 +0200 ++++ b/config/ltmain.sh 2016-10-27 18:59:21.497411984 +0200 +@@ -5806,6 +5806,11 @@ + arg=$func_stripname_result + ;; + ++ -Wl,--start-group|-Wl,--end-group|-Wl,-\(|-Wl,-\)) ++ func_append deplibs " $arg" ++ continue ++ ;; ++ + -Wl,*) + wlprefix=`expr x"$wl" : '.*' - 1` + wlprefix=`expr x"$arg" : 'x\(.\{'"$wlprefix"'\}\)'` +@@ -6434,6 +6439,15 @@ + alldeplibs=yes + continue + ;; ++ -Wl,--start-group|-Wl,--end-group|-Wl,-\(|-Wl,-\)) ++ if test "$linkmode,$pass" = "prog,link"; then ++ compile_deplibs="$deplib $compile_deplibs" ++ finalize_deplibs="$deplib $finalize_deplibs" ++ else ++ deplibs="$deplib $deplibs" ++ fi ++ continue ++ ;; + esac # case $deplib + + if test "$found" = yes || test -f "$lib"; then : diff --git a/contrib/03ltmain-ld-groups-patch/ltmain-ld-groups-libtool-2.4.6.patch b/contrib/03ltmain-ld-groups-patch/ltmain-ld-groups-libtool-2.4.6.patch new file mode 100644 index 0000000000000000000000000000000000000000..3546e2c2d5dd960e445bd62ceaa5738634ccc0bf --- /dev/null +++ b/contrib/03ltmain-ld-groups-patch/ltmain-ld-groups-libtool-2.4.6.patch @@ -0,0 +1,30 @@ +--- a/config/ltmain.sh 2016-10-27 18:24:46.464521224 +0200 ++++ b/config/ltmain.sh 2016-10-27 18:25:41.837607694 +0200 +@@ -7226,6 +7226,11 @@ + arg=$func_stripname_result + ;; + ++ -Wl,--start-group|-Wl,--end-group|-Wl,-\(|-Wl,-\)) ++ func_append deplibs " $arg" ++ continue ++ ;; ++ + -Wl,*) + wlprefix=`expr x"$wl" : '.*' - 1` + wlprefix=`expr x"$arg" : 'x\(.\{'"$wlprefix"'\}\)'` +@@ -7879,6 +7884,15 @@ + alldeplibs=: + continue + ;; ++ -Wl,--start-group|-Wl,--end-group|-Wl,-\(|-Wl,-\)) ++ if test "$linkmode,$pass" = "prog,link"; then ++ compile_deplibs="$deplib $compile_deplibs" ++ finalize_deplibs="$deplib $finalize_deplibs" ++ else ++ deplibs="$deplib $deplibs" ++ fi ++ continue ++ ;; + esac # case $deplib + + $found || test -f "$lib" \ diff --git a/contrib/04ltmain-xlinker-patch/README b/contrib/04ltmain-xlinker-patch/README new file mode 100644 index 0000000000000000000000000000000000000000..3324a82c67e1230482211eaedb127c9cdeb0f926 --- /dev/null +++ b/contrib/04ltmain-xlinker-patch/README @@ -0,0 +1,4 @@ +This patch allows having -Xlinker and -XCClinker command line options in +libtool --mode=compile invocations. + +This is crucial because linker flags are different for nagfor and gcc. diff --git a/contrib/04ltmain-xlinker-patch/ltmain-xlinker-patch.patch b/contrib/04ltmain-xlinker-patch/ltmain-xlinker-patch.patch new file mode 100644 index 0000000000000000000000000000000000000000..989b6ae5d2bdc5050eb899255fd56cd2add4b906 --- /dev/null +++ b/contrib/04ltmain-xlinker-patch/ltmain-xlinker-patch.patch @@ -0,0 +1,27 @@ +--- a/config/ltmain.sh 2019-06-13 14:57:30.333358936 +0200 ++++ b/config/ltmain.sh.new 2019-06-13 14:56:02.639520965 +0200 +@@ -3310,6 +3310,12 @@ + continue + ;; + ++ skip ) ++ lastarg= ++ arg_mode=normal ++ continue ++ ;; ++ + normal ) + # Accept any command-line options. + case $arg in +@@ -3335,6 +3341,11 @@ + continue + ;; + ++ -Xlinker | -XCClinker) ++ arg_mode=skip # the next one is ignored for compile mode ++ continue ++ ;; ++ + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or diff --git a/contrib/05macos-nagfor-patch/macos-nagfor.patch b/contrib/05macos-nagfor-patch/macos-nagfor.patch new file mode 100644 index 0000000000000000000000000000000000000000..befdb41228fa2551824267b237573afcb10579f6 --- /dev/null +++ b/contrib/05macos-nagfor-patch/macos-nagfor.patch @@ -0,0 +1,13 @@ +--- a/config/ltmain.sh 2019-10-18 09:59:55.967567005 +0200 ++++ b/config/ltmain.sh 2019-10-18 10:00:11.403887362 +0200 +@@ -8958,8 +8958,8 @@ + xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + # On Darwin other compilers +- case $CC in +- nagfor*) ++ case $with_nagfor in ++ yes) + verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + ;; + *) diff --git a/patch/ltmain.sh.nag_pthread.patch b/contrib/06ltmain_nag_pthread-patch/ltmain_nag_pthread.patch similarity index 67% rename from patch/ltmain.sh.nag_pthread.patch rename to contrib/06ltmain_nag_pthread-patch/ltmain_nag_pthread.patch index 63b3d3c66dd379150633c99c24e80358171e20f2..e6c618e15ecea2ddfab5dd465e50f8b30cd50323 100644 --- a/patch/ltmain.sh.nag_pthread.patch +++ b/contrib/06ltmain_nag_pthread-patch/ltmain_nag_pthread.patch @@ -1,20 +1,19 @@ --- a/config/ltmain.sh +++ b/config/ltmain.sh -@@ -7862,6 +7862,13 @@ func_mode_link () +@@ -7936,6 +7936,12 @@ func_mode_link () # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + + # Additionally convert " -pthread" to " -Wl,-pthread" for nagfor -+ func_cc_basename $CC -+ case $func_cc_basename_result in -+ nagfor*) tmp_inherited_linker_flags=`$ECHO " $tmp_inherited_linker_flags" | $SED 's/ -pthread/ -Wl,-pthread/g'` ;; -+ esac ++ if test yes = "$with_nagfor" ; then ++ tmp_inherited_linker_flags=`$ECHO " $tmp_inherited_linker_flags" | $SED 's/ -pthread\b/ -Wl,-pthread/g'` ++ fi + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; -@@ -9494,6 +9501,22 @@ EOF +@@ -9570,6 +9577,20 @@ EOF ;; esac @@ -28,12 +27,19 @@ + # better not to revert the changes, otherwise, uncomment the following + # lines. + -+ func_cc_basename $CC -+ case $func_cc_basename_result in -+ nagfor*) -+ new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% -Wl,-pthread% -pthread%g'` ;; -+ esac ++ if test yes = "$with_nagfor" ; then ++ new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's/ -Wl,-pthread\b/ -pthread/g;s/^ *//'` ++ fi + # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= +@@ -10328,6 +10348,8 @@ + *) func_append new_libs " $deplib" ;; + esac + ;; ++ -Wl,-pthread) ++ func_append new_libs " $deplib" ;; + -Wl,*) + func_stripname -Wl, '' "$deplib" + func_append new_libs " $wl$func_stripname_result" diff --git a/contrib/07ltmain-early-xcompile-patch/README b/contrib/07ltmain-early-xcompile-patch/README new file mode 100644 index 0000000000000000000000000000000000000000..510e36ee9df7468b602a98d6014b179cebbe89f6 --- /dev/null +++ b/contrib/07ltmain-early-xcompile-patch/README @@ -0,0 +1,3 @@ +This patch fixes a bug in libtool that leads to a fault when +-Xcompiler is used as first option of compiler flag variables like +CFLAGS and FCLAGS. diff --git a/contrib/07ltmain-early-xcompile-patch/ltmain-early-xcompile-libtool-2.4.6.patch b/contrib/07ltmain-early-xcompile-patch/ltmain-early-xcompile-libtool-2.4.6.patch new file mode 100644 index 0000000000000000000000000000000000000000..dab413481b044c73b24b6c54f3963fb9ff7f7f47 --- /dev/null +++ b/contrib/07ltmain-early-xcompile-patch/ltmain-early-xcompile-libtool-2.4.6.patch @@ -0,0 +1,12 @@ +--- a/config/ltmain.sh ++++ b/config/ltmain.sh +@@ -3300,7 +3300,8 @@ func_mode_compile () + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile +- lastarg=$arg ++ lastarg=$srcfile ++ srcfile=$arg + arg_mode=normal + ;; + diff --git a/contrib/08ltmain-parallel-printf-patch/ltmain-parallel-printf.patch b/contrib/08ltmain-parallel-printf-patch/ltmain-parallel-printf.patch new file mode 100644 index 0000000000000000000000000000000000000000..1572368f1f0578044252a858637b12788fc3069c --- /dev/null +++ b/contrib/08ltmain-parallel-printf-patch/ltmain-parallel-printf.patch @@ -0,0 +1,21 @@ +--- a/config/ltmain.sh ++++ b/config/ltmain.sh +@@ -310,6 +310,18 @@ test -z "$GREP" && { + # in the command search PATH. + + : ${CP="cp -f"} ++# work around bug in libtool which raises an error when running in a ++# parallel make that should have been handled in printf internally ++printf() ++{ ++ while ! builtin printf "$@" ; do ++ errcode=$? ++ # errcode might be EAGAIN=11 which means to simply try again ++ if [ $errcode != 11 ]; then ++ return $errcode ++ fi ++ done ++} + : ${ECHO="printf %s\n"} + : ${EGREP="$GREP -E"} + : ${FGREP="$GREP -F"} diff --git a/contrib/09debian-no-overlink-patch/README.txt b/contrib/09debian-no-overlink-patch/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..402811d4b66bc216b3e92edd5bb7021f0dcb7aab --- /dev/null +++ b/contrib/09debian-no-overlink-patch/README.txt @@ -0,0 +1,11 @@ +This is a combination of patches from the Debian project: +https://sources.debian.org/patches/libtool/2.4.6-15/deplib_binary.patch +https://sources.debian.org/patches/libtool/2.4.6-15/link_all_deplibs.patch + +The patch prevents overlinking. + +The comment in link_all_deplibs.patch says: +## Do not link against deplibs. This is not needed for shared libs +## on atleast ELF systems since those already know which libs they +## need themself. This seems to break a few things and will be fixed +## in a better way in a future upstream version. diff --git a/contrib/09debian-no-overlink-patch/debian-no-overlink.libtool.m4.patch b/contrib/09debian-no-overlink-patch/debian-no-overlink.libtool.m4.patch new file mode 100644 index 0000000000000000000000000000000000000000..080e4a21a3e94ba090fc2cbd33e07b55ee7fc208 --- /dev/null +++ b/contrib/09debian-no-overlink-patch/debian-no-overlink.libtool.m4.patch @@ -0,0 +1,30 @@ +--- a/m4/libtool.m4 ++++ b/m4/libtool.m4 +@@ -4936,6 +4936,9 @@ m4_if([$1], [CXX], [ + ;; + esac + ;; ++ linux* | k*bsd*-gnu | gnu*) ++ _LT_TAGVAR(link_all_deplibs, $1)=no ++ ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; +@@ -4998,6 +5001,9 @@ dnl Note also adjust exclude_expsyms for C++ above. + openbsd* | bitrig*) + with_gnu_ld=no + ;; ++ linux* | k*bsd*-gnu | gnu*) ++ _LT_TAGVAR(link_all_deplibs, $1)=no ++ ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes +@@ -5773,6 +5779,7 @@ _LT_EOF + if test yes = "$lt_cv_irix_exported_symbol"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi ++ _LT_TAGVAR(link_all_deplibs, $1)=no + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' diff --git a/contrib/09debian-no-overlink-patch/debian-no-overlink.patch b/contrib/09debian-no-overlink-patch/debian-no-overlink.patch new file mode 100644 index 0000000000000000000000000000000000000000..1ae35c1ae8654514dbcfe8f90e5fbd5cc3145ac2 --- /dev/null +++ b/contrib/09debian-no-overlink-patch/debian-no-overlink.patch @@ -0,0 +1,44 @@ +--- a/config/ltmain.sh ++++ b/config/ltmain.sh +@@ -7646,7 +7646,10 @@ func_mode_link () + case $pass in + dlopen) libs=$dlfiles ;; + dlpreopen) libs=$dlprefiles ;; +- link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; ++ link) ++ libs="$deplibs %DEPLIBS%" ++ test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ++ ;; + esac + fi + if test lib,dlpreopen = "$linkmode,$pass"; then +@@ -7980,19 +7983,19 @@ func_mode_link () + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" ++ tmp_libs= ++ for deplib in $dependency_libs; do ++ deplibs="$deplib $deplibs" ++ if $opt_preserve_dup_deps; then ++ case "$tmp_libs " in ++ *" $deplib "*) func_append specialdeplibs " $deplib" ;; ++ esac ++ fi ++ func_append tmp_libs " $deplib" ++ done + elif test prog != "$linkmode" && test lib != "$linkmode"; then + func_fatal_error "'$lib' is not a convenience library" + fi +- tmp_libs= +- for deplib in $dependency_libs; do +- deplibs="$deplib $deplibs" +- if $opt_preserve_dup_deps; then +- case "$tmp_libs " in +- *" $deplib "*) func_append specialdeplibs " $deplib" ;; +- esac +- fi +- func_append tmp_libs " $deplib" +- done + continue + fi # $pass = conv + diff --git a/doc/README.pio_write b/doc/README.pio_write index 997fb82d9ff2f953eb2d2e0a3dbe08273b9ae7ca..9b8a21689913846030b45f42f33552ac77a4d4a3 100644 --- a/doc/README.pio_write +++ b/doc/README.pio_write @@ -120,3 +120,63 @@ MPI-mode-only flags: The program will write to two files named example_0.$SUFFIX and example_1.$SUFFIX in sequence, each composed of variables over NTSTEPS time steps to the current working directory. + +The following long options exist to further tune the program behaviour: + +-qcache-redists[=(true|false)], -qno-cache-redists[=(true|false)] + +Takes optionally =true or =false as argument, (=true is assumed if no +argument is specified). If true (the default), YAXT redist descriptors +are cached. Since data decomposition changes for dynamically +repartitioning models, it might be beneficial for tests of +load-balanced applications to turn this off. + +-qpio-role-scheme=(last|first|balanced) + +Use this option to change which MPI processes become I/O servers: + +In the default configuration (last), it's the highest-ranking processes, +for "first", ranks 0-NUMSERVERS-1 become I/O servers and in the case +"balanced" it's those processes for which rank % NUMSERVERS == 0 + +-qcreate-uuid[=(true|false)], -qno-create-uuid[=(true|false)] + +Use this option to generate UUID for the created grids/zaxis data structures. +This feature is off by default. + +-quse-dist-grid[=(true|false)], -qno-use-dist-grid[=(true|false)] + +If true, generate a distributed grid on the I/O clients and servers. This +feature is only available when CDI was built with a PPM library including +the distributed multi-array feature. + +-qtaxis-type=(absolute|relative|forecast) + +Create a time axis following the conventions of TAXIS_ABSOLUTE, +TAXIS_RELATIVE or TAXIS_FORECAST respectively. + +-qtaxis-unit=<UNIT> + +Set the time unit to one of + +* second +* minute +* quarter +* 30minutes +* hour +* 3hours +* 6hours +* 12hours +* day +* month +* year + +As with -qtaxis-type see the CDI library documentation for specifics. + +-qdatatype=<DATATYPE> + +Set the external representation of the written data. Valid values for +DATATYPE are pack followed by the number of significant bits for GRIB +and GRIB2 data and flt32 or flt64 for the other file formats (which +store raw floating point values) to use 32 and 64 bit float formats. +Note: this option must follow the -f option to become effective. diff --git a/doc/pio/tex/c_quick_ref.tex b/doc/pio/tex/c_quick_ref.tex deleted file mode 100644 index 3a105165d24ba109f5f6d1b021f0642402c7c3d2..0000000000000000000000000000000000000000 --- a/doc/pio/tex/c_quick_ref.tex +++ /dev/null @@ -1,176 +0,0 @@ -\chapter*{Quick Reference} -\addcontentsline{toc}{chapter}{Quick Reference} - -This appendix provide a brief listing of the C language bindings of the -CDI library routines: - -\section*{\tt \htmlref{cdiPioCSRBalanced}{cdiPioCSRBalanced}} - -\begin{verbatim} - int cdiPioCSRBalanced (MPI_Comm commSuper, int IOMode, int nProcsIO); -\end{verbatim} - -return role codes appropriate to use \textit{nProcsIO} -tasks distributed on evenly spaced ranks as I/O servers. - - -\section*{\tt \htmlref{cdiPioCSRFirstN}{cdiPioCSRFirstN}} - -\begin{verbatim} - int cdiPioCSRFirstN (MPI_Comm commSuper, int IOMode, int nProcsIO); -\end{verbatim} - -return role codes appropriate to use the first -\textit{nProcsIO} tasks as I/O servers. - - -\section*{\tt \htmlref{cdiPioCSRLastN}{cdiPioCSRLastN}} - -\begin{verbatim} - int cdiPioCSRLastN (MPI_Comm commSuper, int IOMode, int nProcsIO); -\end{verbatim} - -return role codes appropriate to use the last -\textit{nProcsIO} tasks as I/O servers. - - -\section*{\tt \htmlref{cdiPioConfCreate}{cdiPioConfCreate}} - -\begin{verbatim} - int cdiPioConfCreate (); -\end{verbatim} - -create new configuration object and return its handle. - - -\section*{\tt \htmlref{cdiPioConfDestroy}{cdiPioConfDestroy}} - -\begin{verbatim} - void cdiPioConfDestroy (int confResH); -\end{verbatim} - -delete configuration object. - - -\section*{\tt \htmlref{cdiPioConfGetCSRole}{cdiPioConfGetCSRole}} - -\begin{verbatim} - int cdiPioConfGetCSRole (int confResH); -\end{verbatim} - -query role attribute of configuration object. - - -\section*{\tt \htmlref{cdiPioConfGetIOMode}{cdiPioConfGetIOMode}} - -\begin{verbatim} - int cdiPioConfGetIOMode (int confResH); -\end{verbatim} - -query IOMode attribute of configuration object. - - -\section*{\tt \htmlref{cdiPioConfGetPartInflate}{cdiPioConfGetPartInflate}} - -\begin{verbatim} - float cdiPioConfGetPartInflate (int confResH); -\end{verbatim} - -query partition imbalance attribute of -configuration object. - - -\section*{\tt \htmlref{cdiPioConfSetCSRole}{cdiPioConfSetCSRole}} - -\begin{verbatim} - void cdiPioConfSetCSRole (int confResH, int CSRole); -\end{verbatim} - -set role attribute of configuration object. - - -\section*{\tt \htmlref{cdiPioConfSetIOMode}{cdiPioConfSetIOMode}} - -\begin{verbatim} - void cdiPioConfSetIOMode (int confResH, int IOMode); -\end{verbatim} - -set IOMode attribute of configuration object. - - -\section*{\tt \htmlref{cdiPioConfSetPartInflate}{cdiPioConfSetPartInflate}} - -\begin{verbatim} - void cdiPioConfSetPartInflate (int confResH, float partInflate); -\end{verbatim} - -set partition imbalance attribute of -configuration object. - - -\section*{\tt \htmlref{cdiPioConfSetPostCommSetupActions}{cdiPioConfSetPostCommSetupActions}} - -\begin{verbatim} - void cdiPioConfSetPostCommSetupActions (int confResH, - void (*postCommSetupActions)(void)); -\end{verbatim} - -set function to be called after -setup of client/server communications of configuration object. - - -\section*{\tt \htmlref{cdiPioConfSetRedistCache}{cdiPioConfSetRedistCache}} - -\begin{verbatim} - void cdiPioConfSetRedistCache (int confResH, int doCache); -\end{verbatim} - -set doCache to anything non-zero if data -for internal data exchanges is to be cached. This makes sense when -the data passed via streamWriteVarPart or streamWriteScatteredVarPart -is always decomposed statically using the same partitioning -description objects and the sequence of calls to streamWriteVarPart -or streamWriteScatteredVarPart for a stream matches the sequence -of the previous sequence (divided by pioWriteTimestep). - - -\section*{\tt \htmlref{cdiPioInit}{cdiPioInit}} - -\begin{verbatim} - MPI_Comm cdiPioInit (MPI_Comm commSuper, int confResH, int *pioNamespace); -\end{verbatim} - -initialize I/O server processes and communication. - - -\section*{\tt \htmlref{cdiPioNoPostCommSetup}{cdiPioNoPostCommSetup}} - -\begin{verbatim} - void cdiPioNoPostCommSetup (); -\end{verbatim} - -Dummy function to use as argument to pioInit -if no actions are necessary after I/O servers initialize communication. - - -\section*{\tt \htmlref{cdiPioStr2IOMode}{cdiPioStr2IOMode}} - -\begin{verbatim} - int cdiPioStr2IOMode (const char *modeStr); -\end{verbatim} - -return integer code corresponding to string -representation of mode or -1 if no match was found. - - -\section*{\tt \htmlref{pioInit}{pioInit}} - -\begin{verbatim} - MPI_Comm pioInit (MPI_Comm commSuper, int nProcsIO, int IOMode, - int *pioNamespace, float partInflate, - void (*postCommSetupActions)(void)); -\end{verbatim} - -initialize I/O server processes and communication. - - diff --git a/doc/pio/tex/f_quick_ref.tex b/doc/pio/tex/f_quick_ref.tex deleted file mode 100644 index 45756d48c3a1cf8173b631c894c65f515c778c85..0000000000000000000000000000000000000000 --- a/doc/pio/tex/f_quick_ref.tex +++ /dev/null @@ -1,180 +0,0 @@ -\chapter*{Quick Reference} -\addcontentsline{toc}{chapter}{Quick Reference} - -This appendix provide a brief listing of the Fortran language bindings of the -CDI library routines: - -\section*{\tt \htmlref{cdiPioCSRBalanced}{cdiPioCSRBalanced}} - -\begin{verbatim} - INTEGER FUNCTION cdiPioCSRBalanced (INTEGER commSuper, INTEGER IOMode, - INTEGER nProcsIO) -\end{verbatim} - -return role codes appropriate to use \textit{nProcsIO} -tasks distributed on evenly spaced ranks as I/O servers. - - -\section*{\tt \htmlref{cdiPioCSRFirstN}{cdiPioCSRFirstN}} - -\begin{verbatim} - INTEGER FUNCTION cdiPioCSRFirstN (INTEGER commSuper, INTEGER IOMode, - INTEGER nProcsIO) -\end{verbatim} - -return role codes appropriate to use the first -\textit{nProcsIO} tasks as I/O servers. - - -\section*{\tt \htmlref{cdiPioCSRLastN}{cdiPioCSRLastN}} - -\begin{verbatim} - INTEGER FUNCTION cdiPioCSRLastN (INTEGER commSuper, INTEGER IOMode, - INTEGER nProcsIO) -\end{verbatim} - -return role codes appropriate to use the last -\textit{nProcsIO} tasks as I/O servers. - - -\section*{\tt \htmlref{cdiPioConfCreate}{cdiPioConfCreate}} - -\begin{verbatim} - INTEGER FUNCTION cdiPioConfCreate -\end{verbatim} - -create new configuration object and return its handle. - - -\section*{\tt \htmlref{cdiPioConfDestroy}{cdiPioConfDestroy}} - -\begin{verbatim} - SUBROUTINE cdiPioConfDestroy (INTEGER confResH) -\end{verbatim} - -delete configuration object. - - -\section*{\tt \htmlref{cdiPioConfGetCSRole}{cdiPioConfGetCSRole}} - -\begin{verbatim} - INTEGER FUNCTION cdiPioConfGetCSRole (INTEGER confResH) -\end{verbatim} - -query role attribute of configuration object. - - -\section*{\tt \htmlref{cdiPioConfGetIOMode}{cdiPioConfGetIOMode}} - -\begin{verbatim} - INTEGER FUNCTION cdiPioConfGetIOMode (INTEGER confResH) -\end{verbatim} - -query IOMode attribute of configuration object. - - -\section*{\tt \htmlref{cdiPioConfGetPartInflate}{cdiPioConfGetPartInflate}} - -\begin{verbatim} - REAL FUNCTION cdiPioConfGetPartInflate (INTEGER confResH) -\end{verbatim} - -query partition imbalance attribute of -configuration object. - - -\section*{\tt \htmlref{cdiPioConfSetCSRole}{cdiPioConfSetCSRole}} - -\begin{verbatim} - SUBROUTINE cdiPioConfSetCSRole (INTEGER confResH, INTEGER CSRole) -\end{verbatim} - -set role attribute of configuration object. - - -\section*{\tt \htmlref{cdiPioConfSetIOMode}{cdiPioConfSetIOMode}} - -\begin{verbatim} - SUBROUTINE cdiPioConfSetIOMode (INTEGER confResH, INTEGER IOMode) -\end{verbatim} - -set IOMode attribute of configuration object. - - -\section*{\tt \htmlref{cdiPioConfSetPartInflate}{cdiPioConfSetPartInflate}} - -\begin{verbatim} - SUBROUTINE cdiPioConfSetPartInflate (INTEGER confResH, REAL partInflate) -\end{verbatim} - -set partition imbalance attribute of -configuration object. - - -\section*{\tt \htmlref{cdiPioConfSetPostCommSetupActions}{cdiPioConfSetPostCommSetupActions}} - -\begin{verbatim} - SUBROUTINE cdiPioConfSetPostCommSetupActions (INTEGER confResH, - PROCEDURE postCommSetupActions) -\end{verbatim} - -set function to be called after -setup of client/server communications of configuration object. - - -\section*{\tt \htmlref{cdiPioConfSetRedistCache}{cdiPioConfSetRedistCache}} - -\begin{verbatim} - SUBROUTINE cdiPioConfSetRedistCache (INTEGER confResH, INTEGER doCache) -\end{verbatim} - -set doCache to anything non-zero if data -for internal data exchanges is to be cached. This makes sense when -the data passed via streamWriteVarPart or streamWriteScatteredVarPart -is always decomposed statically using the same partitioning -description objects and the sequence of calls to streamWriteVarPart -or streamWriteScatteredVarPart for a stream matches the sequence -of the previous sequence (divided by pioWriteTimestep). - - -\section*{\tt \htmlref{cdiPioInit}{cdiPioInit}} - -\begin{verbatim} - INTEGER FUNCTION cdiPioInit (INTEGER commSuper, INTEGER confResH, - INTEGER pioNamespace) -\end{verbatim} - -initialize I/O server processes and communication. - - -\section*{\tt \htmlref{cdiPioNoPostCommSetup}{cdiPioNoPostCommSetup}} - -\begin{verbatim} - SUBROUTINE cdiPioNoPostCommSetup -\end{verbatim} - -Dummy function to use as argument to pioInit -if no actions are necessary after I/O servers initialize communication. - - -\section*{\tt \htmlref{cdiPioStr2IOMode}{cdiPioStr2IOMode}} - -\begin{verbatim} - INTEGER FUNCTION cdiPioStr2IOMode (CHARACTER*(*) modeStr) -\end{verbatim} - -return integer code corresponding to string -representation of mode or -1 if no match was found. - - -\section*{\tt \htmlref{pioInit}{pioInit}} - -\begin{verbatim} - INTEGER FUNCTION pioInit (INTEGER commSuper, INTEGER nProcsIO, INTEGER IOMode, - INTEGER pioNamespace, REAL partInflate, - PROCEDURE postCommSetupActions) -\end{verbatim} - -initialize I/O server processes and communication. - - diff --git a/doc/tex/c_quick_ref.tex b/doc/tex/c_quick_ref.tex deleted file mode 100644 index 690c6789232da753f94cc5badca08f42c1a31fa6..0000000000000000000000000000000000000000 --- a/doc/tex/c_quick_ref.tex +++ /dev/null @@ -1,1563 +0,0 @@ -\chapter*{Quick Reference} -\addcontentsline{toc}{chapter}{Quick Reference} - -This appendix provide a brief listing of the C language bindings of the CDI library routines: - -\section*{\tt \htmlref{cdiClearAdditionalKeys}{cdiClearAdditionalKeys}} - -\begin{verbatim} - void cdiClearAdditionalKeys (); -\end{verbatim} - -Clear the list of additional GRIB keys. - - -\section*{\tt \htmlref{cdiDefAdditionalKey}{cdiDefAdditionalKey}} - -\begin{verbatim} - void cdiDefAdditionalKey (const char *string); -\end{verbatim} - -Register an additional GRIB key which is read when file is opened. - - -\section*{\tt \htmlref{cdiDefAttFlt}{cdiDefAttFlt}} - -\begin{verbatim} - int cdiDefAttFlt (int cdiID, int varID, const char *name, int type, int len, - const double dp[]); -\end{verbatim} - -Define a floating point attribute. - - -\section*{\tt \htmlref{cdiDefAttInt}{cdiDefAttInt}} - -\begin{verbatim} - int cdiDefAttInt (int cdiID, int varID, const char *name, int type, int len, - const int ip[]); -\end{verbatim} - -Define an integer attribute. - - -\section*{\tt \htmlref{cdiDefAttTxt}{cdiDefAttTxt}} - -\begin{verbatim} - int cdiDefAttTxt (int cdiID, int varID, const char *name, int len, - const char *tp_cbuf); -\end{verbatim} - -Define a text attribute. - - -\section*{\tt \htmlref{cdiDefKeyFloat}{cdiDefKeyFloat}} - -\begin{verbatim} - int cdiDefKeyFloat (int cdiID, int varID, int key, double value); -\end{verbatim} - -Define a float value from a key. - - -\section*{\tt \htmlref{cdiDefKeyInt}{cdiDefKeyInt}} - -\begin{verbatim} - int cdiDefKeyInt (int cdiID, int varID, int key, int value); -\end{verbatim} - -Define an integer value from a key. - - -\section*{\tt \htmlref{cdiDefKeyString}{cdiDefKeyString}} - -\begin{verbatim} - int cdiDefKeyString (int cdiID, int varID, int key, const char *string); -\end{verbatim} - -Define a string from a key. - - -\section*{\tt \htmlref{cdiInqAtt}{cdiInqAtt}} - -\begin{verbatim} - int cdiInqAtt (int cdiID, int varID, int attrnum, char *name, int *typep, - int *lenp); -\end{verbatim} - -Get information about an attribute. - - -\section*{\tt \htmlref{cdiInqAttFlt}{cdiInqAttFlt}} - -\begin{verbatim} - int cdiInqAttFlt (int cdiID, int varID, const char *name, int mlen, double dp[]); -\end{verbatim} - -Get the value(s) of a floating point attribute. - - -\section*{\tt \htmlref{cdiInqAttInt}{cdiInqAttInt}} - -\begin{verbatim} - int cdiInqAttInt (int cdiID, int varID, const char *name, int mlen, int ip[]); -\end{verbatim} - -Get the value(s) of an integer attribute. - - -\section*{\tt \htmlref{cdiInqAttTxt}{cdiInqAttTxt}} - -\begin{verbatim} - int cdiInqAttTxt (int cdiID, int varID, const char *name, int mlen, - char *tp_cbuf); -\end{verbatim} - -Get the value(s) of a text attribute. - - -\section*{\tt \htmlref{cdiInqKeyInt}{cdiInqKeyInt}} - -\begin{verbatim} - int cdiInqKeyInt (int cdiID, int varID, int key, int *value); -\end{verbatim} - -Get an integer value from a key. - - -\section*{\tt \htmlref{cdiInqKeyLen}{cdiInqKeyLen}} - -\begin{verbatim} - int cdiInqKeyLen (int cdiID, int varID, int key, int *length); -\end{verbatim} - -Get the length of the string representation of the key. - - -\section*{\tt \htmlref{cdiInqKeyString}{cdiInqKeyString}} - -\begin{verbatim} - int cdiInqKeyString (int cdiID, int varID, int key, char *string, int *length); -\end{verbatim} - -Get a string from a key. - - -\section*{\tt \htmlref{cdiInqNatts}{cdiInqNatts}} - -\begin{verbatim} - int cdiInqNatts (int cdiID, int varID, int *nattsp); -\end{verbatim} - -Get number of attributes assigned to this variable. - - -\section*{\tt \htmlref{gridCreate}{gridCreate}} - -\begin{verbatim} - int gridCreate (int gridtype, SizeType size); -\end{verbatim} - -Create a horizontal Grid. - - -\section*{\tt \htmlref{gridDefNP}{gridDefNP}} - -\begin{verbatim} - void gridDefNP (int gridID, int np); -\end{verbatim} - -Define the number of parallels between a pole and the equator. - - -\section*{\tt \htmlref{gridDefNumber}{gridDefNumber}} - -\begin{verbatim} - void gridDefNumber (int gridID, int number); -\end{verbatim} - -Define the reference number for an unstructured grid. - - -\section*{\tt \htmlref{gridDefNvertex}{gridDefNvertex}} - -\begin{verbatim} - void gridDefNvertex (int gridID, int nvertex); -\end{verbatim} - -Define the number of vertex of a Gridbox. - - -\section*{\tt \htmlref{gridDefPosition}{gridDefPosition}} - -\begin{verbatim} - void gridDefPosition (int gridID, int position); -\end{verbatim} - -Define the position of grid in the reference file. - - -\section*{\tt \htmlref{gridDefProj}{gridDefProj}} - -\begin{verbatim} - void gridDefProj (int gridID, int projID); -\end{verbatim} - -Define the projection ID of a Grid. - - -\section*{\tt \htmlref{gridDefReference}{gridDefReference}} - -\begin{verbatim} - void gridDefReference (int gridID, const char *reference); -\end{verbatim} - -Define the reference URI for an unstructured grid. - - -\section*{\tt \htmlref{gridDefUUID}{gridDefUUID}} - -\begin{verbatim} - void gridDefUUID (int gridID, const unsigned char uuid[CDI_UUID_SIZE]); -\end{verbatim} - -Define the UUID of an unstructured grid. - - -\section*{\tt \htmlref{gridDefXbounds}{gridDefXbounds}} - -\begin{verbatim} - void gridDefXbounds (int gridID, const double xbounds[]); -\end{verbatim} - -Define the bounds of a X-axis. - - -\section*{\tt \htmlref{gridDefXlongname}{gridDefXlongname}} - -\begin{verbatim} - void gridDefXlongname (int gridID, const char *xlongname); -\end{verbatim} - -Define the longname of a X-axis. - - -\section*{\tt \htmlref{gridDefXname}{gridDefXname}} - -\begin{verbatim} - void gridDefXname (int gridID, const char *xname); -\end{verbatim} - -Define the name of a X-axis. - - -\section*{\tt \htmlref{gridDefXsize}{gridDefXsize}} - -\begin{verbatim} - void gridDefXsize (int gridID, SizeType xsize); -\end{verbatim} - -Define the size of a X-axis. - - -\section*{\tt \htmlref{gridDefXunits}{gridDefXunits}} - -\begin{verbatim} - void gridDefXunits (int gridID, const char *xunits); -\end{verbatim} - -Define the units of a X-axis. - - -\section*{\tt \htmlref{gridDefXvals}{gridDefXvals}} - -\begin{verbatim} - void gridDefXvals (int gridID, const double xvals[]); -\end{verbatim} - -Define the values of a X-axis. - - -\section*{\tt \htmlref{gridDefYbounds}{gridDefYbounds}} - -\begin{verbatim} - void gridDefYbounds (int gridID, const double ybounds[]); -\end{verbatim} - -Define the bounds of a Y-axis. - - -\section*{\tt \htmlref{gridDefYlongname}{gridDefYlongname}} - -\begin{verbatim} - void gridDefYlongname (int gridID, const char *ylongname); -\end{verbatim} - -Define the longname of a Y-axis. - - -\section*{\tt \htmlref{gridDefYname}{gridDefYname}} - -\begin{verbatim} - void gridDefYname (int gridID, const char *yname); -\end{verbatim} - -Define the name of a Y-axis. - - -\section*{\tt \htmlref{gridDefYsize}{gridDefYsize}} - -\begin{verbatim} - void gridDefYsize (int gridID, SizeType ysize); -\end{verbatim} - -Define the size of a Y-axis. - - -\section*{\tt \htmlref{gridDefYunits}{gridDefYunits}} - -\begin{verbatim} - void gridDefYunits (int gridID, const char *yunits); -\end{verbatim} - -Define the units of a Y-axis. - - -\section*{\tt \htmlref{gridDefYvals}{gridDefYvals}} - -\begin{verbatim} - void gridDefYvals (int gridID, const double yvals[]); -\end{verbatim} - -Define the values of a Y-axis. - - -\section*{\tt \htmlref{gridDestroy}{gridDestroy}} - -\begin{verbatim} - void gridDestroy (int gridID); -\end{verbatim} - -Destroy a horizontal Grid. - - -\section*{\tt \htmlref{gridDuplicate}{gridDuplicate}} - -\begin{verbatim} - int gridDuplicate (int gridID); -\end{verbatim} - -Duplicate a Grid. - - -\section*{\tt \htmlref{gridInqNP}{gridInqNP}} - -\begin{verbatim} - int gridInqNP (int gridID); -\end{verbatim} - -Get the number of parallels between a pole and the equator. - - -\section*{\tt \htmlref{gridInqNumber}{gridInqNumber}} - -\begin{verbatim} - int gridInqNumber (int gridID); -\end{verbatim} - -Get the reference number to an unstructured grid. - - -\section*{\tt \htmlref{gridInqNvertex}{gridInqNvertex}} - -\begin{verbatim} - int gridInqNvertex (int gridID); -\end{verbatim} - -Get the number of vertex of a Gridbox. - - -\section*{\tt \htmlref{gridInqPosition}{gridInqPosition}} - -\begin{verbatim} - int gridInqPosition (int gridID); -\end{verbatim} - -Get the position of grid in the reference file. - - -\section*{\tt \htmlref{gridInqProj}{gridInqProj}} - -\begin{verbatim} - int gridInqProj (int gridID); -\end{verbatim} - -Get the projection ID of a Grid. - - -\section*{\tt \htmlref{gridInqProjType}{gridInqProjType}} - -\begin{verbatim} - int gridInqProjType (int gridID); -\end{verbatim} - -Get the projection type. - - -\section*{\tt \htmlref{gridInqReference}{gridInqReference}} - -\begin{verbatim} - int gridInqReference (int gridID, char *reference); -\end{verbatim} - -Get the reference URI to an unstructured grid. - - -\section*{\tt \htmlref{gridInqSize}{gridInqSize}} - -\begin{verbatim} - SizeType gridInqSize (int gridID); -\end{verbatim} - -Get the size of a Grid. - - -\section*{\tt \htmlref{gridInqType}{gridInqType}} - -\begin{verbatim} - int gridInqType (int gridID); -\end{verbatim} - -Get the type of a Grid. - - -\section*{\tt \htmlref{gridInqUUID}{gridInqUUID}} - -\begin{verbatim} - void gridInqUUID (int gridID, unsigned char uuid[CDI_UUID_SIZE]); -\end{verbatim} - -Get the UUID of an unstructured grid. - - -\section*{\tt \htmlref{gridInqXIsc}{gridInqXIsc}} - -\begin{verbatim} - int gridInqXIsc (int gridID); -\end{verbatim} - -Find out whether X-coordinate is of type CHAR. - - -\section*{\tt \htmlref{gridInqXbounds}{gridInqXbounds}} - -\begin{verbatim} - SizeType gridInqXbounds (int gridID, double xbounds[]); -\end{verbatim} - -Get the bounds of a X-axis. - - -\section*{\tt \htmlref{gridInqXlongname}{gridInqXlongname}} - -\begin{verbatim} - void gridInqXlongname (int gridID, char *xlongname); -\end{verbatim} - -Get the longname of a X-axis. - - -\section*{\tt \htmlref{gridInqXname}{gridInqXname}} - -\begin{verbatim} - void gridInqXname (int gridID, char *xname); -\end{verbatim} - -Get the name of a X-axis. - - -\section*{\tt \htmlref{gridInqXsize}{gridInqXsize}} - -\begin{verbatim} - SizeType gridInqXsize (int gridID); -\end{verbatim} - -Get the size of a X-axis. - - -\section*{\tt \htmlref{gridInqXunits}{gridInqXunits}} - -\begin{verbatim} - void gridInqXunits (int gridID, char *xunits); -\end{verbatim} - -Get the units of a X-axis. - - -\section*{\tt \htmlref{gridInqXval}{gridInqXval}} - -\begin{verbatim} - double gridInqXval (int gridID, SizeType index); -\end{verbatim} - -Get one value of a X-axis. - - -\section*{\tt \htmlref{gridInqXvals}{gridInqXvals}} - -\begin{verbatim} - SizeType gridInqXvals (int gridID, double xvals[]); -\end{verbatim} - -Get all values of a X-axis. - - -\section*{\tt \htmlref{gridInqYIsc}{gridInqYIsc}} - -\begin{verbatim} - int gridInqYIsc (int gridID); -\end{verbatim} - -Find out whether Y-coordinate is of type CHAR. - - -\section*{\tt \htmlref{gridInqYbounds}{gridInqYbounds}} - -\begin{verbatim} - SizeType gridInqYbounds (int gridID, double ybounds[]); -\end{verbatim} - -Get the bounds of a Y-axis. - - -\section*{\tt \htmlref{gridInqYlongname}{gridInqYlongname}} - -\begin{verbatim} - void gridInqYlongname (int gridID, char *ylongname); -\end{verbatim} - -Get the longname of a Y-axis. - - -\section*{\tt \htmlref{gridInqYname}{gridInqYname}} - -\begin{verbatim} - void gridInqYname (int gridID, char *yname); -\end{verbatim} - -Get the name of a Y-axis. - - -\section*{\tt \htmlref{gridInqYsize}{gridInqYsize}} - -\begin{verbatim} - SizeType gridInqYsize (int gridID); -\end{verbatim} - -Get the size of a Y-axis. - - -\section*{\tt \htmlref{gridInqYunits}{gridInqYunits}} - -\begin{verbatim} - void gridInqYunits (int gridID, char *yunits); -\end{verbatim} - -Get the units of a Y-axis. - - -\section*{\tt \htmlref{gridInqYval}{gridInqYval}} - -\begin{verbatim} - double gridInqYval (int gridID, SizeType index); -\end{verbatim} - -Get one value of a Y-axis. - - -\section*{\tt \htmlref{gridInqYvals}{gridInqYvals}} - -\begin{verbatim} - SizeType gridInqYvals (int gridID, double yvals[]); -\end{verbatim} - -Get all values of a Y-axis. - - -\section*{\tt \htmlref{streamClose}{streamClose}} - -\begin{verbatim} - void streamClose (int streamID); -\end{verbatim} - -Close an open dataset. - - -\section*{\tt \htmlref{streamDefByteorder}{streamDefByteorder}} - -\begin{verbatim} - void streamDefByteorder (int streamID, int byteorder); -\end{verbatim} - -Define the byteorder. - - -\section*{\tt \htmlref{streamDefCompLevel}{streamDefCompLevel}} - -\begin{verbatim} - void streamDefCompLevel (int streamID, int complevel); -\end{verbatim} - -Define compression level. - - -\section*{\tt \htmlref{streamDefCompType}{streamDefCompType}} - -\begin{verbatim} - void streamDefCompType (int streamID, int comptype); -\end{verbatim} - -Define compression type. - - -\section*{\tt \htmlref{streamDefTimestep}{streamDefTimestep}} - -\begin{verbatim} - int streamDefTimestep (int streamID, int tsID); -\end{verbatim} - -Define time step. - - -\section*{\tt \htmlref{streamDefVlist}{streamDefVlist}} - -\begin{verbatim} - void streamDefVlist (int streamID, int vlistID); -\end{verbatim} - -Define the Vlist for a stream. - - -\section*{\tt \htmlref{streamInqByteorder}{streamInqByteorder}} - -\begin{verbatim} - int streamInqByteorder (int streamID); -\end{verbatim} - -Get the byteorder. - - -\section*{\tt \htmlref{streamInqCompLevel}{streamInqCompLevel}} - -\begin{verbatim} - int streamInqCompLevel (int streamID); -\end{verbatim} - -Get compression level. - - -\section*{\tt \htmlref{streamInqCompType}{streamInqCompType}} - -\begin{verbatim} - int streamInqCompType (int streamID); -\end{verbatim} - -Get compression type. - - -\section*{\tt \htmlref{streamInqFiletype}{streamInqFiletype}} - -\begin{verbatim} - int streamInqFiletype (int streamID); -\end{verbatim} - -Get the filetype. - - -\section*{\tt \htmlref{streamInqTimestep}{streamInqTimestep}} - -\begin{verbatim} - int streamInqTimestep (int streamID, int tsID); -\end{verbatim} - -Get time step. - - -\section*{\tt \htmlref{streamInqVlist}{streamInqVlist}} - -\begin{verbatim} - int streamInqVlist (int streamID); -\end{verbatim} - -Get the Vlist of a stream. - - -\section*{\tt \htmlref{streamOpenRead}{streamOpenRead}} - -\begin{verbatim} - int streamOpenRead (const char *path); -\end{verbatim} - -Open a dataset for reading. - - -\section*{\tt \htmlref{streamOpenWrite}{streamOpenWrite}} - -\begin{verbatim} - int streamOpenWrite (const char *path, int filetype); -\end{verbatim} - -Create a new dataset. - - -\section*{\tt \htmlref{streamReadVar}{streamReadVar}} - -\begin{verbatim} - void streamReadVar (int streamID, int varID, double data[], SizeType *nmiss); -\end{verbatim} - -Read a variable. - - -\section*{\tt \htmlref{streamReadVarSlice}{streamReadVarSlice}} - -\begin{verbatim} - void streamReadVarSlice (int streamID, int varID, int levelID, double data[], - SizeType *nmiss); -\end{verbatim} - -Read a horizontal slice of a variable. - - -\section*{\tt \htmlref{streamSync}{streamSync}} - -\begin{verbatim} - void streamSync (int streamID); -\end{verbatim} - -Synchronize an Open Dataset to Disk. - - -\section*{\tt \htmlref{streamWriteVar}{streamWriteVar}} - -\begin{verbatim} - void streamWriteVar (int streamID, int varID, const double data[], - SizeType nmiss); -\end{verbatim} - -Write a variable. - - -\section*{\tt \htmlref{streamWriteVarSlice}{streamWriteVarSlice}} - -\begin{verbatim} - void streamWriteVarSlice (int streamID, int varID, int levelID, - const double data[], SizeType nmiss); -\end{verbatim} - -Write a horizontal slice of a variable. - - -\section*{\tt \htmlref{subtypeCreate}{subtypeCreate}} - -\begin{verbatim} - int subtypeCreate (int subtype); -\end{verbatim} - -Create a variable subtype. - - -\section*{\tt \htmlref{subtypeDefActiveIndex}{subtypeDefActiveIndex}} - -\begin{verbatim} - void subtypeDefActiveIndex (int subtypeID, int index); -\end{verbatim} - -Set the currently active index of a subtype (e.g. current tile index). - - -\section*{\tt \htmlref{subtypeInqActiveIndex}{subtypeInqActiveIndex}} - -\begin{verbatim} - int subtypeInqActiveIndex (int subtypeID); -\end{verbatim} - -Get the currently active index of a subtype (e.g. current tile index). - - -\section*{\tt \htmlref{subtypeInqAttribute}{subtypeInqAttribute}} - -\begin{verbatim} - int subtypeInqAttribute (int subtypeID, int index, const char *key, - int *outValue); -\end{verbatim} - -Inquire the value of a subtype attribute. Returns CDI_EINVAL if the attribute does not exist.. - - -\section*{\tt \htmlref{subtypeInqSize}{subtypeInqSize}} - -\begin{verbatim} - int subtypeInqSize (int subtypeID); -\end{verbatim} - -Get the size of a subtype (e.g. no. of tiles). - - -\section*{\tt \htmlref{subtypeInqTile}{subtypeInqTile}} - -\begin{verbatim} - int subtypeInqTile (int subtypeID, int tileindex, int attribute); -\end{verbatim} - -Specialized version of subtypeInqSubEntry looking for tile/attribute pair. - - -\section*{\tt \htmlref{tableRead}{tableRead}} - -\begin{verbatim} - int tableRead (const char *tablefile); -\end{verbatim} - -read table of parameters from file in tabular format. - - -\section*{\tt \htmlref{tableWrite}{tableWrite}} - -\begin{verbatim} - void tableWrite (const char *filename, int tableID); -\end{verbatim} - -write table of parameters to file in tabular format. - - -\section*{\tt \htmlref{taxisCreate}{taxisCreate}} - -\begin{verbatim} - int taxisCreate (int taxistype); -\end{verbatim} - -Create a Time axis. - - -\section*{\tt \htmlref{taxisDefCalendar}{taxisDefCalendar}} - -\begin{verbatim} - void taxisDefCalendar (int taxisID, int calendar); -\end{verbatim} - -Define the calendar. - - -\section*{\tt \htmlref{taxisDefFdate}{taxisDefFdate}} - -\begin{verbatim} - void taxisDefFdate (int taxisID, int date); -\end{verbatim} - -Define the forecast reference date. - - -\section*{\tt \htmlref{taxisDefFtime}{taxisDefFtime}} - -\begin{verbatim} - void taxisDefFtime (int taxisID, int time); -\end{verbatim} - -Define the forecast reference time. - - -\section*{\tt \htmlref{taxisDefRdate}{taxisDefRdate}} - -\begin{verbatim} - void taxisDefRdate (int taxisID, int date); -\end{verbatim} - -Define the reference date. - - -\section*{\tt \htmlref{taxisDefRtime}{taxisDefRtime}} - -\begin{verbatim} - void taxisDefRtime (int taxisID, int time); -\end{verbatim} - -Define the reference time. - - -\section*{\tt \htmlref{taxisDefVdate}{taxisDefVdate}} - -\begin{verbatim} - void taxisDefVdate (int taxisID, int date); -\end{verbatim} - -Define the verification date. - - -\section*{\tt \htmlref{taxisDefVtime}{taxisDefVtime}} - -\begin{verbatim} - void taxisDefVtime (int taxisID, int time); -\end{verbatim} - -Define the verification time. - - -\section*{\tt \htmlref{taxisDestroy}{taxisDestroy}} - -\begin{verbatim} - void taxisDestroy (int taxisID); -\end{verbatim} - -Destroy a Time axis. - - -\section*{\tt \htmlref{taxisInqCalendar}{taxisInqCalendar}} - -\begin{verbatim} - int taxisInqCalendar (int taxisID); -\end{verbatim} - -Get the calendar. - - -\section*{\tt \htmlref{taxisInqFdate}{taxisInqFdate}} - -\begin{verbatim} - int taxisInqFdate (int taxisID); -\end{verbatim} - -Get the forecast reference date. - - -\section*{\tt \htmlref{taxisInqFtime}{taxisInqFtime}} - -\begin{verbatim} - int taxisInqFtime (int taxisID); -\end{verbatim} - -Get the forecast reference time. - - -\section*{\tt \htmlref{taxisInqRdate}{taxisInqRdate}} - -\begin{verbatim} - int taxisInqRdate (int taxisID); -\end{verbatim} - -Get the reference date. - - -\section*{\tt \htmlref{taxisInqRtime}{taxisInqRtime}} - -\begin{verbatim} - int taxisInqRtime (int taxisID); -\end{verbatim} - -Get the reference time. - - -\section*{\tt \htmlref{taxisInqVdate}{taxisInqVdate}} - -\begin{verbatim} - int taxisInqVdate (int taxisID); -\end{verbatim} - -Get the verification date. - - -\section*{\tt \htmlref{taxisInqVtime}{taxisInqVtime}} - -\begin{verbatim} - int taxisInqVtime (int taxisID); -\end{verbatim} - -Get the verification time. - - -\section*{\tt \htmlref{vlistCat}{vlistCat}} - -\begin{verbatim} - void vlistCat (int vlistID2, int vlistID1); -\end{verbatim} - -Concatenate two variable lists. - - -\section*{\tt \htmlref{vlistCopy}{vlistCopy}} - -\begin{verbatim} - void vlistCopy (int vlistID2, int vlistID1); -\end{verbatim} - -Copy a variable list. - - -\section*{\tt \htmlref{vlistCopyFlag}{vlistCopyFlag}} - -\begin{verbatim} - void vlistCopyFlag (int vlistID2, int vlistID1); -\end{verbatim} - -Copy some entries of a variable list. - - -\section*{\tt \htmlref{vlistCopyVarName}{vlistCopyVarName}} - -\begin{verbatim} - char *vlistCopyVarName (int vlistId, int varId); -\end{verbatim} - -Safe and convenient version of vlistInqVarName. - - -\section*{\tt \htmlref{vlistCreate}{vlistCreate}} - -\begin{verbatim} - int vlistCreate (); -\end{verbatim} - -Create a variable list. - - -\section*{\tt \htmlref{vlistDefTaxis}{vlistDefTaxis}} - -\begin{verbatim} - void vlistDefTaxis (int vlistID, int taxisID); -\end{verbatim} - -Define the time axis of a variable list. - - -\section*{\tt \htmlref{vlistDefVar}{vlistDefVar}} - -\begin{verbatim} - int vlistDefVar (int vlistID, int gridID, int zaxisID, int timetype); -\end{verbatim} - -Create a new variable. - - -\section*{\tt \htmlref{vlistDefVarCode}{vlistDefVarCode}} - -\begin{verbatim} - void vlistDefVarCode (int vlistID, int varID, int code); -\end{verbatim} - -Define the code number of a Variable. - - -\section*{\tt \htmlref{vlistDefVarDatatype}{vlistDefVarDatatype}} - -\begin{verbatim} - void vlistDefVarDatatype (int vlistID, int varID, int datatype); -\end{verbatim} - -Define the data type of a Variable. - - -\section*{\tt \htmlref{vlistDefVarDblKey}{vlistDefVarDblKey}} - -\begin{verbatim} - void vlistDefVarDblKey (int vlistID, int varID, const char *name, double value); -\end{verbatim} - -Set an arbitrary keyword/double value pair for GRIB API. - - -\section*{\tt \htmlref{vlistDefVarExtra}{vlistDefVarExtra}} - -\begin{verbatim} - void vlistDefVarExtra (int vlistID, int varID, const char *extra); -\end{verbatim} - -Define extra information of a Variable. - - -\section*{\tt \htmlref{vlistDefVarIntKey}{vlistDefVarIntKey}} - -\begin{verbatim} - void vlistDefVarIntKey (int vlistID, int varID, const char *name, int value); -\end{verbatim} - -Set an arbitrary keyword/integer value pair for GRIB API. - - -\section*{\tt \htmlref{vlistDefVarLongname}{vlistDefVarLongname}} - -\begin{verbatim} - void vlistDefVarLongname (int vlistID, int varID, const char *longname); -\end{verbatim} - -Define the long name of a Variable. - - -\section*{\tt \htmlref{vlistDefVarMissval}{vlistDefVarMissval}} - -\begin{verbatim} - void vlistDefVarMissval (int vlistID, int varID, double missval); -\end{verbatim} - -Define the missing value of a Variable. - - -\section*{\tt \htmlref{vlistDefVarName}{vlistDefVarName}} - -\begin{verbatim} - void vlistDefVarName (int vlistID, int varID, const char *name); -\end{verbatim} - -Define the name of a Variable. - - -\section*{\tt \htmlref{vlistDefVarParam}{vlistDefVarParam}} - -\begin{verbatim} - void vlistDefVarParam (int vlistID, int varID, int param); -\end{verbatim} - -Define the parameter number of a Variable. - - -\section*{\tt \htmlref{vlistDefVarStdname}{vlistDefVarStdname}} - -\begin{verbatim} - void vlistDefVarStdname (int vlistID, int varID, const char *stdname); -\end{verbatim} - -Define the standard name of a Variable. - - -\section*{\tt \htmlref{vlistDefVarTiles}{vlistDefVarTiles}} - -\begin{verbatim} - int vlistDefVarTiles (int vlistID, int gridID, int zaxisID, int timetype, - int tilesetID); -\end{verbatim} - -Create a new tile-based variable. - - -\section*{\tt \htmlref{vlistDefVarUnits}{vlistDefVarUnits}} - -\begin{verbatim} - void vlistDefVarUnits (int vlistID, int varID, const char *units); -\end{verbatim} - -Define the units of a Variable. - - -\section*{\tt \htmlref{vlistDestroy}{vlistDestroy}} - -\begin{verbatim} - void vlistDestroy (int vlistID); -\end{verbatim} - -Destroy a variable list. - - -\section*{\tt \htmlref{vlistDuplicate}{vlistDuplicate}} - -\begin{verbatim} - int vlistDuplicate (int vlistID); -\end{verbatim} - -Duplicate a variable list. - - -\section*{\tt \htmlref{vlistHasVarKey}{vlistHasVarKey}} - -\begin{verbatim} - int vlistHasVarKey (int vlistID, int varID, const char *name); -\end{verbatim} - -returns 1 if meta-data key was read, 0 otherwise. - - -\section*{\tt \htmlref{vlistInqTaxis}{vlistInqTaxis}} - -\begin{verbatim} - int vlistInqTaxis (int vlistID); -\end{verbatim} - -Get the time axis of a variable list. - - -\section*{\tt \htmlref{vlistInqVarCode}{vlistInqVarCode}} - -\begin{verbatim} - int vlistInqVarCode (int vlistID, int varID); -\end{verbatim} - -Get the code number of a Variable. - - -\section*{\tt \htmlref{vlistInqVarDatatype}{vlistInqVarDatatype}} - -\begin{verbatim} - int vlistInqVarDatatype (int vlistID, int varID); -\end{verbatim} - -Get the data type of a Variable. - - -\section*{\tt \htmlref{vlistInqVarDblKey}{vlistInqVarDblKey}} - -\begin{verbatim} - double vlistInqVarDblKey (int vlistID, int varID, const char *name); -\end{verbatim} - -raw access to GRIB meta-data. - - -\section*{\tt \htmlref{vlistInqVarExtra}{vlistInqVarExtra}} - -\begin{verbatim} - void vlistInqVarExtra (int vlistID, int varID, char *extra); -\end{verbatim} - -Get extra information of a Variable. - - -\section*{\tt \htmlref{vlistInqVarIntKey}{vlistInqVarIntKey}} - -\begin{verbatim} - int vlistInqVarIntKey (int vlistID, int varID, const char *name); -\end{verbatim} - -raw access to GRIB meta-data. - - -\section*{\tt \htmlref{vlistInqVarLongname}{vlistInqVarLongname}} - -\begin{verbatim} - void vlistInqVarLongname (int vlistID, int varID, char *longname); -\end{verbatim} - -Get the long name of a Variable. - - -\section*{\tt \htmlref{vlistInqVarMissval}{vlistInqVarMissval}} - -\begin{verbatim} - double vlistInqVarMissval (int vlistID, int varID); -\end{verbatim} - -Get the missing value of a Variable. - - -\section*{\tt \htmlref{vlistInqVarName}{vlistInqVarName}} - -\begin{verbatim} - void vlistInqVarName (int vlistID, int varID, char *name); -\end{verbatim} - -Get the name of a Variable. - - -\section*{\tt \htmlref{vlistInqVarParam}{vlistInqVarParam}} - -\begin{verbatim} - int vlistInqVarParam (int vlistID, int varID); -\end{verbatim} - -Get the parameter number of a Variable. - - -\section*{\tt \htmlref{vlistInqVarStdname}{vlistInqVarStdname}} - -\begin{verbatim} - void vlistInqVarStdname (int vlistID, int varID, char *stdname); -\end{verbatim} - -Get the standard name of a Variable. - - -\section*{\tt \htmlref{vlistInqVarSubtype}{vlistInqVarSubtype}} - -\begin{verbatim} - int vlistInqVarSubtype (int vlistID, int varID); -\end{verbatim} - -Return subtype ID for a given variable. - - -\section*{\tt \htmlref{vlistInqVarTsteptype}{vlistInqVarTsteptype}} - -\begin{verbatim} - int vlistInqVarTsteptype (int vlistID, int varID); -\end{verbatim} - -Get the timestep type of a Variable. - - -\section*{\tt \htmlref{vlistInqVarUnits}{vlistInqVarUnits}} - -\begin{verbatim} - void vlistInqVarUnits (int vlistID, int varID, char *units); -\end{verbatim} - -Get the units of a Variable. - - -\section*{\tt \htmlref{vlistMerge}{vlistMerge}} - -\begin{verbatim} - void vlistMerge (int vlistID2, int vlistID1); -\end{verbatim} - -Merge two variable lists. - - -\section*{\tt \htmlref{vlistNgrids}{vlistNgrids}} - -\begin{verbatim} - int vlistNgrids (int vlistID); -\end{verbatim} - -Number of grids in a variable list. - - -\section*{\tt \htmlref{vlistNsubtypes}{vlistNsubtypes}} - -\begin{verbatim} - int vlistNsubtypes (int vlistID); -\end{verbatim} - -Number of subtypes in a variable list. - - -\section*{\tt \htmlref{vlistNumber}{vlistNumber}} - -\begin{verbatim} - int vlistNumber (int vlistID); -\end{verbatim} - -Number type in a variable list. - - -\section*{\tt \htmlref{vlistNvars}{vlistNvars}} - -\begin{verbatim} - int vlistNvars (int vlistID); -\end{verbatim} - -Number of variables in a variable list. - - -\section*{\tt \htmlref{vlistNzaxis}{vlistNzaxis}} - -\begin{verbatim} - int vlistNzaxis (int vlistID); -\end{verbatim} - -Number of zaxis in a variable list. - - -\section*{\tt \htmlref{zaxisCreate}{zaxisCreate}} - -\begin{verbatim} - int zaxisCreate (int zaxistype, int size); -\end{verbatim} - -Create a vertical Z-axis. - - -\section*{\tt \htmlref{zaxisDefLevel}{zaxisDefLevel}} - -\begin{verbatim} - void zaxisDefLevel (int zaxisID, int levelID, double levels); -\end{verbatim} - -Define one level of a Z-axis. - - -\section*{\tt \htmlref{zaxisDefLevels}{zaxisDefLevels}} - -\begin{verbatim} - void zaxisDefLevels (int zaxisID, const double levels[]); -\end{verbatim} - -Define the levels of a Z-axis. - - -\section*{\tt \htmlref{zaxisDefLongname}{zaxisDefLongname}} - -\begin{verbatim} - void zaxisDefLongname (int zaxisID, const char *longname_optional); -\end{verbatim} - -Define the longname of a Z-axis. - - -\section*{\tt \htmlref{zaxisDefName}{zaxisDefName}} - -\begin{verbatim} - void zaxisDefName (int zaxisID, const char *name_optional); -\end{verbatim} - -Define the name of a Z-axis. - - -\section*{\tt \htmlref{zaxisDefNlevRef}{zaxisDefNlevRef}} - -\begin{verbatim} - void zaxisDefNlevRef (int gridID, int nhlev); -\end{verbatim} - -Define the number of half levels of a generalized Z-axis. - - -\section*{\tt \htmlref{zaxisDefNumber}{zaxisDefNumber}} - -\begin{verbatim} - void zaxisDefNumber (int gridID, int number); -\end{verbatim} - -Define the reference number for a generalized Z-axis. - - -\section*{\tt \htmlref{zaxisDefUUID}{zaxisDefUUID}} - -\begin{verbatim} - void zaxisDefUUID (int zaxisID, const unsigned char uuid[CDI_UUID_SIZE]); -\end{verbatim} - -Define the UUID of a generalized Z-axis. - - -\section*{\tt \htmlref{zaxisDefUnits}{zaxisDefUnits}} - -\begin{verbatim} - void zaxisDefUnits (int zaxisID, const char *units_optional); -\end{verbatim} - -Define the units of a Z-axis. - - -\section*{\tt \htmlref{zaxisDestroy}{zaxisDestroy}} - -\begin{verbatim} - void zaxisDestroy (int zaxisID); -\end{verbatim} - -Destroy a vertical Z-axis. - - -\section*{\tt \htmlref{zaxisDuplicate}{zaxisDuplicate}} - -\begin{verbatim} - int zaxisDuplicate (int zaxisID); -\end{verbatim} - -Duplicate a Z-axis. - - -\section*{\tt \htmlref{zaxisInqCLen}{zaxisInqCLen}} - -\begin{verbatim} - int zaxisInqCLen (int zaxisID); -\end{verbatim} - -Get maximal string length of character Z-axis. - - -\section*{\tt \htmlref{zaxisInqLevel}{zaxisInqLevel}} - -\begin{verbatim} - double zaxisInqLevel (int zaxisID, int levelID); -\end{verbatim} - -Get one level of a Z-axis. - - -\section*{\tt \htmlref{zaxisInqLevels}{zaxisInqLevels}} - -\begin{verbatim} - int zaxisInqLevels (int zaxisID, double levels[]); -\end{verbatim} - -Get all levels of a Z-axis. - - -\section*{\tt \htmlref{zaxisInqLongname}{zaxisInqLongname}} - -\begin{verbatim} - void zaxisInqLongname (int zaxisID, char *longname); -\end{verbatim} - -Get the longname of a Z-axis. - - -\section*{\tt \htmlref{zaxisInqName}{zaxisInqName}} - -\begin{verbatim} - void zaxisInqName (int zaxisID, char *name); -\end{verbatim} - -Get the name of a Z-axis. - - -\section*{\tt \htmlref{zaxisInqNlevRef}{zaxisInqNlevRef}} - -\begin{verbatim} - int zaxisInqNlevRef (int gridID); -\end{verbatim} - -Get the number of half levels of a generalized Z-axis. - - -\section*{\tt \htmlref{zaxisInqNumber}{zaxisInqNumber}} - -\begin{verbatim} - int zaxisInqNumber (int gridID); -\end{verbatim} - -Get the reference number to a generalized Z-axis. - - -\section*{\tt \htmlref{zaxisInqSize}{zaxisInqSize}} - -\begin{verbatim} - int zaxisInqSize (int zaxisID); -\end{verbatim} - -Get the size of a Z-axis. - - -\section*{\tt \htmlref{zaxisInqStdname}{zaxisInqStdname}} - -\begin{verbatim} - void zaxisInqStdname (int zaxisID, char *stdname); -\end{verbatim} - -Get the standard name of a Z-axis. - - -\section*{\tt \htmlref{zaxisInqType}{zaxisInqType}} - -\begin{verbatim} - int zaxisInqType (int zaxisID); -\end{verbatim} - -Get the type of a Z-axis. - - -\section*{\tt \htmlref{zaxisInqUUID}{zaxisInqUUID}} - -\begin{verbatim} - void zaxisInqUUID (int zaxisID, unsigned char uuid[CDI_UUID_SIZE]); -\end{verbatim} - -Get the UUID of a generalized Z-axis. - - -\section*{\tt \htmlref{zaxisInqUnits}{zaxisInqUnits}} - -\begin{verbatim} - void zaxisInqUnits (int zaxisID, char *units); -\end{verbatim} - -Get the units of a Z-axis. - - diff --git a/doc/tex/cdi_cman.tex b/doc/tex/cdi_cman.tex index a0fed2f3d9e7146a3b5ba9111aa5eb2bdc2fb364..46b074f4edad3133c743d7ce31b6160484a256fd 100644 --- a/doc/tex/cdi_cman.tex +++ b/doc/tex/cdi_cman.tex @@ -47,6 +47,7 @@ \renewcommand{\headrulewidth}{0pt} } +\usepackage{html} \usepackage{exscale} \usepackage{array,colortbl} % color table @@ -135,7 +136,7 @@ \end{picture} \begin{flushright} -{\large\bfseries Climate Data Interface \\ Version 2.1.0 \\ October 2022} +{\large\bfseries Climate Data Interface \\ Version 2.2.0 \\ March 2023} \end{flushright} \vfill diff --git a/doc/tex/cdi_fman.tex b/doc/tex/cdi_fman.tex index 5e276b1fec360baa86c17b43566d3d1b79710d9d..8bbcd5326c3fe2a3eaa2b0c78c1ac7e9e8834aa9 100644 --- a/doc/tex/cdi_fman.tex +++ b/doc/tex/cdi_fman.tex @@ -45,6 +45,7 @@ \renewcommand{\headrulewidth}{0pt} } +\usepackage{html} \usepackage{exscale} \usepackage{array,colortbl} % color table @@ -132,7 +133,7 @@ \end{picture} \begin{flushright} -{\large\bfseries Climate Data Interface \\ Version 2.1.0 \\ October 2022} +{\large\bfseries Climate Data Interface \\ Version 2.2.0 \\ March 2023} \end{flushright} \vfill diff --git a/doc/tex/environment.tex b/doc/tex/environment.tex index ba6b8f0efc496fbf1b5915231c1e28f73560d62a..199f26825f986c9fa11e03f062d2804ad4905d82 100644 --- a/doc/tex/environment.tex +++ b/doc/tex/environment.tex @@ -11,9 +11,13 @@ The following table describes the environment variables that affect {\CDI}. %\cellcolor{pcolor2} {\bfseries Variable name} & {\bfseries Default} & {\bfseries Description} \\ \hline CDI\_CONVERT\_CUBESPHERE & 1 & Convert cubed-sphere data to unstructured grid. \\ +CDI\_CHUNK\_CACHE & 0 & Set the NetCDF4 chunk cache size. \\ +CDI\_CHUNK\_CACHE\_MAX & 0 & Set maximum chunk cache size. \\ CDI\_GRIB1\_TEMPLATE & None & Path to a GRIB1 template file for GRIB\_API. \\ CDI\_GRIB2\_TEMPLATE & None & Path to a GRIB2 template file for GRIB\_API. \\ CDI\_INVENTORY\_MODE & None & Set to time to skip double variable entries. \\ -CDI\_READ\_CELL\_CORNERS & 1 & Read grid cell corners. \\ +CDI\_QUERY\_ABORT & 1 & Abort if query entry not found \\ + CDI\_READ\_CELL\_CORNERS & 1 & Read grid cell corners. \\ +CDI\_SHUFFLE & 0 & Set shuffle option to NetCDF4 deflation compression. \\ CDI\_VERSION\_INFO & 1 & Set to 0 to disable NetCDF global attribute CDI. \end{tabular} diff --git a/doc/tex/f_quick_ref.tex b/doc/tex/f_quick_ref.tex deleted file mode 100644 index b44741069d603cdec19e356a0db7954428afa7be..0000000000000000000000000000000000000000 --- a/doc/tex/f_quick_ref.tex +++ /dev/null @@ -1,1586 +0,0 @@ -\chapter*{Quick Reference} -\addcontentsline{toc}{chapter}{Quick Reference} - -This appendix provide a brief listing of the Fortran language bindings of the CDI library routines: - -\section*{\tt \htmlref{cdiClearAdditionalKeys}{cdiClearAdditionalKeys}} - -\begin{verbatim} - SUBROUTINE cdiClearAdditionalKeys -\end{verbatim} - -Clear the list of additional GRIB keys. - - -\section*{\tt \htmlref{cdiDefAdditionalKey}{cdiDefAdditionalKey}} - -\begin{verbatim} - SUBROUTINE cdiDefAdditionalKey (CHARACTER*(*) string) -\end{verbatim} - -Register an additional GRIB key which is read when file is opened. - - -\section*{\tt \htmlref{cdiDefAttFlt}{cdiDefAttFlt}} - -\begin{verbatim} - INTEGER FUNCTION cdiDefAttFlt (INTEGER cdiID, INTEGER varID, CHARACTER*(*) name, - INTEGER type, INTEGER len, DOUBLEPRECISION dp(*)) -\end{verbatim} - -Define a floating point attribute. - - -\section*{\tt \htmlref{cdiDefAttInt}{cdiDefAttInt}} - -\begin{verbatim} - INTEGER FUNCTION cdiDefAttInt (INTEGER cdiID, INTEGER varID, CHARACTER*(*) name, - INTEGER type, INTEGER len, INTEGER ip(*)) -\end{verbatim} - -Define an integer attribute. - - -\section*{\tt \htmlref{cdiDefAttTxt}{cdiDefAttTxt}} - -\begin{verbatim} - INTEGER FUNCTION cdiDefAttTxt (INTEGER cdiID, INTEGER varID, CHARACTER*(*) name, - INTEGER len, CHARACTER*(*) tp_cbuf) -\end{verbatim} - -Define a text attribute. - - -\section*{\tt \htmlref{cdiDefKeyFloat}{cdiDefKeyFloat}} - -\begin{verbatim} - INTEGER FUNCTION cdiDefKeyFloat (INTEGER cdiID, INTEGER varID, INTEGER key, - DOUBLEPRECISION value) -\end{verbatim} - -Define a float value from a key. - - -\section*{\tt \htmlref{cdiDefKeyInt}{cdiDefKeyInt}} - -\begin{verbatim} - INTEGER FUNCTION cdiDefKeyInt (INTEGER cdiID, INTEGER varID, INTEGER key, - INTEGER value) -\end{verbatim} - -Define an integer value from a key. - - -\section*{\tt \htmlref{cdiDefKeyString}{cdiDefKeyString}} - -\begin{verbatim} - INTEGER FUNCTION cdiDefKeyString (INTEGER cdiID, INTEGER varID, INTEGER key, - CHARACTER*(*) string) -\end{verbatim} - -Define a string from a key. - - -\section*{\tt \htmlref{cdiInqAtt}{cdiInqAtt}} - -\begin{verbatim} - INTEGER FUNCTION cdiInqAtt (INTEGER cdiID, INTEGER varID, INTEGER attrnum, - CHARACTER*(*) name, INTEGER typep, INTEGER lenp) -\end{verbatim} - -Get information about an attribute. - - -\section*{\tt \htmlref{cdiInqAttFlt}{cdiInqAttFlt}} - -\begin{verbatim} - INTEGER FUNCTION cdiInqAttFlt (INTEGER cdiID, INTEGER varID, CHARACTER*(*) name, - INTEGER mlen, DOUBLEPRECISION dp(*)) -\end{verbatim} - -Get the value(s) of a floating point attribute. - - -\section*{\tt \htmlref{cdiInqAttInt}{cdiInqAttInt}} - -\begin{verbatim} - INTEGER FUNCTION cdiInqAttInt (INTEGER cdiID, INTEGER varID, CHARACTER*(*) name, - INTEGER mlen, INTEGER ip(*)) -\end{verbatim} - -Get the value(s) of an integer attribute. - - -\section*{\tt \htmlref{cdiInqAttTxt}{cdiInqAttTxt}} - -\begin{verbatim} - INTEGER FUNCTION cdiInqAttTxt (INTEGER cdiID, INTEGER varID, CHARACTER*(*) name, - INTEGER mlen, CHARACTER*(*) tp_cbuf) -\end{verbatim} - -Get the value(s) of a text attribute. - - -\section*{\tt \htmlref{cdiInqKeyInt}{cdiInqKeyInt}} - -\begin{verbatim} - INTEGER FUNCTION cdiInqKeyInt (INTEGER cdiID, INTEGER varID, INTEGER key, - INTEGER value) -\end{verbatim} - -Get an integer value from a key. - - -\section*{\tt \htmlref{cdiInqKeyLen}{cdiInqKeyLen}} - -\begin{verbatim} - INTEGER FUNCTION cdiInqKeyLen (INTEGER cdiID, INTEGER varID, INTEGER key, - INTEGER length) -\end{verbatim} - -Get the length of the string representation of the key. - - -\section*{\tt \htmlref{cdiInqKeyString}{cdiInqKeyString}} - -\begin{verbatim} - INTEGER FUNCTION cdiInqKeyString (INTEGER cdiID, INTEGER varID, INTEGER key, - CHARACTER*(*) string, INTEGER length) -\end{verbatim} - -Get a string from a key. - - -\section*{\tt \htmlref{cdiInqNatts}{cdiInqNatts}} - -\begin{verbatim} - INTEGER FUNCTION cdiInqNatts (INTEGER cdiID, INTEGER varID, INTEGER nattsp) -\end{verbatim} - -Get number of attributes assigned to this variable. - - -\section*{\tt \htmlref{gridCreate}{gridCreate}} - -\begin{verbatim} - INTEGER FUNCTION gridCreate (INTEGER gridtype, INTEGER size) -\end{verbatim} - -Create a horizontal Grid. - - -\section*{\tt \htmlref{gridDefNP}{gridDefNP}} - -\begin{verbatim} - SUBROUTINE gridDefNP (INTEGER gridID, INTEGER np) -\end{verbatim} - -Define the number of parallels between a pole and the equator. - - -\section*{\tt \htmlref{gridDefNumber}{gridDefNumber}} - -\begin{verbatim} - SUBROUTINE gridDefNumber (INTEGER gridID, INTEGER number) -\end{verbatim} - -Define the reference number for an unstructured grid. - - -\section*{\tt \htmlref{gridDefNvertex}{gridDefNvertex}} - -\begin{verbatim} - SUBROUTINE gridDefNvertex (INTEGER gridID, INTEGER nvertex) -\end{verbatim} - -Define the number of vertex of a Gridbox. - - -\section*{\tt \htmlref{gridDefPosition}{gridDefPosition}} - -\begin{verbatim} - SUBROUTINE gridDefPosition (INTEGER gridID, INTEGER position) -\end{verbatim} - -Define the position of grid in the reference file. - - -\section*{\tt \htmlref{gridDefProj}{gridDefProj}} - -\begin{verbatim} - SUBROUTINE gridDefProj (INTEGER gridID, INTEGER projID) -\end{verbatim} - -Define the projection ID of a Grid. - - -\section*{\tt \htmlref{gridDefReference}{gridDefReference}} - -\begin{verbatim} - SUBROUTINE gridDefReference (INTEGER gridID, CHARACTER*(*) reference) -\end{verbatim} - -Define the reference URI for an unstructured grid. - - -\section*{\tt \htmlref{gridDefUUID}{gridDefUUID}} - -\begin{verbatim} - SUBROUTINE gridDefUUID (INTEGER gridID, INTEGER*1(16) uuid) -\end{verbatim} - -Define the UUID of an unstructured grid. - - -\section*{\tt \htmlref{gridDefXbounds}{gridDefXbounds}} - -\begin{verbatim} - SUBROUTINE gridDefXbounds (INTEGER gridID, DOUBLEPRECISION xbounds(*)) -\end{verbatim} - -Define the bounds of a X-axis. - - -\section*{\tt \htmlref{gridDefXlongname}{gridDefXlongname}} - -\begin{verbatim} - SUBROUTINE gridDefXlongname (INTEGER gridID, CHARACTER*(*) xlongname) -\end{verbatim} - -Define the longname of a X-axis. - - -\section*{\tt \htmlref{gridDefXname}{gridDefXname}} - -\begin{verbatim} - SUBROUTINE gridDefXname (INTEGER gridID, CHARACTER*(*) xname) -\end{verbatim} - -Define the name of a X-axis. - - -\section*{\tt \htmlref{gridDefXsize}{gridDefXsize}} - -\begin{verbatim} - SUBROUTINE gridDefXsize (INTEGER gridID, INTEGER xsize) -\end{verbatim} - -Define the size of a X-axis. - - -\section*{\tt \htmlref{gridDefXunits}{gridDefXunits}} - -\begin{verbatim} - SUBROUTINE gridDefXunits (INTEGER gridID, CHARACTER*(*) xunits) -\end{verbatim} - -Define the units of a X-axis. - - -\section*{\tt \htmlref{gridDefXvals}{gridDefXvals}} - -\begin{verbatim} - SUBROUTINE gridDefXvals (INTEGER gridID, DOUBLEPRECISION xvals(*)) -\end{verbatim} - -Define the values of a X-axis. - - -\section*{\tt \htmlref{gridDefYbounds}{gridDefYbounds}} - -\begin{verbatim} - SUBROUTINE gridDefYbounds (INTEGER gridID, DOUBLEPRECISION ybounds(*)) -\end{verbatim} - -Define the bounds of a Y-axis. - - -\section*{\tt \htmlref{gridDefYlongname}{gridDefYlongname}} - -\begin{verbatim} - SUBROUTINE gridDefYlongname (INTEGER gridID, CHARACTER*(*) ylongname) -\end{verbatim} - -Define the longname of a Y-axis. - - -\section*{\tt \htmlref{gridDefYname}{gridDefYname}} - -\begin{verbatim} - SUBROUTINE gridDefYname (INTEGER gridID, CHARACTER*(*) yname) -\end{verbatim} - -Define the name of a Y-axis. - - -\section*{\tt \htmlref{gridDefYsize}{gridDefYsize}} - -\begin{verbatim} - SUBROUTINE gridDefYsize (INTEGER gridID, INTEGER ysize) -\end{verbatim} - -Define the size of a Y-axis. - - -\section*{\tt \htmlref{gridDefYunits}{gridDefYunits}} - -\begin{verbatim} - SUBROUTINE gridDefYunits (INTEGER gridID, CHARACTER*(*) yunits) -\end{verbatim} - -Define the units of a Y-axis. - - -\section*{\tt \htmlref{gridDefYvals}{gridDefYvals}} - -\begin{verbatim} - SUBROUTINE gridDefYvals (INTEGER gridID, DOUBLEPRECISION yvals(*)) -\end{verbatim} - -Define the values of a Y-axis. - - -\section*{\tt \htmlref{gridDestroy}{gridDestroy}} - -\begin{verbatim} - SUBROUTINE gridDestroy (INTEGER gridID) -\end{verbatim} - -Destroy a horizontal Grid. - - -\section*{\tt \htmlref{gridDuplicate}{gridDuplicate}} - -\begin{verbatim} - INTEGER FUNCTION gridDuplicate (INTEGER gridID) -\end{verbatim} - -Duplicate a Grid. - - -\section*{\tt \htmlref{gridInqNP}{gridInqNP}} - -\begin{verbatim} - INTEGER FUNCTION gridInqNP (INTEGER gridID) -\end{verbatim} - -Get the number of parallels between a pole and the equator. - - -\section*{\tt \htmlref{gridInqNumber}{gridInqNumber}} - -\begin{verbatim} - INTEGER FUNCTION gridInqNumber (INTEGER gridID) -\end{verbatim} - -Get the reference number to an unstructured grid. - - -\section*{\tt \htmlref{gridInqNvertex}{gridInqNvertex}} - -\begin{verbatim} - INTEGER FUNCTION gridInqNvertex (INTEGER gridID) -\end{verbatim} - -Get the number of vertex of a Gridbox. - - -\section*{\tt \htmlref{gridInqPosition}{gridInqPosition}} - -\begin{verbatim} - INTEGER FUNCTION gridInqPosition (INTEGER gridID) -\end{verbatim} - -Get the position of grid in the reference file. - - -\section*{\tt \htmlref{gridInqProj}{gridInqProj}} - -\begin{verbatim} - INTEGER FUNCTION gridInqProj (INTEGER gridID) -\end{verbatim} - -Get the projection ID of a Grid. - - -\section*{\tt \htmlref{gridInqProjType}{gridInqProjType}} - -\begin{verbatim} - INTEGER FUNCTION gridInqProjType (INTEGER gridID) -\end{verbatim} - -Get the projection type. - - -\section*{\tt \htmlref{gridInqReference}{gridInqReference}} - -\begin{verbatim} - INTEGER FUNCTION gridInqReference (INTEGER gridID, CHARACTER*(*) reference) -\end{verbatim} - -Get the reference URI to an unstructured grid. - - -\section*{\tt \htmlref{gridInqSize}{gridInqSize}} - -\begin{verbatim} - INTEGER FUNCTION gridInqSize (INTEGER gridID) -\end{verbatim} - -Get the size of a Grid. - - -\section*{\tt \htmlref{gridInqType}{gridInqType}} - -\begin{verbatim} - INTEGER FUNCTION gridInqType (INTEGER gridID) -\end{verbatim} - -Get the type of a Grid. - - -\section*{\tt \htmlref{gridInqUUID}{gridInqUUID}} - -\begin{verbatim} - SUBROUTINE gridInqUUID (INTEGER gridID, INTEGER*1(16) uuid) -\end{verbatim} - -Get the UUID of an unstructured grid. - - -\section*{\tt \htmlref{gridInqXIsc}{gridInqXIsc}} - -\begin{verbatim} - INTEGER FUNCTION gridInqXIsc (INTEGER gridID) -\end{verbatim} - -Find out whether X-coordinate is of type CHAR. - - -\section*{\tt \htmlref{gridInqXbounds}{gridInqXbounds}} - -\begin{verbatim} - INTEGER FUNCTION gridInqXbounds (INTEGER gridID, DOUBLEPRECISION xbounds(*)) -\end{verbatim} - -Get the bounds of a X-axis. - - -\section*{\tt \htmlref{gridInqXlongname}{gridInqXlongname}} - -\begin{verbatim} - SUBROUTINE gridInqXlongname (INTEGER gridID, CHARACTER*(*) xlongname) -\end{verbatim} - -Get the longname of a X-axis. - - -\section*{\tt \htmlref{gridInqXname}{gridInqXname}} - -\begin{verbatim} - SUBROUTINE gridInqXname (INTEGER gridID, CHARACTER*(*) xname) -\end{verbatim} - -Get the name of a X-axis. - - -\section*{\tt \htmlref{gridInqXsize}{gridInqXsize}} - -\begin{verbatim} - INTEGER FUNCTION gridInqXsize (INTEGER gridID) -\end{verbatim} - -Get the size of a X-axis. - - -\section*{\tt \htmlref{gridInqXunits}{gridInqXunits}} - -\begin{verbatim} - SUBROUTINE gridInqXunits (INTEGER gridID, CHARACTER*(*) xunits) -\end{verbatim} - -Get the units of a X-axis. - - -\section*{\tt \htmlref{gridInqXval}{gridInqXval}} - -\begin{verbatim} - DOUBLEPRECISION FUNCTION gridInqXval (INTEGER gridID, INTEGER index) -\end{verbatim} - -Get one value of a X-axis. - - -\section*{\tt \htmlref{gridInqXvals}{gridInqXvals}} - -\begin{verbatim} - INTEGER FUNCTION gridInqXvals (INTEGER gridID, DOUBLEPRECISION xvals(*)) -\end{verbatim} - -Get all values of a X-axis. - - -\section*{\tt \htmlref{gridInqYIsc}{gridInqYIsc}} - -\begin{verbatim} - INTEGER FUNCTION gridInqYIsc (INTEGER gridID) -\end{verbatim} - -Find out whether Y-coordinate is of type CHAR. - - -\section*{\tt \htmlref{gridInqYbounds}{gridInqYbounds}} - -\begin{verbatim} - INTEGER FUNCTION gridInqYbounds (INTEGER gridID, DOUBLEPRECISION ybounds(*)) -\end{verbatim} - -Get the bounds of a Y-axis. - - -\section*{\tt \htmlref{gridInqYlongname}{gridInqYlongname}} - -\begin{verbatim} - SUBROUTINE gridInqYlongname (INTEGER gridID, CHARACTER*(*) ylongname) -\end{verbatim} - -Get the longname of a Y-axis. - - -\section*{\tt \htmlref{gridInqYname}{gridInqYname}} - -\begin{verbatim} - SUBROUTINE gridInqYname (INTEGER gridID, CHARACTER*(*) yname) -\end{verbatim} - -Get the name of a Y-axis. - - -\section*{\tt \htmlref{gridInqYsize}{gridInqYsize}} - -\begin{verbatim} - INTEGER FUNCTION gridInqYsize (INTEGER gridID) -\end{verbatim} - -Get the size of a Y-axis. - - -\section*{\tt \htmlref{gridInqYunits}{gridInqYunits}} - -\begin{verbatim} - SUBROUTINE gridInqYunits (INTEGER gridID, CHARACTER*(*) yunits) -\end{verbatim} - -Get the units of a Y-axis. - - -\section*{\tt \htmlref{gridInqYval}{gridInqYval}} - -\begin{verbatim} - DOUBLEPRECISION FUNCTION gridInqYval (INTEGER gridID, INTEGER index) -\end{verbatim} - -Get one value of a Y-axis. - - -\section*{\tt \htmlref{gridInqYvals}{gridInqYvals}} - -\begin{verbatim} - INTEGER FUNCTION gridInqYvals (INTEGER gridID, DOUBLEPRECISION yvals(*)) -\end{verbatim} - -Get all values of a Y-axis. - - -\section*{\tt \htmlref{streamClose}{streamClose}} - -\begin{verbatim} - SUBROUTINE streamClose (INTEGER streamID) -\end{verbatim} - -Close an open dataset. - - -\section*{\tt \htmlref{streamDefByteorder}{streamDefByteorder}} - -\begin{verbatim} - SUBROUTINE streamDefByteorder (INTEGER streamID, INTEGER byteorder) -\end{verbatim} - -Define the byteorder. - - -\section*{\tt \htmlref{streamDefCompLevel}{streamDefCompLevel}} - -\begin{verbatim} - SUBROUTINE streamDefCompLevel (INTEGER streamID, INTEGER complevel) -\end{verbatim} - -Define compression level. - - -\section*{\tt \htmlref{streamDefCompType}{streamDefCompType}} - -\begin{verbatim} - SUBROUTINE streamDefCompType (INTEGER streamID, INTEGER comptype) -\end{verbatim} - -Define compression type. - - -\section*{\tt \htmlref{streamDefTimestep}{streamDefTimestep}} - -\begin{verbatim} - INTEGER FUNCTION streamDefTimestep (INTEGER streamID, INTEGER tsID) -\end{verbatim} - -Define time step. - - -\section*{\tt \htmlref{streamDefVlist}{streamDefVlist}} - -\begin{verbatim} - SUBROUTINE streamDefVlist (INTEGER streamID, INTEGER vlistID) -\end{verbatim} - -Define the Vlist for a stream. - - -\section*{\tt \htmlref{streamInqByteorder}{streamInqByteorder}} - -\begin{verbatim} - INTEGER FUNCTION streamInqByteorder (INTEGER streamID) -\end{verbatim} - -Get the byteorder. - - -\section*{\tt \htmlref{streamInqCompLevel}{streamInqCompLevel}} - -\begin{verbatim} - INTEGER FUNCTION streamInqCompLevel (INTEGER streamID) -\end{verbatim} - -Get compression level. - - -\section*{\tt \htmlref{streamInqCompType}{streamInqCompType}} - -\begin{verbatim} - INTEGER FUNCTION streamInqCompType (INTEGER streamID) -\end{verbatim} - -Get compression type. - - -\section*{\tt \htmlref{streamInqFiletype}{streamInqFiletype}} - -\begin{verbatim} - INTEGER FUNCTION streamInqFiletype (INTEGER streamID) -\end{verbatim} - -Get the filetype. - - -\section*{\tt \htmlref{streamInqTimestep}{streamInqTimestep}} - -\begin{verbatim} - INTEGER FUNCTION streamInqTimestep (INTEGER streamID, INTEGER tsID) -\end{verbatim} - -Get time step. - - -\section*{\tt \htmlref{streamInqVlist}{streamInqVlist}} - -\begin{verbatim} - INTEGER FUNCTION streamInqVlist (INTEGER streamID) -\end{verbatim} - -Get the Vlist of a stream. - - -\section*{\tt \htmlref{streamOpenRead}{streamOpenRead}} - -\begin{verbatim} - INTEGER FUNCTION streamOpenRead (CHARACTER*(*) path) -\end{verbatim} - -Open a dataset for reading. - - -\section*{\tt \htmlref{streamOpenWrite}{streamOpenWrite}} - -\begin{verbatim} - INTEGER FUNCTION streamOpenWrite (CHARACTER*(*) path, INTEGER filetype) -\end{verbatim} - -Create a new dataset. - - -\section*{\tt \htmlref{streamReadVar}{streamReadVar}} - -\begin{verbatim} - SUBROUTINE streamReadVar (INTEGER streamID, INTEGER varID, - DOUBLEPRECISION data(*), INTEGER nmiss) -\end{verbatim} - -Read a variable. - - -\section*{\tt \htmlref{streamReadVarSlice}{streamReadVarSlice}} - -\begin{verbatim} - SUBROUTINE streamReadVarSlice (INTEGER streamID, INTEGER varID, INTEGER levelID, - DOUBLEPRECISION data(*), INTEGER nmiss) -\end{verbatim} - -Read a horizontal slice of a variable. - - -\section*{\tt \htmlref{streamSync}{streamSync}} - -\begin{verbatim} - SUBROUTINE streamSync (INTEGER streamID) -\end{verbatim} - -Synchronize an Open Dataset to Disk. - - -\section*{\tt \htmlref{streamWriteVar}{streamWriteVar}} - -\begin{verbatim} - SUBROUTINE streamWriteVar (INTEGER streamID, INTEGER varID, - DOUBLEPRECISION data(*), INTEGER nmiss) -\end{verbatim} - -Write a variable. - - -\section*{\tt \htmlref{streamWriteVarSlice}{streamWriteVarSlice}} - -\begin{verbatim} - SUBROUTINE streamWriteVarSlice (INTEGER streamID, INTEGER varID, INTEGER levelID, - DOUBLEPRECISION data(*), INTEGER nmiss) -\end{verbatim} - -Write a horizontal slice of a variable. - - -\section*{\tt \htmlref{subtypeCreate}{subtypeCreate}} - -\begin{verbatim} - INTEGER FUNCTION subtypeCreate (INTEGER subtype) -\end{verbatim} - -Create a variable subtype. - - -\section*{\tt \htmlref{subtypeDefActiveIndex}{subtypeDefActiveIndex}} - -\begin{verbatim} - SUBROUTINE subtypeDefActiveIndex (INTEGER subtypeID, INTEGER index) -\end{verbatim} - -Set the currently active index of a subtype (e.g. current tile index). - - -\section*{\tt \htmlref{subtypeInqActiveIndex}{subtypeInqActiveIndex}} - -\begin{verbatim} - INTEGER FUNCTION subtypeInqActiveIndex (INTEGER subtypeID) -\end{verbatim} - -Get the currently active index of a subtype (e.g. current tile index). - - -\section*{\tt \htmlref{subtypeInqAttribute}{subtypeInqAttribute}} - -\begin{verbatim} - INTEGER FUNCTION subtypeInqAttribute (INTEGER subtypeID, INTEGER index, - CHARACTER*(*) key, INTEGER outValue) -\end{verbatim} - -Inquire the value of a subtype attribute. Returns CDI_EINVAL if the attribute does not exist.. - - -\section*{\tt \htmlref{subtypeInqSize}{subtypeInqSize}} - -\begin{verbatim} - INTEGER FUNCTION subtypeInqSize (INTEGER subtypeID) -\end{verbatim} - -Get the size of a subtype (e.g. no. of tiles). - - -\section*{\tt \htmlref{subtypeInqTile}{subtypeInqTile}} - -\begin{verbatim} - INTEGER FUNCTION subtypeInqTile (INTEGER subtypeID, INTEGER tileindex, - INTEGER attribute) -\end{verbatim} - -Specialized version of subtypeInqSubEntry looking for tile/attribute pair. - - -\section*{\tt \htmlref{tableRead}{tableRead}} - -\begin{verbatim} - INTEGER FUNCTION tableRead (CHARACTER*(*) tablefile) -\end{verbatim} - -read table of parameters from file in tabular format. - - -\section*{\tt \htmlref{tableWrite}{tableWrite}} - -\begin{verbatim} - SUBROUTINE tableWrite (CHARACTER*(*) filename, INTEGER tableID) -\end{verbatim} - -write table of parameters to file in tabular format. - - -\section*{\tt \htmlref{taxisCreate}{taxisCreate}} - -\begin{verbatim} - INTEGER FUNCTION taxisCreate (INTEGER taxistype) -\end{verbatim} - -Create a Time axis. - - -\section*{\tt \htmlref{taxisDefCalendar}{taxisDefCalendar}} - -\begin{verbatim} - SUBROUTINE taxisDefCalendar (INTEGER taxisID, INTEGER calendar) -\end{verbatim} - -Define the calendar. - - -\section*{\tt \htmlref{taxisDefFdate}{taxisDefFdate}} - -\begin{verbatim} - SUBROUTINE taxisDefFdate (INTEGER taxisID, INTEGER date) -\end{verbatim} - -Define the forecast reference date. - - -\section*{\tt \htmlref{taxisDefFtime}{taxisDefFtime}} - -\begin{verbatim} - SUBROUTINE taxisDefFtime (INTEGER taxisID, INTEGER time) -\end{verbatim} - -Define the forecast reference time. - - -\section*{\tt \htmlref{taxisDefRdate}{taxisDefRdate}} - -\begin{verbatim} - SUBROUTINE taxisDefRdate (INTEGER taxisID, INTEGER date) -\end{verbatim} - -Define the reference date. - - -\section*{\tt \htmlref{taxisDefRtime}{taxisDefRtime}} - -\begin{verbatim} - SUBROUTINE taxisDefRtime (INTEGER taxisID, INTEGER time) -\end{verbatim} - -Define the reference time. - - -\section*{\tt \htmlref{taxisDefVdate}{taxisDefVdate}} - -\begin{verbatim} - SUBROUTINE taxisDefVdate (INTEGER taxisID, INTEGER date) -\end{verbatim} - -Define the verification date. - - -\section*{\tt \htmlref{taxisDefVtime}{taxisDefVtime}} - -\begin{verbatim} - SUBROUTINE taxisDefVtime (INTEGER taxisID, INTEGER time) -\end{verbatim} - -Define the verification time. - - -\section*{\tt \htmlref{taxisDestroy}{taxisDestroy}} - -\begin{verbatim} - SUBROUTINE taxisDestroy (INTEGER taxisID) -\end{verbatim} - -Destroy a Time axis. - - -\section*{\tt \htmlref{taxisInqCalendar}{taxisInqCalendar}} - -\begin{verbatim} - INTEGER FUNCTION taxisInqCalendar (INTEGER taxisID) -\end{verbatim} - -Get the calendar. - - -\section*{\tt \htmlref{taxisInqFdate}{taxisInqFdate}} - -\begin{verbatim} - INTEGER FUNCTION taxisInqFdate (INTEGER taxisID) -\end{verbatim} - -Get the forecast reference date. - - -\section*{\tt \htmlref{taxisInqFtime}{taxisInqFtime}} - -\begin{verbatim} - INTEGER FUNCTION taxisInqFtime (INTEGER taxisID) -\end{verbatim} - -Get the forecast reference time. - - -\section*{\tt \htmlref{taxisInqRdate}{taxisInqRdate}} - -\begin{verbatim} - INTEGER FUNCTION taxisInqRdate (INTEGER taxisID) -\end{verbatim} - -Get the reference date. - - -\section*{\tt \htmlref{taxisInqRtime}{taxisInqRtime}} - -\begin{verbatim} - INTEGER FUNCTION taxisInqRtime (INTEGER taxisID) -\end{verbatim} - -Get the reference time. - - -\section*{\tt \htmlref{taxisInqVdate}{taxisInqVdate}} - -\begin{verbatim} - INTEGER FUNCTION taxisInqVdate (INTEGER taxisID) -\end{verbatim} - -Get the verification date. - - -\section*{\tt \htmlref{taxisInqVtime}{taxisInqVtime}} - -\begin{verbatim} - INTEGER FUNCTION taxisInqVtime (INTEGER taxisID) -\end{verbatim} - -Get the verification time. - - -\section*{\tt \htmlref{vlistCat}{vlistCat}} - -\begin{verbatim} - SUBROUTINE vlistCat (INTEGER vlistID2, INTEGER vlistID1) -\end{verbatim} - -Concatenate two variable lists. - - -\section*{\tt \htmlref{vlistCopy}{vlistCopy}} - -\begin{verbatim} - SUBROUTINE vlistCopy (INTEGER vlistID2, INTEGER vlistID1) -\end{verbatim} - -Copy a variable list. - - -\section*{\tt \htmlref{vlistCopyFlag}{vlistCopyFlag}} - -\begin{verbatim} - SUBROUTINE vlistCopyFlag (INTEGER vlistID2, INTEGER vlistID1) -\end{verbatim} - -Copy some entries of a variable list. - - -\section*{\tt \htmlref{vlistCopyVarName}{vlistCopyVarName}} - -\begin{verbatim} - CHARACTER(80) FUNCTION vlistCopyVarName (INTEGER vlistId, INTEGER varId) -\end{verbatim} - -Safe and convenient version of vlistInqVarName. - - -\section*{\tt \htmlref{vlistCreate}{vlistCreate}} - -\begin{verbatim} - INTEGER FUNCTION vlistCreate -\end{verbatim} - -Create a variable list. - - -\section*{\tt \htmlref{vlistDefTaxis}{vlistDefTaxis}} - -\begin{verbatim} - SUBROUTINE vlistDefTaxis (INTEGER vlistID, INTEGER taxisID) -\end{verbatim} - -Define the time axis of a variable list. - - -\section*{\tt \htmlref{vlistDefVar}{vlistDefVar}} - -\begin{verbatim} - INTEGER FUNCTION vlistDefVar (INTEGER vlistID, INTEGER gridID, INTEGER zaxisID, - INTEGER timetype) -\end{verbatim} - -Create a new variable. - - -\section*{\tt \htmlref{vlistDefVarCode}{vlistDefVarCode}} - -\begin{verbatim} - SUBROUTINE vlistDefVarCode (INTEGER vlistID, INTEGER varID, INTEGER code) -\end{verbatim} - -Define the code number of a Variable. - - -\section*{\tt \htmlref{vlistDefVarDatatype}{vlistDefVarDatatype}} - -\begin{verbatim} - SUBROUTINE vlistDefVarDatatype (INTEGER vlistID, INTEGER varID, INTEGER datatype) -\end{verbatim} - -Define the data type of a Variable. - - -\section*{\tt \htmlref{vlistDefVarDblKey}{vlistDefVarDblKey}} - -\begin{verbatim} - SUBROUTINE vlistDefVarDblKey (INTEGER vlistID, INTEGER varID, CHARACTER*(*) name, - DOUBLEPRECISION value) -\end{verbatim} - -Set an arbitrary keyword/double value pair for GRIB API. - - -\section*{\tt \htmlref{vlistDefVarExtra}{vlistDefVarExtra}} - -\begin{verbatim} - SUBROUTINE vlistDefVarExtra (INTEGER vlistID, INTEGER varID, CHARACTER*(*) extra) -\end{verbatim} - -Define extra information of a Variable. - - -\section*{\tt \htmlref{vlistDefVarIntKey}{vlistDefVarIntKey}} - -\begin{verbatim} - SUBROUTINE vlistDefVarIntKey (INTEGER vlistID, INTEGER varID, CHARACTER*(*) name, - INTEGER value) -\end{verbatim} - -Set an arbitrary keyword/integer value pair for GRIB API. - - -\section*{\tt \htmlref{vlistDefVarLongname}{vlistDefVarLongname}} - -\begin{verbatim} - SUBROUTINE vlistDefVarLongname (INTEGER vlistID, INTEGER varID, - CHARACTER*(*) longname) -\end{verbatim} - -Define the long name of a Variable. - - -\section*{\tt \htmlref{vlistDefVarMissval}{vlistDefVarMissval}} - -\begin{verbatim} - SUBROUTINE vlistDefVarMissval (INTEGER vlistID, INTEGER varID, - DOUBLEPRECISION missval) -\end{verbatim} - -Define the missing value of a Variable. - - -\section*{\tt \htmlref{vlistDefVarName}{vlistDefVarName}} - -\begin{verbatim} - SUBROUTINE vlistDefVarName (INTEGER vlistID, INTEGER varID, CHARACTER*(*) name) -\end{verbatim} - -Define the name of a Variable. - - -\section*{\tt \htmlref{vlistDefVarParam}{vlistDefVarParam}} - -\begin{verbatim} - SUBROUTINE vlistDefVarParam (INTEGER vlistID, INTEGER varID, INTEGER param) -\end{verbatim} - -Define the parameter number of a Variable. - - -\section*{\tt \htmlref{vlistDefVarStdname}{vlistDefVarStdname}} - -\begin{verbatim} - SUBROUTINE vlistDefVarStdname (INTEGER vlistID, INTEGER varID, - CHARACTER*(*) stdname) -\end{verbatim} - -Define the standard name of a Variable. - - -\section*{\tt \htmlref{vlistDefVarTiles}{vlistDefVarTiles}} - -\begin{verbatim} - INTEGER FUNCTION vlistDefVarTiles (INTEGER vlistID, INTEGER gridID, - INTEGER zaxisID, INTEGER timetype, - INTEGER tilesetID) -\end{verbatim} - -Create a new tile-based variable. - - -\section*{\tt \htmlref{vlistDefVarUnits}{vlistDefVarUnits}} - -\begin{verbatim} - SUBROUTINE vlistDefVarUnits (INTEGER vlistID, INTEGER varID, CHARACTER*(*) units) -\end{verbatim} - -Define the units of a Variable. - - -\section*{\tt \htmlref{vlistDestroy}{vlistDestroy}} - -\begin{verbatim} - SUBROUTINE vlistDestroy (INTEGER vlistID) -\end{verbatim} - -Destroy a variable list. - - -\section*{\tt \htmlref{vlistDuplicate}{vlistDuplicate}} - -\begin{verbatim} - INTEGER FUNCTION vlistDuplicate (INTEGER vlistID) -\end{verbatim} - -Duplicate a variable list. - - -\section*{\tt \htmlref{vlistHasVarKey}{vlistHasVarKey}} - -\begin{verbatim} - INTEGER FUNCTION vlistHasVarKey (INTEGER vlistID, INTEGER varID, - CHARACTER*(*) name) -\end{verbatim} - -returns 1 if meta-data key was read, 0 otherwise. - - -\section*{\tt \htmlref{vlistInqTaxis}{vlistInqTaxis}} - -\begin{verbatim} - INTEGER FUNCTION vlistInqTaxis (INTEGER vlistID) -\end{verbatim} - -Get the time axis of a variable list. - - -\section*{\tt \htmlref{vlistInqVarCode}{vlistInqVarCode}} - -\begin{verbatim} - INTEGER FUNCTION vlistInqVarCode (INTEGER vlistID, INTEGER varID) -\end{verbatim} - -Get the code number of a Variable. - - -\section*{\tt \htmlref{vlistInqVarDatatype}{vlistInqVarDatatype}} - -\begin{verbatim} - INTEGER FUNCTION vlistInqVarDatatype (INTEGER vlistID, INTEGER varID) -\end{verbatim} - -Get the data type of a Variable. - - -\section*{\tt \htmlref{vlistInqVarDblKey}{vlistInqVarDblKey}} - -\begin{verbatim} - DOUBLEPRECISION FUNCTION vlistInqVarDblKey (INTEGER vlistID, INTEGER varID, - CHARACTER*(*) name) -\end{verbatim} - -raw access to GRIB meta-data. - - -\section*{\tt \htmlref{vlistInqVarExtra}{vlistInqVarExtra}} - -\begin{verbatim} - SUBROUTINE vlistInqVarExtra (INTEGER vlistID, INTEGER varID, CHARACTER*(*) extra) -\end{verbatim} - -Get extra information of a Variable. - - -\section*{\tt \htmlref{vlistInqVarIntKey}{vlistInqVarIntKey}} - -\begin{verbatim} - INTEGER FUNCTION vlistInqVarIntKey (INTEGER vlistID, INTEGER varID, - CHARACTER*(*) name) -\end{verbatim} - -raw access to GRIB meta-data. - - -\section*{\tt \htmlref{vlistInqVarLongname}{vlistInqVarLongname}} - -\begin{verbatim} - SUBROUTINE vlistInqVarLongname (INTEGER vlistID, INTEGER varID, - CHARACTER*(*) longname) -\end{verbatim} - -Get the long name of a Variable. - - -\section*{\tt \htmlref{vlistInqVarMissval}{vlistInqVarMissval}} - -\begin{verbatim} - DOUBLEPRECISION FUNCTION vlistInqVarMissval (INTEGER vlistID, INTEGER varID) -\end{verbatim} - -Get the missing value of a Variable. - - -\section*{\tt \htmlref{vlistInqVarName}{vlistInqVarName}} - -\begin{verbatim} - SUBROUTINE vlistInqVarName (INTEGER vlistID, INTEGER varID, CHARACTER*(*) name) -\end{verbatim} - -Get the name of a Variable. - - -\section*{\tt \htmlref{vlistInqVarParam}{vlistInqVarParam}} - -\begin{verbatim} - INTEGER FUNCTION vlistInqVarParam (INTEGER vlistID, INTEGER varID) -\end{verbatim} - -Get the parameter number of a Variable. - - -\section*{\tt \htmlref{vlistInqVarStdname}{vlistInqVarStdname}} - -\begin{verbatim} - SUBROUTINE vlistInqVarStdname (INTEGER vlistID, INTEGER varID, - CHARACTER*(*) stdname) -\end{verbatim} - -Get the standard name of a Variable. - - -\section*{\tt \htmlref{vlistInqVarSubtype}{vlistInqVarSubtype}} - -\begin{verbatim} - INTEGER FUNCTION vlistInqVarSubtype (INTEGER vlistID, INTEGER varID) -\end{verbatim} - -Return subtype ID for a given variable. - - -\section*{\tt \htmlref{vlistInqVarTsteptype}{vlistInqVarTsteptype}} - -\begin{verbatim} - INTEGER FUNCTION vlistInqVarTsteptype (INTEGER vlistID, INTEGER varID) -\end{verbatim} - -Get the timestep type of a Variable. - - -\section*{\tt \htmlref{vlistInqVarUnits}{vlistInqVarUnits}} - -\begin{verbatim} - SUBROUTINE vlistInqVarUnits (INTEGER vlistID, INTEGER varID, CHARACTER*(*) units) -\end{verbatim} - -Get the units of a Variable. - - -\section*{\tt \htmlref{vlistMerge}{vlistMerge}} - -\begin{verbatim} - SUBROUTINE vlistMerge (INTEGER vlistID2, INTEGER vlistID1) -\end{verbatim} - -Merge two variable lists. - - -\section*{\tt \htmlref{vlistNgrids}{vlistNgrids}} - -\begin{verbatim} - INTEGER FUNCTION vlistNgrids (INTEGER vlistID) -\end{verbatim} - -Number of grids in a variable list. - - -\section*{\tt \htmlref{vlistNsubtypes}{vlistNsubtypes}} - -\begin{verbatim} - INTEGER FUNCTION vlistNsubtypes (INTEGER vlistID) -\end{verbatim} - -Number of subtypes in a variable list. - - -\section*{\tt \htmlref{vlistNumber}{vlistNumber}} - -\begin{verbatim} - INTEGER FUNCTION vlistNumber (INTEGER vlistID) -\end{verbatim} - -Number type in a variable list. - - -\section*{\tt \htmlref{vlistNvars}{vlistNvars}} - -\begin{verbatim} - INTEGER FUNCTION vlistNvars (INTEGER vlistID) -\end{verbatim} - -Number of variables in a variable list. - - -\section*{\tt \htmlref{vlistNzaxis}{vlistNzaxis}} - -\begin{verbatim} - INTEGER FUNCTION vlistNzaxis (INTEGER vlistID) -\end{verbatim} - -Number of zaxis in a variable list. - - -\section*{\tt \htmlref{zaxisCreate}{zaxisCreate}} - -\begin{verbatim} - INTEGER FUNCTION zaxisCreate (INTEGER zaxistype, INTEGER size) -\end{verbatim} - -Create a vertical Z-axis. - - -\section*{\tt \htmlref{zaxisDefLevel}{zaxisDefLevel}} - -\begin{verbatim} - SUBROUTINE zaxisDefLevel (INTEGER zaxisID, INTEGER levelID, - DOUBLEPRECISION levels) -\end{verbatim} - -Define one level of a Z-axis. - - -\section*{\tt \htmlref{zaxisDefLevels}{zaxisDefLevels}} - -\begin{verbatim} - SUBROUTINE zaxisDefLevels (INTEGER zaxisID, DOUBLEPRECISION levels(*)) -\end{verbatim} - -Define the levels of a Z-axis. - - -\section*{\tt \htmlref{zaxisDefLongname}{zaxisDefLongname}} - -\begin{verbatim} - SUBROUTINE zaxisDefLongname (INTEGER zaxisID, CHARACTER*(*) longname_optional) -\end{verbatim} - -Define the longname of a Z-axis. - - -\section*{\tt \htmlref{zaxisDefName}{zaxisDefName}} - -\begin{verbatim} - SUBROUTINE zaxisDefName (INTEGER zaxisID, CHARACTER*(*) name_optional) -\end{verbatim} - -Define the name of a Z-axis. - - -\section*{\tt \htmlref{zaxisDefNlevRef}{zaxisDefNlevRef}} - -\begin{verbatim} - SUBROUTINE zaxisDefNlevRef (INTEGER gridID, INTEGER nhlev) -\end{verbatim} - -Define the number of half levels of a generalized Z-axis. - - -\section*{\tt \htmlref{zaxisDefNumber}{zaxisDefNumber}} - -\begin{verbatim} - SUBROUTINE zaxisDefNumber (INTEGER gridID, INTEGER number) -\end{verbatim} - -Define the reference number for a generalized Z-axis. - - -\section*{\tt \htmlref{zaxisDefUUID}{zaxisDefUUID}} - -\begin{verbatim} - SUBROUTINE zaxisDefUUID (INTEGER zaxisID, INTEGER*1(16) uuid) -\end{verbatim} - -Define the UUID of a generalized Z-axis. - - -\section*{\tt \htmlref{zaxisDefUnits}{zaxisDefUnits}} - -\begin{verbatim} - SUBROUTINE zaxisDefUnits (INTEGER zaxisID, CHARACTER*(*) units_optional) -\end{verbatim} - -Define the units of a Z-axis. - - -\section*{\tt \htmlref{zaxisDestroy}{zaxisDestroy}} - -\begin{verbatim} - SUBROUTINE zaxisDestroy (INTEGER zaxisID) -\end{verbatim} - -Destroy a vertical Z-axis. - - -\section*{\tt \htmlref{zaxisDuplicate}{zaxisDuplicate}} - -\begin{verbatim} - INTEGER FUNCTION zaxisDuplicate (INTEGER zaxisID) -\end{verbatim} - -Duplicate a Z-axis. - - -\section*{\tt \htmlref{zaxisInqCLen}{zaxisInqCLen}} - -\begin{verbatim} - INTEGER FUNCTION zaxisInqCLen (INTEGER zaxisID) -\end{verbatim} - -Get maximal string length of character Z-axis. - - -\section*{\tt \htmlref{zaxisInqLevel}{zaxisInqLevel}} - -\begin{verbatim} - DOUBLEPRECISION FUNCTION zaxisInqLevel (INTEGER zaxisID, INTEGER levelID) -\end{verbatim} - -Get one level of a Z-axis. - - -\section*{\tt \htmlref{zaxisInqLevels}{zaxisInqLevels}} - -\begin{verbatim} - INTEGER FUNCTION zaxisInqLevels (INTEGER zaxisID, DOUBLEPRECISION levels(*)) -\end{verbatim} - -Get all levels of a Z-axis. - - -\section*{\tt \htmlref{zaxisInqLongname}{zaxisInqLongname}} - -\begin{verbatim} - SUBROUTINE zaxisInqLongname (INTEGER zaxisID, CHARACTER*(*) longname) -\end{verbatim} - -Get the longname of a Z-axis. - - -\section*{\tt \htmlref{zaxisInqName}{zaxisInqName}} - -\begin{verbatim} - SUBROUTINE zaxisInqName (INTEGER zaxisID, CHARACTER*(*) name) -\end{verbatim} - -Get the name of a Z-axis. - - -\section*{\tt \htmlref{zaxisInqNlevRef}{zaxisInqNlevRef}} - -\begin{verbatim} - INTEGER FUNCTION zaxisInqNlevRef (INTEGER gridID) -\end{verbatim} - -Get the number of half levels of a generalized Z-axis. - - -\section*{\tt \htmlref{zaxisInqNumber}{zaxisInqNumber}} - -\begin{verbatim} - INTEGER FUNCTION zaxisInqNumber (INTEGER gridID) -\end{verbatim} - -Get the reference number to a generalized Z-axis. - - -\section*{\tt \htmlref{zaxisInqSize}{zaxisInqSize}} - -\begin{verbatim} - INTEGER FUNCTION zaxisInqSize (INTEGER zaxisID) -\end{verbatim} - -Get the size of a Z-axis. - - -\section*{\tt \htmlref{zaxisInqStdname}{zaxisInqStdname}} - -\begin{verbatim} - SUBROUTINE zaxisInqStdname (INTEGER zaxisID, CHARACTER*(*) stdname) -\end{verbatim} - -Get the standard name of a Z-axis. - - -\section*{\tt \htmlref{zaxisInqType}{zaxisInqType}} - -\begin{verbatim} - INTEGER FUNCTION zaxisInqType (INTEGER zaxisID) -\end{verbatim} - -Get the type of a Z-axis. - - -\section*{\tt \htmlref{zaxisInqUUID}{zaxisInqUUID}} - -\begin{verbatim} - SUBROUTINE zaxisInqUUID (INTEGER zaxisID, INTEGER*1(16) uuid) -\end{verbatim} - -Get the UUID of a generalized Z-axis. - - -\section*{\tt \htmlref{zaxisInqUnits}{zaxisInqUnits}} - -\begin{verbatim} - SUBROUTINE zaxisInqUnits (INTEGER zaxisID, CHARACTER*(*) units) -\end{verbatim} - -Get the units of a Z-axis. - - diff --git a/examples/Makefile.am b/examples/Makefile.am index cad9a8acdc10de00488b85688a40fd1de2c04195..10f37847f41cb71e08eb127dc8c8923367566485 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,52 +1,107 @@ -## Process this file with automake to produce Makefile.in -# -EXTRA_DIST = cdi_read_f2003.f90 cdi_write_f2003.f90 -# -check_PROGRAMS = cdi_write cdi_write_relativ cdi_write_ens cdi_write_hybrid cdi_write_local cdi_read cdi_copy cdi_append -if CREATE_ISOC -check_PROGRAMS += cdi_read_f2003 cdi_write_f2003 -endif +SUBDIRS = pio + +noinst_PROGRAMS = +check_PROGRAMS = +CLEANFILES = + +EXTRA_PROGRAMS = \ + cdi_append \ + cdi_copy \ + cdi_read \ + cdi_write \ + cdi_write_ens \ + cdi_write_hybrid \ + cdi_write_local \ + cdi_write_relativ + +# Examples that are part of the test suite: +test_PROGRAMS_ = + if ENABLE_NETCDF -check_PROGRAMS += cdi_write_const -endif -# -AM_CPPFLAGS = -I$(top_srcdir)/src -AM_FCFLAGS = $(FPP_INCOPT)$(top_srcdir)/src $(FC_MOD_FLAG)../src -LDADD = $(top_builddir)/src/libcdi.la -# -cdi_write_SOURCES = cdi_write.c -cdi_write_relativ_SOURCES = cdi_write_relativ.c -cdi_write_ens_SOURCES = cdi_write_ens.c -cdi_write_const_SOURCES = cdi_write_const.c -cdi_write_hybrid_SOURCES = cdi_write_hybrid.c -cdi_write_local_SOURCES = cdi_write_local.c -cdi_read_SOURCES = cdi_read.c -cdi_copy_SOURCES = cdi_copy.c -cdi_append_SOURCES = cdi_append.c -# -cdi_read_f2003_SOURCES = cdi_read_f2003.f90 -cdi_read_f2003_LDADD = $(top_builddir)/src/libcdi_f2003.la $(top_builddir)/src/libcdi.la -# -cdi_write_f2003_SOURCES = cdi_write_f2003.f90 -cdi_write_f2003_LDADD = $(top_builddir)/src/libcdi_f2003.la $(top_builddir)/src/libcdi.la - -if FORTRAN_MOD_UC -cdi_read_f2003.$(OBJEXT) cdi_write_f2003.$(OBJEXT): $(top_builddir)/src/MO_CDI.$(FCMODEXT) -else -cdi_read_f2003.$(OBJEXT) cdi_write_f2003.$(OBJEXT): $(top_builddir)/src/mo_cdi.$(FCMODEXT) +test_PROGRAMS_ += cdi_write_const endif -# +if ENABLE_ISOC_INTERFACE +test_PROGRAMS_ += cdi_read_f2003 cdi_write_f2003 +endif ENABLE_ISOC_INTERFACE + +if with_on_demand_check_programs +check_PROGRAMS += $(test_PROGRAMS_) +else !with_on_demand_check_programs +noinst_PROGRAMS += $(test_PROGRAMS_) +endif !with_on_demand_check_programs + +if with_example_programs +noinst_PROGRAMS += $(EXTRA_PROGRAMS) +else !with_example_programs +CLEANFILES += $(EXTRA_PROGRAMS) +endif !with_example_programs +examples-local: $(test_PROGRAMS_) $(EXTRA_PROGRAMS) + +AM_CPPFLAGS = -I$(top_srcdir)/src + +AM_FCFLAGS = +if ENABLE_ISOC_INTERFACE +AM_FCFLAGS += $(FC_MOD_FLAG)$(top_builddir)/src +endif ENABLE_ISOC_INTERFACE + +AM_LDFLAGS = if ENABLE_ALL_STATIC -cdi_write_LDFLAGS = -all-static -cdi_read_LDFLAGS = -all-static -cdi_copy_LDFLAGS = -all-static -cdi_append_LDFLAGS = -all-static -cdi_read_f2003_LDFLAGS = -all-static -cdi_write_f2003_LDFLAGS = -all-static +AM_LDFLAGS += -all-static endif -# -clean-local: clean-local-dirs -.PHONY: clean-local-dirs -clean-local-dirs: + +LDADD = $(top_builddir)/src/libcdi.la + +cdi_append_SOURCES = cdi_append.c + +cdi_copy_SOURCES = cdi_copy.c + +cdi_read_SOURCES = cdi_read.c + +cdi_write_SOURCES = cdi_write.c + +cdi_write_ens_SOURCES = cdi_write_ens.c + +cdi_write_hybrid_SOURCES = cdi_write_hybrid.c + +cdi_write_local_SOURCES = cdi_write_local.c + +cdi_write_relativ_SOURCES = cdi_write_relativ.c + +cdi_write_const_SOURCES = cdi_write_const.c + +cdi_read_f2003_SOURCES = cdi_read_f2003.f90 +cdi_read_f2003_LDADD = $(top_builddir)/src/libcdi_f2003.la $(LDADD) + +cdi_write_f2003_SOURCES = cdi_write_f2003.f90 +cdi_write_f2003_LDADD = $(top_builddir)/src/libcdi_f2003.la $(LDADD) + +if FC_MOD_UPPERCASE +mo_cdi_mod = MO_CDI.$(FCMODEXT) +else !FC_MOD_UPPERCASE +mo_cdi_mod = mo_cdi.$(FCMODEXT) +endif !FC_MOD_UPPERCASE + +cdi_read_f2003.$(OBJEXT) cdi_write_f2003.$(OBJEXT): $(top_builddir)/src/$(mo_cdi_mod) + +clean-local: + -rm -f *.grb *.grb2 *.nc -rm -rf *.dSYM + +# Compile programs using Libtool: +COMPILE = $(LTCOMPILE) +FCCOMPILE = $(LTFCCOMPILE) +PPFCCOMPILE = $(LTPPFCCOMPILE) +CXXCOMPILE = $(LTCXXCOMPILE) + +# Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler +# and might not be compatible with the Fortran compiler: +LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) + +# Avoid compiling twice by running Libtool with '-static' +# This is safe because all Libtool libraries in this directory are +# static-only and contain PIC objects: +AM_CFLAGS = -static +AM_FCFLAGS += -static +AM_CXXFLAGS = -static diff --git a/examples/cdi_append.c b/examples/cdi_append.c index 0ce594de14f0b23886baadba028c488d34a2a436..31719366f4e9767b8554083e290534d135116f5b 100644 --- a/examples/cdi_append.c +++ b/examples/cdi_append.c @@ -1,18 +1,19 @@ #include <stdio.h> #include "cdi.h" -int main(void) +int +main(void) { - enum { - nlon = 12, // Number of longitudes - nlat = 6, // Number of latitudes - nlev = 5, // Number of levels - nts = 3, // Number of time steps + enum + { + nlon = 12, // Number of longitudes + nlat = 6, // Number of latitudes + nlev = 5, // Number of levels + nts = 3, // Number of time steps }; SizeType nmiss = 0; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; - + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; // Append a dataset (created by cdi_write) int streamID = streamOpenAppend("example.nc"); @@ -22,7 +23,7 @@ int main(void) return 1; } - // Get the variable list of the dataset + // Get the variable list of the dataset int vlistID = streamInqVlist(streamID); int numVars = vlistNvars(vlistID); @@ -36,16 +37,16 @@ int main(void) int varID2 = 1; SizeType varSize1 = gridInqSize(vlistInqVarGrid(vlistID, varID1)) * zaxisInqSize(vlistInqVarZaxis(vlistID, varID1)); - if (varSize1 != nlon*nlat) + if (varSize1 != nlon * nlat) { - fprintf(stderr, "Unexpected size of variable 1: %ld\n", (long)varSize1); + fprintf(stderr, "Unexpected size of variable 1: %ld\n", (long) varSize1); return 1; } SizeType varSize2 = gridInqSize(vlistInqVarGrid(vlistID, varID2)) * zaxisInqSize(vlistInqVarZaxis(vlistID, varID2)); - if (varSize2 != nlon*nlat*nlev) + if (varSize2 != nlon * nlat * nlev) { - fprintf(stderr, "Unexpected size of variable 2: %ld\n", (long)varSize2); + fprintf(stderr, "Unexpected size of variable 2: %ld\n", (long) varSize2); return 1; } @@ -65,8 +66,8 @@ int main(void) streamDefTimestep(streamID, nsteps + tsID); // Init var1 and var2 - for (size_t i = 0; i < nlon*nlat; i++) var1[i] = 1.1; - for (size_t i = 0; i < nlon*nlat*nlev; i++) var2[i] = 2.2; + for (size_t i = 0; i < nlon * nlat; i++) var1[i] = 1.1; + for (size_t i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, nmiss); diff --git a/examples/cdi_copy.c b/examples/cdi_copy.c index 8770925a34be0f21b60fe75c31f4bb6c11a60689..33c3dee245799cea0800f22964a2afa2e9963bc2 100644 --- a/examples/cdi_copy.c +++ b/examples/cdi_copy.c @@ -1,21 +1,13 @@ #include <stdio.h> +#include <stdlib.h> #include "cdi.h" -int main(void) +int +main(void) { - enum { - nlon = 12, // Number of longitudes - nlat = 6, // Number of latitudes - nlev = 5, // Number of levels - nts = 3, // Number of time steps - }; - SizeType nmiss; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; - // Open the input dataset - int streamID1 = streamOpenRead("example.nc"); + int streamID1 = streamOpenRead("example.nc"); if (streamID1 < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID1)); @@ -25,43 +17,55 @@ int main(void) // Get the variable list of the dataset int vlistID1 = streamInqVlist(streamID1); - // Set the variable IDs - int varID1 = 0; - int varID2 = 1; + int nvars = vlistNvars(vlistID1); + + int varDataSize = 0; + double *varData = NULL; + for (int varID = 0; varID < nvars; ++varID) + { + int varSize = vlistInqVarSize(vlistID1, varID); + varDataSize = varSize > varDataSize ? varSize : varDataSize; + } + varData = malloc((size_t) varDataSize * sizeof(double)); + if (!varData) + { + perror("cannot allocate temporary copying buffer"); + return EXIT_FAILURE; + } // Open the output dataset (GRIB format) - int streamID2 = streamOpenWrite("example.grb", CDI_FILETYPE_GRB); + int streamID2 = streamOpenWrite("example.grb", CDI_FILETYPE_GRB); if (streamID2 < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID2)); - return 1; + return EXIT_FAILURE; } int vlistID2 = vlistDuplicate(vlistID1); streamDefVlist(streamID2, vlistID2); - // Loop over the number of time steps - for (int tsID = 0; tsID < nts; tsID++) + // Loop over the input time steps + int tsID = 0; + while (streamInqTimestep(streamID1, tsID)) { - // Inquire the input time step - streamInqTimestep(streamID1, tsID); - // Define the output time step streamDefTimestep(streamID2, tsID); - // Read var1 and var2 - streamReadVar(streamID1, varID1, var1, &nmiss); - streamReadVar(streamID1, varID2, var2, &nmiss); - - // Write var1 and var2 - streamWriteVar(streamID2, varID1, var1, nmiss); - streamWriteVar(streamID2, varID2, var2, nmiss); + for (int varID = 0; varID < nvars; ++varID) + { + SizeType nmiss; + // Read var + streamReadVar(streamID1, varID, varData, &nmiss); + // Write var + streamWriteVar(streamID2, varID, varData, nmiss); + } + ++tsID; } // Close the streams streamClose(streamID1); streamClose(streamID2); - return 0; + return EXIT_SUCCESS; } diff --git a/examples/cdi_copy_file.c b/examples/cdi_copy_file.c index c06e0329c841529889344f07157c4a7a4535b045..7cd915ee2287becb4cbdc64804c476d68b21619a 100644 --- a/examples/cdi_copy_file.c +++ b/examples/cdi_copy_file.c @@ -5,9 +5,10 @@ /* gcc -g -O2 -o cdi_copy_file cdi_copy_file.c -I../src ../src/libcdi.a -lm */ -#define MAX_LEVEL 200 +#define MAX_LEVEL 200 -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { int linfo = 0; int vlistID1, vlistID2, varID, streamID1, streamID2; @@ -16,7 +17,7 @@ int main(int argc, char *argv[]) double *vardata = NULL; const char *ifile, *ofile; - if ( argc == 1 ) + if (argc == 1) { fprintf(stderr, "usage: %s ifile ofile\n", argv[0]); return (-1); @@ -26,11 +27,11 @@ int main(int argc, char *argv[]) ofile = argv[2]; /* Open the input dataset */ - streamID1 = streamOpenRead(ifile); - if ( streamID1 < 0 ) + streamID1 = streamOpenRead(ifile); + if (streamID1 < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID1)); - return(1); + return (1); } /* Get the variable list of the dataset */ @@ -38,14 +39,14 @@ int main(int argc, char *argv[]) nvars = vlistNvars(vlistID1); size_t gridsize = vlistGridsizeMax(vlistID1); - vardata = (double *) malloc(gridsize*MAX_LEVEL*sizeof(double)); + vardata = (double *) malloc(gridsize * MAX_LEVEL * sizeof(double)); /* Open the output dataset (GRIB format) */ - streamID2 = streamOpenWrite(ofile, CDI_FILETYPE_GRB); - if ( streamID2 < 0 ) + streamID2 = streamOpenWrite(ofile, CDI_FILETYPE_GRB); + if (streamID2 < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID2)); - return(1); + return (1); } vlistID2 = vlistDuplicate(vlistID1); @@ -54,38 +55,37 @@ int main(int argc, char *argv[]) /* Loop over all time steps */ int tsID = 0; - while ( (status = streamInqTimestep(streamID1, tsID)) ) + while ((status = streamInqTimestep(streamID1, tsID))) { /* Define the output time step */ streamDefTimestep(streamID2, tsID); - for ( varID = 0; varID < nvars; ++varID ) - { - /* Read variable */ - streamReadVar(streamID1, varID, vardata, &nmiss); - - if ( linfo ) - { - int i, k, nlevel; - nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID)); - gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID)); - for ( k = 0; k < nlevel; ++k ) - { - double fmin = 1.e30, fmax = -1.e30, fmean = 0; - for ( i = 0; i < gridsize; ++i ) - { - if ( vardata[k*gridsize+i] < fmin ) fmin = vardata[k*gridsize+i]; - if ( vardata[k*gridsize+i] > fmax ) fmax = vardata[k*gridsize+i]; - fmean += vardata[k*gridsize+i]; - } - printf("%3d %3d %3d %9g %9g %9g\n", - tsID, varID, k, fmin, fmean/gridsize, fmax); - } - } - - /* Write variable */ - streamWriteVar(streamID2, varID, vardata, nmiss); - } + for (varID = 0; varID < nvars; ++varID) + { + /* Read variable */ + streamReadVar(streamID1, varID, vardata, &nmiss); + + if (linfo) + { + int i, k, nlevel; + nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID)); + gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID)); + for (k = 0; k < nlevel; ++k) + { + double fmin = 1.e30, fmax = -1.e30, fmean = 0; + for (i = 0; i < gridsize; ++i) + { + if (vardata[k * gridsize + i] < fmin) fmin = vardata[k * gridsize + i]; + if (vardata[k * gridsize + i] > fmax) fmax = vardata[k * gridsize + i]; + fmean += vardata[k * gridsize + i]; + } + printf("%3d %3d %3d %9g %9g %9g\n", tsID, varID, k, fmin, fmean / gridsize, fmax); + } + } + + /* Write variable */ + streamWriteVar(streamID2, varID, vardata, nmiss); + } tsID++; } diff --git a/examples/cdi_open.c b/examples/cdi_open.c index 8fd541c531b003355ff81f8fd0ec154552fd7a0d..84beee2a2f5f4ce380218c3e11dcbe87529b0159 100644 --- a/examples/cdi_open.c +++ b/examples/cdi_open.c @@ -5,47 +5,47 @@ #define NOPEN 2048 #define FILENAME "example.grb" -int main(void) +int +main(void) { int iopen; int idel; int taxisID, vlistID, streamID; int streamIDs[NOPEN]; - for ( iopen = 0; iopen < NOPEN; ++iopen ) + for (iopen = 0; iopen < NOPEN; ++iopen) { - fprintf(stderr, "sequential open %d\n", iopen+1); + fprintf(stderr, "sequential open %d\n", iopen + 1); /* Open the dataset */ streamID = streamOpenRead(FILENAME); - if ( streamID < 0 ) - { - fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); - } + if (streamID < 0) + { + fprintf(stderr, "%s\n", cdiStringError(streamID)); + return (1); + } /* Get the variable list of the dataset */ vlistID = streamInqVlist(streamID); /* Get the Time axis from the variable list */ taxisID = vlistInqTaxis(vlistID); - + /* Close the input stream */ streamClose(streamID); } - for ( iopen = 0; iopen < NOPEN; ++iopen ) - streamIDs[iopen] = -1; + for (iopen = 0; iopen < NOPEN; ++iopen) streamIDs[iopen] = -1; - for ( iopen = 0; iopen < NOPEN; ++iopen ) + for (iopen = 0; iopen < NOPEN; ++iopen) { - fprintf(stderr, "simultaneous open %d\n", iopen+1); + fprintf(stderr, "simultaneous open %d\n", iopen + 1); /* Open the dataset */ streamID = streamOpenRead(FILENAME); - if ( streamID < 0 ) - { - fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); - } + if (streamID < 0) + { + fprintf(stderr, "%s\n", cdiStringError(streamID)); + return (1); + } /* Get the variable list of the dataset */ vlistID = streamInqVlist(streamID); @@ -55,34 +55,34 @@ int main(void) streamIDs[iopen] = streamID; - if ( iopen%2 ) - { - idel = (int) ((iopen+1) * (rand() / (RAND_MAX + 1.0))); - if ( streamIDs[idel] >= 0 ) - { - streamClose(streamIDs[idel]); - streamIDs[idel] = -1; - fprintf(stderr, "randomly closed %d\n", idel); - } - } + if (iopen % 2) + { + idel = (int) ((iopen + 1) * (rand() / (RAND_MAX + 1.0))); + if (streamIDs[idel] >= 0) + { + streamClose(streamIDs[idel]); + streamIDs[idel] = -1; + fprintf(stderr, "randomly closed %d\n", idel); + } + } } - - for ( iopen = 0; iopen < NOPEN; ++iopen ) + + for (iopen = 0; iopen < NOPEN; ++iopen) { /* Close the input stream */ - if ( streamIDs[iopen] >= 0 ) streamClose(streamIDs[iopen]); + if (streamIDs[iopen] >= 0) streamClose(streamIDs[iopen]); } - for ( iopen = 0; iopen < NOPEN; ++iopen ) + for (iopen = 0; iopen < NOPEN; ++iopen) { - fprintf(stderr, "simultaneous open %d\n", iopen+1); + fprintf(stderr, "simultaneous open %d\n", iopen + 1); /* Open the dataset */ streamID = streamOpenRead(FILENAME); - if ( streamID < 0 ) - { - fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); - } + if (streamID < 0) + { + fprintf(stderr, "%s\n", cdiStringError(streamID)); + return (1); + } /* Get the variable list of the dataset */ vlistID = streamInqVlist(streamID); @@ -92,11 +92,11 @@ int main(void) streamIDs[iopen] = streamID; } - - for ( iopen = 0; iopen < NOPEN; ++iopen ) + + for (iopen = 0; iopen < NOPEN; ++iopen) { /* Close the input stream */ - if ( streamIDs[iopen] >= 0 ) streamClose(streamIDs[iopen]); + if (streamIDs[iopen] >= 0) streamClose(streamIDs[iopen]); } return 0; diff --git a/examples/cdi_read.c b/examples/cdi_read.c index e1e8ee26d696fda6ef8764b4eaaaf5350d6701ff..f957f23476a27d155b51667e49db2a79355eae5f 100644 --- a/examples/cdi_read.c +++ b/examples/cdi_read.c @@ -1,20 +1,21 @@ #include <stdio.h> #include "cdi.h" -int main(void) +int +main(void) { - enum { - nlon = 12, // Number of longitudes - nlat = 6, // Number of latitudes - nlev = 5, // Number of levels - nts = 3, // Number of time steps + enum + { + nlon = 12, // Number of longitudes + nlat = 6, // Number of latitudes + nlev = 5, // Number of levels + nts = 3, // Number of time steps }; SizeType nmiss; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; - - // Open the dataset + // Open the dataset int streamID = streamOpenRead("example.nc"); if (streamID < 0) { @@ -22,33 +23,33 @@ int main(void) return 1; } - // Get the variable list of the dataset + // Get the variable list of the dataset int vlistID = streamInqVlist(streamID); - // Set the variable IDs + // Set the variable IDs int varID1 = 0; int varID2 = 1; - // Get the Time axis from the variable list + // Get the Time axis from the variable list int taxisID = vlistInqTaxis(vlistID); - // Loop over the number of time steps + // Loop over the number of time steps for (int tsID = 0; tsID < nts; tsID++) { - // Inquire the time step + // Inquire the time step streamInqTimestep(streamID, tsID); - // Get the verification date and time + // Get the verification date and time int vdate = taxisInqVdate(taxisID); int vtime = taxisInqVtime(taxisID); - printf("read timestep %d: date=%d time=%d\n", tsID+1, vdate, vtime); + printf("read timestep %d: date=%d time=%d\n", tsID + 1, vdate, vtime); - // Read var1 and var2 + // Read var1 and var2 streamReadVar(streamID, varID1, var1, &nmiss); streamReadVar(streamID, varID2, var2, &nmiss); } - // Close the input stream + // Close the input stream streamClose(streamID); return 0; diff --git a/examples/cdi_read_atts.c b/examples/cdi_read_atts.c index c39584197a4114221333197442deed3e1e19c754..f37f6c9e8c5e4550402acc5dac219d678f856db0 100644 --- a/examples/cdi_read_atts.c +++ b/examples/cdi_read_atts.c @@ -1,28 +1,28 @@ #include <stdio.h> #include "cdi.h" -int nlon = 12; // Number of longitudes -int nlat = 6; // Number of latitudes -int nlev = 5; // Number of levels -int nts = 3; // Number of time steps +int nlon = 12; // Number of longitudes +int nlat = 6; // Number of latitudes +int nlev = 5; // Number of levels +int nts = 3; // Number of time steps -int main(void) +int +main(void) { int taxisID, vlistID, varID1, varID2, streamID; size_t nmiss; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; - - // Open the dataset + // Open the dataset streamID = streamOpenRead("example_att.nc"); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); + return (1); } - // Get the variable list of the dataset + // Get the variable list of the dataset vlistID = streamInqVlist(streamID); int status; @@ -31,7 +31,7 @@ int main(void) printf("vlistInqNatts status %d\n", status); int type, len; char attname[256]; - for ( int i = 0; i< natts; ++i) + for (int i = 0; i < natts; ++i) { status = vlistInqAtt(vlistID, -1, i, attname, &type, &len); printf("vlistInqAtt status = %d name = %s len = %d\n", status, attname, len); @@ -45,29 +45,29 @@ int main(void) status = vlistInqAttInt(vlistID, -1, "jjj", 1, &ival); printf("vlistInqAttInt status = %d name = %s val = %d\n", status, "jjj", ival); - // Set the variable IDs + // Set the variable IDs varID1 = 0; varID2 = 1; - // Get the Time axis from the variable list + // Get the Time axis from the variable list taxisID = vlistInqTaxis(vlistID); - // Loop over the number of time steps - for ( int tsID = 0; tsID < nts; tsID++ ) + // Loop over the number of time steps + for (int tsID = 0; tsID < nts; tsID++) { - // Inquire the time step + // Inquire the time step streamInqTimestep(streamID, tsID); - // Get the verification date and time + // Get the verification date and time int vdate = taxisInqVdate(taxisID); int vtime = taxisInqVtime(taxisID); - // Read var1 and var2 + // Read var1 and var2 streamReadVar(streamID, varID1, var1, &nmiss); streamReadVar(streamID, varID2, var2, &nmiss); } - // Close the input stream + // Close the input stream streamClose(streamID); return 0; diff --git a/examples/cdi_read_f2003.f90 b/examples/cdi_read_f2003.f90 index e1dd41569aebb2726cda7d733adc687f6893d2e6..4c24688fbbe14b7693eb62933ee0453fec0d1902 100644 --- a/examples/cdi_read_f2003.f90 +++ b/examples/cdi_read_f2003.f90 @@ -21,7 +21,7 @@ PROGRAM CDIREADF2003 WRITE (0, '(a,132a)') 'cdi version: ', cdi_version ! Open the dataset - streamID = streamOpenRead(C_CHAR_"example.nc"//C_NULL_CHAR) + streamID = streamOpenRead(C_CHAR_"example_f2003.nc"//C_NULL_CHAR) IF ( streamID < 0 ) THEN PRINT *, 'Could not Read the file.' msg => cdiStringError(streamID) diff --git a/examples/cdi_read_float.c b/examples/cdi_read_float.c index aec8af006639236c756b99f3e5df03c4a3923256..41267501d2244786bad447fe3ebac1c552fdd184 100644 --- a/examples/cdi_read_float.c +++ b/examples/cdi_read_float.c @@ -1,54 +1,54 @@ #include <stdio.h> #include "cdi.h" -int nlon = 12; // Number of longitudes -int nlat = 6; // Number of latitudes -int nlev = 5; // Number of levels -int nts = 3; // Number of time steps +int nlon = 12; // Number of longitudes +int nlat = 6; // Number of latitudes +int nlev = 5; // Number of levels +int nts = 3; // Number of time steps -int main(void) +int +main(void) { int taxisID, vlistID, varID1, varID2, streamID; size_t nmiss; - float var1[nlon*nlat]; - float var2[nlon*nlat*nlev]; + float var1[nlon * nlat]; + float var2[nlon * nlat * nlev]; - - // Open the dataset + // Open the dataset streamID = streamOpenRead("example.grb"); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); + return (1); } - // Get the variable list of the dataset + // Get the variable list of the dataset vlistID = streamInqVlist(streamID); - // Set the variable IDs + // Set the variable IDs varID1 = 0; varID2 = 1; - // Get the Time axis from the variable list + // Get the Time axis from the variable list taxisID = vlistInqTaxis(vlistID); - // Loop over the number of time steps - for ( int tsID = 0; tsID < nts; tsID++ ) + // Loop over the number of time steps + for (int tsID = 0; tsID < nts; tsID++) { - // Inquire the time step + // Inquire the time step streamInqTimestep(streamID, tsID); - // Get the verification date and time + // Get the verification date and time int vdate = taxisInqVdate(taxisID); int vtime = taxisInqVtime(taxisID); - // Read var1 and var2 + // Read var1 and var2 streamReadVarF(streamID, varID1, var1, &nmiss); streamReadVarF(streamID, varID2, var2, &nmiss); printf("tsID %d %d %d %g %g\n", tsID, vdate, vtime, var1[0], var2[0]); } - // Close the input stream + // Close the input stream streamClose(streamID); return 0; diff --git a/examples/cdi_read_records.c b/examples/cdi_read_records.c index 95712247643d69cc53adf8eb33452c46954ffc00..af891d07113e0259f601519d56f70eacba8f2eb7 100644 --- a/examples/cdi_read_records.c +++ b/examples/cdi_read_records.c @@ -9,20 +9,20 @@ #define HAVE_LIBPTHREAD 1 #endif -#if defined (HAVE_LIBPTHREAD) -# include <pthread.h> +#if defined(HAVE_LIBPTHREAD) +#include <pthread.h> #endif -typedef struct { +typedef struct +{ int streamID; int *varID, *levelID; size_t *nmiss; double *array; -} -read_arg_t; - +} read_arg_t; -typedef struct { +typedef struct +{ int varID, levelID; size_t nmiss; double *array; @@ -30,17 +30,16 @@ typedef struct { int recID, nrecs; read_arg_t read_arg; void *iothread; -} -par_io_t; +} par_io_t; - -typedef struct work_st{ - void (*routine) (void*); +typedef struct work_st +{ + void (*routine)(void *); void *arg; } work_t; - -typedef struct { +typedef struct +{ int varID, levelID; size_t nmiss; double *array; @@ -49,17 +48,17 @@ typedef struct { int shutdown; int used; work_t *work; -#if defined (HAVE_LIBPTHREAD) +#if defined(HAVE_LIBPTHREAD) pthread_t thrID; pthread_attr_t attr; - pthread_mutex_t lock; + pthread_mutex_t lock; pthread_cond_t not_empty; pthread_cond_t empty; #endif } iothread_t; - -void readRecord(void *arg) +void +readRecord(void *arg) { read_arg_t *read_arg = (read_arg_t *) arg; int streamID; @@ -68,46 +67,47 @@ void readRecord(void *arg) double *array; streamID = read_arg->streamID; - varID = read_arg->varID; - levelID = read_arg->levelID; - nmiss = read_arg->nmiss; - array = read_arg->array; + varID = read_arg->varID; + levelID = read_arg->levelID; + nmiss = read_arg->nmiss; + array = read_arg->array; streamInqRecord(streamID, varID, levelID); streamReadRecord(streamID, array, nmiss); } -#if defined (HAVE_LIBPTHREAD) +#if defined(HAVE_LIBPTHREAD) /* This function is the work function of the thread */ -void *do_work(void *p) +void * +do_work(void *p) { iothread_t *iothread = (iothread_t *) p; - while ( 1 ) + while (1) { pthread_mutex_lock(&(iothread->lock)); - while ( iothread->used == 0 ) - { - if ( iothread->shutdown ) - { - pthread_mutex_unlock(&(iothread->lock)); - // pthread_exit(NULL); - return (NULL); - } - // wait until the condition says its no emtpy and give up the lock. - pthread_mutex_unlock(&(iothread->lock)); - pthread_cond_wait(&(iothread->not_empty), &(iothread->lock)); - - if ( iothread->shutdown ) - { - pthread_mutex_unlock(&(iothread->lock)); - // pthread_exit(NULL); - return (NULL); - } - } - - (iothread->work->routine) (iothread->work->arg); //actually do work. + while (iothread->used == 0) + { + if (iothread->shutdown) + { + pthread_mutex_unlock(&(iothread->lock)); + // pthread_exit(NULL); + return (NULL); + } + // wait until the condition says its no emtpy and give up the lock. + pthread_mutex_unlock(&(iothread->lock)); + pthread_cond_wait(&(iothread->not_empty), &(iothread->lock)); + + if (iothread->shutdown) + { + pthread_mutex_unlock(&(iothread->lock)); + // pthread_exit(NULL); + return (NULL); + } + } + + (iothread->work->routine)(iothread->work->arg); // actually do work. free(iothread->work); iothread->used = 0; @@ -120,35 +120,35 @@ void *do_work(void *p) } #endif - -#if defined (HAVE_LIBPTHREAD) -iothread_t *create_iothread() +#if defined(HAVE_LIBPTHREAD) +iothread_t * +create_iothread() { iothread_t *iothread = NULL; iothread = (iothread_t *) malloc(sizeof(iothread_t)); - if ( iothread == NULL ) + if (iothread == NULL) { fprintf(stderr, "Out of memory creating a new iothread!\n"); return (NULL); } - //initialize mutex and condition variables. - if ( pthread_mutex_init(&iothread->lock, NULL) ) + // initialize mutex and condition variables. + if (pthread_mutex_init(&iothread->lock, NULL)) { fprintf(stderr, "Mutex initiation error!\n"); return (NULL); } - if ( pthread_cond_init(&(iothread->empty),NULL) ) + if (pthread_cond_init(&(iothread->empty), NULL)) { - fprintf(stderr, "CV initiation error!\n"); + fprintf(stderr, "CV initiation error!\n"); return (NULL); } - if ( pthread_cond_init(&(iothread->not_empty),NULL) ) + if (pthread_cond_init(&(iothread->not_empty), NULL)) { - fprintf(stderr, "CV initiation error!\n"); + fprintf(stderr, "CV initiation error!\n"); return (NULL); } @@ -156,31 +156,31 @@ iothread_t *create_iothread() pthread_attr_setdetachstate(&(iothread->attr), PTHREAD_CREATE_JOINABLE); iothread->shutdown = 0; - iothread->used = 0; + iothread->used = 0; - //make thread - if ( pthread_create(&(iothread->thrID), &(iothread->attr), do_work, (void *)iothread) ) + // make thread + if (pthread_create(&(iothread->thrID), &(iothread->attr), do_work, (void *) iothread)) { - fprintf(stderr, "Thread initiation error!\n"); - return NULL; + fprintf(stderr, "Thread initiation error!\n"); + return NULL; } return (iothread); } #endif - -#if defined (HAVE_LIBPTHREAD) -void check_iothread(void *p) +#if defined(HAVE_LIBPTHREAD) +void +check_iothread(void *p) { iothread_t *iothread = (iothread_t *) p; pthread_mutex_lock(&(iothread->lock)); - while ( iothread->used == 1 ) + while (iothread->used == 1) { - // wait until the condition says its emtpy and give up the lock. - pthread_mutex_unlock(&(iothread->lock)); //get the lock. + // wait until the condition says its emtpy and give up the lock. + pthread_mutex_unlock(&(iothread->lock)); // get the lock. pthread_cond_wait(&(iothread->empty), &(iothread->lock)); } @@ -188,29 +188,29 @@ void check_iothread(void *p) } #endif -#if defined (HAVE_LIBPTHREAD) +#if defined(HAVE_LIBPTHREAD) typedef void (*dispatch_fn)(void *); -void dispatch(void *p, dispatch_fn dispatch_to_here, void *arg) +void +dispatch(void *p, dispatch_fn dispatch_to_here, void *arg) { iothread_t *iothread = (iothread_t *) p; work_t *work; - //make a work element. - work = (work_t*) malloc(sizeof(work_t)); - if ( work == NULL ) + // make a work element. + work = (work_t *) malloc(sizeof(work_t)); + if (work == NULL) { fprintf(stderr, "Out of memory creating a work struct!\n"); - return; + return; } work->routine = dispatch_to_here; - work->arg = arg; + work->arg = arg; pthread_mutex_lock(&(iothread->lock)); - if ( iothread->used == 1 ) - fprintf(stderr, "dispatch: Internal synchronization problem!\n"); + if (iothread->used == 1) fprintf(stderr, "dispatch: Internal synchronization problem!\n"); iothread->work = work; iothread->used = 1; @@ -220,16 +220,16 @@ void dispatch(void *p, dispatch_fn dispatch_to_here, void *arg) } #endif -#if defined (HAVE_LIBPTHREAD) -void destroy_iothread(void *p) +#if defined(HAVE_LIBPTHREAD) +void +destroy_iothread(void *p) { iothread_t *iothread = (iothread_t *) p; int status; pthread_mutex_lock(&(iothread->lock)); - if ( iothread->used == 1 ) - fprintf(stderr, "destroy_iothread: Internal synchronization problem!\n"); + if (iothread->used == 1) fprintf(stderr, "destroy_iothread: Internal synchronization problem!\n"); iothread->shutdown = 1; pthread_cond_signal(&(iothread->not_empty)); @@ -237,9 +237,9 @@ void destroy_iothread(void *p) pthread_mutex_unlock(&(iothread->lock)); status = pthread_join(iothread->thrID, NULL); - if ( status > 0 ) + if (status > 0) { - fprintf(stderr, "pthread_join error!\n"); + fprintf(stderr, "pthread_join error!\n"); return; } @@ -252,14 +252,14 @@ void destroy_iothread(void *p) } #endif - -void stream_read_record_par(int streamID, int *varID, int *levelID, double *array, size_t *nmiss, par_io_t *parIO) +void +stream_read_record_par(int streamID, int *varID, int *levelID, double *array, size_t *nmiss, par_io_t *parIO) { int lpario = 0; int recID = 0, nrecs = 0; -#if defined (HAVE_LIBPTHREAD) - if ( parIO ) +#if defined(HAVE_LIBPTHREAD) + if (parIO) { lpario = 1; recID = parIO->recID; @@ -267,62 +267,62 @@ void stream_read_record_par(int streamID, int *varID, int *levelID, double *arra } #endif - if ( recID == 0 || lpario == 0 ) + if (recID == 0 || lpario == 0) { read_arg_t read_arg; read_arg.streamID = streamID; - read_arg.varID = varID; - read_arg.levelID = levelID; - read_arg.nmiss = nmiss; - read_arg.array = array; + read_arg.varID = varID; + read_arg.levelID = levelID; + read_arg.nmiss = nmiss; + read_arg.array = array; readRecord(&read_arg); } -#if defined (HAVE_LIBPTHREAD) +#if defined(HAVE_LIBPTHREAD) else { check_iothread(parIO->iothread); - *varID = parIO->varID; - *levelID = parIO->levelID; - *nmiss = parIO->nmiss; + *varID = parIO->varID; + *levelID = parIO->levelID; + *nmiss = parIO->nmiss; - memcpy(array, parIO->array, parIO->array_size*sizeof(double)); + memcpy(array, parIO->array, parIO->array_size * sizeof(double)); } - if ( lpario && nrecs > 1 ) + if (lpario && nrecs > 1) { - if ( (recID+1) < nrecs ) - { - read_arg_t *read_arg = &(parIO->read_arg); + if ((recID + 1) < nrecs) + { + read_arg_t *read_arg = &(parIO->read_arg); - if ( recID == 0 ) parIO->iothread = create_iothread(); + if (recID == 0) parIO->iothread = create_iothread(); - read_arg->streamID = streamID; - read_arg->varID = &parIO->varID; - read_arg->levelID = &parIO->levelID; - read_arg->nmiss = &parIO->nmiss; - read_arg->array = parIO->array; + read_arg->streamID = streamID; + read_arg->varID = &parIO->varID; + read_arg->levelID = &parIO->levelID; + read_arg->nmiss = &parIO->nmiss; + read_arg->array = parIO->array; - dispatch(parIO->iothread, readRecord, read_arg); - } + dispatch(parIO->iothread, readRecord, read_arg); + } else - { - destroy_iothread(parIO->iothread); - } + { + destroy_iothread(parIO->iothread); + } } #endif } - -void stream_read_record(int streamID, int *varID, int *levelID, double *data, size_t *nmiss) +void +stream_read_record(int streamID, int *varID, int *levelID, double *data, size_t *nmiss) { streamInqRecord(streamID, varID, levelID); streamReadRecord(streamID, data, nmiss); } - -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { int taxisID, vlistID, varID, levelID, streamID, tsID; size_t nmiss; @@ -334,7 +334,7 @@ int main(int argc, char *argv[]) par_io_t parIO; char *fname = NULL; - if ( argc != 2 ) + if (argc != 2) { fprintf(stderr, "usage: %s filename\n", argv[0]); return (-1); @@ -344,10 +344,10 @@ int main(int argc, char *argv[]) /* Open the dataset */ streamID = streamOpenRead(fname); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); + return (1); } /* Get the variable list of the dataset */ @@ -355,47 +355,47 @@ int main(int argc, char *argv[]) /* Get the Time axis from the variable list */ taxisID = vlistInqTaxis(vlistID); - + gridsize = vlistGridsizeMax(vlistID); - data = (double *) malloc(gridsize*sizeof(double)); + data = (double *) malloc(gridsize * sizeof(double)); #ifdef PARIO - parIO.array = (double *) malloc(gridsize*sizeof(double)); + parIO.array = (double *) malloc(gridsize * sizeof(double)); parIO.array_size = gridsize; #endif /* Loop over all time steps */ tsID = 0; - while ( (nrecs = streamInqTimestep(streamID, tsID)) ) + while ((nrecs = streamInqTimestep(streamID, tsID))) { /* Get the verification date and time */ vdate = taxisInqVdate(taxisID); vtime = taxisInqVtime(taxisID); /* Read all records */ - for ( recID = 0; recID < nrecs; recID++ ) - { - parIO.recID = recID; parIO.nrecs = nrecs; + for (recID = 0; recID < nrecs; recID++) + { + parIO.recID = recID; + parIO.nrecs = nrecs; #ifdef PARIO - stream_read_record_par(streamID, &varID, &levelID, data, &nmiss, &parIO); + stream_read_record_par(streamID, &varID, &levelID, data, &nmiss, &parIO); #else - stream_read_record(streamID, &varID, &levelID, data, &nmiss); + stream_read_record(streamID, &varID, &levelID, data, &nmiss); #endif - code = vlistInqVarCode(vlistID, varID); - gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); - fmin = 1.e33; - fmax = -1.e33; - fmean = 0; - for ( int j = 0; j < 2; ++j ) - for ( i = 0; i < gridsize; ++i ) - { - if ( data[i] < fmin ) fmin = data[i]; - if ( data[i] > fmax ) fmax = data[i]; - fmean += data[i]; - } - fmean /= gridsize; - fprintf(stdout, "%3d %3d %3d %d %g %g %g\n", - code, varID, levelID, gridsize, fmin, fmean, fmax); - } + code = vlistInqVarCode(vlistID, varID); + gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); + fmin = 1.e33; + fmax = -1.e33; + fmean = 0; + for (int j = 0; j < 2; ++j) + for (i = 0; i < gridsize; ++i) + { + if (data[i] < fmin) fmin = data[i]; + if (data[i] > fmax) fmax = data[i]; + fmean += data[i]; + } + fmean /= gridsize; + fprintf(stdout, "%3d %3d %3d %d %g %g %g\n", code, varID, levelID, gridsize, fmin, fmean, fmax); + } tsID++; } diff --git a/examples/cdi_read_time.c b/examples/cdi_read_time.c index a511ecf63270335de68106060539e0c8e6fa186e..d88c8bd88fced1e9662ee001cbedca424ec41d33 100644 --- a/examples/cdi_read_time.c +++ b/examples/cdi_read_time.c @@ -1,52 +1,52 @@ #include <stdio.h> #include "cdi.h" -int main(void) +int +main(void) { - const int nlon = 12; // Number of longitudes - const int nlat = 6; // Number of latitudes - const int nlev = 5; // Number of levels - const int nts = 20; // Number of time steps + const int nlon = 12; // Number of longitudes + const int nlat = 6; // Number of latitudes + const int nlev = 5; // Number of levels + const int nts = 20; // Number of time steps size_t nmiss; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; - - // Open the dataset + // Open the dataset int streamID = streamOpenRead("/Users/m214003/tmp/ATNeu.synth.hourly.allvars_ebc.nc"); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); return 1; } - // Get the variable list of the dataset + // Get the variable list of the dataset int vlistID = streamInqVlist(streamID); - // Set the variable IDs + // Set the variable IDs int varID1 = 0; int varID2 = 1; - // Get the Time axis from the variable list + // Get the Time axis from the variable list int taxisID = vlistInqTaxis(vlistID); - // Loop over the number of time steps - for ( int tsID = 4; tsID < nts; tsID++ ) + // Loop over the number of time steps + for (int tsID = 4; tsID < nts; tsID++) { - // Inquire the time step + // Inquire the time step streamInqTimestep(streamID, tsID); - // Get the verification date and time + // Get the verification date and time int vdate = taxisInqVdate(taxisID); int vtime = taxisInqVtime(taxisID); - printf("read timestep %d: date=%d time=%d\n", tsID+1, vdate, vtime); + printf("read timestep %d: date=%d time=%d\n", tsID + 1, vdate, vtime); - // Read var1 and var2 + // Read var1 and var2 // streamReadVar(streamID, varID1, var1, &nmiss); // streamReadVar(streamID, varID2, var2, &nmiss); } - // Close the input stream + // Close the input stream streamClose(streamID); return 0; diff --git a/examples/cdi_write.c b/examples/cdi_write.c index 56ec1e2a856e9063461de4e7220ae2a6ec37bf2a..deceff1e94f790a0e74f0dfd69f3dbeba4e3797a 100644 --- a/examples/cdi_write.c +++ b/examples/cdi_write.c @@ -1,24 +1,25 @@ #include <stdio.h> #include "cdi.h" -int main(void) +int +main(void) { - enum { - nlon = 12, // Number of longitudes - nlat = 6, // Number of latitudes - nlev = 5, // Number of levels - nts = 3, // Number of time steps + enum + { + nlon = 12, // Number of longitudes + nlat = 6, // Number of latitudes + nlev = 5, // Number of levels + nts = 3, // Number of time steps }; SizeType nmiss = 0; - double lons[] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; - double lats[] = {-75, -45, -15, 15, 45, 75}; - double levs[] = {101300, 92500, 85000, 50000, 20000}; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; - + double lons[] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; + double lats[] = { -75, -45, -15, 15, 45, 75 }; + double levs[] = { 101300, 92500, 85000, 50000, 20000 }; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; // Create a regular lon/lat grid - int gridID = gridCreate(GRID_LONLAT, nlon*nlat); + int gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); @@ -30,7 +31,7 @@ int main(void) // Create a pressure level Z-axis int zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levs); - + // Create a variable list int vlistID = vlistCreate(); @@ -63,15 +64,15 @@ int main(void) for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID - taxisDefVdate(taxisID, 19850101+tsID); + taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 - for (size_t i = 0; i < nlon*nlat; i++) var1[i] = 1.1; - for (size_t i = 0; i < nlon*nlat*nlev; i++) var2[i] = 2.2; + for (size_t i = 0; i < nlon * nlat; i++) var1[i] = 1.1; + for (size_t i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, nmiss); diff --git a/examples/cdi_write_const.c b/examples/cdi_write_const.c index 61c68a05a30f1744b7bfee4752e05e89f3a30e85..40d50faaa58dd1f2b30410d68802d392820eb269 100644 --- a/examples/cdi_write_const.c +++ b/examples/cdi_write_const.c @@ -1,24 +1,24 @@ #include <stdio.h> #include "cdi.h" -#define nlon 12 // Number of longitudes -#define nlat 6 // Number of latitudes -#define nlev 5 // Number of levels +#define nlon 12 // Number of longitudes +#define nlat 6 // Number of latitudes +#define nlev 5 // Number of levels -int main(void) +int +main(void) { int gridID, zaxisID1, zaxisID2; int vlistID, varID1, varID2, streamID; size_t i, nmiss = 0; - double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; - double lats[nlat] = {-75, -45, -15, 15, 45, 75}; - double levs[nlev] = {101300, 92500, 85000, 50000, 20000}; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; - + double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; + double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; + double levs[nlev] = { 101300, 92500, 85000, 50000, 20000 }; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; // Create a regular lon/lat grid - gridID = gridCreate(GRID_LONLAT, nlon*nlat); + gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); @@ -30,7 +30,7 @@ int main(void) // Create a pressure level Z-axis zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levs); - + // Create a variable list vlistID = vlistCreate(); @@ -44,20 +44,20 @@ int main(void) // Create a dataset in netCDF format streamID = streamOpenWrite("example_const.nc", CDI_FILETYPE_NC); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); + return (1); } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); - //streamDefTimestep(streamID, 0); + // streamDefTimestep(streamID, 0); // Init var1 and var2 - for ( i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1; - for ( i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2; + for (i = 0; i < nlon * nlat; i++) var1[i] = 1.1; + for (i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, nmiss); diff --git a/examples/cdi_write_curv_rll.c b/examples/cdi_write_curv_rll.c index 1cfae55d36fa9109c8ca1b185f15984ca4585b59..b4d5984aa1e8ade1a2f1cf368983764ac1f48522 100644 --- a/examples/cdi_write_curv_rll.c +++ b/examples/cdi_write_curv_rll.c @@ -1,30 +1,30 @@ #include <stdio.h> #include "cdi.h" -int main(void) +int +main(void) { - const int nlon = 12; // Number of longitudes - const int nlat = 6; // Number of latitudes - const int nlev = 5; // Number of levels - const int nts = 3; // Number of time steps + const int nlon = 12; // Number of longitudes + const int nlat = 6; // Number of latitudes + const int nlev = 5; // Number of levels + const int nts = 3; // Number of time steps size_t nmiss = 0; - double levs[] = {101300, 92500, 85000, 50000, 20000}; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; - + double levs[] = { 101300, 92500, 85000, 50000, 20000 }; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; // Create a curvilinear grid - int gridID = gridCreate(GRID_CURVILINEAR, nlon*nlat); + int gridID = gridCreate(GRID_CURVILINEAR, nlon * nlat); { - double lons[] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; - double lats[] = {-75, -45, -15, 15, 45, 75}; + double lons[] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; + double lats[] = { -75, -45, -15, 15, 45, 75 }; - double lons2D[nlon*nlat], lats2D[nlon*nlat]; + double lons2D[nlon * nlat], lats2D[nlon * nlat]; for (int j = 0; j < nlat; ++j) for (int i = 0; i < nlon; ++i) { - lons2D[j*nlon+i] = lons[i]; - lats2D[j*nlon+i] = lats[j]; + lons2D[j * nlon + i] = lons[i]; + lats2D[j * nlon + i] = lats[j]; } gridDefXsize(gridID, nlon); @@ -38,9 +38,9 @@ int main(void) // Create a rotated lon/lat grid { - int projID = gridCreate(GRID_PROJECTION, nlon*nlat); - double rlons[] = {10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65}; - double rlats[] = {5, 10, 15, 20, 25, 30}; + int projID = gridCreate(GRID_PROJECTION, nlon * nlat); + double rlons[] = { 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65 }; + double rlats[] = { 5, 10, 15, 20, 25, 30 }; gridDefXsize(projID, nlon); gridDefYsize(projID, nlat); @@ -61,7 +61,7 @@ int main(void) // Create a pressure level Z-axis int zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levs); - + // Create a variable list int vlistID = vlistCreate(); @@ -81,7 +81,7 @@ int main(void) // Create a dataset in netCDF format int streamID = streamOpenWrite("example.grb", CDI_FILETYPE_GRB2); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); return 1; @@ -91,18 +91,18 @@ int main(void) streamDefVlist(streamID, vlistID); // Loop over the number of time steps - for ( int tsID = 0; tsID < nts; tsID++ ) + for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID - taxisDefVdate(taxisID, 19850101+tsID); + taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 - for ( size_t i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1; - for ( size_t i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2; + for (size_t i = 0; i < nlon * nlat; i++) var1[i] = 1.1; + for (size_t i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, nmiss); diff --git a/examples/cdi_write_dbl.c b/examples/cdi_write_dbl.c index cbcc4e441c035fe42fd5d38e38a6c4d072923052..9a48e7bd2cf775ed9f15802877a36a6de4d29e90 100644 --- a/examples/cdi_write_dbl.c +++ b/examples/cdi_write_dbl.c @@ -1,25 +1,25 @@ #include <stdio.h> #include "cdi.h" -#define nlon 12 // Number of longitudes -#define nlat 6 // Number of latitudes -#define nlev 5 // Number of levels -#define nts 3 // Number of time steps +#define nlon 12 // Number of longitudes +#define nlat 6 // Number of latitudes +#define nlev 5 // Number of levels +#define nts 3 // Number of time steps -int main(void) +int +main(void) { int gridID, zaxisID1, zaxisID2, taxisID; int vlistID, varID1, varID2, streamID, tsID; size_t i, nmiss = 0; - double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; - double lats[nlat] = {-75, -45, -15, 15, 45, 75}; - double levs[nlev] = {5, 10, 50, 100, 500}; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; - + double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; + double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; + double levs[nlev] = { 5, 10, 50, 100, 500 }; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; // Create a regular lon/lat grid - gridID = gridCreate(GRID_LONLAT, nlon*nlat); + gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); @@ -32,7 +32,7 @@ int main(void) zaxisID2 = zaxisCreate(ZAXIS_DEPTH_BELOW_LAND, nlev); zaxisDefLevels(zaxisID2, levs); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, "m"); - + // Create a variable list vlistID = vlistCreate(); @@ -52,28 +52,28 @@ int main(void) // Create a dataset in netCDF format streamID = streamOpenWrite("example.grb", CDI_FILETYPE_GRB); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); + return (1); } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); // Loop over the number of time steps - for ( tsID = 0; tsID < nts; tsID++ ) + for (tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID - taxisDefVdate(taxisID, 19850101+tsID); + taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 - for ( i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1; - for ( i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2; + for (i = 0; i < nlon * nlat; i++) var1[i] = 1.1; + for (i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, nmiss); diff --git a/examples/cdi_write_ens.c b/examples/cdi_write_ens.c index 67c4922266db86b7e192541dca96fbe34125ee5f..1db9d139386e3a12f5fd83308f1ef3e4bd496aa2 100644 --- a/examples/cdi_write_ens.c +++ b/examples/cdi_write_ens.c @@ -4,11 +4,12 @@ #include "cdi.h" -int main(void) +int +main(void) { char fname[] = "test_ens.grb2"; int filetype = CDI_FILETYPE_GRB2; - int nlat = 18, nlon = 2*nlat; + int nlat = 18, nlon = 2 * nlat; double *data = NULL; int nlevel; int varID; @@ -22,17 +23,17 @@ int main(void) int instID; - size_t datasize = (size_t)nlon * (size_t)nlat; - data = (double *) malloc(datasize * sizeof (double)); - memset(data, 0, datasize * sizeof (double)); + size_t datasize = (size_t) nlon * (size_t) nlat; + data = (double *) malloc(datasize * sizeof(double)); + memset(data, 0, datasize * sizeof(double)); - gridID = gridCreate(GRID_GAUSSIAN, (int)datasize); + gridID = gridCreate(GRID_GAUSSIAN, (int) datasize); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); zaxisID = zaxisCreate(ZAXIS_SURFACE, 1); - - instID = institutDef( 252, 0, NULL, NULL ); + + instID = institutDef(252, 0, NULL, NULL); vlistID = vlistCreate(); varID = vlistDefVar(vlistID, gridID, zaxisID, TIME_VARYING); @@ -40,7 +41,7 @@ int main(void) int perturbationNumber = 1; int numberOfForecastsInEnsemble = 2; int typeOfEnsembleForecast = 3; - + cdiDefKeyInt(vlistID, varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, typeOfEnsembleForecast); cdiDefKeyInt(vlistID, varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, numberOfForecastsInEnsemble); cdiDefKeyInt(vlistID, varID, CDI_KEY_PERTURBATIONNUMBER, perturbationNumber); @@ -48,14 +49,14 @@ int main(void) cdiInqKeyInt(vlistID, varID, CDI_KEY_PERTURBATIONNUMBER, &perturbationNumber); cdiInqKeyInt(vlistID, varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, &numberOfForecastsInEnsemble); cdiInqKeyInt(vlistID, varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, &typeOfEnsembleForecast); - - vlistDefInstitut( vlistID,instID ); + + vlistDefInstitut(vlistID, instID); taxisID = taxisCreate(TAXIS_ABSOLUTE); vlistDefTaxis(vlistID, taxisID); streamID1 = streamOpenWrite(fname, filetype); - if ( streamID1 < 0 ) + if (streamID1 < 0) { fprintf(stderr, "Open failed on %s\n", fname); fprintf(stderr, "%s\n", cdiStringError(streamID1)); @@ -75,7 +76,7 @@ int main(void) filetype = streamInqFiletype(streamID1); streamID2 = streamOpenWrite(fname, filetype); - if ( streamID2 < 0 ) + if (streamID2 < 0) { fprintf(stderr, "Open failed on %s\n", fname); fprintf(stderr, "%s\n", cdiStringError(streamID2)); @@ -86,48 +87,48 @@ int main(void) nvars = vlistNvars(vlistID); - for ( varID = 0; varID < nvars; varID++ ) + for (varID = 0; varID < nvars; varID++) { - int gridID = vlistInqVarGrid(vlistID, varID); - int zaxisID = vlistInqVarZaxis(vlistID, varID); - size_t gridsize = (size_t)gridInqSize(gridID); - size_t nlevel = (size_t)zaxisInqSize(zaxisID); - if ( gridsize * nlevel > datasize ) datasize = gridsize * nlevel; + int varGridID = vlistInqVarGrid(vlistID, varID); + int varZaxisID = vlistInqVarZaxis(vlistID, varID); + size_t gridsize = (size_t) gridInqSize(varGridID); + size_t varNlevel = (size_t) zaxisInqSize(varZaxisID); + if (gridsize * varNlevel > datasize) datasize = gridsize * varNlevel; } - data = (double *) malloc(datasize*sizeof(double)); - memset(data, 0, datasize*sizeof(double)); + data = (double *) malloc(datasize * sizeof(double)); + memset(data, 0, datasize * sizeof(double)); taxisID = vlistInqTaxis(vlistID); tsID = 0; - while ( (nrecs = streamInqTimestep(streamID1, tsID)) ) + while ((nrecs = streamInqTimestep(streamID1, tsID))) { - /* int vdate = */taxisInqVdate(taxisID); - /* int vtime = */taxisInqVtime(taxisID); + /* int vdate = */ taxisInqVdate(taxisID); + /* int vtime = */ taxisInqVtime(taxisID); streamDefTimestep(streamID2, tsID); - for ( varID = 0; varID < nvars; varID++ ) - { - streamReadVar(streamID1, varID, data, &nmiss); - - /* int code = */vlistInqVarCode(vlistID, varID); - gridID = vlistInqVarGrid(vlistID, varID); - zaxisID = vlistInqVarZaxis(vlistID, varID); - /* int gridtype = */gridInqType(gridID); - /* int gridsize = */gridInqSize(gridID); - nlevel = zaxisInqSize(zaxisID); - /* double missval = */vlistInqVarMissval(vlistID, varID); - - for ( levelID = 0; levelID < nlevel; levelID++ ) - { - /* int level = (int) */zaxisInqLevel(zaxisID, levelID); - /* int offset = gridsize*levelID; */ - } - - streamWriteVar(streamID2, varID, data, nmiss); - } + for (varID = 0; varID < nvars; varID++) + { + streamReadVar(streamID1, varID, data, &nmiss); + + /* int code = */ vlistInqVarCode(vlistID, varID); + gridID = vlistInqVarGrid(vlistID, varID); + zaxisID = vlistInqVarZaxis(vlistID, varID); + /* int gridtype = */ gridInqType(gridID); + /* int gridsize = */ gridInqSize(gridID); + nlevel = zaxisInqSize(zaxisID); + /* double missval = */ vlistInqVarMissval(vlistID, varID); + + for (levelID = 0; levelID < nlevel; levelID++) + { + /* int level = (int) */ zaxisInqLevel(zaxisID, levelID); + /* int offset = gridsize*levelID; */ + } + + streamWriteVar(streamID2, varID, data, nmiss); + } tsID++; } diff --git a/examples/cdi_write_f2003.f90 b/examples/cdi_write_f2003.f90 index 8fa963ce81bada707de0484b6f981cea4f5538e1..c0ea791313e7a9c1580f279ce77ac3bf4bfca99f 100644 --- a/examples/cdi_write_f2003.f90 +++ b/examples/cdi_write_f2003.f90 @@ -59,7 +59,7 @@ CALL vlistDefTaxis(vlistID, taxisID) ! Create a dataset in netCDF format - streamID = streamOpenWrite(C_CHAR_"example.nc"//C_NULL_CHAR, CDI_FILETYPE_NC) + streamID = streamOpenWrite(C_CHAR_"example_f2003.nc"//C_NULL_CHAR, CDI_FILETYPE_NC) IF ( streamID < 0 ) THEN msg => cdiStringError(streamID) WRITE(0,'(132a)') msg diff --git a/examples/cdi_write_float.c b/examples/cdi_write_float.c index a4f6b5663f5ce3fca75948aa186f8f1311303edd..6ffbd1b4a5ee6910de4201e7eb6d62d45dfff38d 100644 --- a/examples/cdi_write_float.c +++ b/examples/cdi_write_float.c @@ -1,25 +1,25 @@ #include <stdio.h> #include "cdi.h" -#define nlon 12 // Number of longitudes -#define nlat 6 // Number of latitudes -#define nlev 5 // Number of levels -#define nts 3 // Number of time steps +#define nlon 12 // Number of longitudes +#define nlat 6 // Number of latitudes +#define nlev 5 // Number of levels +#define nts 3 // Number of time steps -int main(void) +int +main(void) { int gridID, zaxisID1, zaxisID2, taxisID; int vlistID, varID1, varID2, streamID, tsID; size_t i, nmiss = 0; - double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; - double lats[nlat] = {-75, -45, -15, 15, 45, 75}; - double levs[nlev] = {101300, 92500, 85000, 50000, 20000}; - float var1[nlon*nlat]; - float var2[nlon*nlat*nlev]; - + double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; + double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; + double levs[nlev] = { 101300, 92500, 85000, 50000, 20000 }; + float var1[nlon * nlat]; + float var2[nlon * nlat * nlev]; // Create a regular lon/lat grid - gridID = gridCreate(GRID_LONLAT, nlon*nlat); + gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); @@ -31,7 +31,7 @@ int main(void) // Create a pressure level Z-axis zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levs); - + // Create a variable list vlistID = vlistCreate(); @@ -51,28 +51,28 @@ int main(void) // Create a dataset in netCDF format streamID = streamOpenWrite("example_f.nc", CDI_FILETYPE_NC); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); + return (1); } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); // Loop over the number of time steps - for ( tsID = 0; tsID < nts; tsID++ ) + for (tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID - taxisDefVdate(taxisID, 19850101+tsID); + taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 - for ( i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1; - for ( i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2; + for (i = 0; i < nlon * nlat; i++) var1[i] = 1.1; + for (i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVarF(streamID, varID1, var1, nmiss); diff --git a/examples/cdi_write_forecast.c b/examples/cdi_write_forecast.c index 7dababcc4de8cf6e720e809b06aa554748d5bbd6..658d8b5ce44f63d02be7750312ae78db586b5aa9 100644 --- a/examples/cdi_write_forecast.c +++ b/examples/cdi_write_forecast.c @@ -1,25 +1,25 @@ #include <stdio.h> #include "cdi.h" -#define nlon 12 // Number of longitudes -#define nlat 6 // Number of latitudes -#define nlev 1 // Number of levels -#define nts 3 // Number of time steps +#define nlon 12 // Number of longitudes +#define nlat 6 // Number of latitudes +#define nlev 1 // Number of levels +#define nts 3 // Number of time steps -int main(void) +int +main(void) { int gridID, zaxisID1, zaxisID2, taxisID; int vlistID, varID1, varID2, streamID, tsID; size_t i, nmiss = 0; - double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; - double lats[nlat] = {-75, -45, -15, 15, 45, 75}; - double levs[nlev] = {101300}; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; - + double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; + double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; + double levs[nlev] = { 101300 }; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; // Create a regular lon/lat grid - gridID = gridCreate(GRID_LONLAT, nlon*nlat); + gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); @@ -31,7 +31,7 @@ int main(void) // Create a pressure level Z-axis zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levs); - + // Create a variable list vlistID = vlistCreate(); @@ -53,32 +53,32 @@ int main(void) // Create a dataset in netCDF format streamID = streamOpenWrite("example.nc", CDI_FILETYPE_NC); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); + return (1); } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); // Loop over the number of time steps - for ( tsID = 0; tsID < nts; tsID++ ) + for (tsID = 0; tsID < nts; tsID++) { taxisDefFdate(taxisID, 19850101); taxisDefFtime(taxisID, 0); taxisDefForecastPeriod(taxisID, 6); // Set the verification date to 1985-01-01 + tsID - taxisDefVdate(taxisID, 19850101+tsID); + taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 - for ( i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1; - for ( i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2; + for (i = 0; i < nlon * nlat; i++) var1[i] = 1.1; + for (i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, nmiss); diff --git a/examples/cdi_write_gribkey.c b/examples/cdi_write_gribkey.c index 14c65bbec6fcec126d0e9fae12fab165ea33e746..be992754d8c07e2be23bec22d7543aa1fa3b46a0 100644 --- a/examples/cdi_write_gribkey.c +++ b/examples/cdi_write_gribkey.c @@ -1,25 +1,25 @@ #include <stdio.h> #include "cdi.h" -#define nlon 12 // Number of longitudes -#define nlat 6 // Number of latitudes -#define nlev 5 // Number of levels -#define nts 3 // Number of time steps +#define nlon 12 // Number of longitudes +#define nlat 6 // Number of latitudes +#define nlev 5 // Number of levels +#define nts 3 // Number of time steps -int main(void) +int +main(void) { int gridID, zaxisID1, zaxisID2, taxisID; int vlistID, varID1, varID2, streamID; size_t nmiss = 0; - double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; - double lats[nlat] = {-75, -45, -15, 15, 45, 75}; - double levs[nlev] = {101300, 92500, 85000, 50000, 20000}; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; - + double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; + double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; + double levs[nlev] = { 101300, 92500, 85000, 50000, 20000 }; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; // Create a regular lon/lat grid - gridID = gridCreate(GRID_LONLAT, nlon*nlat); + gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); @@ -31,7 +31,7 @@ int main(void) // Create a pressure level Z-axis zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levs); - + // Create a variable list vlistID = vlistCreate(); @@ -53,10 +53,10 @@ int main(void) // Create a dataset in netCDF format streamID = streamOpenWrite("example_ens.grb", CDI_FILETYPE_GRB2); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); + return (1); } // Assign the variable list to the dataset @@ -67,20 +67,20 @@ int main(void) printf("vlist ID %d %d\n", vlistID, vlistID0); // Loop over the number of time steps - for ( int tsID = 0; tsID < nts; tsID++ ) + for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID - taxisDefVdate(taxisID, 19850101+tsID); + taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); - vlistDefVarIntKey(vlistID0, varID1, "dataTime", 1200+(tsID+1)*10); + vlistDefVarIntKey(vlistID0, varID1, "dataTime", 1200 + (tsID + 1) * 10); // Init var1 and var2 - for ( size_t i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1; - for ( size_t i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2; + for (size_t i = 0; i < nlon * nlat; i++) var1[i] = 1.1; + for (size_t i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, nmiss); diff --git a/examples/cdi_write_hybrid.c b/examples/cdi_write_hybrid.c index f9b9a901eeaf4a6801911fb1f29c766e432b373b..5437f12e5fec9786ee4ab81d4c07889ac3aa6894 100644 --- a/examples/cdi_write_hybrid.c +++ b/examples/cdi_write_hybrid.c @@ -1,30 +1,30 @@ #include <stdio.h> #include "cdi.h" -#define nlon 12 // Number of longitudes -#define nlat 6 // Number of latitudes -#define nhlev 6 // Number of half hybrid levels -#define nflev 5 // Number of full hybrid levels -#define nts 3 // Number of time steps - -int main(void) +#define nlon 12 // Number of longitudes +#define nlat 6 // Number of latitudes +#define nhlev 6 // Number of half hybrid levels +#define nflev 5 // Number of full hybrid levels +#define nts 3 // Number of time steps + +int +main(void) { int gridID, zaxisID1, zaxisID2, zaxisID3, zaxisID4, taxisID; int vlistID, varID1, varID2, varID3, varID4, streamID; size_t nmiss = 0; - double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; - double lats[nlat] = {-75, -45, -15, 15, 45, 75}; - double levs[nhlev] = {1, 2, 3, 4, 5, 6}; - double levs2[nhlev] = {2, 3, 4, 5, 6, -1}; - double vct[2*nhlev] = {0, 6000, 10000, 16000, 8000, 0, 0, 0.0004, 0.03, 0.2, 0.7, 1.0}; - double var1[nlon*nlat]; - double var2[nlon*nlat*nflev]; - double var3[nlon*nlat*nhlev]; - double var4[nlon*nlat*nflev]; - + double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; + double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; + double levs[nhlev] = { 1, 2, 3, 4, 5, 6 }; + double levs2[nhlev] = { 2, 3, 4, 5, 6, -1 }; + double vct[2 * nhlev] = { 0, 6000, 10000, 16000, 8000, 0, 0, 0.0004, 0.03, 0.2, 0.7, 1.0 }; + double var1[nlon * nlat]; + double var2[nlon * nlat * nflev]; + double var3[nlon * nlat * nhlev]; + double var4[nlon * nlat * nflev]; // Create a regular lon/lat grid - gridID = gridCreate(GRID_LONLAT, nlon*nlat); + gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); @@ -36,20 +36,20 @@ int main(void) // Create a hybrid level Z-axis zaxisID2 = zaxisCreate(ZAXIS_HYBRID, nflev); zaxisDefLevels(zaxisID2, levs); - zaxisDefVct(zaxisID2, nhlev*2, vct); + zaxisDefVct(zaxisID2, nhlev * 2, vct); // Create a hybrid half level Z-axis zaxisID3 = zaxisCreate(ZAXIS_HYBRID, nhlev); zaxisDefLevels(zaxisID3, levs); - zaxisDefVct(zaxisID3, nhlev*2, vct); + zaxisDefVct(zaxisID3, nhlev * 2, vct); // Create a hybrid level Z-axis zaxisID4 = zaxisCreate(ZAXIS_HYBRID, nflev); zaxisDefLevels(zaxisID4, levs); zaxisDefLbounds(zaxisID4, levs); zaxisDefUbounds(zaxisID4, levs2); - zaxisDefVct(zaxisID4, nhlev*2, vct); - + zaxisDefVct(zaxisID4, nhlev * 2, vct); + // Create a variable list vlistID = vlistCreate(); @@ -73,34 +73,34 @@ int main(void) // Create a dataset in netCDF format streamID = streamOpenWrite("example.nc", CDI_FILETYPE_NC); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); + return (1); } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); // Loop over the number of time steps - for ( int tsID = 0; tsID < nts; tsID++ ) + for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID - taxisDefVdate(taxisID, 19850101+tsID); + taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 - for ( size_t i = 0; i < nlon*nlat; ++i ) var1[i] = 1.1; - for ( size_t k = 0; k < nflev; ++k ) - for ( size_t i = 0; i < nlon*nlat; ++i ) var2[i+k*nlon*nlat] = 2.2+k; - for ( size_t k = 0; k < nhlev; ++k ) - for ( size_t i = 0; i < nlon*nlat; ++i ) var3[i+k*nlon*nlat] = -2.2-k; - for ( size_t k = 0; k < nflev; ++k ) - for ( size_t i = 0; i < nlon*nlat; ++i ) var4[i+k*nlon*nlat] = 100+k; - + for (size_t i = 0; i < nlon * nlat; ++i) var1[i] = 1.1; + for (size_t k = 0; k < nflev; ++k) + for (size_t i = 0; i < nlon * nlat; ++i) var2[i + k * nlon * nlat] = 2.2 + k; + for (size_t k = 0; k < nhlev; ++k) + for (size_t i = 0; i < nlon * nlat; ++i) var3[i + k * nlon * nlat] = -2.2 - k; + for (size_t k = 0; k < nflev; ++k) + for (size_t i = 0; i < nlon * nlat; ++i) var4[i + k * nlon * nlat] = 100 + k; + // Write var1 and var2 streamWriteVar(streamID, varID1, var1, nmiss); streamWriteVar(streamID, varID2, var2, nmiss); diff --git a/examples/cdi_write_local.c b/examples/cdi_write_local.c index 2f33af1cbdde71a4e8e2f4de1bd430148150722c..35d88f92920fa08bb82e878e353b276eeb0a1c27 100644 --- a/examples/cdi_write_local.c +++ b/examples/cdi_write_local.c @@ -1,25 +1,25 @@ #include <stdio.h> #include "cdi.h" -#define nlon 12 // Number of longitudes -#define nlat 6 // Number of latitudes -#define nlev 5 // Number of levels -#define nts 3 // Number of time steps +#define nlon 12 // Number of longitudes +#define nlat 6 // Number of latitudes +#define nlev 5 // Number of levels +#define nts 3 // Number of time steps -int main(void) +int +main(void) { int gridID, zaxisID1, zaxisID2, taxisID; int vlistID, varID1, varID2, streamID; size_t nmiss = 0; - double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; - double lats[nlat] = {-75, -45, -15, 15, 45, 75}; - double levs[nlev] = {101300, 92500, 85000, 50000, 20000}; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; - + double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; + double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; + double levs[nlev] = { 101300, 92500, 85000, 50000, 20000 }; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; // Create a regular lon/lat grid - gridID = gridCreate(GRID_LONLAT, nlon*nlat); + gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); @@ -31,7 +31,7 @@ int main(void) // Create a pressure level Z-axis zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levs); - + // Create a variable list vlistID = vlistCreate(); @@ -50,9 +50,8 @@ int main(void) cdiDefKeyInt(vlistID, CDI_GLOBAL, CDI_KEY_MPIMUSER, 1403); cdiDefKeyInt(vlistID, CDI_GLOBAL, CDI_KEY_REVSTATUS, 0); - unsigned char revNumber[] = { 187, 128, 50, 251, 161, 44, 146, 63, 154, 149, - 83, 90, 81, 103, 109, 138, 157, 216, 208, 64 }; - + unsigned char revNumber[] = { 187, 128, 50, 251, 161, 44, 146, 63, 154, 149, 83, 90, 81, 103, 109, 138, 157, 216, 208, 64 }; + cdiDefKeyBytes(vlistID, CDI_GLOBAL, CDI_KEY_REVNUMBER, revNumber, 20); // Create a Time axis @@ -63,28 +62,28 @@ int main(void) // Create a dataset in netCDF format streamID = streamOpenWrite("example_loc.grb", CDI_FILETYPE_GRB2); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); + return (1); } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); // Loop over the number of time steps - for ( int tsID = 0; tsID < nts; tsID++ ) + for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID - taxisDefVdate(taxisID, 19850101+tsID); + taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 - for ( size_t i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1; - for ( size_t i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2; + for (size_t i = 0; i < nlon * nlat; i++) var1[i] = 1.1; + for (size_t i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, nmiss); diff --git a/examples/cdi_write_pl.c b/examples/cdi_write_pl.c index b012bb315b5b429aadfe366f28f760518aade801..4a3ff88a9e8fd40caab1595f14987b7bfb47eb24 100644 --- a/examples/cdi_write_pl.c +++ b/examples/cdi_write_pl.c @@ -1,26 +1,26 @@ #include <stdio.h> #include "cdi.h" -#define nlon 12 // Number of longitudes -#define nlat 6 // Number of latitudes -#define nlev 5 // Number of levels -#define nts 3 // Number of time steps +#define nlon 12 // Number of longitudes +#define nlat 6 // Number of latitudes +#define nlev 5 // Number of levels +#define nts 3 // Number of time steps -int main(void) +int +main(void) { int gridID, zaxisID1, zaxisID2, taxisID; int vlistID, varID1, varID2, streamID; size_t nmiss = 0; - double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; - double lats[nlat] = {-75, -45, -15, 15, 45, 75}; - double levs[nlev] = {100000.1, 10000.2, 1000.38, 100.4, 10.5}; - double levs2[nlev] = { 10000.2, 1000.38, 100.4, 10.5, 1}; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; - + double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; + double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; + double levs[nlev] = { 100000.1, 10000.2, 1000.38, 100.4, 10.5 }; + double levs2[nlev] = { 10000.2, 1000.38, 100.4, 10.5, 1 }; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; // Create a regular lon/lat grid - gridID = gridCreate(GRID_LONLAT, nlon*nlat); + gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); @@ -34,7 +34,7 @@ int main(void) zaxisDefLevels(zaxisID2, levs); zaxisDefLbounds(zaxisID2, levs); zaxisDefUbounds(zaxisID2, levs2); - + // Create a variable list vlistID = vlistCreate(); @@ -54,29 +54,29 @@ int main(void) // Create a dataset in netCDF format streamID = streamOpenWrite("example.grb2", CDI_FILETYPE_GRB2); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); + return (1); } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); // Loop over the number of time steps - for ( int tsID = 0; tsID < nts; tsID++ ) + for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID - taxisDefVdate(taxisID, 19850101+tsID); + taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 - for ( size_t i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1; - for ( size_t k = 0; k < nlev; ++k ) - for ( i = 0; i < nlon*nlat; i++ ) var2[i+k*nlon*nlat] = 2.2+k; + for (size_t i = 0; i < nlon * nlat; i++) var1[i] = 1.1; + for (size_t k = 0; k < nlev; ++k) + for (i = 0; i < nlon * nlat; i++) var2[i + k * nlon * nlat] = 2.2 + k; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, nmiss); diff --git a/examples/cdi_write_point.c b/examples/cdi_write_point.c index 38bd56c09f832d0e903e1cea2d1d58108d9cf1c5..84d9cdc72733d0660d3b1b19e7dd3d2fe272ade3 100644 --- a/examples/cdi_write_point.c +++ b/examples/cdi_write_point.c @@ -1,20 +1,20 @@ #include <stdio.h> #include "cdi.h" -#define ngp 1 // Number of gridpoints -#define nlev 5 // Number of levels -#define nts 3 // Number of time steps +#define ngp 1 // Number of gridpoints +#define nlev 5 // Number of levels +#define nts 3 // Number of time steps -int main(void) +int +main(void) { int gridID, zaxisID1, zaxisID2, taxisID; int vlistID, varID1, varID2, streamID; size_t nmiss = 0; - double levs[nlev] = {101300, 92500, 85000, 50000, 20000}; + double levs[nlev] = { 101300, 92500, 85000, 50000, 20000 }; double var1; double var2[nlev]; - // Create a generic grid without dimensions and coordinates gridID = gridCreate(GRID_GENERIC, 1); @@ -24,7 +24,7 @@ int main(void) // Create a pressure level Z-axis zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levs); - + // Create a variable list vlistID = vlistCreate(); @@ -44,20 +44,20 @@ int main(void) // Create a dataset in netCDF format streamID = streamOpenWrite("example.nc", CDI_FILETYPE_NC); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); + return (1); } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); // Loop over the number of time steps - for ( int tsID = 0; tsID < nts; tsID++ ) + for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID - taxisDefVdate(taxisID, 19850101+tsID); + taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step @@ -65,7 +65,7 @@ int main(void) // Init var1 and var2 var1 = 1.1; - for ( size_t i = 0; i < nlev; i++ ) var2[i] = 2.2; + for (size_t i = 0; i < nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, &var1, nmiss); diff --git a/examples/cdi_write_refgrid.c b/examples/cdi_write_refgrid.c index b008a7b6cd16e8d37e060aa64bda6a0f6a2e6ee4..9aa390199baf10d75ff76a414e5b175a4d2b63b5 100644 --- a/examples/cdi_write_refgrid.c +++ b/examples/cdi_write_refgrid.c @@ -1,23 +1,23 @@ #include <stdio.h> #include "cdi.h" -#define nlon 12 // Number of longitudes -#define nlat 6 // Number of latitudes -#define nlev 5 // Number of levels -#define nts 3 // Number of time steps +#define nlon 12 // Number of longitudes +#define nlat 6 // Number of latitudes +#define nlev 5 // Number of levels +#define nts 3 // Number of time steps -int main(void) +int +main(void) { int gridID, zaxisID1, zaxisID2, taxisID; int vlistID, varID1, varID2, streamID; size_t nmiss = 0; - double levs[nlev] = {101300, 92500, 85000, 50000, 20000}; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; - + double levs[nlev] = { 101300, 92500, 85000, 50000, 20000 }; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; // Create a grid reference - gridID = gridCreate(GRID_UNSTRUCTURED, nlon*nlat); + gridID = gridCreate(GRID_UNSTRUCTURED, nlon * nlat); cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, 123); cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDINREFERENCE, 3); cdiDefKeyString(gridID, CDI_GLOBAL, CDI_KEY_REFERENCEURI, "http://www.x.y/gridfile.nc"); @@ -29,7 +29,7 @@ int main(void) // Create a pressure level Z-axis zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levs); - + // Create a variable list vlistID = vlistCreate(); @@ -48,30 +48,30 @@ int main(void) vlistDefTaxis(vlistID, taxisID); // Create a dataset in netCDF format - //streamID = streamOpenWrite("example.grb2", CDI_FILETYPE_GRB2); + // streamID = streamOpenWrite("example.grb2", CDI_FILETYPE_GRB2); streamID = streamOpenWrite("example.nc", CDI_FILETYPE_NC); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); + return (1); } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); // Loop over the number of time steps - for ( int tsID = 0; tsID < nts; tsID++ ) + for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID - taxisDefVdate(taxisID, 19850101+tsID); + taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 - for ( size_t i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1; - for ( size_t i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2; + for (size_t i = 0; i < nlon * nlat; i++) var1[i] = 1.1; + for (size_t i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, nmiss); diff --git a/examples/cdi_write_refvgrid.c b/examples/cdi_write_refvgrid.c index 4ff2437d91fafc8b9c320533f2e9149e377cb5fe..f9ee3c4f64379b35a270c620ce550abe490dfc6b 100644 --- a/examples/cdi_write_refvgrid.c +++ b/examples/cdi_write_refvgrid.c @@ -1,22 +1,23 @@ #include <stdio.h> #include "cdi.h" -#define nlon 12 // Number of longitudes -#define nlat 6 // Number of latitudes -#define nlev 5 // Number of levels -#define nts 3 // Number of time steps +#define nlon 12 // Number of longitudes +#define nlat 6 // Number of latitudes +#define nlev 5 // Number of levels +#define nts 3 // Number of time steps -int main(void) +int +main(void) { int gridID, zaxisID1, zaxisID2, taxisID; int vlistID, varID1, varID2, streamID, tsID; size_t nmiss = 0; - double levs[nlev] = {1, 2, 3, 4, 5}; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; + double levs[nlev] = { 1, 2, 3, 4, 5 }; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; // Create a grid reference - gridID = gridCreate(GRID_UNSTRUCTURED, nlon*nlat); + gridID = gridCreate(GRID_UNSTRUCTURED, nlon * nlat); cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, 123); cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDINREFERENCE, 3); cdiDefKeyString(gridID, CDI_GLOBAL, CDI_KEY_REFERENCEURI, "http://www.x.y/gridfile.nc"); @@ -32,9 +33,9 @@ int main(void) cdiDefKeyInt(zaxisID2, CDI_GLOBAL, CDI_KEY_NLEV, nlev); cdiDefKeyInt(zaxisID2, CDI_GLOBAL, CDI_KEY_NUMBEROFVGRIDUSED, 71); - //zaxisDefReference(zaxisID2, "http://www.x.y/vgridfile.nc"); + // zaxisDefReference(zaxisID2, "http://www.x.y/vgridfile.nc"); cdiDefKeyBytes(zaxisID2, CDI_GLOBAL, CDI_KEY_UUID, "8765432112345678", CDI_UUID_SIZE); - + // Create a variable list vlistID = vlistCreate(); @@ -54,29 +55,29 @@ int main(void) // Create a dataset in netCDF format streamID = streamOpenWrite("example.grb2", CDI_FILETYPE_GRB2); - //streamID = streamOpenWrite("example.nc", CDI_FILETYPE_NC); - if ( streamID < 0 ) + // streamID = streamOpenWrite("example.nc", CDI_FILETYPE_NC); + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); + return (1); } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); // Loop over the number of time steps - for ( int tsID = 0; tsID < nts; tsID++ ) + for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID - taxisDefVdate(taxisID, 19850101+tsID); + taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 - for ( size_t i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1; - for ( size_t i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2; + for (size_t i = 0; i < nlon * nlat; i++) var1[i] = 1.1; + for (size_t i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, nmiss); diff --git a/examples/cdi_write_relativ.c b/examples/cdi_write_relativ.c index 7f1b15c55a9297c24f0358cea85570a8ce8cc4e6..62c62bb6337613f3758ddf1dfcf575a086537623 100644 --- a/examples/cdi_write_relativ.c +++ b/examples/cdi_write_relativ.c @@ -1,24 +1,25 @@ #include <stdio.h> #include "cdi.h" -int main(void) +int +main(void) { - enum { - nlon = 12, // Number of longitudes - nlat = 6, // Number of latitudes - nlev = 5, // Number of levels - nts = 3, // Number of time steps + enum + { + nlon = 12, // Number of longitudes + nlat = 6, // Number of latitudes + nlev = 5, // Number of levels + nts = 3, // Number of time steps }; int nmiss = 0; - double lons[] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; - double lats[] = {-75, -45, -15, 15, 45, 75}; - double levs[] = {101300, 92500, 85000, 50000, 20000}; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; - + double lons[] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; + double lats[] = { -75, -45, -15, 15, 45, 75 }; + double levs[] = { 101300, 92500, 85000, 50000, 20000 }; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; // Create a regular lon/lat grid - int gridID = gridCreate(GRID_LONLAT, nlon*nlat); + int gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); @@ -30,7 +31,7 @@ int main(void) // Create a pressure level Z-axis int zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levs); - + // Create a variable list int vlistID = vlistCreate(); @@ -50,7 +51,7 @@ int main(void) // Create a dataset in netCDF format int streamID = streamOpenWrite("example.nc", CDI_FILETYPE_NC); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); return 1; @@ -60,18 +61,18 @@ int main(void) streamDefVlist(streamID, vlistID); // Loop over the number of time steps - for ( int tsID = 0; tsID < nts; tsID++ ) + for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID - taxisDefVdate(taxisID, 19850101+tsID); + taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 - for ( int i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1; - for ( int i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2; + for (int i = 0; i < nlon * nlat; i++) var1[i] = 1.1; + for (int i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, nmiss); diff --git a/examples/cdi_write_reset.c b/examples/cdi_write_reset.c index a11f3abac80c40c262a7698ce04f18fae226da93..ce6da51e52399d47afa9a46a5ef3ad0aad29278d 100644 --- a/examples/cdi_write_reset.c +++ b/examples/cdi_write_reset.c @@ -1,26 +1,26 @@ #include <stdio.h> #include "cdi.h" -#define nrun 100 // Number of runs -#define nlon 12 // Number of longitudes -#define nlat 6 // Number of latitudes -#define nlev 5 // Number of levels -#define nts 3 // Number of time steps - -static -int run(int irun) +#define nrun 100 // Number of runs +#define nlon 12 // Number of longitudes +#define nlat 6 // Number of latitudes +#define nlev 5 // Number of levels +#define nts 3 // Number of time steps + +static int +run(int irun) { int gridID, zaxisID1, zaxisID2, taxisID; int vlistID, varID1, varID2, streamID; size_t nmiss = 0; - double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; - double lats[nlat] = {-75, -45, -15, 15, 45, 75}; - double levs[nlev] = {101300, 92500, 85000, 50000, 20000}; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; + double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; + double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; + double levs[nlev] = { 101300, 92500, 85000, 50000, 20000 }; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; // Create a regular lon/lat grid - gridID = gridCreate(GRID_LONLAT, nlon*nlat); + gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); @@ -32,7 +32,7 @@ int run(int irun) // Create a pressure level Z-axis zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levs); - + // Create a variable list vlistID = vlistCreate(); @@ -52,28 +52,28 @@ int run(int irun) // Create a dataset in netCDF format streamID = streamOpenWrite("example.nc", CDI_FILETYPE_NC); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); - return(1); + return (1); } // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); // Loop over the number of time steps - for ( int tsID = 0; tsID < nts; tsID++ ) + for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID - taxisDefVdate(taxisID, 19850101+tsID); + taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 - for ( size_t i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1; - for ( size_t i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2; + for (size_t i = 0; i < nlon * nlat; i++) var1[i] = 1.1; + for (size_t i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, nmiss); @@ -95,15 +95,16 @@ int run(int irun) return 0; } -int main(void) +int +main(void) { int irun; - for ( irun = 0; irun < nrun; ++irun ) + for (irun = 0; irun < nrun; ++irun) { run(irun); cdiReset(); } - + return 0; } diff --git a/examples/cdi_write_rll.c b/examples/cdi_write_rll.c index 2720466735946772ff69a65fa3760e87f6d0343b..b936c39103aa288941e0b2d0686dde74f3e488b0 100644 --- a/examples/cdi_write_rll.c +++ b/examples/cdi_write_rll.c @@ -1,22 +1,22 @@ #include <stdio.h> #include "cdi.h" -int main(void) +int +main(void) { - const int nlon = 12; // Number of longitudes - const int nlat = 6; // Number of latitudes - const int nlev = 5; // Number of levels - const int nts = 3; // Number of time steps + const int nlon = 12; // Number of longitudes + const int nlat = 6; // Number of latitudes + const int nlev = 5; // Number of levels + const int nts = 3; // Number of time steps size_t nmiss = 0; - double lons[] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; - double lats[] = {-75, -45, -15, 15, 45, 75}; - double levs[] = {101300, 92500, 85000, 50000, 20000}; - double var1[nlon*nlat]; - double var2[nlon*nlat*nlev]; - + double lons[] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; + double lats[] = { -75, -45, -15, 15, 45, 75 }; + double levs[] = { 101300, 92500, 85000, 50000, 20000 }; + double var1[nlon * nlat]; + double var2[nlon * nlat * nlev]; // Create a regular lon/lat grid - int gridID = gridCreate(GRID_PROJECTION, nlon*nlat); + int gridID = gridCreate(GRID_PROJECTION, nlon * nlat); gridDefParamRLL(gridID, -162., 39.25, 0); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); @@ -32,7 +32,7 @@ int main(void) // Create a pressure level Z-axis int zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID2, levs); - + // Create a variable list int vlistID = vlistCreate(); @@ -52,7 +52,7 @@ int main(void) // Create a dataset in netCDF format int streamID = streamOpenWrite("example.nc", CDI_FILETYPE_NC); - if ( streamID < 0 ) + if (streamID < 0) { fprintf(stderr, "%s\n", cdiStringError(streamID)); return 1; @@ -62,18 +62,18 @@ int main(void) streamDefVlist(streamID, vlistID); // Loop over the number of time steps - for ( int tsID = 0; tsID < nts; tsID++ ) + for (int tsID = 0; tsID < nts; tsID++) { // Set the verification date to 1985-01-01 + tsID - taxisDefVdate(taxisID, 19850101+tsID); + taxisDefVdate(taxisID, 19850101 + tsID); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, 120000); // Define the time step streamDefTimestep(streamID, tsID); // Init var1 and var2 - for ( size_t i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1; - for ( size_t i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2; + for (size_t i = 0; i < nlon * nlat; i++) var1[i] = 1.1; + for (size_t i = 0; i < nlon * nlat * nlev; i++) var2[i] = 2.2; // Write var1 and var2 streamWriteVar(streamID, varID1, var1, nmiss); diff --git a/examples/pio/Makefile.am b/examples/pio/Makefile.am index e840afb55e1a0c0a20ec1ae8f9dfa28b98d18604..650bbfcae5001970bcd9fe16a960131c90188c51 100644 --- a/examples/pio/Makefile.am +++ b/examples/pio/Makefile.am @@ -1,35 +1,99 @@ -check_PROGRAMS=collectData collectDataNStreams +noinst_PROGRAMS = +CLEANFILES = -AM_CPPFLAGS = -I$(top_srcdir)/src $(YAXT_CFLAGS) -AM_FCFLAGS = $(FPP_INCOPT)$(top_srcdir)/src $(MPI_FC_INCLUDE) -AM_CFLAGS = $(MPI_C_INCLUDE) +EXTRA_PROGRAMS = \ + collectData \ + collectDataNStreams -if USE_MPI -check_PROGRAMS+=compareResourcesArray -AM_FCFLAGS += $(FPP_DEFOPT)USE_MPI -endif +if ENABLE_MPI +EXTRA_PROGRAMS += \ + collectData.parallel \ + collectDataNStreams.parallel \ + compareResourcesArray +endif ENABLE_MPI -if USE_FC -check_PROGRAMS+=collectData2003 -endif +if ENABLE_CF_INTERFACE +if BUILD_FC_PROGRAMS +EXTRA_PROGRAMS += collectData2003 +endif BUILD_FC_PROGRAMS +if BUILD_PIO_FC_PROGRAMS +EXTRA_PROGRAMS += collectData2003.parallel +endif BUILD_PIO_FC_PROGRAMS +endif ENABLE_CF_INTERFACE + +if with_example_programs +noinst_PROGRAMS += $(EXTRA_PROGRAMS) +else !with_example_programs +CLEANFILES += $(EXTRA_PROGRAMS) +endif !with_example_programs +examples-local: $(EXTRA_PROGRAMS) + +AM_CPPFLAGS = -I$(top_srcdir)/src $(YAXT_C_INCLUDE) $(MPI_C_INCLUDE) -collectData_SOURCES=collectData.c +AM_FCFLAGS = +if ENABLE_CF_INTERFACE +AM_FCFLAGS += $(FC_OPTINC)$(top_builddir)/src $(FC_OPTINC)$(top_srcdir)/src +endif ENABLE_CF_INTERFACE +AM_FCFLAGS += $(YAXT_FC_MOD) $(MPI_FC_MOD) -if USE_MPI -LDADD=$(top_builddir)/src/libcdipio.la $(top_builddir)/src/libcdi.la $(YAXT_LIBS) $(MPI_C_LIB) -collectData2003_LDADD=$(top_builddir)/src/libcdipio.la $(top_builddir)/src/libcdi.la $(YAXT_LIBS) $(MPI_FC_LIB) -else -LDADD=$(top_builddir)/src/libcdi.la -collectData2003_LDADD=$(top_builddir)/src/libcdi.la +AM_LDFLAGS = +if ENABLE_ALL_STATIC +AM_LDFLAGS += -all-static endif -collectData2003_SOURCES=collectData2003.F90 +LDADD = $(top_builddir)/src/libcdi.la + +collectData_SOURCES = collectData.c +nodist_collectData_parallel_SOURCES = $(collectData_SOURCES:.c=.parallel.c) +collectData_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_C_LIB) $(LDADD) collectDataNStreams_SOURCES = collectDataNStreams.c +nodist_collectDataNStreams_parallel_SOURCES = $(collectDataNStreams_SOURCES:.c=.parallel.c) +collectDataNStreams_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_C_LIB) $(LDADD) compareResourcesArray_SOURCES = compareResourcesArray.c -# -clean-local: clean-local-dirs -.PHONY: clean-local-dirs -clean-local-dirs: +compareResourcesArray_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_C_LIB) $(LDADD) + +collectData2003_SOURCES = collectData2003.F90 +nodist_collectData2003_parallel_SOURCES = $(collectData2003_SOURCES:.F90=.parallel.F90) +collectData2003_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(YAXT_FC_LIB) $(MPI_FC_LIB) $(LDADD) + +clean-local: + -rm -f *.parallel.c *.parallel.F90 + -rm -f *.grb -rm -rf *.dSYM + +# Compile programs using Libtool: +COMPILE = $(LTCOMPILE) +FCCOMPILE = $(LTFCCOMPILE) +PPFCCOMPILE = $(LTPPFCCOMPILE) +CXXCOMPILE = $(LTCXXCOMPILE) + +# Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler +# and might not be compatible with the Fortran compiler: +LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) + +# Avoid compiling twice by running Libtool with '-static' +# This is safe because all Libtool libraries in this directory are +# static-only and contain PIC objects: +AM_CFLAGS = -static +AM_FCFLAGS += -static +AM_CXXFLAGS = -static + +# Generate source files for parallel versions of the programs. We do this to +# avoid target-specific flags, which result into rules that do not use the +# compilation commands above. +SUFFIXES = .parallel.c .parallel.F90 + +.c.parallel.c: + $(AM_V_GEN):;{ \ + echo '#define USE_MPI 1'; \ + echo '#include "$<"'; \ + } >$@ + +.F90.parallel.F90: + $(AM_V_GEN):;{ \ + echo '#define USE_MPI 1'; \ + echo '#include "$<"'; \ + } >$@ diff --git a/examples/pio/collectData.c b/examples/pio/collectData.c index 1b2d987a1f7b0e6f88f412e8fc2a1cc71bffb4bf..f23b5550a30618f7a8d2824a8a79fd81df0587d9 100644 --- a/examples/pio/collectData.c +++ b/examples/pio/collectData.c @@ -1,5 +1,5 @@ -#if defined (HAVE_CONFIG_H) -# include "config.h" +#if defined(HAVE_CONFIG_H) +#include "config.h" #endif #include <stdio.h> @@ -23,148 +23,137 @@ typedef int MPI_Comm; #ifdef USE_MPI #include "cdipio.h" -static int -uniform_partition_start(int set_interval[2], int nparts, int part_idx); +static int uniform_partition_start(int set_interval[2], int nparts, int part_idx); #endif -static void modelRun(MPI_Comm commModel) +static void +modelRun(MPI_Comm commModel) { - enum { - filetype = CDI_FILETYPE_GRB, - ntfiles = 2, - ntsteps = 3, - nVars = 5, - nlon = 12, - nlat = 6, - maxlev = 5 }; - - static int nlev[nVars] = {1,1,5,5,2}; + enum + { + filetype = CDI_FILETYPE_GRB, + ntfiles = 2, + ntsteps = 3, + nVars = 5, + nlon = 12, + nlat = 6, + maxlev = 5 + }; + + static int nlev[nVars] = { 1, 1, 5, 5, 2 }; static const char *name = "example"; int gridID, zaxisID[nVars], taxisID; int vlistID, varID[nVars], streamID, tsID, tfID = 0; int i, j, nmiss = 0; - double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; - double lats[nlat] = {-75, -45, -15, 15, 45, 75}; - double levs[maxlev] = {101300, 92500, 85000, 50000, 20000}; - double var[nlon*nlat*maxlev]; + double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; + double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; + double levs[maxlev] = { 101300, 92500, 85000, 50000, 20000 }; + double var[nlon * nlat * maxlev]; int vdate = 19850101, vtime = 120000; char filename[1024]; size_t varSize[nVars]; #if USE_MPI int rank, comm_size; - struct var1DDeco { + struct var1DDeco + { int chunkSize, start; Xt_idxlist partDesc; } varDeco[nVars]; #endif #ifndef USE_MPI - (void)commModel; + (void) commModel; #endif - gridID = gridCreate ( GRID_LONLAT, nlon*nlat ); - gridDefXsize ( gridID, nlon ); - gridDefYsize ( gridID, nlat ); - gridDefXvals ( gridID, lons ); - gridDefYvals ( gridID, lats ); + gridID = gridCreate(GRID_LONLAT, nlon * nlat); + gridDefXsize(gridID, nlon); + gridDefYsize(gridID, nlat); + gridDefXvals(gridID, lons); + gridDefYvals(gridID, lats); - for ( i = 0; i < nVars; i++ ) + for (i = 0; i < nVars; i++) { - zaxisID[i] = zaxisCreate ( ZAXIS_PRESSURE, nlev[i] ); - zaxisDefLevels ( zaxisID[i], levs ); - varSize[i] = nlon * nlat * (size_t)nlev[i]; + zaxisID[i] = zaxisCreate(ZAXIS_PRESSURE, nlev[i]); + zaxisDefLevels(zaxisID[i], levs); + varSize[i] = nlon * nlat * (size_t) nlev[i]; } - vlistID = vlistCreate (); + vlistID = vlistCreate(); #if USE_MPI - xmpi ( MPI_Comm_rank ( commModel, &rank )); - xmpi ( MPI_Comm_size ( commModel, &comm_size )); + xmpi(MPI_Comm_rank(commModel, &rank)); + xmpi(MPI_Comm_size(commModel, &comm_size)); #endif - for ( i = 0; i < nVars; i++ ) + for (i = 0; i < nVars; i++) { - varID[i] = vlistDefVar ( vlistID, gridID, zaxisID[i], TIME_VARIABLE); + varID[i] = vlistDefVar(vlistID, gridID, zaxisID[i], TIME_VARIABLE); #ifdef USE_MPI { - int start = uniform_partition_start((int [2]){ 0, (int)varSize[i] - 1 }, - comm_size, rank), - chunkSize = uniform_partition_start((int [2]){ 0, (int)varSize[i] - 1 }, - comm_size, rank + 1) - start; - fprintf(stderr, "%d: start=%d, chunkSize = %d\n", rank, - start, chunkSize); - Xt_idxlist idxlist - = xt_idxstripes_new(&(struct Xt_stripe){ .start = start, - .nstrides = chunkSize, .stride = 1 }, 1); - varDeco[i] = (struct var1DDeco){ - .start = start, - .chunkSize = chunkSize, - .partDesc = idxlist - }; + int start = uniform_partition_start((int[2]){ 0, (int) varSize[i] - 1 }, comm_size, rank), + chunkSize = uniform_partition_start((int[2]){ 0, (int) varSize[i] - 1 }, comm_size, rank + 1) - start; + fprintf(stderr, "%d: start=%d, chunkSize = %d\n", rank, start, chunkSize); + Xt_idxlist idxlist = xt_idxstripes_new(&(struct Xt_stripe){ .start = start, .nstrides = chunkSize, .stride = 1 }, 1); + varDeco[i] = (struct var1DDeco){ .start = start, .chunkSize = chunkSize, .partDesc = idxlist }; } #endif } - taxisID = taxisCreate ( TAXIS_ABSOLUTE ); - vlistDefTaxis ( vlistID, taxisID ); + taxisID = taxisCreate(TAXIS_ABSOLUTE); + vlistDefTaxis(vlistID, taxisID); - sprintf ( &filename[0], "%s_%d.grb", name, tfID ); - streamID = streamOpenWrite ( filename, filetype ); - xassert ( streamID >= 0 ); - streamDefVlist ( streamID, vlistID); + sprintf(&filename[0], "%s_%d.grb", name, tfID); + streamID = streamOpenWrite(filename, filetype); + xassert(streamID >= 0); + streamDefVlist(streamID, vlistID); #ifdef USE_MPI - pioEndDef (); + pioEndDef(); #endif - for ( tfID = 0; tfID < ntfiles; tfID++ ) + for (tfID = 0; tfID < ntfiles; tfID++) { /* if ( tfID > 0 ) */ - { - streamClose ( streamID ); - sprintf ( &filename[0], "%s_%d.grb", name, tfID ); - streamID = streamOpenWrite ( filename, filetype ); - xassert ( streamID >= 0 ); - streamDefVlist ( streamID, vlistID ); - } - for ( tsID = 0; tsID < ntsteps; tsID++ ) - { - taxisDefVdate ( taxisID, vdate ); - taxisDefVtime ( taxisID, vtime ); - streamDefTimestep ( streamID, tsID ); - for ( i = 0; i < nVars; i++ ) - { + { + streamClose(streamID); + sprintf(&filename[0], "%s_%d.grb", name, tfID); + streamID = streamOpenWrite(filename, filetype); + xassert(streamID >= 0); + streamDefVlist(streamID, vlistID); + } + for (tsID = 0; tsID < ntsteps; tsID++) + { + taxisDefVdate(taxisID, vdate); + taxisDefVtime(taxisID, vtime); + streamDefTimestep(streamID, tsID); + for (i = 0; i < nVars; i++) + { #ifdef USE_MPI int chunk = varDeco[i].chunkSize; #else - int chunk = (int)varSize[i]; + int chunk = (int) varSize[i]; #endif - for (j = 0; j < chunk; ++j) var[j] = 2.2; + for (j = 0; j < chunk; ++j) var[j] = 2.2; #ifdef USE_MPI - streamWriteVarPart(streamID, varID[i], var, nmiss, - varDeco[i].partDesc); + streamWriteVarPart(streamID, varID[i], var, nmiss, varDeco[i].partDesc); #else - streamWriteVar ( streamID, varID[i], var, nmiss ); + streamWriteVar(streamID, varID[i], var, nmiss); #endif - } + } #ifdef USE_MPI - pioWriteTimestep(); + pioWriteTimestep(); #endif - } + } } + streamClose(streamID); + vlistDestroy(vlistID); + taxisDestroy(taxisID); + for (i = 0; i < nVars; i++) zaxisDestroy(zaxisID[i]); + gridDestroy(gridID); #ifdef USE_MPI - pioEndTimestepping (); -#endif - streamClose ( streamID ); - vlistDestroy ( vlistID ); - taxisDestroy ( taxisID ); - for ( i = 0; i < nVars; i++ ) - zaxisDestroy ( zaxisID[i] ); - gridDestroy ( gridID ); -#ifdef USE_MPI - for (int varIdx = 0; varIdx < nVars; ++varIdx) - xt_idxlist_delete(varDeco[varIdx].partDesc); + for (int varIdx = 0; varIdx < nVars; ++varIdx) xt_idxlist_delete(varDeco[varIdx].partDesc); MPI_Barrier(commModel); #endif } -int main (int argc, char *argv[]) +int +main(int argc, char *argv[]) { MPI_Comm commModel = MPI_COMM_NULL; #ifdef USE_MPI @@ -173,56 +162,55 @@ int main (int argc, char *argv[]) int IOMode = PIO_WRITER; int nProcsIO = 2; - xmpi ( MPI_Init ( &argc, &argv)); + xmpi(MPI_Init(&argc, &argv)); commGlob = MPI_COMM_WORLD; xt_initialize(commGlob); - xmpi ( MPI_Comm_set_errhandler ( commGlob, MPI_ERRORS_RETURN )); - xmpi ( MPI_Comm_size ( commGlob, &sizeGlob )); - xmpi ( MPI_Comm_rank ( commGlob, &rankGlob )); + xmpi(MPI_Comm_set_errhandler(commGlob, MPI_ERRORS_RETURN)); + xmpi(MPI_Comm_size(commGlob, &sizeGlob)); + xmpi(MPI_Comm_rank(commGlob, &rankGlob)); { int opt; - while ((opt = getopt(argc, argv, "p:w:")) != -1) - switch (opt) { - case 'p': - IOMode = cdiPioStr2IOMode(optarg); - if (IOMode < 0) - { - fprintf(stderr, "Unsupported PIO mode requested: %s\n", optarg); - exit(EXIT_FAILURE); - } - break; - case 'w': + while ((opt = getopt(argc, argv, "p:w:")) != -1) switch (opt) { - long temp = strtol(optarg, NULL, 0); - if (temp < 0 || temp > INT_MAX/2) + case 'p': + IOMode = cdiPioStr2IOMode(optarg); + if (IOMode < 0) { - fprintf(stderr, "Unsupported number of I/O servers: %ld\n", temp); + fprintf(stderr, "Unsupported PIO mode requested: %s\n", optarg); exit(EXIT_FAILURE); } - nProcsIO = (int)temp; break; + case 'w': + { + long temp = strtol(optarg, NULL, 0); + if (temp < 0 || temp > INT_MAX / 2) + { + fprintf(stderr, "Unsupported number of I/O servers: %ld\n", temp); + exit(EXIT_FAILURE); + } + nProcsIO = (int) temp; + break; + } } - } } - commModel = pioInit(commGlob, nProcsIO, IOMode, &pioNamespace, 1.0f, - cdiPioNoPostCommSetup); + commModel = pioInit(commGlob, nProcsIO, IOMode, &pioNamespace, 1.0f, cdiPioNoPostCommSetup); if (commModel != MPI_COMM_NULL) { namespaceSetActive(pioNamespace); #else - (void)argc; - (void)argv; + (void) argc; + (void) argv; #endif modelRun(commModel); #ifdef USE_MPI } - pioFinalize (); + pioFinalize(); xt_finalize(); - MPI_Finalize (); + MPI_Finalize(); #endif return 0; } @@ -232,8 +220,7 @@ static int uniform_partition_start(int set_interval[2], int nparts, int part_idx) { int part_offset - = (int)((((long long)set_interval[1] - (long long)set_interval[0] + 1LL) - * (long long)part_idx) / (long long)nparts); + = (int) ((((long long) set_interval[1] - (long long) set_interval[0] + 1LL) * (long long) part_idx) / (long long) nparts); int start = set_interval[0] + part_offset; return start; } diff --git a/examples/pio/collectData2003.F90 b/examples/pio/collectData2003.F90 index bec482c7716885a47b3d4a5294bf32acd261f5ba..ce10858beb65bdc6b22c731a5e67e6e28f3d28a6 100644 --- a/examples/pio/collectData2003.F90 +++ b/examples/pio/collectData2003.F90 @@ -3,6 +3,7 @@ PROGRAM collectdata2003 USE yaxt, ONLY: xt_initialize, xt_finalize, xt_idxlist, xt_idxstripes_new, & xt_idxlist_delete, xi => xt_int_kind, xt_stripe USE iso_c_binding, ONLY: c_int + USE mpi #endif IMPLICIT NONE @@ -11,12 +12,11 @@ PROGRAM collectdata2003 INCLUDE 'cdipio.inc' #ifdef USE_MPI - INCLUDE 'mpif.h' - INTEGER, PARAMETER :: i4 = SELECTED_INT_KIND(9) INTEGER, PARAMETER :: i8 = SELECTED_INT_KIND(14) #endif +#ifdef USE_MPI ! For parallel IO: ! Parameter and variables needed. INTEGER, PARAMETER :: nProcsIO = 3 @@ -25,6 +25,7 @@ PROGRAM collectdata2003 ! INTEGER, PARAMETER :: IOMode = PIO_WRITER ! INTEGER, PARAMETER :: IOMode = PIO_ASYNCH INTEGER, PARAMETER :: IOMode = PIO_FPGUARD +#endif INTEGER :: commModel #ifdef USE_MPI @@ -218,12 +219,6 @@ CONTAINS #endif END DO -#ifdef USE_MPI - ! For parallel IO: - ! Preparation for local cleanup - CALL pioEndTimestepping () -#endif - ! Close the output stream CALL streamClose(streamID) diff --git a/examples/pio/collectDataNStreams.c b/examples/pio/collectDataNStreams.c index 58a9501e43aa3d345bfd29b7abc346c944bd443d..263023720de4d0ff46875d4a14b2d0ae1f7b1a9b 100644 --- a/examples/pio/collectDataNStreams.c +++ b/examples/pio/collectDataNStreams.c @@ -1,5 +1,5 @@ -#if defined (HAVE_CONFIG_H) -# include "config.h" +#if defined(HAVE_CONFIG_H) +#include "config.h" #endif #include <stdio.h> @@ -20,225 +20,207 @@ typedef int MPI_Comm; #include "pio_util.h" #endif -static void hoursPassingHack ( int * vdate, int * vtime, int hoursPassed ) +static void +hoursPassingHack(int *vdate, int *vtime, int hoursPassed) { int sum, days, hours, oldDays; - xassert ( hoursPassed % 10000 == 0 ); - sum = * vtime + hoursPassed; + xassert(hoursPassed % 10000 == 0); + sum = *vtime + hoursPassed; days = sum / 240000; hours = sum % 240000; - oldDays = * vdate % 100; - if ( oldDays + days > 28 ) xabort ( "UNEXPECTED USE" ); - * vtime = hours; - * vdate = * vdate + days; + oldDays = *vdate % 100; + if (oldDays + days > 28) xabort("UNEXPECTED USE"); + *vtime = hours; + *vdate = *vdate + days; } #ifdef USE_MPI -static int -uniform_partition_start(int set_interval[2], int nparts, int part_idx); +static int uniform_partition_start(int set_interval[2], int nparts, int part_idx); #endif -static void modelRun(MPI_Comm commModel) +static void +modelRun(MPI_Comm commModel) { - enum { - filetype = CDI_FILETYPE_GRB, - nStreams = 5, + enum + { + filetype = CDI_FILETYPE_GRB, + nStreams = 5, MAXNSTREAMS = 25, - ntfiles = 2, - ntsteps = 3, - nVars = 5, - nlon = 12, - nlat = 6, - MAXNLEV = 5 }; + ntfiles = 2, + ntsteps = 3, + nVars = 5, + nlon = 12, + nlat = 6, + MAXNLEV = 5 + }; - static int nlev[nStreams][nVars] = - {{1,1,5,5,2},{3,5,2,2,1},{3,5,2,2,1},{5,2,2,2,1}, {3,3,3,3,3}}; + static int nlev[nStreams][nVars] + = { { 1, 1, 5, 5, 2 }, { 3, 5, 2, 2, 1 }, { 3, 5, 2, 2, 1 }, { 5, 2, 2, 2, 1 }, { 3, 3, 3, 3, 3 } }; static char nameExp[] = "example"; - static int asciiA = 65; + static int asciiA = 65; char filename[1024]; int gridID, zaxisID[nStreams][nVars], taxisID; int streamID[nStreams], vlistID[nStreams], varID[nStreams][nVars], tsID, tfID = 0; int i, j, nmiss = 0; - double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; - double lats[nlat] = {-75, -45, -15, 15, 45, 75}; - double levs[MAXNLEV] = {101300, 92500, 85000, 50000, 20000}; + double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; + double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; + double levs[MAXNLEV] = { 101300, 92500, 85000, 50000, 20000 }; double *var; int vdate = 19850101, vtime = 120000, hourStep = 20000; size_t varSize[nStreams][nVars]; #if USE_MPI int rank, comm_size; - struct var1DDeco { + struct var1DDeco + { int chunkSize, start; Xt_idxlist partDesc; } varDeco[nStreams][nVars]; #endif #ifndef USE_MPI - (void)commModel; + (void) commModel; #endif - xassert ( nStreams < MAXNSTREAMS ); + xassert(nStreams < MAXNSTREAMS); - gridID = gridCreate ( GRID_LONLAT, nlon*nlat ); - gridDefXsize ( gridID, nlon ); - gridDefYsize ( gridID, nlat ); - gridDefXvals ( gridID, lons ); - gridDefYvals ( gridID, lats ); + gridID = gridCreate(GRID_LONLAT, nlon * nlat); + gridDefXsize(gridID, nlon); + gridDefYsize(gridID, nlat); + gridDefXvals(gridID, lons); + gridDefYvals(gridID, lats); - for ( i = 0; i < nStreams; i++ ) + for (i = 0; i < nStreams; i++) { - for ( j = 0; j < nVars; j++ ) + for (j = 0; j < nVars; j++) { - xassert ( nlev[i][j] > 0 && nlev[i][j] <= MAXNLEV ); - zaxisID[i][j] = zaxisCreate ( ZAXIS_PRESSURE, nlev[i][j] ); - zaxisDefLevels ( zaxisID[i][j], levs ); + xassert(nlev[i][j] > 0 && nlev[i][j] <= MAXNLEV); + zaxisID[i][j] = zaxisCreate(ZAXIS_PRESSURE, nlev[i][j]); + zaxisDefLevels(zaxisID[i][j], levs); } - vlistID[i] = vlistCreate (); + vlistID[i] = vlistCreate(); } #if USE_MPI - xmpi ( MPI_Comm_rank ( commModel, &rank )); - xmpi ( MPI_Comm_size ( commModel, &comm_size )); + xmpi(MPI_Comm_rank(commModel, &rank)); + xmpi(MPI_Comm_size(commModel, &comm_size)); #endif { size_t maxChunkSize = 0; - for ( i = 0; i < nStreams; i++ ) - for ( j = 0; j < nVars; j++ ) - { - varID[i][j] = vlistDefVar(vlistID[i], gridID, zaxisID[i][j], - TIME_VARIABLE); - varSize[i][j] = nlon * nlat * (size_t)nlev[i][j]; -#ifdef USE_MPI + for (i = 0; i < nStreams; i++) + for (j = 0; j < nVars; j++) { - int start = uniform_partition_start((int [2]){ 0, (int)varSize[i][j] - 1 }, - comm_size, rank), - chunkSize = uniform_partition_start((int [2]){ 0, (int)varSize[i][j] - 1 }, - comm_size, rank + 1) - start; - if (maxChunkSize < (size_t)chunkSize) - maxChunkSize = (size_t)chunkSize; - fprintf(stderr, "%d: start=%d, chunkSize = %d\n", rank, - start, chunkSize); - Xt_idxlist idxlist - = xt_idxstripes_new(&(struct Xt_stripe){ .start = start, - .nstrides = chunkSize, .stride = 1 }, 1); - varDeco[i][j] = (struct var1DDeco){ - .start = start, - .chunkSize = chunkSize, - .partDesc = idxlist - }; - } + varID[i][j] = vlistDefVar(vlistID[i], gridID, zaxisID[i][j], TIME_VARIABLE); + varSize[i][j] = nlon * nlat * (size_t) nlev[i][j]; +#ifdef USE_MPI + { + int start = uniform_partition_start((int[2]){ 0, (int) varSize[i][j] - 1 }, comm_size, rank), + chunkSize = uniform_partition_start((int[2]){ 0, (int) varSize[i][j] - 1 }, comm_size, rank + 1) - start; + if (maxChunkSize < (size_t) chunkSize) maxChunkSize = (size_t) chunkSize; + fprintf(stderr, "%d: start=%d, chunkSize = %d\n", rank, start, chunkSize); + Xt_idxlist idxlist = xt_idxstripes_new(&(struct Xt_stripe){ .start = start, .nstrides = chunkSize, .stride = 1 }, 1); + varDeco[i][j] = (struct var1DDeco){ .start = start, .chunkSize = chunkSize, .partDesc = idxlist }; + } #else - if (maxChunkSize < varSize[i][j]) - maxChunkSize = varSize[i][j]; + if (maxChunkSize < varSize[i][j]) maxChunkSize = varSize[i][j]; #endif - } - var = (double *)malloc(maxChunkSize * sizeof (var[0])); + } + var = (double *) malloc(maxChunkSize * sizeof(var[0])); } - taxisID = taxisCreate ( TAXIS_ABSOLUTE ); - for ( i = 0; i < nStreams; i++ ) - vlistDefTaxis ( vlistID[i], taxisID ); + taxisID = taxisCreate(TAXIS_ABSOLUTE); + for (i = 0; i < nStreams; i++) vlistDefTaxis(vlistID[i], taxisID); - for ( i = 0; i < nStreams; i++ ) + for (i = 0; i < nStreams; i++) { - memset ( filename, 0, 1024 ); - sprintf ( &filename[0], "%s%c_%d.grb", nameExp, asciiA + i, tfID ); - streamID[i] = streamOpenWrite ( filename, filetype ); - xassert ( streamID[i] >= 0 ); - streamDefVlist ( streamID[i], vlistID[i]); + memset(filename, 0, 1024); + sprintf(&filename[0], "%s%c_%d.grb", nameExp, asciiA + i, tfID); + streamID[i] = streamOpenWrite(filename, filetype); + xassert(streamID[i] >= 0); + streamDefVlist(streamID[i], vlistID[i]); } #ifdef USE_MPI - pioEndDef (); + pioEndDef(); #endif - for ( tfID = 0; tfID < ntfiles; tfID++ ) + for (tfID = 0; tfID < ntfiles; tfID++) { - if ( tfID > 0 ) - { - for ( i = 0; i < nStreams; i++ ) + if (tfID > 0) + { + for (i = 0; i < nStreams; i++) { - streamClose ( streamID[i] ); - sprintf ( &filename[0], "%s%c_%d.grb", nameExp, asciiA + i, tfID ); - streamID[i] = streamOpenWrite ( filename, filetype ); - xassert ( streamID[i] >= 0 ); - streamDefVlist ( streamID[i], vlistID[i] ); + streamClose(streamID[i]); + sprintf(&filename[0], "%s%c_%d.grb", nameExp, asciiA + i, tfID); + streamID[i] = streamOpenWrite(filename, filetype); + xassert(streamID[i] >= 0); + streamDefVlist(streamID[i], vlistID[i]); } - } + } - for ( tsID = 0; tsID < ntsteps; tsID++ ) - { - hoursPassingHack ( &vdate, &vtime, hourStep ); - taxisDefVdate ( taxisID, vdate ); - taxisDefVtime ( taxisID, vtime ); - /* temporary fix for problem calling streamDefTimestep after - * streamWriteVarPart - * FIXME: this can be merged with the loop below again once - * per-stream RDMA windows are realized */ - for ( i = 0; i < nStreams; i++ ) - streamDefTimestep(streamID[i], tsID); - for ( i = 0; i < nStreams; i++ ) + for (tsID = 0; tsID < ntsteps; tsID++) + { + hoursPassingHack(&vdate, &vtime, hourStep); + taxisDefVdate(taxisID, vdate); + taxisDefVtime(taxisID, vtime); + for (i = 0; i < nStreams; i++) { - for ( j = 0; j < nVars; j++ ) + streamDefTimestep(streamID[i], tsID); + for (j = 0; j < nVars; j++) { #ifdef USE_MPI int start = varDeco[i][j].start; int chunk = varDeco[i][j].chunkSize; #else - int start = 0, chunk = (int)varSize[i][j]; + int start = 0, chunk = (int) varSize[i][j]; #endif - for(int k = 0; k < chunk; k++) - var[k] = 3.3 * (double)(k + start); + for (int k = 0; k < chunk; k++) var[k] = 3.3 * (double) (k + start); #ifdef USE_MPI - streamWriteVarPart(streamID[i], varID[i][j], var, nmiss, - varDeco[i][j].partDesc); + streamWriteVarPart(streamID[i], varID[i][j], var, nmiss, varDeco[i][j].partDesc); #else streamWriteVar(streamID[i], varID[i][j], var, nmiss); #endif } } #ifdef USE_MPI - pioWriteTimestep(); + pioWriteTimestep(); #endif - } + } #ifdef USE_MPI MPI_Barrier(commModel); #endif } #ifdef USE_MPI - pioEndTimestepping (); - for (size_t streamIdx = 0; streamIdx < (size_t)nStreams; ++streamIdx) - for (size_t varIdx = 0; varIdx < (size_t)nVars; ++varIdx) - xt_idxlist_delete(varDeco[streamIdx][varIdx].partDesc); + for (size_t streamIdx = 0; streamIdx < (size_t) nStreams; ++streamIdx) + for (size_t varIdx = 0; varIdx < (size_t) nVars; ++varIdx) xt_idxlist_delete(varDeco[streamIdx][varIdx].partDesc); #endif - for ( i = 0; i < nStreams; i++ ) + for (i = 0; i < nStreams; i++) { - streamClose ( streamID[i] ); - vlistDestroy ( vlistID[i] ); + streamClose(streamID[i]); + vlistDestroy(vlistID[i]); } - taxisDestroy ( taxisID ); - for ( i = 0; i < nStreams; i++ ) - for ( j = 0; j < nVars; j++ ) - zaxisDestroy ( zaxisID[i][j] ); - gridDestroy ( gridID ); + taxisDestroy(taxisID); + for (i = 0; i < nStreams; i++) + for (j = 0; j < nVars; j++) zaxisDestroy(zaxisID[i][j]); + gridDestroy(gridID); free(var); } - -int main (int argc, char *argv[]) +int +main(int argc, char *argv[]) { - enum { - nProcsIODef = 3, - //IOModeDef = PIO_NONE, - //IOModeDef = PIO_MPI, + enum + { + nProcsIODef = 3, + // IOModeDef = PIO_NONE, + // IOModeDef = PIO_MPI, #ifdef USE_MPI - IOModeDef = PIO_FPGUARD, + IOModeDef = PIO_FPGUARD, #endif - //IOModeDef = PIO_ASYNCH, - //IOModeDef = PIO_WRITER, + // IOModeDef = PIO_ASYNCH, + // IOModeDef = PIO_WRITER, }; MPI_Comm commModel = MPI_COMM_NULL; @@ -248,21 +230,20 @@ int main (int argc, char *argv[]) int rankGlob; int IOMode, nProcsIO, pioNamespace; - xmpi ( MPI_Init ( &argc, &argv)); + xmpi(MPI_Init(&argc, &argv)); commGlob = MPI_COMM_WORLD; xt_initialize(commGlob); - xmpi ( MPI_Comm_set_errhandler ( commGlob, MPI_ERRORS_RETURN )); - xmpi ( MPI_Comm_size ( commGlob, &sizeGlob )); - xmpi ( MPI_Comm_rank ( commGlob, &rankGlob )); + xmpi(MPI_Comm_set_errhandler(commGlob, MPI_ERRORS_RETURN)); + xmpi(MPI_Comm_size(commGlob, &sizeGlob)); + xmpi(MPI_Comm_rank(commGlob, &rankGlob)); if (argc > 1) { - xassert ( argc >= 3 ); + xassert(argc >= 3); IOMode = atoi(argv[1]); nProcsIO = atoi(argv[2]); - xassert ( IOMode >= PIO_MINIOMODE && IOMode <= PIO_MAXIOMODE && - nProcsIO >= 0 && nProcsIO <= sizeGlob ); - printf ( "IOMode=%d, nProcsIO=%d", IOMode, nProcsIO ); + xassert(IOMode >= PIO_MINIOMODE && IOMode <= PIO_MAXIOMODE && nProcsIO >= 0 && nProcsIO <= sizeGlob); + printf("IOMode=%d, nProcsIO=%d", IOMode, nProcsIO); } else { @@ -270,22 +251,22 @@ int main (int argc, char *argv[]) nProcsIO = nProcsIODef; } - commModel = pioInit(commGlob, nProcsIO, IOMode, &pioNamespace, 1.0f, - cdiPioNoPostCommSetup); + commModel = pioInit(commGlob, nProcsIO, IOMode, &pioNamespace, 1.0f, cdiPioNoPostCommSetup); if (commModel != MPI_COMM_NULL) { namespaceSetActive(pioNamespace); #else - (void)argc; (void)argv; + (void) argc; + (void) argv; #endif modelRun(commModel); #ifdef USE_MPI } - pioFinalize (); + pioFinalize(); xt_finalize(); - MPI_Finalize (); + MPI_Finalize(); #endif return 0; } @@ -295,8 +276,7 @@ static int uniform_partition_start(int set_interval[2], int nparts, int part_idx) { int part_offset - = (int)((((long long)set_interval[1] - (long long)set_interval[0] + 1LL) - * (long long)part_idx) / (long long)nparts); + = (int) ((((long long) set_interval[1] - (long long) set_interval[0] + 1LL) * (long long) part_idx) / (long long) nparts); int start = set_interval[0] + part_offset; return start; } diff --git a/examples/pio/compareResourcesArray.c b/examples/pio/compareResourcesArray.c index 98ad653d81e934aa45071b4427a1bac64ec28d85..0082d60caee0271025039752166cee9fd0e94bd0 100644 --- a/examples/pio/compareResourcesArray.c +++ b/examples/pio/compareResourcesArray.c @@ -1,4 +1,4 @@ -#if defined (HAVE_CONFIG_H) +#if defined(HAVE_CONFIG_H) #include "config.h" #endif @@ -13,44 +13,45 @@ #include "resource_handle.h" #include "resource_unpack.h" -extern int reshListCompare ( int, int ); +extern int reshListCompare(int, int); -enum { - IOMode = PIO_NONE, - nProcsIO = 1, +enum +{ + IOMode = PIO_NONE, + nProcsIO = 1, DOUBLE_PRECISION = 8, - nlon = 12, - nlat = 6, - nlev = 5, - ntsteps = 3 }; + nlon = 12, + nlat = 6, + nlev = 5, + ntsteps = 3 +}; -static double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; -static double lats[nlat] = {-75, -45, -15, 15, 45, 75}; -static double levs[nlev] = {101300, 92500, 85000, 50000, 20000}; +static double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; +static double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; +static double levs[nlev] = { 101300, 92500, 85000, 50000, 20000 }; -static int defineGrid() +static int +defineGrid() { int gridID = CDI_UNDEFID; - int mask_vec[nlon*nlat]; - const int * mp = &mask_vec[0]; - double area_vec[nlon*nlat]; - const double * ap = &area_vec[0]; + int mask_vec[nlon * nlat]; + const int *mp = &mask_vec[0]; + double area_vec[nlon * nlat]; + const double *ap = &area_vec[0]; int i; - gridID = gridCreate(GRID_LONLAT, nlon*nlat); + gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); gridDefYvals(gridID, lats); - gridDefNvertex ( gridID, 1 ); - gridDefXbounds ( gridID, lons ); - gridDefYbounds ( gridID, lats ); - for ( i = 0; i < nlon*nlat; i++ ) - mask_vec[i] = i % 2 ; - gridDefMaskGME ( gridID, mp ); - for ( i = 0; i < nlon*nlat; i++ ) - mask_vec[i] = 1; - gridDefMask ( gridID, mp ); + gridDefNvertex(gridID, 1); + gridDefXbounds(gridID, lons); + gridDefYbounds(gridID, lats); + for (i = 0; i < nlon * nlat; i++) mask_vec[i] = i % 2; + gridDefMaskGME(gridID, mp); + for (i = 0; i < nlon * nlat; i++) mask_vec[i] = 1; + gridDefMask(gridID, mp); cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_NAME, "myXname"); cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_NAME, "myYname"); @@ -59,79 +60,81 @@ static int defineGrid() cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, "myXunits"); cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_UNITS, "myYunits"); - gridDefDatatype ( gridID, DOUBLE_PRECISION ); - gridDefTrunc ( gridID, 1 ); + gridDefDatatype(gridID, DOUBLE_PRECISION); + gridDefTrunc(gridID, 1); cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, 6); cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDINREFERENCE, 7); cdiDefKeyString(gridID, CDI_GLOBAL, CDI_KEY_REFERENCEURI, "myReference"); -/* gridDefLCC ( gridID, double originLon, double originLat, */ -/* double lonParY, double lat1, double lat2, double xinc, double yinc, int projflag, int scanflag); */ -/* gridDefLcc2 ( gridID, double earth_radius, double lon_0, */ -/* double lat_0, double lat_1,double lat_2);*/ -/* gridDefLaea ( gridID, double earth_radius, double lon_0, double lat_0); */ - for ( i = 0; i < nlon*nlat; i++ ) - area_vec[i] = 0.1 * i; - gridDefArea ( gridID, ap ); - for ( i = 0; i < nlon*nlat; i++ ) - mask_vec[i] = i; - gridDefReducedPoints ( gridID, nlon*nlat, mp ); - gridDefComplexPacking ( gridID, 1 ); + /* gridDefLCC ( gridID, double originLon, double originLat, */ + /* double lonParY, double lat1, double lat2, double xinc, double yinc, int projflag, int scanflag); */ + /* gridDefLcc2 ( gridID, double earth_radius, double lon_0, */ + /* double lat_0, double lat_1,double lat_2);*/ + /* gridDefLaea ( gridID, double earth_radius, double lon_0, double lat_0); */ + for (i = 0; i < nlon * nlat; i++) area_vec[i] = 0.1 * i; + gridDefArea(gridID, ap); + for (i = 0; i < nlon * nlat; i++) mask_vec[i] = i; + gridDefReducedPoints(gridID, nlon * nlat, mp); + gridDefComplexPacking(gridID, 1); return gridID; } -static int defineZaxis () +static int +defineZaxis() { int zaxisID = CDI_UNDEFID; double vct[3] = { 3.0, 3.3, 3.6 }; zaxisID = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID, levs); - zaxisDefLevel ( zaxisID, 2, 8507.3 ); + zaxisDefLevel(zaxisID, 2, 8507.3); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, "myName"); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_LONGNAME, "myLongname"); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, "myUnits"); - zaxisDefDatatype ( zaxisID, DOUBLE_PRECISION ); + zaxisDefDatatype(zaxisID, DOUBLE_PRECISION); cdiDefKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_TYPEOFFIRSTFIXEDSURFACE, 1); - zaxisDefVct ( zaxisID, 3, vct ); - zaxisDefLbounds ( zaxisID, &levs[0] ); - zaxisDefUbounds ( zaxisID, &levs[0] ); - zaxisDefWeights ( zaxisID, &levs[0] ); + zaxisDefVct(zaxisID, 3, vct); + zaxisDefLbounds(zaxisID, &levs[0]); + zaxisDefUbounds(zaxisID, &levs[0]); + zaxisDefWeights(zaxisID, &levs[0]); return zaxisID; } -static int defineTaxis () +static int +defineTaxis() { int taxisID = taxisCreate(TAXIS_ABSOLUTE); - taxisDefType ( taxisID, 0 ); - taxisDefVdate ( taxisID, 1 ); - taxisDefVtime ( taxisID, 2 ); - taxisDefRdate ( taxisID, 3 ); - taxisDefRtime ( taxisID, 4 ); - taxisDefVdateBounds ( taxisID, 5, 6 ); - taxisDefVtimeBounds ( taxisID, 7, 8 ); - taxisDefCalendar ( taxisID, 1 ); - taxisDefTunit ( taxisID, 1 ); - taxisDefNumavg ( taxisID, 1 ); + taxisDefType(taxisID, 0); + taxisDefVdate(taxisID, 1); + taxisDefVtime(taxisID, 2); + taxisDefRdate(taxisID, 3); + taxisDefRtime(taxisID, 4); + taxisDefVdateBounds(taxisID, 5, 6); + taxisDefVtimeBounds(taxisID, 7, 8); + taxisDefCalendar(taxisID, 1); + taxisDefTunit(taxisID, 1); + taxisDefNumavg(taxisID, 1); return taxisID; } -static void defineStream ( int streamID, int vlistID ) +static void +defineStream(int streamID, int vlistID) { - streamDefByteorder ( streamID, 1 ); - streamDefCompType ( streamID, 2 ); - streamDefCompLevel ( streamID, 3 ); + streamDefByteorder(streamID, 1); + streamDefCompType(streamID, 2); + streamDefCompLevel(streamID, 3); streamDefVlist(streamID, vlistID); } -static int defineVlist ( int gridID, int zaxisID, int taxisID ) +static int +defineVlist(int gridID, int zaxisID, int taxisID) { int vlistID = CDI_UNDEFID; int zaxisID2 = zaxisCreate(ZAXIS_SURFACE, 1); @@ -143,8 +146,7 @@ static int defineVlist ( int gridID, int zaxisID, int taxisID ) vlistDefVarName(vlistID, varID1, "varname1"); { int globfac[] = { 23, 42 }; - cdiDefAttInt(vlistID, varID1, "seer's globule factors", CDI_DATATYPE_INT16, - 2, globfac); + cdiDefAttInt(vlistID, varID1, "seer's globule factors", CDI_DATATYPE_INT16, 2, globfac); } vlistDefVarName(vlistID, varID2, "varname2"); cdiDefAttTxt(vlistID, varID2, "txt demo", 6, "banana"); @@ -153,11 +155,11 @@ static int defineVlist ( int gridID, int zaxisID, int taxisID ) } static int -defineInstitute () +defineInstitute() { int instID = CDI_UNDEFID; - instID = institutDef( 0, 0,"MYINSTITUTE", "myInstitute"); + instID = institutDef(0, 0, "MYINSTITUTE", "myInstitute"); return instID; } @@ -172,53 +174,53 @@ static void printResources() { FILE *fp = fopen("reshArrayModel.txt", "w"); - if (!fp) - xabort("%s", "could not open file"); + if (!fp) xabort("%s", "could not open file"); reshListPrint(fp); fclose(fp); } - -static void modelRun ( MPI_Comm comm ) +static void +modelRun(MPI_Comm comm) { int gridID, zaxisID, taxisID, instID, vlistID, streamID; - char * recvBuffer, * sendBuffer; + char *recvBuffer, *sendBuffer; int bufferSize, differ; MPI_Status status; - namespaceSetActive ( 0 ); + namespaceSetActive(0); - gridID = defineGrid (); - zaxisID = defineZaxis (); - taxisID = defineTaxis (); - instID = defineInstitute (); + gridID = defineGrid(); + zaxisID = defineZaxis(); + taxisID = defineTaxis(); + instID = defineInstitute(); defineModel(instID); - vlistID = defineVlist ( gridID, zaxisID, taxisID); + vlistID = defineVlist(gridID, zaxisID, taxisID); streamID = streamOpenWrite("example.grb", CDI_FILETYPE_GRB); - if ( streamID < 0 ) xabort ( "Could not open file" ); - defineStream ( streamID, vlistID ); + if (streamID < 0) xabort("Could not open file"); + defineStream(streamID, vlistID); reshPackBufferCreate(&sendBuffer, &bufferSize, &comm); - xmpi ( MPI_Send ( sendBuffer, bufferSize, MPI_PACKED, 0, 0, comm )); - recvBuffer = Malloc((size_t)bufferSize); - xmpi ( MPI_Recv ( recvBuffer, bufferSize, MPI_PACKED, 0, 0, comm, &status )); + xmpi(MPI_Send(sendBuffer, bufferSize, MPI_PACKED, 0, 0, comm)); + recvBuffer = Malloc((size_t) bufferSize); + xmpi(MPI_Recv(recvBuffer, bufferSize, MPI_PACKED, 0, 0, comm, &status)); - namespaceSetActive ( 1 ); - reshUnpackResources(recvBuffer, bufferSize, &comm); - Free ( recvBuffer ); - reshPackBufferDestroy ( &sendBuffer ); + namespaceSetActive(1); + reshUnpackResources(recvBuffer, bufferSize, &comm, (cdiPostResUpdateHook) 0); + Free(recvBuffer); + reshPackBufferDestroy(&sendBuffer); - differ = reshListCompare ( 0, 1 ); - printf ( "The resource arrays %s.\n", differ ? "differ" : "are equal" ); + differ = reshListCompare(0, 1); + printf("The resource arrays %s.\n", differ ? "differ" : "are equal"); printResources(); - namespaceSetActive ( 0 ); + namespaceSetActive(0); streamClose(streamID); return; } -int main (int argc, char *argv[]) +int +main(int argc, char *argv[]) { int sizeGlob, pioNamespace; MPI_Comm commGlob, commModel; @@ -226,23 +228,20 @@ int main (int argc, char *argv[]) MPI_Init(&argc, &argv); commGlob = MPI_COMM_WORLD; xt_initialize(commGlob); - xmpi ( MPI_Comm_set_errhandler ( commGlob, MPI_ERRORS_RETURN )); - xmpi ( MPI_Comm_size ( commGlob, &sizeGlob )); + xmpi(MPI_Comm_set_errhandler(commGlob, MPI_ERRORS_RETURN)); + xmpi(MPI_Comm_size(commGlob, &sizeGlob)); - if ( sizeGlob != 1 ) - xabort ( "test transition of resource array only with 1 PE." ); + if (sizeGlob != 1) xabort("test transition of resource array only with 1 PE."); - if ( nProcsIO != 1 ) - xabort ( "bad distribution of tasks on PEs" ); + if (nProcsIO != 1) xabort("bad distribution of tasks on PEs"); - commModel = pioInit(commGlob, nProcsIO, IOMode, &pioNamespace, 1.0f, - cdiPioNoPostCommSetup); + commModel = pioInit(commGlob, nProcsIO, IOMode, &pioNamespace, 1.0f, cdiPioNoPostCommSetup); namespaceSetActive(pioNamespace); - modelRun ( commModel ); + modelRun(commModel); xt_finalize(); - MPI_Finalize (); + MPI_Finalize(); return 0; } diff --git a/interfaces/CdiInfo.cpp b/interfaces/CdiInfo.cpp index 5d960bed3134d68f0c98a28f35d31990fcaaf3b7..ef597c7c94403cb135f31c8d041e9ad3915f2e68 100644 --- a/interfaces/CdiInfo.cpp +++ b/interfaces/CdiInfo.cpp @@ -4,13 +4,13 @@ #include "cdi.hpp" int -main() +main(int argc, char *argv[]) { int varno; std::string _name; CdiVariable var; - Cdi info("mulval.nc"); + Cdi info(argc > 1 ? argv[1] : "testdata/mulval.nc"); std::cout << "#===============================" << std::endl; for (int i = 0; i < info.nvars; i++) std::cout << info.codes[i] << ' '; diff --git a/interfaces/Makefile.am b/interfaces/Makefile.am index 4dcc694f43d92514a44b3d2fa4b77d0e2cf65eea..55f7cc1cfe162c4a0a69279b47357a85374dd1a3 100644 --- a/interfaces/Makefile.am +++ b/interfaces/Makefile.am @@ -1,99 +1,178 @@ -## Process this file with automake to produce Makefile.in -# -SWIG_FILE = $(abs_top_srcdir)/interfaces/cdi.i -BINDINGS = -CLEANFILES = -BINDING_TESTS = - -EXTRA_DIST = mulval.nc.gz - -INTERFACES_FILES = \ - $(abs_top_srcdir)/interfaces/ruby/test.rb \ - $(abs_top_srcdir)/interfaces/ruby/setup.rb \ - $(abs_top_srcdir)/interfaces/python/test.py \ - $(abs_top_srcdir)/interfaces/python/setup.py - -MODULE_NAME = Cdi -RUBY_WRAPPER_FILE = $(abs_top_builddir)/interfaces/ruby/cdi_wrapper.cpp -RUBY_SHARED_LIB = $(abs_top_builddir)/interfaces/ruby/$(MODULE_NAME).so -RUBY_MAKEFILE = $(abs_top_builddir)/interfaces/ruby/Makefile -PYTHON_WRAPPER_FILE = $(abs_top_builddir)/interfaces/python/cdi_wrapper.cpp -PYTHON_SHARED_LIB = $(abs_top_builddir)/interfaces/python/$(MODULE_NAME).so -PYTHON_MAKEFILE = $(abs_top_builddir)/interfaces/python/Makefile - -CLEANFILES += $(RUBY_WRAPPER_FILE) $(RUBY_MAKEFILE) $(RUBY_SHARED_LIB) $(PYTHON_MAKEFILE) $(PYTHON_SHARED_LIB) $(PYTHON_WRAPPER_FILE) - -bin_PROGRAMS = -noinst_PROGRAMS = -noinst_LTLIBRARIES = -if CREATE_INTERFACES -noinst_PROGRAMS += CdiInfo -noinst_LTLIBRARIES += libcdipp.la -endif -# -locallibs = $(abs_top_builddir)/src/.libs/libcdi.so @LTLIBOBJS@ @NETCDF_LIBS@ @SZLIB_LIBS@ +EXTRA_LTLIBRARIES = libcdipp.la libcdipp_la_SOURCES = cdi.cpp cdi.hpp -libcdipp_la_LIBADD = $(top_builddir)/src/libcdi.la -libcdipp_la_LDFLAGS = @NETCDF_LIBS@ @SZLIB_LIBS@ $(LDFLAGS) - -CdiInfo_SOURCES = CdiInfo.cpp mulval.nc -CdiInfo_LDADD = libcdipp.la -CdiInfo_LDFLAGS = @NETCDF_LIBS@ @SZLIB_LIBS@ $(LDFLAGS) - -mulval.nc: $(abs_top_srcdir)/interfaces/mulval.nc.gz - gunzip -c $< > $@ -# -# -if ENABLE_RUBY -BINDINGS += ruby-binding -BINDING_TESTS += ruby-test -# Ruby ==================================================== -$(RUBY_WRAPPER_FILE): $(SWIG_FILE) - mkdir -p $(dir $@) - $(SWIG) -ruby -c++ -globalmodule -debug-classes -o $@ $(AM_CPPFLAGS) $< - -$(RUBY_MAKEFILE): $(abs_top_srcdir)/interfaces/ruby/setup.rb - mkdir -p $(dir $@) - cd ruby && CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="$(LDFLAGS)" INCFLAGS="-I$(abs_top_srcdir)/src -I$(abs_top_srcdir)/interfaces" ruby $< - -$(RUBY_SHARED_LIB): $(RUBY_WRAPPER_FILE) $(RUBY_MAKEFILE) - cd ruby && make - -ruby-binding: $(RUBY_SHARED_LIB) - -ruby-test: $(RUBY_SHARED_LIB) mulval.nc - cd ruby && ruby $(abs_top_srcdir)/interfaces/ruby/test.rb - -install-ruby: $(RUBY_SHARED_LIB) - cd ruby && make install -endif -# ========================================================= -if ENABLE_PYTHON -BINDINGS += python-binding -BINDING_TESTS += python-test -# Python ================================================== -$(PYTHON_WRAPPER_FILE): $(SWIG_FILE) - mkdir -p $(dir $@) - $(SWIG) -python -c++ -debug-classes -o $(PYTHON_WRAPPER_FILE) $(AM_CPPFLAGS) $< - -$(PYTHON_SHARED_LIB): $(PYTHON_WRAPPER_FILE) $(abs_top_srcdir)/interfaces/python/setup.py - mkdir -p $(dir $@) - cd python; CC="$(CC)" CXX="$(CXX)" BUILDLIBDIR="$(top_builddir)/src/.libs" LIBDIR=$(libdir) CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="-L../../src/.libs $(LDFLAGS)" INCFLAGS="-I$(abs_top_srcdir)/src -I$(abs_top_srcdir)/interfaces" python $(abs_top_srcdir)/interfaces/python/setup.py build_ext --inplace -R "$(abs_top_builddir)/src/.libs" - -python-binding: $(PYTHON_SHARED_LIB) - -python-test: $(abs_top_srcdir)/interfaces/python/test.py mulval.nc - @cd python; python $< - -install-python: $(PYTHON_SHARED_LIB) mulval.nc - cd python; CC="$(CC)" CXX="$(CXX)" BUILDLIBDIR="$(top_builddir)/src/.libs" LIBDIR=$(libdir) CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="-L../../src/.libs $(LDFLAGS)" INCFLAGS="-I$(abs_top_srcdir)/src -I$(abs_top_srcdir)/interfaces" python $(abs_top_srcdir)/interfaces/python/setup.py install --prefix=$(prefix) -R $(libdir) -endif -# -AM_CPPFLAGS = -I$(top_srcdir)/src -# -all-local: $(BINDINGS) -# -test: $(BINDING_TESTS) -# -CLEANFILES += `ls *~ *.o *.la` +libcdipp_la_LIBADD = $(top_builddir)/src/libcdi.la + +test_PROGRAMS_ = CdiInfo + +CdiInfo_SOURCES = CdiInfo.cpp +CdiInfo_LDADD = libcdipp.la + +AM_CPPFLAGS = -I$(abs_top_srcdir)/src + +all_local = +install_exec_local = +uninstall_local = +clean_local = + +if ENABLE_RUBY_INTERFACE +V_MAKERUBY = $(v_MAKERUBY_@AM_V@) +v_MAKERUBY_ = $(v_MAKERUBY_@AM_DEFAULT_V@) +v_MAKERUBY_0 = 0 +v_MAKERUBY_1 = 1 + +# For compatibility with older versions of Ruby, the recipes below redefine +# the following additional variables of the generated Makefile (this is known +# to be needed for Ruby 2.7.4 but not for Ruby 3.1.0): +# sitearchdir='$$(sitelibdir)/$$(sitearch)' +# sitedir='$$(rubylibprefix)/site_ruby' +# RM='$$(RM_RF)' + +.PHONY: ruby-binding +all_local += ruby-binding +ruby-binding: ruby/Cdi.la +ruby/Cdi.la: ruby/cdi_wrapper.cpp ruby/Makefile libcdipp.la + $(AM_V_CXXLD)$(am__cd) ruby && \ + $(MAKE) $(AM_MAKEFLAGS) \ + prefix='$(prefix)' \ + sitearchdir='$$(sitelibdir)/$$(sitearch)' \ + sitedir='$$(rubylibprefix)/site_ruby' \ + TIMESTAMP_DIR='.dirstamp' \ + CDI_INCFLAGS='-I$(abs_srcdir)' \ + CDI_CPPFLAGS='$(AM_CPPFLAGS) $(CPPFLAGS)' \ + CDI_CXXFLAGS='$(AM_CXXFLAGS) -shared $(CXXFLAGS)' \ + CDI_LDFLAGS='$(AM_LDFLAGS) -module -avoid-version $(LDFLAGS) -rpath $$(RUBYARCHDIR)' \ + CDI_LIBS='$(LIBS)' \ + CCDLFLAGS= \ + CXX='$(SHELL) $(abs_top_builddir)/libtool $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX)' \ + LDSHAREDXX='$(SHELL) $(abs_top_builddir)/libtool $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) $$(CDI_CXXFLAGS)' \ + DLLIB='$$(TARGET).la' \ + V='$(V_MAKERUBY)' + +ruby/Makefile: $(abs_srcdir)/ruby/setup.rb Makefile + $(AM_V_GEN)$(MKDIR_P) $(@D) && $(am__cd) $(@D) && $(RUBY) $< && \ + $(SED) -i~ -e '/^\.cpp\.o:/s/^\.cpp\.o/.cpp.lo/;/^.SUFFIXES:/s/$$/ .lo/' \ + -e '$$auninstall:; $$(UNINSTALL_PROG) $$(RUBYARCHDIR)/$$(DLLIB)' \ + Makefile && rm -f Makefile~ + +.PHONY: ruby-install +install_exec_local += ruby-install +ruby-install: ruby-binding + $(am__cd) ruby && \ + $(MAKE) $(AM_MAKEFLAGS) install \ + prefix='$(DESTDIR)$(prefix)' \ + sitearchdir='$$(sitelibdir)/$$(sitearch)' \ + sitedir='$$(rubylibprefix)/site_ruby' \ + TIMESTAMP_DIR='.dirstamp$(DESTDIR)' \ + INSTALL_PROG='$(SHELL) $(abs_top_builddir)/libtool $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG)' \ + DLLIB='$$(TARGET).la' + +.PHONY: ruby-uninstall +uninstall_local += ruby-uninstall +ruby-uninstall: + $(am__cd) ruby && \ + $(MAKE) $(AM_MAKEFLAGS) uninstall \ + prefix='$(DESTDIR)$(prefix)' \ + sitearchdir='$$(sitelibdir)/$$(sitearch)' \ + sitedir='$$(rubylibprefix)/site_ruby' \ + UNINSTALL_PROG='$(SHELL) $(abs_top_builddir)/libtool $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f' \ + DLLIB='$$(TARGET).la' + +.PHONY: ruby-clean +# We call with distclean to remove the generated ruby/Makefile, which is +# generated by this makefile, and should, therefore, be deleted with +# 'make clean': +clean_local += ruby-clean +ruby-clean: + if test -f ruby/Makefile; then \ + $(am__cd) ruby && \ + $(MAKE) $(AM_MAKEFLAGS) distclean \ + RM='$$(RM_RF)' \ + DLLIB='$$(TARGET).la' \ + CLEANOBJS='*.lo .libs .dirstamp'; \ + fi + +if with_on_demand_check_programs +check_PROGRAMS = $(test_PROGRAMS_) +else !with_on_demand_check_programs +noinst_PROGRAMS = $(test_PROGRAMS_) +endif !with_on_demand_check_programs + +endif ENABLE_RUBY_INTERFACE + +AUTOMAKE_OPTIONS = subdir-objects +if ENABLE_PYTHON_INTERFACE + +python_PYTHON = python/Cdi.py +pyexec_LTLIBRARIES = python/_Cdi.la +python__Cdi_la_SOURCES = python/cdi_wrapper.cpp +python__Cdi_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_CPPFLAGS) +python__Cdi_la_CXXFLAGS = $(AM_CXXFLAGS) -shared +python__Cdi_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version +python__Cdi_la_LIBADD = libcdipp.la $(PYTHON_LIBS) + +if with_on_demand_check_programs +check_PROGRAMS = $(test_PROGRAMS_) +else !with_on_demand_check_programs +noinst_PROGRAMS = $(test_PROGRAMS_) +endif !with_on_demand_check_programs +endif ENABLE_PYTHON_INTERFACE + +if MAINTAINER_MODE +ruby/cdi_wrapper.cpp: cdi.i cdi.hpp + $(AM_V_GEN)$(MKDIR_P) $(@D) && $(SWIG) -ruby -c++ -globalmodule -o $@ $< + +python/Cdi.py: cdi.i cdi.hpp + $(AM_V_GEN)$(SWIG) -python -c++ -o python/cdi_wrapper.cpp $< + +python/cdi_wrapper.cpp: python/Cdi.py + $(AM_V_at)test -f $@ || rm -f $< + $(AM_V_at)test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $< +else !MAINTAINER_MODE +ruby/cdi_wrapper.cpp python/Cdi.py python/cdi_wrapper.cpp: + @:;{ \ + echo "ERROR: cannot generate '$@' when the maintainer mode is disabled:"; \ + echo " re-configure with the '--enable-maintainer-mode' option"; \ + } >&2; exit 1 +endif !MAINTAINER_MODE + +all-local: $(all_local) +install-exec-local: $(install_exec_local) +uninstall-local: $(uninstall_local) +clean-local: $(clean_local) + +AM_TESTSUITE_SUMMARY_HEADER = ' for Ruby and Python interfaces of $(PACKAGE_STRING)' +TEST_EXTENSIONS = .run +TESTS = \ + test_cpp_nc.run \ + test_python_grb.run \ + test_python_nc.run \ + test_ruby_grb.run \ + test_ruby_nc.run + +MOSTLYCLEANFILES = $(EXTRA_LTLIBRARIES) +MAINTAINERCLEANFILES = \ + python/Cdi.py \ + python/cdi_wrapper.cpp \ + ruby/cdi_wrapper.cpp + +EXTRA_DIST = \ + cdi.i \ + f2003/bindGen.rb \ + python/test.py \ + ruby/cdi_wrapper.cpp \ + ruby/setup.rb \ + ruby/test.rb \ + testdata/mulval.grb \ + testdata/mulval.nc + +# Compile programs using Libtool: +COMPILE = $(LTCOMPILE) +FCCOMPILE = $(LTFCCOMPILE) +PPFCCOMPILE = $(LTPPFCCOMPILE) +CXXCOMPILE = $(LTCXXCOMPILE) + +# Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler +# and might not be compatible with the Fortran compiler: +LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) diff --git a/interfaces/cdi.cpp b/interfaces/cdi.cpp index fe3d33871c4692bbc37c01ce03502fb16a475a3b..6a842450dd7c21f763b54af8160690a399345aa6 100644 --- a/interfaces/cdi.cpp +++ b/interfaces/cdi.cpp @@ -376,6 +376,7 @@ Cdi::Cdi(const char *path) { std::cout << "Failed to read input '" << path << "'"; std::cout << "Got streamID = " << streamID; + throw; } vlistID = streamInqVlist(streamID); nvars = vlistNvars(vlistID); @@ -391,9 +392,8 @@ Cdi::~Cdi() { streamClose(streamID); } void Cdi::getTaxes() { - int taxisID; ntaxes = 1; - taxisID = vlistInqTaxis(vlistID); + int taxisID = vlistInqTaxis(vlistID); taxes[taxisID] = CdiTaxis(vlistID); } diff --git a/interfaces/cdi.hpp b/interfaces/cdi.hpp index ed5a1df09faa2febb76a0efd5ecef017a6cdeccc..fd12923beb6cac9539f3c6e2712c6c014ca8c766 100644 --- a/interfaces/cdi.hpp +++ b/interfaces/cdi.hpp @@ -1,6 +1,9 @@ #include <string> #include <vector> #include <map> +// the following include is only needed for buggy versions of SWIG +// (2.0.7 and earlier) with newer STL which no longer include cstddef +#include <cstddef> #include "cdi.h" class CdiGrid diff --git a/interfaces/cdilib.i b/interfaces/cdilib.i deleted file mode 100644 index 54e2c00e97068730066caf8c8bd9030690b5592f..0000000000000000000000000000000000000000 --- a/interfaces/cdilib.i +++ /dev/null @@ -1,5 +0,0 @@ -%module CdiLib -%{ -#include "cdi.h" -%} -%include "cdi.h" diff --git a/interfaces/f2003/bindGen.rb b/interfaces/f2003/bindGen.rb index 1ee9c93b1f7f3e0af1f4de025fc1d1d220313923..a50b5e3b17bec702bc4014be96cc8cc503c284a3 100755 --- a/interfaces/f2003/bindGen.rb +++ b/interfaces/f2003/bindGen.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +$VERBOSE=true # This script generates a fortran source file that uses the ISO_C_BINDINGS to interface to the functions defined in the given C header file. # The basic approach is, that every C function is wrapped in a fortran function/subroutine, which internally uses a bind(c) interface to the C code. @@ -134,6 +135,16 @@ $argumentTemplates = :callExpression => '<name>_dummy', :passAs => 'integer(c_<type>), value :: <name>_dummy', :postcallStatements => '' + }, { #logical + :regex => '^\s*(?<type>bool)\s+(?<name>\w+)\s*$', + :placeholders => %w[name type], + :dummyName => '<name>_dummy', + :acceptAs => 'logical(c_<type>), value :: <name>_dummy', + :helperVars => '', + :precallStatements => '', + :callExpression => '<name>_dummy', + :passAs => 'logical(c_<type>), value :: <name>_dummy', + :postcallStatements => '' }, { #<floatTypes> :regex => '^\s*(?<type><floatTypes>)\s+(?<name>\w+)\s*$', :placeholders => %w[name type], @@ -366,6 +377,16 @@ $argumentTemplates = :callExpression => '<name>_dummy', :passAs => 'integer(c_<type>), intent(in) :: <name>_dummy(<lineSize>, <lineCount>)', :postcallStatements => "" + }, { #const <integerTypes> <name>[][<lineSize>] + :regex => '^\s*const\s+(?<type><integerTypes>)\s+(?<name>\w+)\s*\[\s*\]\s*\[\s*(?<lineSize>[^\]]+)\s*\]\s*$', + :placeholders => %w[name type lineSize], + :dummyName => '<name>_dummy', + :acceptAs => 'integer(c_<type>), intent(in) :: <name>_dummy(<lineSize>, *)', + :helperVars => "", + :precallStatements => "", + :callExpression => '<name>_dummy', + :passAs => 'integer(c_<type>), intent(in) :: <name>_dummy(<lineSize>, *)', + :postcallStatements => "" }, #Non-optional pointer arguments. These match both pointers and #arrays, so they must appear after the more special array templates. @@ -489,6 +510,16 @@ $returnTypeTemplates = [ :receiveAs => 'integer(c_<type>)', :assignVariable => $wrapperResultVarName, :postcallStatements => '' + }, { #bool + :regex => '^\s*(?<type>bool)\s*$', + :placeholders => %w[type], + :isVoid => false, + :returnAs => 'logical(c_<type>)', + :helperVars => '', + :precallStatements => '', + :receiveAs => 'logical(c_<type>)', + :assignVariable => $wrapperResultVarName, + :postcallStatements => '' }, { #<floatTypes> :regex => '^\s*(?<type><floatTypes>)\s*$', :placeholders => %w[type], @@ -603,9 +634,9 @@ $verbatimDeclarations = ' type(c_ptr), value :: charPtr end function lib_strlen - subroutine lib_free(pointer) bind(c, name = "free") + subroutine lib_free(ptr) bind(c, name = "free") import c_ptr - type(c_ptr), value, intent(in) :: pointer + type(c_ptr), value, intent(in) :: ptr end subroutine lib_free end interface ' @@ -934,10 +965,42 @@ end #Scan the given header and collect the interface information in the global variables. def scanHeader(headerPath) #Scan the given header. - headerLines = IO.popen('cpp -fpreprocessed -dD ' + headerPath).readlines #The options cause the preprocessor to strip all comments, but retain all #defines, and ignore #includes. - headerLines.each do |line| + headerFile = File.open(headerPath, 'r') + commentTerm = %r{\*/} + commentInit = %r{/[*/]} + while line = headerFile.gets line.chomp! + line.gsub!(/SizeType/,'int') + line.gsub!(/DateType/,'int') + + commentBeginLineNo = headerFile.lineno + while foundComment = commentInit.match(line) + commentBegin = foundComment.begin(0) + typeChar = line[commentBegin+1] + if typeChar == "/" + line = line[0,commentBegin] + line.rstrip! + foundComment = false + elsif typeChar == "*" + commentSubStr=line[commentBegin..-1] + if commentTerm.match(commentSubStr) + newLine = line.gsub(%r{/\*.*?\*/},'') + line = newLine.rstrip + else + while newLine = headerFile.gets and not foundCommentEnd = commentTerm.match(newLine) + end + if not newLine + $stderr.puts("Unterminated comment started at line ", + commentBeginLineNo, "'", line, "'") + exit(1) + end + newLine.chomp! + line = line[0,commentBegin] + + newLine[foundCommentEnd.begin(0)+2..-1] + end + end + end if /^\s*$/.match(line) #Empty lines are ignored. @@ -958,7 +1021,7 @@ def scanHeader(headerPath) defineFunction(matchedLine['functionName'], matchedLine['arguments'], matchedLine['returnType']) else - puts("Warning: Unrecognized line '#{line}'") + STDERR.puts("Warning: Unrecognized line '#{line}'") end end end @@ -971,7 +1034,7 @@ def fortranLine(file, line) mline = line.gsub("\t", ' '*spacesPerTab) charsPerLine=79 indentation = /^ */.match(mline)[0] - if not /^ *!/.match(mline) + if not %r{^ *!}.match(mline) while mline.length > charsPerLine # last position of space preceding line break tspos = mline[0..charsPerLine].rindex(' ') || charsPerLine diff --git a/interfaces/mulval.nc.gz b/interfaces/mulval.nc.gz deleted file mode 100644 index 2c49351784678c71b4a54c7736293defae5d4d54..0000000000000000000000000000000000000000 Binary files a/interfaces/mulval.nc.gz and /dev/null differ diff --git a/interfaces/python/CdiLib.py b/interfaces/python/CdiLib.py deleted file mode 100644 index a329f812145c01113b6c16822cb754dbd55cb54e..0000000000000000000000000000000000000000 --- a/interfaces/python/CdiLib.py +++ /dev/null @@ -1,1668 +0,0 @@ -# This file was automatically generated by SWIG (http://www.swig.org). -# Version 4.0.0 -# -# Do not make changes to this file unless you know what you are doing--modify -# the SWIG interface file instead. - -from sys import version_info as _swig_python_version_info -if _swig_python_version_info < (2, 7, 0): - raise RuntimeError('Python 2.7 or later required') - -# Import the low-level C/C++ module -if __package__ or '.' in __name__: - from . import _CdiLib -else: - import _CdiLib - -try: - import builtins as __builtin__ -except ImportError: - import __builtin__ - -def _swig_setattr_nondynamic(self, class_type, name, value, static=1): - if name == "thisown": - return self.this.own(value) - if name == "this": - if type(value).__name__ == 'SwigPyObject': - self.__dict__[name] = value - return - method = class_type.__swig_setmethods__.get(name, None) - if method: - return method(self, value) - if not static: - object.__setattr__(self, name, value) - else: - raise AttributeError("You cannot add attributes to %s" % self) - - -def _swig_setattr(self, class_type, name, value): - return _swig_setattr_nondynamic(self, class_type, name, value, 0) - - -def _swig_getattr(self, class_type, name): - if name == "thisown": - return self.this.own() - method = class_type.__swig_getmethods__.get(name, None) - if method: - return method(self) - raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name)) - - -def _swig_repr(self): - try: - strthis = "proxy of " + self.this.__repr__() - except __builtin__.Exception: - strthis = "" - return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) - - -def _swig_setattr_nondynamic_instance_variable(set): - def set_instance_attr(self, name, value): - if name == "thisown": - self.this.own(value) - elif name == "this": - set(self, name, value) - elif hasattr(self, name) and isinstance(getattr(type(self), name), property): - set(self, name, value) - else: - raise AttributeError("You cannot add instance attributes to %s" % self) - return set_instance_attr - - -def _swig_setattr_nondynamic_class_variable(set): - def set_class_attr(cls, name, value): - if hasattr(cls, name) and not isinstance(getattr(cls, name), property): - set(cls, name, value) - else: - raise AttributeError("You cannot add class attributes to %s" % cls) - return set_class_attr - - -def _swig_add_metaclass(metaclass): - """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass""" - def wrapper(cls): - return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy()) - return wrapper - - -class _SwigNonDynamicMeta(type): - """Meta class to enforce nondynamic attributes (no new attributes) for a class""" - __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__) - - -CDI_MAX_NAME = _CdiLib.CDI_MAX_NAME -CDI_UNDEFID = _CdiLib.CDI_UNDEFID -CDI_GLOBAL = _CdiLib.CDI_GLOBAL -CDI_BIGENDIAN = _CdiLib.CDI_BIGENDIAN -CDI_LITTLEENDIAN = _CdiLib.CDI_LITTLEENDIAN -CDI_PDPENDIAN = _CdiLib.CDI_PDPENDIAN -CDI_REAL = _CdiLib.CDI_REAL -CDI_COMP = _CdiLib.CDI_COMP -CDI_BOTH = _CdiLib.CDI_BOTH -CDI_NOERR = _CdiLib.CDI_NOERR -CDI_EEOF = _CdiLib.CDI_EEOF -CDI_ETMOF = _CdiLib.CDI_ETMOF -CDI_ESYSTEM = _CdiLib.CDI_ESYSTEM -CDI_EINVAL = _CdiLib.CDI_EINVAL -CDI_EISDIR = _CdiLib.CDI_EISDIR -CDI_EISEMPTY = _CdiLib.CDI_EISEMPTY -CDI_EUFTYPE = _CdiLib.CDI_EUFTYPE -CDI_ELIBNAVAIL = _CdiLib.CDI_ELIBNAVAIL -CDI_EUFSTRUCT = _CdiLib.CDI_EUFSTRUCT -CDI_EUNC4 = _CdiLib.CDI_EUNC4 -CDI_EDIMSIZE = _CdiLib.CDI_EDIMSIZE -CDI_ELIMIT = _CdiLib.CDI_ELIMIT -CDI_FILETYPE_GRB = _CdiLib.CDI_FILETYPE_GRB -CDI_FILETYPE_GRB2 = _CdiLib.CDI_FILETYPE_GRB2 -CDI_FILETYPE_NC = _CdiLib.CDI_FILETYPE_NC -CDI_FILETYPE_NC2 = _CdiLib.CDI_FILETYPE_NC2 -CDI_FILETYPE_NC4 = _CdiLib.CDI_FILETYPE_NC4 -CDI_FILETYPE_NC4C = _CdiLib.CDI_FILETYPE_NC4C -CDI_FILETYPE_NC5 = _CdiLib.CDI_FILETYPE_NC5 -CDI_FILETYPE_SRV = _CdiLib.CDI_FILETYPE_SRV -CDI_FILETYPE_EXT = _CdiLib.CDI_FILETYPE_EXT -CDI_FILETYPE_IEG = _CdiLib.CDI_FILETYPE_IEG -CDI_COMPRESS_NONE = _CdiLib.CDI_COMPRESS_NONE -CDI_COMPRESS_SZIP = _CdiLib.CDI_COMPRESS_SZIP -CDI_COMPRESS_AEC = _CdiLib.CDI_COMPRESS_AEC -CDI_COMPRESS_ZIP = _CdiLib.CDI_COMPRESS_ZIP -CDI_COMPRESS_JPEG = _CdiLib.CDI_COMPRESS_JPEG -CDI_DATATYPE_PACK = _CdiLib.CDI_DATATYPE_PACK -CDI_DATATYPE_PACK1 = _CdiLib.CDI_DATATYPE_PACK1 -CDI_DATATYPE_PACK2 = _CdiLib.CDI_DATATYPE_PACK2 -CDI_DATATYPE_PACK3 = _CdiLib.CDI_DATATYPE_PACK3 -CDI_DATATYPE_PACK4 = _CdiLib.CDI_DATATYPE_PACK4 -CDI_DATATYPE_PACK5 = _CdiLib.CDI_DATATYPE_PACK5 -CDI_DATATYPE_PACK6 = _CdiLib.CDI_DATATYPE_PACK6 -CDI_DATATYPE_PACK7 = _CdiLib.CDI_DATATYPE_PACK7 -CDI_DATATYPE_PACK8 = _CdiLib.CDI_DATATYPE_PACK8 -CDI_DATATYPE_PACK9 = _CdiLib.CDI_DATATYPE_PACK9 -CDI_DATATYPE_PACK10 = _CdiLib.CDI_DATATYPE_PACK10 -CDI_DATATYPE_PACK11 = _CdiLib.CDI_DATATYPE_PACK11 -CDI_DATATYPE_PACK12 = _CdiLib.CDI_DATATYPE_PACK12 -CDI_DATATYPE_PACK13 = _CdiLib.CDI_DATATYPE_PACK13 -CDI_DATATYPE_PACK14 = _CdiLib.CDI_DATATYPE_PACK14 -CDI_DATATYPE_PACK15 = _CdiLib.CDI_DATATYPE_PACK15 -CDI_DATATYPE_PACK16 = _CdiLib.CDI_DATATYPE_PACK16 -CDI_DATATYPE_PACK17 = _CdiLib.CDI_DATATYPE_PACK17 -CDI_DATATYPE_PACK18 = _CdiLib.CDI_DATATYPE_PACK18 -CDI_DATATYPE_PACK19 = _CdiLib.CDI_DATATYPE_PACK19 -CDI_DATATYPE_PACK20 = _CdiLib.CDI_DATATYPE_PACK20 -CDI_DATATYPE_PACK21 = _CdiLib.CDI_DATATYPE_PACK21 -CDI_DATATYPE_PACK22 = _CdiLib.CDI_DATATYPE_PACK22 -CDI_DATATYPE_PACK23 = _CdiLib.CDI_DATATYPE_PACK23 -CDI_DATATYPE_PACK24 = _CdiLib.CDI_DATATYPE_PACK24 -CDI_DATATYPE_PACK25 = _CdiLib.CDI_DATATYPE_PACK25 -CDI_DATATYPE_PACK26 = _CdiLib.CDI_DATATYPE_PACK26 -CDI_DATATYPE_PACK27 = _CdiLib.CDI_DATATYPE_PACK27 -CDI_DATATYPE_PACK28 = _CdiLib.CDI_DATATYPE_PACK28 -CDI_DATATYPE_PACK29 = _CdiLib.CDI_DATATYPE_PACK29 -CDI_DATATYPE_PACK30 = _CdiLib.CDI_DATATYPE_PACK30 -CDI_DATATYPE_PACK31 = _CdiLib.CDI_DATATYPE_PACK31 -CDI_DATATYPE_PACK32 = _CdiLib.CDI_DATATYPE_PACK32 -CDI_DATATYPE_CPX32 = _CdiLib.CDI_DATATYPE_CPX32 -CDI_DATATYPE_CPX64 = _CdiLib.CDI_DATATYPE_CPX64 -CDI_DATATYPE_FLT32 = _CdiLib.CDI_DATATYPE_FLT32 -CDI_DATATYPE_FLT64 = _CdiLib.CDI_DATATYPE_FLT64 -CDI_DATATYPE_INT8 = _CdiLib.CDI_DATATYPE_INT8 -CDI_DATATYPE_INT16 = _CdiLib.CDI_DATATYPE_INT16 -CDI_DATATYPE_INT32 = _CdiLib.CDI_DATATYPE_INT32 -CDI_DATATYPE_UINT8 = _CdiLib.CDI_DATATYPE_UINT8 -CDI_DATATYPE_UINT16 = _CdiLib.CDI_DATATYPE_UINT16 -CDI_DATATYPE_UINT32 = _CdiLib.CDI_DATATYPE_UINT32 -CDI_DATATYPE_INT = _CdiLib.CDI_DATATYPE_INT -CDI_DATATYPE_FLT = _CdiLib.CDI_DATATYPE_FLT -CDI_DATATYPE_TXT = _CdiLib.CDI_DATATYPE_TXT -CDI_DATATYPE_CPX = _CdiLib.CDI_DATATYPE_CPX -CDI_DATATYPE_UCHAR = _CdiLib.CDI_DATATYPE_UCHAR -CDI_DATATYPE_LONG = _CdiLib.CDI_DATATYPE_LONG -CDI_DATATYPE_UINT = _CdiLib.CDI_DATATYPE_UINT -CDI_CHUNK_AUTO = _CdiLib.CDI_CHUNK_AUTO -CDI_CHUNK_GRID = _CdiLib.CDI_CHUNK_GRID -CDI_CHUNK_LINES = _CdiLib.CDI_CHUNK_LINES -GRID_GENERIC = _CdiLib.GRID_GENERIC -GRID_GAUSSIAN = _CdiLib.GRID_GAUSSIAN -GRID_GAUSSIAN_REDUCED = _CdiLib.GRID_GAUSSIAN_REDUCED -GRID_LONLAT = _CdiLib.GRID_LONLAT -GRID_SPECTRAL = _CdiLib.GRID_SPECTRAL -GRID_FOURIER = _CdiLib.GRID_FOURIER -GRID_GME = _CdiLib.GRID_GME -GRID_TRAJECTORY = _CdiLib.GRID_TRAJECTORY -GRID_UNSTRUCTURED = _CdiLib.GRID_UNSTRUCTURED -GRID_CURVILINEAR = _CdiLib.GRID_CURVILINEAR -GRID_PROJECTION = _CdiLib.GRID_PROJECTION -GRID_CHARXY = _CdiLib.GRID_CHARXY -CDI_PROJ_RLL = _CdiLib.CDI_PROJ_RLL -CDI_PROJ_LCC = _CdiLib.CDI_PROJ_LCC -CDI_PROJ_LAEA = _CdiLib.CDI_PROJ_LAEA -CDI_PROJ_SINU = _CdiLib.CDI_PROJ_SINU -CDI_PROJ_STERE = _CdiLib.CDI_PROJ_STERE -ZAXIS_SURFACE = _CdiLib.ZAXIS_SURFACE -ZAXIS_GENERIC = _CdiLib.ZAXIS_GENERIC -ZAXIS_HYBRID = _CdiLib.ZAXIS_HYBRID -ZAXIS_HYBRID_HALF = _CdiLib.ZAXIS_HYBRID_HALF -ZAXIS_PRESSURE = _CdiLib.ZAXIS_PRESSURE -ZAXIS_HEIGHT = _CdiLib.ZAXIS_HEIGHT -ZAXIS_DEPTH_BELOW_SEA = _CdiLib.ZAXIS_DEPTH_BELOW_SEA -ZAXIS_DEPTH_BELOW_LAND = _CdiLib.ZAXIS_DEPTH_BELOW_LAND -ZAXIS_ISENTROPIC = _CdiLib.ZAXIS_ISENTROPIC -ZAXIS_TRAJECTORY = _CdiLib.ZAXIS_TRAJECTORY -ZAXIS_ALTITUDE = _CdiLib.ZAXIS_ALTITUDE -ZAXIS_SIGMA = _CdiLib.ZAXIS_SIGMA -ZAXIS_MEANSEA = _CdiLib.ZAXIS_MEANSEA -ZAXIS_TOA = _CdiLib.ZAXIS_TOA -ZAXIS_SEA_BOTTOM = _CdiLib.ZAXIS_SEA_BOTTOM -ZAXIS_ATMOSPHERE = _CdiLib.ZAXIS_ATMOSPHERE -ZAXIS_CLOUD_BASE = _CdiLib.ZAXIS_CLOUD_BASE -ZAXIS_CLOUD_TOP = _CdiLib.ZAXIS_CLOUD_TOP -ZAXIS_ISOTHERM_ZERO = _CdiLib.ZAXIS_ISOTHERM_ZERO -ZAXIS_SNOW = _CdiLib.ZAXIS_SNOW -ZAXIS_LAKE_BOTTOM = _CdiLib.ZAXIS_LAKE_BOTTOM -ZAXIS_SEDIMENT_BOTTOM = _CdiLib.ZAXIS_SEDIMENT_BOTTOM -ZAXIS_SEDIMENT_BOTTOM_TA = _CdiLib.ZAXIS_SEDIMENT_BOTTOM_TA -ZAXIS_SEDIMENT_BOTTOM_TW = _CdiLib.ZAXIS_SEDIMENT_BOTTOM_TW -ZAXIS_MIX_LAYER = _CdiLib.ZAXIS_MIX_LAYER -ZAXIS_REFERENCE = _CdiLib.ZAXIS_REFERENCE -ZAXIS_CHAR = _CdiLib.ZAXIS_CHAR -SUBTYPE_TILES = _CdiLib.SUBTYPE_TILES -MAX_KV_PAIRS_MATCH = _CdiLib.MAX_KV_PAIRS_MATCH -class subtype_query_t(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - nAND = property(_CdiLib.subtype_query_t_nAND_get, _CdiLib.subtype_query_t_nAND_set) - key_value_pairs = property(_CdiLib.subtype_query_t_key_value_pairs_get, _CdiLib.subtype_query_t_key_value_pairs_set) - - def __init__(self): - _CdiLib.subtype_query_t_swiginit(self, _CdiLib.new_subtype_query_t()) - __swig_destroy__ = _CdiLib.delete_subtype_query_t - -# Register subtype_query_t in _CdiLib: -_CdiLib.subtype_query_t_swigregister(subtype_query_t) - -TIME_CONSTANT = _CdiLib.TIME_CONSTANT -TIME_VARYING = _CdiLib.TIME_VARYING -TIME_VARIABLE = _CdiLib.TIME_VARIABLE -TSTEP_INSTANT = _CdiLib.TSTEP_INSTANT -TSTEP_AVG = _CdiLib.TSTEP_AVG -TSTEP_ACCUM = _CdiLib.TSTEP_ACCUM -TSTEP_MAX = _CdiLib.TSTEP_MAX -TSTEP_MIN = _CdiLib.TSTEP_MIN -TSTEP_DIFF = _CdiLib.TSTEP_DIFF -TSTEP_RMS = _CdiLib.TSTEP_RMS -TSTEP_SD = _CdiLib.TSTEP_SD -TSTEP_COV = _CdiLib.TSTEP_COV -TSTEP_RATIO = _CdiLib.TSTEP_RATIO -TSTEP_SUM = _CdiLib.TSTEP_SUM -TSTEP_RANGE = _CdiLib.TSTEP_RANGE -TSTEP_INSTANT2 = _CdiLib.TSTEP_INSTANT2 -TSTEP_INSTANT3 = _CdiLib.TSTEP_INSTANT3 -TAXIS_ABSOLUTE = _CdiLib.TAXIS_ABSOLUTE -TAXIS_RELATIVE = _CdiLib.TAXIS_RELATIVE -TAXIS_FORECAST = _CdiLib.TAXIS_FORECAST -TUNIT_SECOND = _CdiLib.TUNIT_SECOND -TUNIT_MINUTE = _CdiLib.TUNIT_MINUTE -TUNIT_QUARTER = _CdiLib.TUNIT_QUARTER -TUNIT_30MINUTES = _CdiLib.TUNIT_30MINUTES -TUNIT_HOUR = _CdiLib.TUNIT_HOUR -TUNIT_3HOURS = _CdiLib.TUNIT_3HOURS -TUNIT_6HOURS = _CdiLib.TUNIT_6HOURS -TUNIT_12HOURS = _CdiLib.TUNIT_12HOURS -TUNIT_DAY = _CdiLib.TUNIT_DAY -TUNIT_MONTH = _CdiLib.TUNIT_MONTH -TUNIT_YEAR = _CdiLib.TUNIT_YEAR -CALENDAR_STANDARD = _CdiLib.CALENDAR_STANDARD -CALENDAR_GREGORIAN = _CdiLib.CALENDAR_GREGORIAN -CALENDAR_PROLEPTIC = _CdiLib.CALENDAR_PROLEPTIC -CALENDAR_360DAYS = _CdiLib.CALENDAR_360DAYS -CALENDAR_365DAYS = _CdiLib.CALENDAR_365DAYS -CALENDAR_366DAYS = _CdiLib.CALENDAR_366DAYS -CALENDAR_NONE = _CdiLib.CALENDAR_NONE -CDI_UUID_SIZE = _CdiLib.CDI_UUID_SIZE -class CdiParam(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - discipline = property(_CdiLib.CdiParam_discipline_get, _CdiLib.CdiParam_discipline_set) - category = property(_CdiLib.CdiParam_category_get, _CdiLib.CdiParam_category_set) - number = property(_CdiLib.CdiParam_number_get, _CdiLib.CdiParam_number_set) - - def __init__(self): - _CdiLib.CdiParam_swiginit(self, _CdiLib.new_CdiParam()) - __swig_destroy__ = _CdiLib.delete_CdiParam - -# Register CdiParam in _CdiLib: -_CdiLib.CdiParam_swigregister(CdiParam) - - -def cdiReset(): - return _CdiLib.cdiReset() - -def cdiStringError(cdiErrno): - return _CdiLib.cdiStringError(cdiErrno) - -def cdiDebug(debug): - return _CdiLib.cdiDebug(debug) - -def cdiLibraryVersion(): - return _CdiLib.cdiLibraryVersion() - -def cdiPrintVersion(): - return _CdiLib.cdiPrintVersion() - -def cdiHaveFiletype(filetype): - return _CdiLib.cdiHaveFiletype(filetype) - -def cdiDefMissval(missval): - return _CdiLib.cdiDefMissval(missval) - -def cdiInqMissval(): - return _CdiLib.cdiInqMissval() - -def cdiInqGridMissval(): - return _CdiLib.cdiInqGridMissval() - -def cdiDefGlobal(string, val): - return _CdiLib.cdiDefGlobal(string, val) - -def namespaceNew(): - return _CdiLib.namespaceNew() - -def namespaceSetActive(namespaceID): - return _CdiLib.namespaceSetActive(namespaceID) - -def namespaceGetActive(): - return _CdiLib.namespaceGetActive() - -def namespaceDelete(namespaceID): - return _CdiLib.namespaceDelete(namespaceID) - -def cdiParamToString(param, paramstr, maxlen): - return _CdiLib.cdiParamToString(param, paramstr, maxlen) - -def cdiDecodeParam(param, pnum, pcat, pdis): - return _CdiLib.cdiDecodeParam(param, pnum, pcat, pdis) - -def cdiEncodeParam(pnum, pcat, pdis): - return _CdiLib.cdiEncodeParam(pnum, pcat, pdis) - -def cdiDecodeDate(date, year, month, day): - return _CdiLib.cdiDecodeDate(date, year, month, day) - -def cdiEncodeDate(year, month, day): - return _CdiLib.cdiEncodeDate(year, month, day) - -def cdiDecodeTime(time, hour, minute, second): - return _CdiLib.cdiDecodeTime(time, hour, minute, second) - -def cdiEncodeTime(hour, minute, second): - return _CdiLib.cdiEncodeTime(hour, minute, second) - -def cdiGetFiletype(path, byteorder): - return _CdiLib.cdiGetFiletype(path, byteorder) - -def streamOpenRead(path): - return _CdiLib.streamOpenRead(path) - -def streamOpenWrite(path, filetype): - return _CdiLib.streamOpenWrite(path, filetype) - -def streamOpenAppend(path): - return _CdiLib.streamOpenAppend(path) - -def streamClose(streamID): - return _CdiLib.streamClose(streamID) - -def streamSync(streamID): - return _CdiLib.streamSync(streamID) - -def streamDefNumWorker(streamID, numWorker): - return _CdiLib.streamDefNumWorker(streamID, numWorker) - -def streamDefVlist(streamID, vlistID): - return _CdiLib.streamDefVlist(streamID, vlistID) - -def streamInqVlist(streamID): - return _CdiLib.streamInqVlist(streamID) - -def streamInqFiletype(streamID): - return _CdiLib.streamInqFiletype(streamID) - -def streamDefByteorder(streamID, byteorder): - return _CdiLib.streamDefByteorder(streamID, byteorder) - -def streamInqByteorder(streamID): - return _CdiLib.streamInqByteorder(streamID) - -def streamDefCompType(streamID, comptype): - return _CdiLib.streamDefCompType(streamID, comptype) - -def streamInqCompType(streamID): - return _CdiLib.streamInqCompType(streamID) - -def streamDefCompLevel(streamID, complevel): - return _CdiLib.streamDefCompLevel(streamID, complevel) - -def streamInqCompLevel(streamID): - return _CdiLib.streamInqCompLevel(streamID) - -def streamDefTimestep(streamID, tsID): - return _CdiLib.streamDefTimestep(streamID, tsID) - -def streamInqTimestep(streamID, tsID): - return _CdiLib.streamInqTimestep(streamID, tsID) - -def streamInqCurTimestepID(streamID): - return _CdiLib.streamInqCurTimestepID(streamID) - -def streamFilename(streamID): - return _CdiLib.streamFilename(streamID) - -def streamFilesuffix(filetype): - return _CdiLib.streamFilesuffix(filetype) - -def streamNvals(streamID): - return _CdiLib.streamNvals(streamID) - -def streamInqNvars(streamID): - return _CdiLib.streamInqNvars(streamID) - -def streamWriteVar(streamID, varID, data, nmiss): - return _CdiLib.streamWriteVar(streamID, varID, data, nmiss) - -def streamWriteVarF(streamID, varID, data, nmiss): - return _CdiLib.streamWriteVarF(streamID, varID, data, nmiss) - -def streamReadVar(streamID, varID, data, nmiss): - return _CdiLib.streamReadVar(streamID, varID, data, nmiss) - -def streamReadVarF(streamID, varID, data, nmiss): - return _CdiLib.streamReadVarF(streamID, varID, data, nmiss) - -def streamReadVarPart(streamID, varID, varType, start, size, data, nmiss, memtype): - return _CdiLib.streamReadVarPart(streamID, varID, varType, start, size, data, nmiss, memtype) - -def streamWriteVarSlice(streamID, varID, levelID, data, nmiss): - return _CdiLib.streamWriteVarSlice(streamID, varID, levelID, data, nmiss) - -def streamWriteVarSliceF(streamID, varID, levelID, data, nmiss): - return _CdiLib.streamWriteVarSliceF(streamID, varID, levelID, data, nmiss) - -def streamReadVarSlicePart(streamID, varID, levelID, varType, start, size, data, nmiss, memtype): - return _CdiLib.streamReadVarSlicePart(streamID, varID, levelID, varType, start, size, data, nmiss, memtype) - -def streamReadVarSlice(streamID, varID, levelID, data, nmiss): - return _CdiLib.streamReadVarSlice(streamID, varID, levelID, data, nmiss) - -def streamReadVarSliceF(streamID, varID, levelID, data, nmiss): - return _CdiLib.streamReadVarSliceF(streamID, varID, levelID, data, nmiss) - -def streamWriteVarChunk(streamID, varID, rect, data, nmiss): - return _CdiLib.streamWriteVarChunk(streamID, varID, rect, data, nmiss) - -def streamDefRecord(streamID, varID, levelID): - return _CdiLib.streamDefRecord(streamID, varID, levelID) - -def streamInqRecord(streamID, varID, levelID): - return _CdiLib.streamInqRecord(streamID, varID, levelID) - -def streamWriteRecord(streamID, data, nmiss): - return _CdiLib.streamWriteRecord(streamID, data, nmiss) - -def streamWriteRecordF(streamID, data, nmiss): - return _CdiLib.streamWriteRecordF(streamID, data, nmiss) - -def streamReadRecord(streamID, data, nmiss): - return _CdiLib.streamReadRecord(streamID, data, nmiss) - -def streamReadRecordF(streamID, data, nmiss): - return _CdiLib.streamReadRecordF(streamID, data, nmiss) - -def streamCopyRecord(streamIDdest, streamIDsrc): - return _CdiLib.streamCopyRecord(streamIDdest, streamIDsrc) - -def streamInqGRIBinfo(streamID, intnum, fltnum, bignum): - return _CdiLib.streamInqGRIBinfo(streamID, intnum, fltnum, bignum) - -def cdiIterator_new(path): - return _CdiLib.cdiIterator_new(path) - -def cdiIterator_clone(me): - return _CdiLib.cdiIterator_clone(me) - -def cdiIterator_serialize(me): - return _CdiLib.cdiIterator_serialize(me) - -def cdiIterator_deserialize(description): - return _CdiLib.cdiIterator_deserialize(description) - -def cdiIterator_print(me, stream): - return _CdiLib.cdiIterator_print(me, stream) - -def cdiIterator_delete(me): - return _CdiLib.cdiIterator_delete(me) - -def cdiIterator_nextField(me): - return _CdiLib.cdiIterator_nextField(me) - -def cdiIterator_inqStartTime(me): - return _CdiLib.cdiIterator_inqStartTime(me) - -def cdiIterator_inqEndTime(me): - return _CdiLib.cdiIterator_inqEndTime(me) - -def cdiIterator_inqRTime(me): - return _CdiLib.cdiIterator_inqRTime(me) - -def cdiIterator_inqVTime(me): - return _CdiLib.cdiIterator_inqVTime(me) - -def cdiIterator_inqLevelType(me, levelSelector, outName_optional, outLongName_optional, outStdName_optional, outUnit_optional): - return _CdiLib.cdiIterator_inqLevelType(me, levelSelector, outName_optional, outLongName_optional, outStdName_optional, outUnit_optional) - -def cdiIterator_inqLevel(me, levelSelector, outValue1_optional, outValue2_optional): - return _CdiLib.cdiIterator_inqLevel(me, levelSelector, outValue1_optional, outValue2_optional) - -def cdiIterator_inqLevelUuid(me, outVgridNumber_optional, outLevelCount_optional, outUuid_optional): - return _CdiLib.cdiIterator_inqLevelUuid(me, outVgridNumber_optional, outLevelCount_optional, outUuid_optional) - -def cdiIterator_inqTile(me, outTileIndex, outTileAttribute): - return _CdiLib.cdiIterator_inqTile(me, outTileIndex, outTileAttribute) - -def cdiIterator_inqTileCount(me, outTileCount, outTileAttributeCount): - return _CdiLib.cdiIterator_inqTileCount(me, outTileCount, outTileAttributeCount) - -def cdiIterator_inqParam(me): - return _CdiLib.cdiIterator_inqParam(me) - -def cdiIterator_inqParamParts(me, outDiscipline, outCategory, outNumber): - return _CdiLib.cdiIterator_inqParamParts(me, outDiscipline, outCategory, outNumber) - -def cdiIterator_inqDatatype(me): - return _CdiLib.cdiIterator_inqDatatype(me) - -def cdiIterator_inqFiletype(me): - return _CdiLib.cdiIterator_inqFiletype(me) - -def cdiIterator_inqTsteptype(me): - return _CdiLib.cdiIterator_inqTsteptype(me) - -def cdiIterator_inqVariableName(me): - return _CdiLib.cdiIterator_inqVariableName(me) - -def cdiIterator_inqGridId(me): - return _CdiLib.cdiIterator_inqGridId(me) - -def cdiIterator_readField(me, data, nmiss_optional): - return _CdiLib.cdiIterator_readField(me, data, nmiss_optional) - -def cdiIterator_readFieldF(me, data, nmiss_optional): - return _CdiLib.cdiIterator_readFieldF(me, data, nmiss_optional) - -def cdiGribIterator_clone(me): - return _CdiLib.cdiGribIterator_clone(me) - -def cdiGribIterator_delete(me): - return _CdiLib.cdiGribIterator_delete(me) - -def cdiGribIterator_getLong(me, key, value): - return _CdiLib.cdiGribIterator_getLong(me, key, value) - -def cdiGribIterator_getDouble(me, key, value): - return _CdiLib.cdiGribIterator_getDouble(me, key, value) - -def cdiGribIterator_getLength(me, key, value): - return _CdiLib.cdiGribIterator_getLength(me, key, value) - -def cdiGribIterator_getString(me, key, value, length): - return _CdiLib.cdiGribIterator_getString(me, key, value, length) - -def cdiGribIterator_getSize(me, key, value): - return _CdiLib.cdiGribIterator_getSize(me, key, value) - -def cdiGribIterator_getLongArray(me, key, value, array_size): - return _CdiLib.cdiGribIterator_getLongArray(me, key, value, array_size) - -def cdiGribIterator_getDoubleArray(me, key, value, array_size): - return _CdiLib.cdiGribIterator_getDoubleArray(me, key, value, array_size) - -def cdiGribIterator_inqEdition(me): - return _CdiLib.cdiGribIterator_inqEdition(me) - -def cdiGribIterator_inqLongValue(me, key): - return _CdiLib.cdiGribIterator_inqLongValue(me, key) - -def cdiGribIterator_inqLongDefaultValue(me, key, defaultValue): - return _CdiLib.cdiGribIterator_inqLongDefaultValue(me, key, defaultValue) - -def cdiGribIterator_inqDoubleValue(me, key): - return _CdiLib.cdiGribIterator_inqDoubleValue(me, key) - -def cdiGribIterator_inqDoubleDefaultValue(me, key, defaultValue): - return _CdiLib.cdiGribIterator_inqDoubleDefaultValue(me, key, defaultValue) - -def cdiGribIterator_inqStringValue(me, key): - return _CdiLib.cdiGribIterator_inqStringValue(me, key) - -def vlistCreate(): - return _CdiLib.vlistCreate() - -def vlistDestroy(vlistID): - return _CdiLib.vlistDestroy(vlistID) - -def vlistDuplicate(vlistID): - return _CdiLib.vlistDuplicate(vlistID) - -def vlistCopy(vlistID2, vlistID1): - return _CdiLib.vlistCopy(vlistID2, vlistID1) - -def vlistCopyFlag(vlistID2, vlistID1): - return _CdiLib.vlistCopyFlag(vlistID2, vlistID1) - -def vlistClearFlag(vlistID): - return _CdiLib.vlistClearFlag(vlistID) - -def vlistCat(vlistID2, vlistID1): - return _CdiLib.vlistCat(vlistID2, vlistID1) - -def vlistMerge(vlistID2, vlistID1): - return _CdiLib.vlistMerge(vlistID2, vlistID1) - -def vlistPrint(vlistID): - return _CdiLib.vlistPrint(vlistID) - -def vlistNumber(vlistID): - return _CdiLib.vlistNumber(vlistID) - -def vlistNvars(vlistID): - return _CdiLib.vlistNvars(vlistID) - -def vlistNgrids(vlistID): - return _CdiLib.vlistNgrids(vlistID) - -def vlistNzaxis(vlistID): - return _CdiLib.vlistNzaxis(vlistID) - -def vlistNsubtypes(vlistID): - return _CdiLib.vlistNsubtypes(vlistID) - -def vlistDefNtsteps(vlistID, nts): - return _CdiLib.vlistDefNtsteps(vlistID, nts) - -def vlistNtsteps(vlistID): - return _CdiLib.vlistNtsteps(vlistID) - -def vlistGridsizeMax(vlistID): - return _CdiLib.vlistGridsizeMax(vlistID) - -def vlistGrid(vlistID, index): - return _CdiLib.vlistGrid(vlistID, index) - -def vlistGridIndex(vlistID, gridID): - return _CdiLib.vlistGridIndex(vlistID, gridID) - -def vlistChangeGridIndex(vlistID, index, gridID): - return _CdiLib.vlistChangeGridIndex(vlistID, index, gridID) - -def vlistChangeGrid(vlistID, gridID1, gridID2): - return _CdiLib.vlistChangeGrid(vlistID, gridID1, gridID2) - -def vlistZaxis(vlistID, index): - return _CdiLib.vlistZaxis(vlistID, index) - -def vlistZaxisIndex(vlistID, zaxisID): - return _CdiLib.vlistZaxisIndex(vlistID, zaxisID) - -def vlistChangeZaxisIndex(vlistID, index, zaxisID): - return _CdiLib.vlistChangeZaxisIndex(vlistID, index, zaxisID) - -def vlistChangeZaxis(vlistID, zaxisID1, zaxisID2): - return _CdiLib.vlistChangeZaxis(vlistID, zaxisID1, zaxisID2) - -def vlistNrecs(vlistID): - return _CdiLib.vlistNrecs(vlistID) - -def vlistSubtype(vlistID, index): - return _CdiLib.vlistSubtype(vlistID, index) - -def vlistSubtypeIndex(vlistID, subtypeID): - return _CdiLib.vlistSubtypeIndex(vlistID, subtypeID) - -def vlistDefTaxis(vlistID, taxisID): - return _CdiLib.vlistDefTaxis(vlistID, taxisID) - -def vlistInqTaxis(vlistID): - return _CdiLib.vlistInqTaxis(vlistID) - -def vlistDefTable(vlistID, tableID): - return _CdiLib.vlistDefTable(vlistID, tableID) - -def vlistInqTable(vlistID): - return _CdiLib.vlistInqTable(vlistID) - -def vlistDefInstitut(vlistID, instID): - return _CdiLib.vlistDefInstitut(vlistID, instID) - -def vlistInqInstitut(vlistID): - return _CdiLib.vlistInqInstitut(vlistID) - -def vlistDefModel(vlistID, modelID): - return _CdiLib.vlistDefModel(vlistID, modelID) - -def vlistInqModel(vlistID): - return _CdiLib.vlistInqModel(vlistID) - -def vlistDefVarTiles(vlistID, gridID, zaxisID, timetype, tilesetID): - return _CdiLib.vlistDefVarTiles(vlistID, gridID, zaxisID, timetype, tilesetID) - -def vlistDefVar(vlistID, gridID, zaxisID, timetype): - return _CdiLib.vlistDefVar(vlistID, gridID, zaxisID, timetype) - -def vlistChangeVarGrid(vlistID, varID, gridID): - return _CdiLib.vlistChangeVarGrid(vlistID, varID, gridID) - -def vlistChangeVarZaxis(vlistID, varID, zaxisID): - return _CdiLib.vlistChangeVarZaxis(vlistID, varID, zaxisID) - -def vlistInqVar(vlistID, varID, gridID, zaxisID, timetype): - return _CdiLib.vlistInqVar(vlistID, varID, gridID, zaxisID, timetype) - -def vlistInqVarGrid(vlistID, varID): - return _CdiLib.vlistInqVarGrid(vlistID, varID) - -def vlistInqVarZaxis(vlistID, varID): - return _CdiLib.vlistInqVarZaxis(vlistID, varID) - -def vlistInqVarID(vlistID, code): - return _CdiLib.vlistInqVarID(vlistID, code) - -def vlistDefVarTimetype(vlistID, varID, timetype): - return _CdiLib.vlistDefVarTimetype(vlistID, varID, timetype) - -def vlistInqVarTimetype(vlistID, varID): - return _CdiLib.vlistInqVarTimetype(vlistID, varID) - -def vlistDefVarTsteptype(vlistID, varID, tsteptype): - return _CdiLib.vlistDefVarTsteptype(vlistID, varID, tsteptype) - -def vlistInqVarTsteptype(vlistID, varID): - return _CdiLib.vlistInqVarTsteptype(vlistID, varID) - -def vlistDefVarCompType(vlistID, varID, comptype): - return _CdiLib.vlistDefVarCompType(vlistID, varID, comptype) - -def vlistInqVarCompType(vlistID, varID): - return _CdiLib.vlistInqVarCompType(vlistID, varID) - -def vlistDefVarCompLevel(vlistID, varID, complevel): - return _CdiLib.vlistDefVarCompLevel(vlistID, varID, complevel) - -def vlistInqVarCompLevel(vlistID, varID): - return _CdiLib.vlistInqVarCompLevel(vlistID, varID) - -def vlistDefVarParam(vlistID, varID, param): - return _CdiLib.vlistDefVarParam(vlistID, varID, param) - -def vlistInqVarParam(vlistID, varID): - return _CdiLib.vlistInqVarParam(vlistID, varID) - -def vlistDefVarCode(vlistID, varID, code): - return _CdiLib.vlistDefVarCode(vlistID, varID, code) - -def vlistInqVarCode(vlistID, varID): - return _CdiLib.vlistInqVarCode(vlistID, varID) - -def vlistDefVarDatatype(vlistID, varID, datatype): - return _CdiLib.vlistDefVarDatatype(vlistID, varID, datatype) - -def vlistInqVarDatatype(vlistID, varID): - return _CdiLib.vlistInqVarDatatype(vlistID, varID) - -def vlistDefVarChunkType(vlistID, varID, chunktype): - return _CdiLib.vlistDefVarChunkType(vlistID, varID, chunktype) - -def vlistInqVarChunkType(vlistID, varID): - return _CdiLib.vlistInqVarChunkType(vlistID, varID) - -def vlistDefVarXYZ(vlistID, varID, xyz): - return _CdiLib.vlistDefVarXYZ(vlistID, varID, xyz) - -def vlistInqVarXYZ(vlistID, varID): - return _CdiLib.vlistInqVarXYZ(vlistID, varID) - -def vlistInqVarNumber(vlistID, varID): - return _CdiLib.vlistInqVarNumber(vlistID, varID) - -def vlistDefVarInstitut(vlistID, varID, instID): - return _CdiLib.vlistDefVarInstitut(vlistID, varID, instID) - -def vlistInqVarInstitut(vlistID, varID): - return _CdiLib.vlistInqVarInstitut(vlistID, varID) - -def vlistDefVarModel(vlistID, varID, modelID): - return _CdiLib.vlistDefVarModel(vlistID, varID, modelID) - -def vlistInqVarModel(vlistID, varID): - return _CdiLib.vlistInqVarModel(vlistID, varID) - -def vlistDefVarTable(vlistID, varID, tableID): - return _CdiLib.vlistDefVarTable(vlistID, varID, tableID) - -def vlistInqVarTable(vlistID, varID): - return _CdiLib.vlistInqVarTable(vlistID, varID) - -def vlistDefVarName(vlistID, varID, name): - return _CdiLib.vlistDefVarName(vlistID, varID, name) - -def vlistInqVarName(vlistID, varID, name): - return _CdiLib.vlistInqVarName(vlistID, varID, name) - -def vlistCopyVarName(vlistId, varId): - return _CdiLib.vlistCopyVarName(vlistId, varId) - -def vlistDefVarStdname(vlistID, varID, stdname): - return _CdiLib.vlistDefVarStdname(vlistID, varID, stdname) - -def vlistInqVarStdname(vlistID, varID, stdname): - return _CdiLib.vlistInqVarStdname(vlistID, varID, stdname) - -def vlistDefVarLongname(vlistID, varID, longname): - return _CdiLib.vlistDefVarLongname(vlistID, varID, longname) - -def vlistInqVarLongname(vlistID, varID, longname): - return _CdiLib.vlistInqVarLongname(vlistID, varID, longname) - -def vlistDefVarUnits(vlistID, varID, units): - return _CdiLib.vlistDefVarUnits(vlistID, varID, units) - -def vlistInqVarUnits(vlistID, varID, units): - return _CdiLib.vlistInqVarUnits(vlistID, varID, units) - -def vlistDefVarMissval(vlistID, varID, missval): - return _CdiLib.vlistDefVarMissval(vlistID, varID, missval) - -def vlistInqVarMissval(vlistID, varID): - return _CdiLib.vlistInqVarMissval(vlistID, varID) - -def vlistDefVarExtra(vlistID, varID, extra): - return _CdiLib.vlistDefVarExtra(vlistID, varID, extra) - -def vlistInqVarExtra(vlistID, varID, extra): - return _CdiLib.vlistInqVarExtra(vlistID, varID, extra) - -def vlistDefVarScalefactor(vlistID, varID, scalefactor): - return _CdiLib.vlistDefVarScalefactor(vlistID, varID, scalefactor) - -def vlistInqVarScalefactor(vlistID, varID): - return _CdiLib.vlistInqVarScalefactor(vlistID, varID) - -def vlistDefVarAddoffset(vlistID, varID, addoffset): - return _CdiLib.vlistDefVarAddoffset(vlistID, varID, addoffset) - -def vlistInqVarAddoffset(vlistID, varID): - return _CdiLib.vlistInqVarAddoffset(vlistID, varID) - -def vlistDefVarTimave(vlistID, varID, timave): - return _CdiLib.vlistDefVarTimave(vlistID, varID, timave) - -def vlistInqVarTimave(vlistID, varID): - return _CdiLib.vlistInqVarTimave(vlistID, varID) - -def vlistInqVarSize(vlistID, varID): - return _CdiLib.vlistInqVarSize(vlistID, varID) - -def vlistDefIndex(vlistID, varID, levID, index): - return _CdiLib.vlistDefIndex(vlistID, varID, levID, index) - -def vlistInqIndex(vlistID, varID, levID): - return _CdiLib.vlistInqIndex(vlistID, varID, levID) - -def vlistDefFlag(vlistID, varID, levID, flag): - return _CdiLib.vlistDefFlag(vlistID, varID, levID, flag) - -def vlistInqFlag(vlistID, varID, levID): - return _CdiLib.vlistInqFlag(vlistID, varID, levID) - -def vlistFindVar(vlistID, fvarID): - return _CdiLib.vlistFindVar(vlistID, fvarID) - -def vlistFindLevel(vlistID, fvarID, flevelID): - return _CdiLib.vlistFindLevel(vlistID, fvarID, flevelID) - -def vlistMergedVar(vlistID, varID): - return _CdiLib.vlistMergedVar(vlistID, varID) - -def vlistMergedLevel(vlistID, varID, levelID): - return _CdiLib.vlistMergedLevel(vlistID, varID, levelID) - -def cdiClearAdditionalKeys(): - return _CdiLib.cdiClearAdditionalKeys() - -def cdiDefAdditionalKey(string): - return _CdiLib.cdiDefAdditionalKey(string) - -def vlistDefVarIntKey(vlistID, varID, name, value): - return _CdiLib.vlistDefVarIntKey(vlistID, varID, name, value) - -def vlistDefVarDblKey(vlistID, varID, name, value): - return _CdiLib.vlistDefVarDblKey(vlistID, varID, name, value) - -def vlistHasVarKey(vlistID, varID, name): - return _CdiLib.vlistHasVarKey(vlistID, varID, name) - -def vlistInqVarDblKey(vlistID, varID, name): - return _CdiLib.vlistInqVarDblKey(vlistID, varID, name) - -def vlistInqVarIntKey(vlistID, varID, name): - return _CdiLib.vlistInqVarIntKey(vlistID, varID, name) - -def cdiInqNatts(cdiID, varID, nattsp): - return _CdiLib.cdiInqNatts(cdiID, varID, nattsp) - -def cdiInqAtt(cdiID, varID, attrnum, name, typep, lenp): - return _CdiLib.cdiInqAtt(cdiID, varID, attrnum, name, typep, lenp) - -def cdiDelAtt(cdiID, varID, name): - return _CdiLib.cdiDelAtt(cdiID, varID, name) - -def cdiCopyAtts(cdiID1, varID1, cdiID2, varID2): - return _CdiLib.cdiCopyAtts(cdiID1, varID1, cdiID2, varID2) - -def cdiDefAttInt(cdiID, varID, name, type, len, ip): - return _CdiLib.cdiDefAttInt(cdiID, varID, name, type, len, ip) - -def cdiDefAttFlt(cdiID, varID, name, type, len, dp): - return _CdiLib.cdiDefAttFlt(cdiID, varID, name, type, len, dp) - -def cdiDefAttTxt(cdiID, varID, name, len, tp_cbuf): - return _CdiLib.cdiDefAttTxt(cdiID, varID, name, len, tp_cbuf) - -def cdiInqAttInt(cdiID, varID, name, mlen, ip): - return _CdiLib.cdiInqAttInt(cdiID, varID, name, mlen, ip) - -def cdiInqAttFlt(cdiID, varID, name, mlen, dp): - return _CdiLib.cdiInqAttFlt(cdiID, varID, name, mlen, dp) - -def cdiInqAttTxt(cdiID, varID, name, mlen, tp_cbuf): - return _CdiLib.cdiInqAttTxt(cdiID, varID, name, mlen, tp_cbuf) - -def gridName(gridtype, gridname): - return _CdiLib.gridName(gridtype, gridname) - -def gridNamePtr(gridtype): - return _CdiLib.gridNamePtr(gridtype) - -def gridCompress(gridID): - return _CdiLib.gridCompress(gridID) - -def gridDefMaskGME(gridID, mask): - return _CdiLib.gridDefMaskGME(gridID, mask) - -def gridInqMaskGME(gridID, mask): - return _CdiLib.gridInqMaskGME(gridID, mask) - -def gridDefMask(gridID, mask): - return _CdiLib.gridDefMask(gridID, mask) - -def gridInqMask(gridID, mask): - return _CdiLib.gridInqMask(gridID, mask) - -def gridCreate(gridtype, size): - return _CdiLib.gridCreate(gridtype, size) - -def gridDestroy(gridID): - return _CdiLib.gridDestroy(gridID) - -def gridDuplicate(gridID): - return _CdiLib.gridDuplicate(gridID) - -def gridDefProj(gridID, projID): - return _CdiLib.gridDefProj(gridID, projID) - -def gridInqProj(gridID): - return _CdiLib.gridInqProj(gridID) - -def gridInqProjType(gridID): - return _CdiLib.gridInqProjType(gridID) - -def gridInqType(gridID): - return _CdiLib.gridInqType(gridID) - -def gridInqSize(gridID): - return _CdiLib.gridInqSize(gridID) - -def gridDefXsize(gridID, xsize): - return _CdiLib.gridDefXsize(gridID, xsize) - -def gridInqXsize(gridID): - return _CdiLib.gridInqXsize(gridID) - -def gridDefYsize(gridID, ysize): - return _CdiLib.gridDefYsize(gridID, ysize) - -def gridInqYsize(gridID): - return _CdiLib.gridInqYsize(gridID) - -def gridDefNP(gridID, np): - return _CdiLib.gridDefNP(gridID, np) - -def gridInqNP(gridID): - return _CdiLib.gridInqNP(gridID) - -def gridDefXvals(gridID, xvals): - return _CdiLib.gridDefXvals(gridID, xvals) - -def gridInqXvals(gridID, xvals): - return _CdiLib.gridInqXvals(gridID, xvals) - -def gridInqXvalsPart(gridID, start, size, xvals): - return _CdiLib.gridInqXvalsPart(gridID, start, size, xvals) - -def gridInqXIsc(gridID): - return _CdiLib.gridInqXIsc(gridID) - -def gridInqXCvals(gridID, xcvals): - return _CdiLib.gridInqXCvals(gridID, xcvals) - -def gridDefYvals(gridID, yvals): - return _CdiLib.gridDefYvals(gridID, yvals) - -def gridInqYvals(gridID, yvals): - return _CdiLib.gridInqYvals(gridID, yvals) - -def gridInqYvalsPart(gridID, start, size, yvals): - return _CdiLib.gridInqYvalsPart(gridID, start, size, yvals) - -def gridInqYIsc(gridID): - return _CdiLib.gridInqYIsc(gridID) - -def gridInqYCvals(gridID, ycvals): - return _CdiLib.gridInqYCvals(gridID, ycvals) -CDI_KEY_TABLESVERSION = _CdiLib.CDI_KEY_TABLESVERSION -CDI_KEY_LOCALTABLESVERSION = _CdiLib.CDI_KEY_LOCALTABLESVERSION -CDI_KEY_TYPEOFGENERATINGPROCESS = _CdiLib.CDI_KEY_TYPEOFGENERATINGPROCESS -CDI_KEY_PRODUCTDEFINITIONTEMPLATE = _CdiLib.CDI_KEY_PRODUCTDEFINITIONTEMPLATE -CDI_KEY_TYPEOFPROCESSEDDATA = _CdiLib.CDI_KEY_TYPEOFPROCESSEDDATA -CDI_KEY_SHAPEOFTHEEARTH = _CdiLib.CDI_KEY_SHAPEOFTHEEARTH -CDI_KEY_BACKGROUNDPROCESS = _CdiLib.CDI_KEY_BACKGROUNDPROCESS -CDI_KEY_TYPEOFENSEMBLEFORECAST = _CdiLib.CDI_KEY_TYPEOFENSEMBLEFORECAST -CDI_KEY_NUMBEROFFORECASTSINENSEMBLE = _CdiLib.CDI_KEY_NUMBEROFFORECASTSINENSEMBLE -CDI_KEY_PERTURBATIONNUMBER = _CdiLib.CDI_KEY_PERTURBATIONNUMBER -CDI_KEY_CENTRE = _CdiLib.CDI_KEY_CENTRE -CDI_KEY_SUBCENTRE = _CdiLib.CDI_KEY_SUBCENTRE -CDI_KEY_MPIMTYPE = _CdiLib.CDI_KEY_MPIMTYPE -CDI_KEY_MPIMCLASS = _CdiLib.CDI_KEY_MPIMCLASS -CDI_KEY_MPIMUSER = _CdiLib.CDI_KEY_MPIMUSER -CDI_KEY_REVSTATUS = _CdiLib.CDI_KEY_REVSTATUS -CDI_KEY_REVNUMBER = _CdiLib.CDI_KEY_REVNUMBER -CDI_KEY_GRIB2LOCALSECTIONNUMBER = _CdiLib.CDI_KEY_GRIB2LOCALSECTIONNUMBER -CDI_KEY_SECTION2PADDINGLENGTH = _CdiLib.CDI_KEY_SECTION2PADDINGLENGTH -CDI_KEY_SECTION2PADDING = _CdiLib.CDI_KEY_SECTION2PADDING -CDI_KEY_UVRELATIVETOGRID = _CdiLib.CDI_KEY_UVRELATIVETOGRID -CDI_KEY_CONSTITUENTTYPE = _CdiLib.CDI_KEY_CONSTITUENTTYPE - -def cdiDefKeyInt(cdiID, varID, key, value): - return _CdiLib.cdiDefKeyInt(cdiID, varID, key, value) - -def cdiInqKeyInt(cdiID, varID, key, value): - return _CdiLib.cdiInqKeyInt(cdiID, varID, key, value) - -def cdiDefKeyBytes(cdiID, varID, key, bytes, length): - return _CdiLib.cdiDefKeyBytes(cdiID, varID, key, bytes, length) - -def cdiInqKeyBytes(cdiID, varID, key, bytes, length): - return _CdiLib.cdiInqKeyBytes(cdiID, varID, key, bytes, length) - -def cdiDefKeyString(cdiID, varID, key, string): - return _CdiLib.cdiDefKeyString(cdiID, varID, key, string) - -def cdiInqKeyString(cdiID, varID, key, string, length): - return _CdiLib.cdiInqKeyString(cdiID, varID, key, string, length) - -def cdiInqKeyLen(cdiID, varID, key, length): - return _CdiLib.cdiInqKeyLen(cdiID, varID, key, length) - -def cdiCopyKeys(cdiID1, varID1, cdiID2, varID2): - return _CdiLib.cdiCopyKeys(cdiID1, varID1, cdiID2, varID2) -CDI_KEY_XNAME = _CdiLib.CDI_KEY_XNAME -CDI_KEY_XDIMNAME = _CdiLib.CDI_KEY_XDIMNAME -CDI_KEY_XLONGNAME = _CdiLib.CDI_KEY_XLONGNAME -CDI_KEY_XUNITS = _CdiLib.CDI_KEY_XUNITS -CDI_KEY_YNAME = _CdiLib.CDI_KEY_YNAME -CDI_KEY_YDIMNAME = _CdiLib.CDI_KEY_YDIMNAME -CDI_KEY_YLONGNAME = _CdiLib.CDI_KEY_YLONGNAME -CDI_KEY_YUNITS = _CdiLib.CDI_KEY_YUNITS -CDI_KEY_VDIMNAME = _CdiLib.CDI_KEY_VDIMNAME -CDI_KEY_MAPPING = _CdiLib.CDI_KEY_MAPPING -CDI_KEY_MAPNAME = _CdiLib.CDI_KEY_MAPNAME -CDI_KEY_NAME = _CdiLib.CDI_KEY_NAME -CDI_KEY_DIMNAME = _CdiLib.CDI_KEY_DIMNAME -CDI_KEY_LONGNAME = _CdiLib.CDI_KEY_LONGNAME -CDI_KEY_UNITS = _CdiLib.CDI_KEY_UNITS -CDI_KEY_PSNAME = _CdiLib.CDI_KEY_PSNAME -CDI_KEY_P0NAME = _CdiLib.CDI_KEY_P0NAME -CDI_KEY_P0VALUE = _CdiLib.CDI_KEY_P0VALUE - -def cdiGridDefKeyStr(gridID, key, size, mesg): - return _CdiLib.cdiGridDefKeyStr(gridID, key, size, mesg) - -def cdiGridInqKeyStr(gridID, key, size, mesg): - return _CdiLib.cdiGridInqKeyStr(gridID, key, size, mesg) - -def cdiZaxisDefKeyStr(zaxisID, key, size, mesg): - return _CdiLib.cdiZaxisDefKeyStr(zaxisID, key, size, mesg) - -def cdiZaxisInqKeyStr(zaxisID, key, size, mesg): - return _CdiLib.cdiZaxisInqKeyStr(zaxisID, key, size, mesg) - -def cdiZaxisDefKeyFlt(zaxisID, key, value): - return _CdiLib.cdiZaxisDefKeyFlt(zaxisID, key, value) - -def cdiZaxisInqKeyFlt(zaxisID, key, value): - return _CdiLib.cdiZaxisInqKeyFlt(zaxisID, key, value) - -def gridDefXname(gridID, xname): - return _CdiLib.gridDefXname(gridID, xname) - -def gridInqXname(gridID, xname): - return _CdiLib.gridInqXname(gridID, xname) - -def gridDefXlongname(gridID, xlongname): - return _CdiLib.gridDefXlongname(gridID, xlongname) - -def gridInqXlongname(gridID, xlongname): - return _CdiLib.gridInqXlongname(gridID, xlongname) - -def gridDefXunits(gridID, xunits): - return _CdiLib.gridDefXunits(gridID, xunits) - -def gridInqXunits(gridID, xunits): - return _CdiLib.gridInqXunits(gridID, xunits) - -def gridDefYname(gridID, yname): - return _CdiLib.gridDefYname(gridID, yname) - -def gridInqYname(gridID, yname): - return _CdiLib.gridInqYname(gridID, yname) - -def gridDefYlongname(gridID, ylongname): - return _CdiLib.gridDefYlongname(gridID, ylongname) - -def gridInqYlongname(gridID, ylongname): - return _CdiLib.gridInqYlongname(gridID, ylongname) - -def gridDefYunits(gridID, yunits): - return _CdiLib.gridDefYunits(gridID, yunits) - -def gridInqYunits(gridID, yunits): - return _CdiLib.gridInqYunits(gridID, yunits) - -def gridInqXstdname(gridID, xstdname): - return _CdiLib.gridInqXstdname(gridID, xstdname) - -def gridInqYstdname(gridID, ystdname): - return _CdiLib.gridInqYstdname(gridID, ystdname) - -def gridDefDatatype(gridID, prec): - return _CdiLib.gridDefDatatype(gridID, prec) - -def gridInqDatatype(gridID): - return _CdiLib.gridInqDatatype(gridID) - -def gridInqXval(gridID, index): - return _CdiLib.gridInqXval(gridID, index) - -def gridInqYval(gridID, index): - return _CdiLib.gridInqYval(gridID, index) - -def gridInqXinc(gridID): - return _CdiLib.gridInqXinc(gridID) - -def gridInqYinc(gridID): - return _CdiLib.gridInqYinc(gridID) - -def gridIsCircular(gridID): - return _CdiLib.gridIsCircular(gridID) - -def gridInqTrunc(gridID): - return _CdiLib.gridInqTrunc(gridID) - -def gridDefTrunc(gridID, trunc): - return _CdiLib.gridDefTrunc(gridID, trunc) - -def gridDefNumber(gridID, number): - return _CdiLib.gridDefNumber(gridID, number) - -def gridInqNumber(gridID): - return _CdiLib.gridInqNumber(gridID) - -def gridDefPosition(gridID, position): - return _CdiLib.gridDefPosition(gridID, position) - -def gridInqPosition(gridID): - return _CdiLib.gridInqPosition(gridID) - -def gridDefReference(gridID, reference): - return _CdiLib.gridDefReference(gridID, reference) - -def gridInqReference(gridID, reference): - return _CdiLib.gridInqReference(gridID, reference) - -def gridDefUUID(gridID, uuid): - return _CdiLib.gridDefUUID(gridID, uuid) - -def gridInqUUID(gridID, uuid): - return _CdiLib.gridInqUUID(gridID, uuid) - -def gridDefParamRLL(gridID, xpole, ypole, angle): - return _CdiLib.gridDefParamRLL(gridID, xpole, ypole, angle) - -def gridInqParamRLL(gridID, xpole, ypole, angle): - return _CdiLib.gridInqParamRLL(gridID, xpole, ypole, angle) - -def gridDefParamGME(gridID, nd, ni, ni2, ni3): - return _CdiLib.gridDefParamGME(gridID, nd, ni, ni2, ni3) - -def gridInqParamGME(gridID, nd, ni, ni2, ni3): - return _CdiLib.gridInqParamGME(gridID, nd, ni, ni2, ni3) - -def gridDefParamLCC(gridID, missval, lon_0, lat_0, lat_1, lat_2, a, rf, xval_0, yval_0, x_0, y_0): - return _CdiLib.gridDefParamLCC(gridID, missval, lon_0, lat_0, lat_1, lat_2, a, rf, xval_0, yval_0, x_0, y_0) - -def gridInqParamLCC(gridID, missval, lon_0, lat_0, lat_1, lat_2, a, rf, xval_0, yval_0, x_0, y_0): - return _CdiLib.gridInqParamLCC(gridID, missval, lon_0, lat_0, lat_1, lat_2, a, rf, xval_0, yval_0, x_0, y_0) - -def gridDefParamSTERE(gridID, missval, lon_0, lat_ts, lat_0, a, xval_0, yval_0, x_0, y_0): - return _CdiLib.gridDefParamSTERE(gridID, missval, lon_0, lat_ts, lat_0, a, xval_0, yval_0, x_0, y_0) - -def gridInqParamSTERE(gridID, missval, lon_0, lat_ts, lat_0, a, xval_0, yval_0, x_0, y_0): - return _CdiLib.gridInqParamSTERE(gridID, missval, lon_0, lat_ts, lat_0, a, xval_0, yval_0, x_0, y_0) - -def gridDefArea(gridID, area): - return _CdiLib.gridDefArea(gridID, area) - -def gridInqArea(gridID, area): - return _CdiLib.gridInqArea(gridID, area) - -def gridHasArea(gridID): - return _CdiLib.gridHasArea(gridID) - -def gridDefNvertex(gridID, nvertex): - return _CdiLib.gridDefNvertex(gridID, nvertex) - -def gridInqNvertex(gridID): - return _CdiLib.gridInqNvertex(gridID) - -def gridDefXbounds(gridID, xbounds): - return _CdiLib.gridDefXbounds(gridID, xbounds) - -def gridInqXbounds(gridID, xbounds): - return _CdiLib.gridInqXbounds(gridID, xbounds) - -def gridInqXboundsPart(gridID, start, size, xbounds): - return _CdiLib.gridInqXboundsPart(gridID, start, size, xbounds) - -def gridDefYbounds(gridID, ybounds): - return _CdiLib.gridDefYbounds(gridID, ybounds) - -def gridInqYbounds(gridID, ybounds): - return _CdiLib.gridInqYbounds(gridID, ybounds) - -def gridInqYboundsPart(gridID, start, size, ybounds): - return _CdiLib.gridInqYboundsPart(gridID, start, size, ybounds) - -def gridDefReducedPoints(gridID, reducedPointsSize, reducedPoints): - return _CdiLib.gridDefReducedPoints(gridID, reducedPointsSize, reducedPoints) - -def gridInqReducedPoints(gridID, reducedPoints): - return _CdiLib.gridInqReducedPoints(gridID, reducedPoints) - -def gridChangeType(gridID, gridtype): - return _CdiLib.gridChangeType(gridID, gridtype) - -def gridDefComplexPacking(gridID, lpack): - return _CdiLib.gridDefComplexPacking(gridID, lpack) - -def gridInqComplexPacking(gridID): - return _CdiLib.gridInqComplexPacking(gridID) - -def gridDefScanningMode(gridID, mode): - return _CdiLib.gridDefScanningMode(gridID, mode) - -def gridInqScanningMode(gridID): - return _CdiLib.gridInqScanningMode(gridID) - -def zaxisName(zaxistype, zaxisname): - return _CdiLib.zaxisName(zaxistype, zaxisname) - -def zaxisNamePtr(leveltype): - return _CdiLib.zaxisNamePtr(leveltype) - -def zaxisCreate(zaxistype, size): - return _CdiLib.zaxisCreate(zaxistype, size) - -def zaxisDestroy(zaxisID): - return _CdiLib.zaxisDestroy(zaxisID) - -def zaxisInqType(zaxisID): - return _CdiLib.zaxisInqType(zaxisID) - -def zaxisInqSize(zaxisID): - return _CdiLib.zaxisInqSize(zaxisID) - -def zaxisDuplicate(zaxisID): - return _CdiLib.zaxisDuplicate(zaxisID) - -def zaxisDefLevels(zaxisID, levels): - return _CdiLib.zaxisDefLevels(zaxisID, levels) - -def zaxisDefCvals(zaxisID, cvals, clength): - return _CdiLib.zaxisDefCvals(zaxisID, cvals, clength) - -def zaxisInqLevels(zaxisID, levels): - return _CdiLib.zaxisInqLevels(zaxisID, levels) - -def zaxisInqCLen(zaxisID): - return _CdiLib.zaxisInqCLen(zaxisID) - -def zaxisInqCVals(zaxisID, clevels): - return _CdiLib.zaxisInqCVals(zaxisID, clevels) - -def zaxisDefLevel(zaxisID, levelID, levels): - return _CdiLib.zaxisDefLevel(zaxisID, levelID, levels) - -def zaxisInqLevel(zaxisID, levelID): - return _CdiLib.zaxisInqLevel(zaxisID, levelID) - -def zaxisDefNlevRef(gridID, nhlev): - return _CdiLib.zaxisDefNlevRef(gridID, nhlev) - -def zaxisInqNlevRef(gridID): - return _CdiLib.zaxisInqNlevRef(gridID) - -def zaxisDefNumber(gridID, number): - return _CdiLib.zaxisDefNumber(gridID, number) - -def zaxisInqNumber(gridID): - return _CdiLib.zaxisInqNumber(gridID) - -def zaxisDefUUID(zaxisID, uuid): - return _CdiLib.zaxisDefUUID(zaxisID, uuid) - -def zaxisInqUUID(zaxisID, uuid): - return _CdiLib.zaxisInqUUID(zaxisID, uuid) - -def zaxisDefName(zaxisID, name_optional): - return _CdiLib.zaxisDefName(zaxisID, name_optional) - -def zaxisInqName(zaxisID, name): - return _CdiLib.zaxisInqName(zaxisID, name) - -def zaxisDefLongname(zaxisID, longname_optional): - return _CdiLib.zaxisDefLongname(zaxisID, longname_optional) - -def zaxisInqLongname(zaxisID, longname): - return _CdiLib.zaxisInqLongname(zaxisID, longname) - -def zaxisDefUnits(zaxisID, units_optional): - return _CdiLib.zaxisDefUnits(zaxisID, units_optional) - -def zaxisInqUnits(zaxisID, units): - return _CdiLib.zaxisInqUnits(zaxisID, units) - -def zaxisInqStdname(zaxisID, stdname): - return _CdiLib.zaxisInqStdname(zaxisID, stdname) - -def zaxisDefDatatype(zaxisID, prec): - return _CdiLib.zaxisDefDatatype(zaxisID, prec) - -def zaxisInqDatatype(zaxisID): - return _CdiLib.zaxisInqDatatype(zaxisID) - -def zaxisDefPositive(zaxisID, positive): - return _CdiLib.zaxisDefPositive(zaxisID, positive) - -def zaxisInqPositive(zaxisID): - return _CdiLib.zaxisInqPositive(zaxisID) - -def zaxisDefScalar(zaxisID): - return _CdiLib.zaxisDefScalar(zaxisID) - -def zaxisInqScalar(zaxisID): - return _CdiLib.zaxisInqScalar(zaxisID) - -def zaxisDefLtype(zaxisID, ltype): - return _CdiLib.zaxisDefLtype(zaxisID, ltype) - -def zaxisInqLtype(zaxisID): - return _CdiLib.zaxisInqLtype(zaxisID) - -def zaxisDefLtype2(zaxisID, ltype2): - return _CdiLib.zaxisDefLtype2(zaxisID, ltype2) - -def zaxisInqLtype2(zaxisID): - return _CdiLib.zaxisInqLtype2(zaxisID) - -def zaxisDefVct(zaxisID, size, vct): - return _CdiLib.zaxisDefVct(zaxisID, size, vct) - -def zaxisInqVct(zaxisID, vct): - return _CdiLib.zaxisInqVct(zaxisID, vct) - -def zaxisInqVctSize(zaxisID): - return _CdiLib.zaxisInqVctSize(zaxisID) - -def zaxisInqVctPtr(zaxisID): - return _CdiLib.zaxisInqVctPtr(zaxisID) - -def zaxisDefLbounds(zaxisID, lbounds): - return _CdiLib.zaxisDefLbounds(zaxisID, lbounds) - -def zaxisInqLbounds(zaxisID, lbounds_optional): - return _CdiLib.zaxisInqLbounds(zaxisID, lbounds_optional) - -def zaxisInqLbound(zaxisID, index): - return _CdiLib.zaxisInqLbound(zaxisID, index) - -def zaxisDefUbounds(zaxisID, ubounds): - return _CdiLib.zaxisDefUbounds(zaxisID, ubounds) - -def zaxisInqUbounds(zaxisID, ubounds_optional): - return _CdiLib.zaxisInqUbounds(zaxisID, ubounds_optional) - -def zaxisInqUbound(zaxisID, index): - return _CdiLib.zaxisInqUbound(zaxisID, index) - -def zaxisDefWeights(zaxisID, weights): - return _CdiLib.zaxisDefWeights(zaxisID, weights) - -def zaxisInqWeights(zaxisID, weights_optional): - return _CdiLib.zaxisInqWeights(zaxisID, weights_optional) - -def zaxisChangeType(zaxisID, zaxistype): - return _CdiLib.zaxisChangeType(zaxisID, zaxistype) - -def taxisCreate(taxistype): - return _CdiLib.taxisCreate(taxistype) - -def taxisDestroy(taxisID): - return _CdiLib.taxisDestroy(taxisID) - -def taxisDuplicate(taxisID): - return _CdiLib.taxisDuplicate(taxisID) - -def taxisCopyTimestep(taxisIDdes, taxisIDsrc): - return _CdiLib.taxisCopyTimestep(taxisIDdes, taxisIDsrc) - -def taxisDefType(taxisID, taxistype): - return _CdiLib.taxisDefType(taxisID, taxistype) - -def taxisInqType(taxisID): - return _CdiLib.taxisInqType(taxisID) - -def taxisDefVdate(taxisID, date): - return _CdiLib.taxisDefVdate(taxisID, date) - -def taxisDefVtime(taxisID, time): - return _CdiLib.taxisDefVtime(taxisID, time) - -def taxisInqVdate(taxisID): - return _CdiLib.taxisInqVdate(taxisID) - -def taxisInqVtime(taxisID): - return _CdiLib.taxisInqVtime(taxisID) - -def taxisDefRdate(taxisID, date): - return _CdiLib.taxisDefRdate(taxisID, date) - -def taxisDefRtime(taxisID, time): - return _CdiLib.taxisDefRtime(taxisID, time) - -def taxisInqRdate(taxisID): - return _CdiLib.taxisInqRdate(taxisID) - -def taxisInqRtime(taxisID): - return _CdiLib.taxisInqRtime(taxisID) - -def taxisDefFdate(taxisID, date): - return _CdiLib.taxisDefFdate(taxisID, date) - -def taxisDefFtime(taxisID, time): - return _CdiLib.taxisDefFtime(taxisID, time) - -def taxisInqFdate(taxisID): - return _CdiLib.taxisInqFdate(taxisID) - -def taxisInqFtime(taxisID): - return _CdiLib.taxisInqFtime(taxisID) - -def taxisHasBounds(taxisID): - return _CdiLib.taxisHasBounds(taxisID) - -def taxisWithBounds(taxisID): - return _CdiLib.taxisWithBounds(taxisID) - -def taxisDeleteBounds(taxisID): - return _CdiLib.taxisDeleteBounds(taxisID) - -def taxisDefVdateBounds(taxisID, vdate_lb, vdate_ub): - return _CdiLib.taxisDefVdateBounds(taxisID, vdate_lb, vdate_ub) - -def taxisDefVtimeBounds(taxisID, vtime_lb, vtime_ub): - return _CdiLib.taxisDefVtimeBounds(taxisID, vtime_lb, vtime_ub) - -def taxisInqVdateBounds(taxisID, vdate_lb, vdate_ub): - return _CdiLib.taxisInqVdateBounds(taxisID, vdate_lb, vdate_ub) - -def taxisInqVtimeBounds(taxisID, vtime_lb, vtime_ub): - return _CdiLib.taxisInqVtimeBounds(taxisID, vtime_lb, vtime_ub) - -def taxisDefCalendar(taxisID, calendar): - return _CdiLib.taxisDefCalendar(taxisID, calendar) - -def taxisInqCalendar(taxisID): - return _CdiLib.taxisInqCalendar(taxisID) - -def taxisDefTunit(taxisID, tunit): - return _CdiLib.taxisDefTunit(taxisID, tunit) - -def taxisInqTunit(taxisID): - return _CdiLib.taxisInqTunit(taxisID) - -def taxisDefForecastTunit(taxisID, tunit): - return _CdiLib.taxisDefForecastTunit(taxisID, tunit) - -def taxisInqForecastTunit(taxisID): - return _CdiLib.taxisInqForecastTunit(taxisID) - -def taxisDefForecastPeriod(taxisID, fc_period): - return _CdiLib.taxisDefForecastPeriod(taxisID, fc_period) - -def taxisInqForecastPeriod(taxisID): - return _CdiLib.taxisInqForecastPeriod(taxisID) - -def taxisDefNumavg(taxisID, numavg): - return _CdiLib.taxisDefNumavg(taxisID, numavg) - -def taxisInqNumavg(taxisID): - return _CdiLib.taxisInqNumavg(taxisID) - -def tunitNamePtr(tunitID): - return _CdiLib.tunitNamePtr(tunitID) - -def institutDef(center, subcenter, name, longname): - return _CdiLib.institutDef(center, subcenter, name, longname) - -def institutInq(center, subcenter, name, longname): - return _CdiLib.institutInq(center, subcenter, name, longname) - -def institutInqNumber(): - return _CdiLib.institutInqNumber() - -def institutInqCenter(instID): - return _CdiLib.institutInqCenter(instID) - -def institutInqSubcenter(instID): - return _CdiLib.institutInqSubcenter(instID) - -def institutInqNamePtr(instID): - return _CdiLib.institutInqNamePtr(instID) - -def institutInqLongnamePtr(instID): - return _CdiLib.institutInqLongnamePtr(instID) - -def modelDef(instID, modelgribID, name): - return _CdiLib.modelDef(instID, modelgribID, name) - -def modelInq(instID, modelgribID, name): - return _CdiLib.modelInq(instID, modelgribID, name) - -def modelInqInstitut(modelID): - return _CdiLib.modelInqInstitut(modelID) - -def modelInqGribID(modelID): - return _CdiLib.modelInqGribID(modelID) - -def modelInqNamePtr(modelID): - return _CdiLib.modelInqNamePtr(modelID) - -def tableFWriteC(ptfp, tableID): - return _CdiLib.tableFWriteC(ptfp, tableID) - -def tableWrite(filename, tableID): - return _CdiLib.tableWrite(filename, tableID) - -def tableRead(tablefile): - return _CdiLib.tableRead(tablefile) - -def tableDef(modelID, tablenum, tablename): - return _CdiLib.tableDef(modelID, tablenum, tablename) - -def tableInqNamePtr(tableID): - return _CdiLib.tableInqNamePtr(tableID) - -def tableInq(modelID, tablenum, tablename): - return _CdiLib.tableInq(modelID, tablenum, tablename) - -def tableInqNumber(): - return _CdiLib.tableInqNumber() - -def tableInqNum(tableID): - return _CdiLib.tableInqNum(tableID) - -def tableInqModel(tableID): - return _CdiLib.tableInqModel(tableID) - -def tableInqEntry(tableID, id, ltype, name, longname, units): - return _CdiLib.tableInqEntry(tableID, id, ltype, name, longname, units) - -def streamDefHistory(streamID, size, history): - return _CdiLib.streamDefHistory(streamID, size, history) - -def streamInqHistorySize(streamID): - return _CdiLib.streamInqHistorySize(streamID) - -def streamInqHistoryString(streamID, history): - return _CdiLib.streamInqHistoryString(streamID, history) - -def subtypeCreate(subtype): - return _CdiLib.subtypeCreate(subtype) - -def subtypePrint(subtypeID): - return _CdiLib.subtypePrint(subtypeID) - -def subtypeCompare(subtypeID1, subtypeID2): - return _CdiLib.subtypeCompare(subtypeID1, subtypeID2) - -def subtypeInqSize(subtypeID): - return _CdiLib.subtypeInqSize(subtypeID) - -def subtypeInqActiveIndex(subtypeID): - return _CdiLib.subtypeInqActiveIndex(subtypeID) - -def subtypeDefActiveIndex(subtypeID, index): - return _CdiLib.subtypeDefActiveIndex(subtypeID, index) - -def keyValuePair(key, value): - return _CdiLib.keyValuePair(key, value) - -def matchAND(q1, q2): - return _CdiLib.matchAND(q1, q2) - -def subtypeInqSubEntry(subtypeID, criterion): - return _CdiLib.subtypeInqSubEntry(subtypeID, criterion) - -def subtypeInqTile(subtypeID, tileindex, attribute): - return _CdiLib.subtypeInqTile(subtypeID, tileindex, attribute) - -def subtypeInqAttribute(subtypeID, index, key, outValue): - return _CdiLib.subtypeInqAttribute(subtypeID, index, key, outValue) - -def vlistInqVarSubtype(vlistID, varID): - return _CdiLib.vlistInqVarSubtype(vlistID, varID) - -def gribapiLibraryVersion(major_version, minor_version, revision_version): - return _CdiLib.gribapiLibraryVersion(major_version, minor_version, revision_version) - -def gaussianLatitudes(latitudes, weights, nlat): - return _CdiLib.gaussianLatitudes(latitudes, weights, nlat) - - diff --git a/interfaces/python/CdiObj.py b/interfaces/python/CdiObj.py deleted file mode 100644 index 3e7f0b502b939cee18bfd8f526af4bb5ccec380e..0000000000000000000000000000000000000000 --- a/interfaces/python/CdiObj.py +++ /dev/null @@ -1,1408 +0,0 @@ -# This file was automatically generated by SWIG (http://www.swig.org). -# Version 4.0.0 -# -# Do not make changes to this file unless you know what you are doing--modify -# the SWIG interface file instead. - -from sys import version_info as _swig_python_version_info -if _swig_python_version_info < (2, 7, 0): - raise RuntimeError('Python 2.7 or later required') - -# Import the low-level C/C++ module -if __package__ or '.' in __name__: - from . import _CdiObj -else: - import _CdiObj - -try: - import builtins as __builtin__ -except ImportError: - import __builtin__ - -def _swig_setattr_nondynamic(self, class_type, name, value, static=1): - if name == "thisown": - return self.this.own(value) - if name == "this": - if type(value).__name__ == 'SwigPyObject': - self.__dict__[name] = value - return - method = class_type.__swig_setmethods__.get(name, None) - if method: - return method(self, value) - if not static: - object.__setattr__(self, name, value) - else: - raise AttributeError("You cannot add attributes to %s" % self) - - -def _swig_setattr(self, class_type, name, value): - return _swig_setattr_nondynamic(self, class_type, name, value, 0) - - -def _swig_getattr(self, class_type, name): - if name == "thisown": - return self.this.own() - method = class_type.__swig_getmethods__.get(name, None) - if method: - return method(self) - raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name)) - - -def _swig_repr(self): - try: - strthis = "proxy of " + self.this.__repr__() - except __builtin__.Exception: - strthis = "" - return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) - - -def _swig_setattr_nondynamic_instance_variable(set): - def set_instance_attr(self, name, value): - if name == "thisown": - self.this.own(value) - elif name == "this": - set(self, name, value) - elif hasattr(self, name) and isinstance(getattr(type(self), name), property): - set(self, name, value) - else: - raise AttributeError("You cannot add instance attributes to %s" % self) - return set_instance_attr - - -def _swig_setattr_nondynamic_class_variable(set): - def set_class_attr(cls, name, value): - if hasattr(cls, name) and not isinstance(getattr(cls, name), property): - set(cls, name, value) - else: - raise AttributeError("You cannot add class attributes to %s" % cls) - return set_class_attr - - -def _swig_add_metaclass(metaclass): - """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass""" - def wrapper(cls): - return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy()) - return wrapper - - -class _SwigNonDynamicMeta(type): - """Meta class to enforce nondynamic attributes (no new attributes) for a class""" - __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__) - - -class SwigPyIterator(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - - def __init__(self, *args, **kwargs): - raise AttributeError("No constructor defined - class is abstract") - __repr__ = _swig_repr - __swig_destroy__ = _CdiObj.delete_SwigPyIterator - - def value(self): - return _CdiObj.SwigPyIterator_value(self) - - def incr(self, n=1): - return _CdiObj.SwigPyIterator_incr(self, n) - - def decr(self, n=1): - return _CdiObj.SwigPyIterator_decr(self, n) - - def distance(self, x): - return _CdiObj.SwigPyIterator_distance(self, x) - - def equal(self, x): - return _CdiObj.SwigPyIterator_equal(self, x) - - def copy(self): - return _CdiObj.SwigPyIterator_copy(self) - - def next(self): - return _CdiObj.SwigPyIterator_next(self) - - def __next__(self): - return _CdiObj.SwigPyIterator___next__(self) - - def previous(self): - return _CdiObj.SwigPyIterator_previous(self) - - def advance(self, n): - return _CdiObj.SwigPyIterator_advance(self, n) - - def __eq__(self, x): - return _CdiObj.SwigPyIterator___eq__(self, x) - - def __ne__(self, x): - return _CdiObj.SwigPyIterator___ne__(self, x) - - def __iadd__(self, n): - return _CdiObj.SwigPyIterator___iadd__(self, n) - - def __isub__(self, n): - return _CdiObj.SwigPyIterator___isub__(self, n) - - def __add__(self, n): - return _CdiObj.SwigPyIterator___add__(self, n) - - def __sub__(self, *args): - return _CdiObj.SwigPyIterator___sub__(self, *args) - def __iter__(self): - return self - -# Register SwigPyIterator in _CdiObj: -_CdiObj.SwigPyIterator_swigregister(SwigPyIterator) - -class IntVector(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def iterator(self): - return _CdiObj.IntVector_iterator(self) - def __iter__(self): - return self.iterator() - - def __nonzero__(self): - return _CdiObj.IntVector___nonzero__(self) - - def __bool__(self): - return _CdiObj.IntVector___bool__(self) - - def __len__(self): - return _CdiObj.IntVector___len__(self) - - def __getslice__(self, i, j): - return _CdiObj.IntVector___getslice__(self, i, j) - - def __setslice__(self, *args): - return _CdiObj.IntVector___setslice__(self, *args) - - def __delslice__(self, i, j): - return _CdiObj.IntVector___delslice__(self, i, j) - - def __delitem__(self, *args): - return _CdiObj.IntVector___delitem__(self, *args) - - def __getitem__(self, *args): - return _CdiObj.IntVector___getitem__(self, *args) - - def __setitem__(self, *args): - return _CdiObj.IntVector___setitem__(self, *args) - - def pop(self): - return _CdiObj.IntVector_pop(self) - - def append(self, x): - return _CdiObj.IntVector_append(self, x) - - def empty(self): - return _CdiObj.IntVector_empty(self) - - def size(self): - return _CdiObj.IntVector_size(self) - - def swap(self, v): - return _CdiObj.IntVector_swap(self, v) - - def begin(self): - return _CdiObj.IntVector_begin(self) - - def end(self): - return _CdiObj.IntVector_end(self) - - def rbegin(self): - return _CdiObj.IntVector_rbegin(self) - - def rend(self): - return _CdiObj.IntVector_rend(self) - - def clear(self): - return _CdiObj.IntVector_clear(self) - - def get_allocator(self): - return _CdiObj.IntVector_get_allocator(self) - - def pop_back(self): - return _CdiObj.IntVector_pop_back(self) - - def erase(self, *args): - return _CdiObj.IntVector_erase(self, *args) - - def __init__(self, *args): - _CdiObj.IntVector_swiginit(self, _CdiObj.new_IntVector(*args)) - - def push_back(self, x): - return _CdiObj.IntVector_push_back(self, x) - - def front(self): - return _CdiObj.IntVector_front(self) - - def back(self): - return _CdiObj.IntVector_back(self) - - def assign(self, n, x): - return _CdiObj.IntVector_assign(self, n, x) - - def resize(self, *args): - return _CdiObj.IntVector_resize(self, *args) - - def insert(self, *args): - return _CdiObj.IntVector_insert(self, *args) - - def reserve(self, n): - return _CdiObj.IntVector_reserve(self, n) - - def capacity(self): - return _CdiObj.IntVector_capacity(self) - __swig_destroy__ = _CdiObj.delete_IntVector - -# Register IntVector in _CdiObj: -_CdiObj.IntVector_swigregister(IntVector) - -class DoubleVector(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def iterator(self): - return _CdiObj.DoubleVector_iterator(self) - def __iter__(self): - return self.iterator() - - def __nonzero__(self): - return _CdiObj.DoubleVector___nonzero__(self) - - def __bool__(self): - return _CdiObj.DoubleVector___bool__(self) - - def __len__(self): - return _CdiObj.DoubleVector___len__(self) - - def __getslice__(self, i, j): - return _CdiObj.DoubleVector___getslice__(self, i, j) - - def __setslice__(self, *args): - return _CdiObj.DoubleVector___setslice__(self, *args) - - def __delslice__(self, i, j): - return _CdiObj.DoubleVector___delslice__(self, i, j) - - def __delitem__(self, *args): - return _CdiObj.DoubleVector___delitem__(self, *args) - - def __getitem__(self, *args): - return _CdiObj.DoubleVector___getitem__(self, *args) - - def __setitem__(self, *args): - return _CdiObj.DoubleVector___setitem__(self, *args) - - def pop(self): - return _CdiObj.DoubleVector_pop(self) - - def append(self, x): - return _CdiObj.DoubleVector_append(self, x) - - def empty(self): - return _CdiObj.DoubleVector_empty(self) - - def size(self): - return _CdiObj.DoubleVector_size(self) - - def swap(self, v): - return _CdiObj.DoubleVector_swap(self, v) - - def begin(self): - return _CdiObj.DoubleVector_begin(self) - - def end(self): - return _CdiObj.DoubleVector_end(self) - - def rbegin(self): - return _CdiObj.DoubleVector_rbegin(self) - - def rend(self): - return _CdiObj.DoubleVector_rend(self) - - def clear(self): - return _CdiObj.DoubleVector_clear(self) - - def get_allocator(self): - return _CdiObj.DoubleVector_get_allocator(self) - - def pop_back(self): - return _CdiObj.DoubleVector_pop_back(self) - - def erase(self, *args): - return _CdiObj.DoubleVector_erase(self, *args) - - def __init__(self, *args): - _CdiObj.DoubleVector_swiginit(self, _CdiObj.new_DoubleVector(*args)) - - def push_back(self, x): - return _CdiObj.DoubleVector_push_back(self, x) - - def front(self): - return _CdiObj.DoubleVector_front(self) - - def back(self): - return _CdiObj.DoubleVector_back(self) - - def assign(self, n, x): - return _CdiObj.DoubleVector_assign(self, n, x) - - def resize(self, *args): - return _CdiObj.DoubleVector_resize(self, *args) - - def insert(self, *args): - return _CdiObj.DoubleVector_insert(self, *args) - - def reserve(self, n): - return _CdiObj.DoubleVector_reserve(self, n) - - def capacity(self): - return _CdiObj.DoubleVector_capacity(self) - __swig_destroy__ = _CdiObj.delete_DoubleVector - -# Register DoubleVector in _CdiObj: -_CdiObj.DoubleVector_swigregister(DoubleVector) - -class DoubleDoubleVector(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def iterator(self): - return _CdiObj.DoubleDoubleVector_iterator(self) - def __iter__(self): - return self.iterator() - - def __nonzero__(self): - return _CdiObj.DoubleDoubleVector___nonzero__(self) - - def __bool__(self): - return _CdiObj.DoubleDoubleVector___bool__(self) - - def __len__(self): - return _CdiObj.DoubleDoubleVector___len__(self) - - def __getslice__(self, i, j): - return _CdiObj.DoubleDoubleVector___getslice__(self, i, j) - - def __setslice__(self, *args): - return _CdiObj.DoubleDoubleVector___setslice__(self, *args) - - def __delslice__(self, i, j): - return _CdiObj.DoubleDoubleVector___delslice__(self, i, j) - - def __delitem__(self, *args): - return _CdiObj.DoubleDoubleVector___delitem__(self, *args) - - def __getitem__(self, *args): - return _CdiObj.DoubleDoubleVector___getitem__(self, *args) - - def __setitem__(self, *args): - return _CdiObj.DoubleDoubleVector___setitem__(self, *args) - - def pop(self): - return _CdiObj.DoubleDoubleVector_pop(self) - - def append(self, x): - return _CdiObj.DoubleDoubleVector_append(self, x) - - def empty(self): - return _CdiObj.DoubleDoubleVector_empty(self) - - def size(self): - return _CdiObj.DoubleDoubleVector_size(self) - - def swap(self, v): - return _CdiObj.DoubleDoubleVector_swap(self, v) - - def begin(self): - return _CdiObj.DoubleDoubleVector_begin(self) - - def end(self): - return _CdiObj.DoubleDoubleVector_end(self) - - def rbegin(self): - return _CdiObj.DoubleDoubleVector_rbegin(self) - - def rend(self): - return _CdiObj.DoubleDoubleVector_rend(self) - - def clear(self): - return _CdiObj.DoubleDoubleVector_clear(self) - - def get_allocator(self): - return _CdiObj.DoubleDoubleVector_get_allocator(self) - - def pop_back(self): - return _CdiObj.DoubleDoubleVector_pop_back(self) - - def erase(self, *args): - return _CdiObj.DoubleDoubleVector_erase(self, *args) - - def __init__(self, *args): - _CdiObj.DoubleDoubleVector_swiginit(self, _CdiObj.new_DoubleDoubleVector(*args)) - - def push_back(self, x): - return _CdiObj.DoubleDoubleVector_push_back(self, x) - - def front(self): - return _CdiObj.DoubleDoubleVector_front(self) - - def back(self): - return _CdiObj.DoubleDoubleVector_back(self) - - def assign(self, n, x): - return _CdiObj.DoubleDoubleVector_assign(self, n, x) - - def resize(self, *args): - return _CdiObj.DoubleDoubleVector_resize(self, *args) - - def insert(self, *args): - return _CdiObj.DoubleDoubleVector_insert(self, *args) - - def reserve(self, n): - return _CdiObj.DoubleDoubleVector_reserve(self, n) - - def capacity(self): - return _CdiObj.DoubleDoubleVector_capacity(self) - __swig_destroy__ = _CdiObj.delete_DoubleDoubleVector - -# Register DoubleDoubleVector in _CdiObj: -_CdiObj.DoubleDoubleVector_swigregister(DoubleDoubleVector) - -class StringVector(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def iterator(self): - return _CdiObj.StringVector_iterator(self) - def __iter__(self): - return self.iterator() - - def __nonzero__(self): - return _CdiObj.StringVector___nonzero__(self) - - def __bool__(self): - return _CdiObj.StringVector___bool__(self) - - def __len__(self): - return _CdiObj.StringVector___len__(self) - - def __getslice__(self, i, j): - return _CdiObj.StringVector___getslice__(self, i, j) - - def __setslice__(self, *args): - return _CdiObj.StringVector___setslice__(self, *args) - - def __delslice__(self, i, j): - return _CdiObj.StringVector___delslice__(self, i, j) - - def __delitem__(self, *args): - return _CdiObj.StringVector___delitem__(self, *args) - - def __getitem__(self, *args): - return _CdiObj.StringVector___getitem__(self, *args) - - def __setitem__(self, *args): - return _CdiObj.StringVector___setitem__(self, *args) - - def pop(self): - return _CdiObj.StringVector_pop(self) - - def append(self, x): - return _CdiObj.StringVector_append(self, x) - - def empty(self): - return _CdiObj.StringVector_empty(self) - - def size(self): - return _CdiObj.StringVector_size(self) - - def swap(self, v): - return _CdiObj.StringVector_swap(self, v) - - def begin(self): - return _CdiObj.StringVector_begin(self) - - def end(self): - return _CdiObj.StringVector_end(self) - - def rbegin(self): - return _CdiObj.StringVector_rbegin(self) - - def rend(self): - return _CdiObj.StringVector_rend(self) - - def clear(self): - return _CdiObj.StringVector_clear(self) - - def get_allocator(self): - return _CdiObj.StringVector_get_allocator(self) - - def pop_back(self): - return _CdiObj.StringVector_pop_back(self) - - def erase(self, *args): - return _CdiObj.StringVector_erase(self, *args) - - def __init__(self, *args): - _CdiObj.StringVector_swiginit(self, _CdiObj.new_StringVector(*args)) - - def push_back(self, x): - return _CdiObj.StringVector_push_back(self, x) - - def front(self): - return _CdiObj.StringVector_front(self) - - def back(self): - return _CdiObj.StringVector_back(self) - - def assign(self, n, x): - return _CdiObj.StringVector_assign(self, n, x) - - def resize(self, *args): - return _CdiObj.StringVector_resize(self, *args) - - def insert(self, *args): - return _CdiObj.StringVector_insert(self, *args) - - def reserve(self, n): - return _CdiObj.StringVector_reserve(self, n) - - def capacity(self): - return _CdiObj.StringVector_capacity(self) - __swig_destroy__ = _CdiObj.delete_StringVector - -# Register StringVector in _CdiObj: -_CdiObj.StringVector_swigregister(StringVector) - -class VarsVector(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def iterator(self): - return _CdiObj.VarsVector_iterator(self) - def __iter__(self): - return self.iterator() - - def __nonzero__(self): - return _CdiObj.VarsVector___nonzero__(self) - - def __bool__(self): - return _CdiObj.VarsVector___bool__(self) - - def __len__(self): - return _CdiObj.VarsVector___len__(self) - - def __getslice__(self, i, j): - return _CdiObj.VarsVector___getslice__(self, i, j) - - def __setslice__(self, *args): - return _CdiObj.VarsVector___setslice__(self, *args) - - def __delslice__(self, i, j): - return _CdiObj.VarsVector___delslice__(self, i, j) - - def __delitem__(self, *args): - return _CdiObj.VarsVector___delitem__(self, *args) - - def __getitem__(self, *args): - return _CdiObj.VarsVector___getitem__(self, *args) - - def __setitem__(self, *args): - return _CdiObj.VarsVector___setitem__(self, *args) - - def pop(self): - return _CdiObj.VarsVector_pop(self) - - def append(self, x): - return _CdiObj.VarsVector_append(self, x) - - def empty(self): - return _CdiObj.VarsVector_empty(self) - - def size(self): - return _CdiObj.VarsVector_size(self) - - def swap(self, v): - return _CdiObj.VarsVector_swap(self, v) - - def begin(self): - return _CdiObj.VarsVector_begin(self) - - def end(self): - return _CdiObj.VarsVector_end(self) - - def rbegin(self): - return _CdiObj.VarsVector_rbegin(self) - - def rend(self): - return _CdiObj.VarsVector_rend(self) - - def clear(self): - return _CdiObj.VarsVector_clear(self) - - def get_allocator(self): - return _CdiObj.VarsVector_get_allocator(self) - - def pop_back(self): - return _CdiObj.VarsVector_pop_back(self) - - def erase(self, *args): - return _CdiObj.VarsVector_erase(self, *args) - - def __init__(self, *args): - _CdiObj.VarsVector_swiginit(self, _CdiObj.new_VarsVector(*args)) - - def push_back(self, x): - return _CdiObj.VarsVector_push_back(self, x) - - def front(self): - return _CdiObj.VarsVector_front(self) - - def back(self): - return _CdiObj.VarsVector_back(self) - - def assign(self, n, x): - return _CdiObj.VarsVector_assign(self, n, x) - - def resize(self, *args): - return _CdiObj.VarsVector_resize(self, *args) - - def insert(self, *args): - return _CdiObj.VarsVector_insert(self, *args) - - def reserve(self, n): - return _CdiObj.VarsVector_reserve(self, n) - - def capacity(self): - return _CdiObj.VarsVector_capacity(self) - __swig_destroy__ = _CdiObj.delete_VarsVector - -# Register VarsVector in _CdiObj: -_CdiObj.VarsVector_swigregister(VarsVector) - -class VarsMap(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def iterator(self): - return _CdiObj.VarsMap_iterator(self) - def __iter__(self): - return self.iterator() - - def __nonzero__(self): - return _CdiObj.VarsMap___nonzero__(self) - - def __bool__(self): - return _CdiObj.VarsMap___bool__(self) - - def __len__(self): - return _CdiObj.VarsMap___len__(self) - def __iter__(self): - return self.key_iterator() - def iterkeys(self): - return self.key_iterator() - def itervalues(self): - return self.value_iterator() - def iteritems(self): - return self.iterator() - - def __getitem__(self, key): - return _CdiObj.VarsMap___getitem__(self, key) - - def __delitem__(self, key): - return _CdiObj.VarsMap___delitem__(self, key) - - def has_key(self, key): - return _CdiObj.VarsMap_has_key(self, key) - - def keys(self): - return _CdiObj.VarsMap_keys(self) - - def values(self): - return _CdiObj.VarsMap_values(self) - - def items(self): - return _CdiObj.VarsMap_items(self) - - def __contains__(self, key): - return _CdiObj.VarsMap___contains__(self, key) - - def key_iterator(self): - return _CdiObj.VarsMap_key_iterator(self) - - def value_iterator(self): - return _CdiObj.VarsMap_value_iterator(self) - - def __setitem__(self, *args): - return _CdiObj.VarsMap___setitem__(self, *args) - - def asdict(self): - return _CdiObj.VarsMap_asdict(self) - - def __init__(self, *args): - _CdiObj.VarsMap_swiginit(self, _CdiObj.new_VarsMap(*args)) - - def empty(self): - return _CdiObj.VarsMap_empty(self) - - def size(self): - return _CdiObj.VarsMap_size(self) - - def swap(self, v): - return _CdiObj.VarsMap_swap(self, v) - - def begin(self): - return _CdiObj.VarsMap_begin(self) - - def end(self): - return _CdiObj.VarsMap_end(self) - - def rbegin(self): - return _CdiObj.VarsMap_rbegin(self) - - def rend(self): - return _CdiObj.VarsMap_rend(self) - - def clear(self): - return _CdiObj.VarsMap_clear(self) - - def get_allocator(self): - return _CdiObj.VarsMap_get_allocator(self) - - def count(self, x): - return _CdiObj.VarsMap_count(self, x) - - def erase(self, *args): - return _CdiObj.VarsMap_erase(self, *args) - - def find(self, x): - return _CdiObj.VarsMap_find(self, x) - - def lower_bound(self, x): - return _CdiObj.VarsMap_lower_bound(self, x) - - def upper_bound(self, x): - return _CdiObj.VarsMap_upper_bound(self, x) - __swig_destroy__ = _CdiObj.delete_VarsMap - -# Register VarsMap in _CdiObj: -_CdiObj.VarsMap_swigregister(VarsMap) - -class VarsByCode(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def iterator(self): - return _CdiObj.VarsByCode_iterator(self) - def __iter__(self): - return self.iterator() - - def __nonzero__(self): - return _CdiObj.VarsByCode___nonzero__(self) - - def __bool__(self): - return _CdiObj.VarsByCode___bool__(self) - - def __len__(self): - return _CdiObj.VarsByCode___len__(self) - def __iter__(self): - return self.key_iterator() - def iterkeys(self): - return self.key_iterator() - def itervalues(self): - return self.value_iterator() - def iteritems(self): - return self.iterator() - - def __getitem__(self, key): - return _CdiObj.VarsByCode___getitem__(self, key) - - def __delitem__(self, key): - return _CdiObj.VarsByCode___delitem__(self, key) - - def has_key(self, key): - return _CdiObj.VarsByCode_has_key(self, key) - - def keys(self): - return _CdiObj.VarsByCode_keys(self) - - def values(self): - return _CdiObj.VarsByCode_values(self) - - def items(self): - return _CdiObj.VarsByCode_items(self) - - def __contains__(self, key): - return _CdiObj.VarsByCode___contains__(self, key) - - def key_iterator(self): - return _CdiObj.VarsByCode_key_iterator(self) - - def value_iterator(self): - return _CdiObj.VarsByCode_value_iterator(self) - - def __setitem__(self, *args): - return _CdiObj.VarsByCode___setitem__(self, *args) - - def asdict(self): - return _CdiObj.VarsByCode_asdict(self) - - def __init__(self, *args): - _CdiObj.VarsByCode_swiginit(self, _CdiObj.new_VarsByCode(*args)) - - def empty(self): - return _CdiObj.VarsByCode_empty(self) - - def size(self): - return _CdiObj.VarsByCode_size(self) - - def swap(self, v): - return _CdiObj.VarsByCode_swap(self, v) - - def begin(self): - return _CdiObj.VarsByCode_begin(self) - - def end(self): - return _CdiObj.VarsByCode_end(self) - - def rbegin(self): - return _CdiObj.VarsByCode_rbegin(self) - - def rend(self): - return _CdiObj.VarsByCode_rend(self) - - def clear(self): - return _CdiObj.VarsByCode_clear(self) - - def get_allocator(self): - return _CdiObj.VarsByCode_get_allocator(self) - - def count(self, x): - return _CdiObj.VarsByCode_count(self, x) - - def erase(self, *args): - return _CdiObj.VarsByCode_erase(self, *args) - - def find(self, x): - return _CdiObj.VarsByCode_find(self, x) - - def lower_bound(self, x): - return _CdiObj.VarsByCode_lower_bound(self, x) - - def upper_bound(self, x): - return _CdiObj.VarsByCode_upper_bound(self, x) - __swig_destroy__ = _CdiObj.delete_VarsByCode - -# Register VarsByCode in _CdiObj: -_CdiObj.VarsByCode_swigregister(VarsByCode) - -class TaxesMap(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def iterator(self): - return _CdiObj.TaxesMap_iterator(self) - def __iter__(self): - return self.iterator() - - def __nonzero__(self): - return _CdiObj.TaxesMap___nonzero__(self) - - def __bool__(self): - return _CdiObj.TaxesMap___bool__(self) - - def __len__(self): - return _CdiObj.TaxesMap___len__(self) - def __iter__(self): - return self.key_iterator() - def iterkeys(self): - return self.key_iterator() - def itervalues(self): - return self.value_iterator() - def iteritems(self): - return self.iterator() - - def __getitem__(self, key): - return _CdiObj.TaxesMap___getitem__(self, key) - - def __delitem__(self, key): - return _CdiObj.TaxesMap___delitem__(self, key) - - def has_key(self, key): - return _CdiObj.TaxesMap_has_key(self, key) - - def keys(self): - return _CdiObj.TaxesMap_keys(self) - - def values(self): - return _CdiObj.TaxesMap_values(self) - - def items(self): - return _CdiObj.TaxesMap_items(self) - - def __contains__(self, key): - return _CdiObj.TaxesMap___contains__(self, key) - - def key_iterator(self): - return _CdiObj.TaxesMap_key_iterator(self) - - def value_iterator(self): - return _CdiObj.TaxesMap_value_iterator(self) - - def __setitem__(self, *args): - return _CdiObj.TaxesMap___setitem__(self, *args) - - def asdict(self): - return _CdiObj.TaxesMap_asdict(self) - - def __init__(self, *args): - _CdiObj.TaxesMap_swiginit(self, _CdiObj.new_TaxesMap(*args)) - - def empty(self): - return _CdiObj.TaxesMap_empty(self) - - def size(self): - return _CdiObj.TaxesMap_size(self) - - def swap(self, v): - return _CdiObj.TaxesMap_swap(self, v) - - def begin(self): - return _CdiObj.TaxesMap_begin(self) - - def end(self): - return _CdiObj.TaxesMap_end(self) - - def rbegin(self): - return _CdiObj.TaxesMap_rbegin(self) - - def rend(self): - return _CdiObj.TaxesMap_rend(self) - - def clear(self): - return _CdiObj.TaxesMap_clear(self) - - def get_allocator(self): - return _CdiObj.TaxesMap_get_allocator(self) - - def count(self, x): - return _CdiObj.TaxesMap_count(self, x) - - def erase(self, *args): - return _CdiObj.TaxesMap_erase(self, *args) - - def find(self, x): - return _CdiObj.TaxesMap_find(self, x) - - def lower_bound(self, x): - return _CdiObj.TaxesMap_lower_bound(self, x) - - def upper_bound(self, x): - return _CdiObj.TaxesMap_upper_bound(self, x) - __swig_destroy__ = _CdiObj.delete_TaxesMap - -# Register TaxesMap in _CdiObj: -_CdiObj.TaxesMap_swigregister(TaxesMap) - -class ZaxesMap(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def iterator(self): - return _CdiObj.ZaxesMap_iterator(self) - def __iter__(self): - return self.iterator() - - def __nonzero__(self): - return _CdiObj.ZaxesMap___nonzero__(self) - - def __bool__(self): - return _CdiObj.ZaxesMap___bool__(self) - - def __len__(self): - return _CdiObj.ZaxesMap___len__(self) - def __iter__(self): - return self.key_iterator() - def iterkeys(self): - return self.key_iterator() - def itervalues(self): - return self.value_iterator() - def iteritems(self): - return self.iterator() - - def __getitem__(self, key): - return _CdiObj.ZaxesMap___getitem__(self, key) - - def __delitem__(self, key): - return _CdiObj.ZaxesMap___delitem__(self, key) - - def has_key(self, key): - return _CdiObj.ZaxesMap_has_key(self, key) - - def keys(self): - return _CdiObj.ZaxesMap_keys(self) - - def values(self): - return _CdiObj.ZaxesMap_values(self) - - def items(self): - return _CdiObj.ZaxesMap_items(self) - - def __contains__(self, key): - return _CdiObj.ZaxesMap___contains__(self, key) - - def key_iterator(self): - return _CdiObj.ZaxesMap_key_iterator(self) - - def value_iterator(self): - return _CdiObj.ZaxesMap_value_iterator(self) - - def __setitem__(self, *args): - return _CdiObj.ZaxesMap___setitem__(self, *args) - - def asdict(self): - return _CdiObj.ZaxesMap_asdict(self) - - def __init__(self, *args): - _CdiObj.ZaxesMap_swiginit(self, _CdiObj.new_ZaxesMap(*args)) - - def empty(self): - return _CdiObj.ZaxesMap_empty(self) - - def size(self): - return _CdiObj.ZaxesMap_size(self) - - def swap(self, v): - return _CdiObj.ZaxesMap_swap(self, v) - - def begin(self): - return _CdiObj.ZaxesMap_begin(self) - - def end(self): - return _CdiObj.ZaxesMap_end(self) - - def rbegin(self): - return _CdiObj.ZaxesMap_rbegin(self) - - def rend(self): - return _CdiObj.ZaxesMap_rend(self) - - def clear(self): - return _CdiObj.ZaxesMap_clear(self) - - def get_allocator(self): - return _CdiObj.ZaxesMap_get_allocator(self) - - def count(self, x): - return _CdiObj.ZaxesMap_count(self, x) - - def erase(self, *args): - return _CdiObj.ZaxesMap_erase(self, *args) - - def find(self, x): - return _CdiObj.ZaxesMap_find(self, x) - - def lower_bound(self, x): - return _CdiObj.ZaxesMap_lower_bound(self, x) - - def upper_bound(self, x): - return _CdiObj.ZaxesMap_upper_bound(self, x) - __swig_destroy__ = _CdiObj.delete_ZaxesMap - -# Register ZaxesMap in _CdiObj: -_CdiObj.ZaxesMap_swigregister(ZaxesMap) - -class GridsMap(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def iterator(self): - return _CdiObj.GridsMap_iterator(self) - def __iter__(self): - return self.iterator() - - def __nonzero__(self): - return _CdiObj.GridsMap___nonzero__(self) - - def __bool__(self): - return _CdiObj.GridsMap___bool__(self) - - def __len__(self): - return _CdiObj.GridsMap___len__(self) - def __iter__(self): - return self.key_iterator() - def iterkeys(self): - return self.key_iterator() - def itervalues(self): - return self.value_iterator() - def iteritems(self): - return self.iterator() - - def __getitem__(self, key): - return _CdiObj.GridsMap___getitem__(self, key) - - def __delitem__(self, key): - return _CdiObj.GridsMap___delitem__(self, key) - - def has_key(self, key): - return _CdiObj.GridsMap_has_key(self, key) - - def keys(self): - return _CdiObj.GridsMap_keys(self) - - def values(self): - return _CdiObj.GridsMap_values(self) - - def items(self): - return _CdiObj.GridsMap_items(self) - - def __contains__(self, key): - return _CdiObj.GridsMap___contains__(self, key) - - def key_iterator(self): - return _CdiObj.GridsMap_key_iterator(self) - - def value_iterator(self): - return _CdiObj.GridsMap_value_iterator(self) - - def __setitem__(self, *args): - return _CdiObj.GridsMap___setitem__(self, *args) - - def asdict(self): - return _CdiObj.GridsMap_asdict(self) - - def __init__(self, *args): - _CdiObj.GridsMap_swiginit(self, _CdiObj.new_GridsMap(*args)) - - def empty(self): - return _CdiObj.GridsMap_empty(self) - - def size(self): - return _CdiObj.GridsMap_size(self) - - def swap(self, v): - return _CdiObj.GridsMap_swap(self, v) - - def begin(self): - return _CdiObj.GridsMap_begin(self) - - def end(self): - return _CdiObj.GridsMap_end(self) - - def rbegin(self): - return _CdiObj.GridsMap_rbegin(self) - - def rend(self): - return _CdiObj.GridsMap_rend(self) - - def clear(self): - return _CdiObj.GridsMap_clear(self) - - def get_allocator(self): - return _CdiObj.GridsMap_get_allocator(self) - - def count(self, x): - return _CdiObj.GridsMap_count(self, x) - - def erase(self, *args): - return _CdiObj.GridsMap_erase(self, *args) - - def find(self, x): - return _CdiObj.GridsMap_find(self, x) - - def lower_bound(self, x): - return _CdiObj.GridsMap_lower_bound(self, x) - - def upper_bound(self, x): - return _CdiObj.GridsMap_upper_bound(self, x) - __swig_destroy__ = _CdiObj.delete_GridsMap - -# Register GridsMap in _CdiObj: -_CdiObj.GridsMap_swigregister(GridsMap) - -class CdiGrid(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def __init__(self, *args): - _CdiObj.CdiGrid_swiginit(self, _CdiObj.new_CdiGrid(*args)) - __swig_destroy__ = _CdiObj.delete_CdiGrid - gridID = property(_CdiObj.CdiGrid_gridID_get, _CdiObj.CdiGrid_gridID_set) - type = property(_CdiObj.CdiGrid_type_get, _CdiObj.CdiGrid_type_set) - size = property(_CdiObj.CdiGrid_size_get, _CdiObj.CdiGrid_size_set) - xsize = property(_CdiObj.CdiGrid_xsize_get, _CdiObj.CdiGrid_xsize_set) - ysize = property(_CdiObj.CdiGrid_ysize_get, _CdiObj.CdiGrid_ysize_set) - prec = property(_CdiObj.CdiGrid_prec_get, _CdiObj.CdiGrid_prec_set) - ncorner = property(_CdiObj.CdiGrid_ncorner_get, _CdiObj.CdiGrid_ncorner_set) - hasXValues = property(_CdiObj.CdiGrid_hasXValues_get, _CdiObj.CdiGrid_hasXValues_set) - hasYValues = property(_CdiObj.CdiGrid_hasYValues_get, _CdiObj.CdiGrid_hasYValues_set) - hasBounds = property(_CdiObj.CdiGrid_hasBounds_get, _CdiObj.CdiGrid_hasBounds_set) - xvalues = property(_CdiObj.CdiGrid_xvalues_get, _CdiObj.CdiGrid_xvalues_set) - yvalues = property(_CdiObj.CdiGrid_yvalues_get, _CdiObj.CdiGrid_yvalues_set) - xbounds = property(_CdiObj.CdiGrid_xbounds_get, _CdiObj.CdiGrid_xbounds_set) - ybounds = property(_CdiObj.CdiGrid_ybounds_get, _CdiObj.CdiGrid_ybounds_set) - xname = property(_CdiObj.CdiGrid_xname_get, _CdiObj.CdiGrid_xname_set) - xlongname = property(_CdiObj.CdiGrid_xlongname_get, _CdiObj.CdiGrid_xlongname_set) - xstdname = property(_CdiObj.CdiGrid_xstdname_get, _CdiObj.CdiGrid_xstdname_set) - xunits = property(_CdiObj.CdiGrid_xunits_get, _CdiObj.CdiGrid_xunits_set) - yname = property(_CdiObj.CdiGrid_yname_get, _CdiObj.CdiGrid_yname_set) - ylongname = property(_CdiObj.CdiGrid_ylongname_get, _CdiObj.CdiGrid_ylongname_set) - ystdname = property(_CdiObj.CdiGrid_ystdname_get, _CdiObj.CdiGrid_ystdname_set) - yunits = property(_CdiObj.CdiGrid_yunits_get, _CdiObj.CdiGrid_yunits_set) - name = property(_CdiObj.CdiGrid_name_get, _CdiObj.CdiGrid_name_set) - - def getValues(self): - return _CdiObj.CdiGrid_getValues(self) - - def getBounds(self): - return _CdiObj.CdiGrid_getBounds(self) - - def getValuesAsPointer(self, xvals, yvals): - return _CdiObj.CdiGrid_getValuesAsPointer(self, xvals, yvals) - - def getBoundsAsPointer(self, xbnds, ybnds): - return _CdiObj.CdiGrid_getBoundsAsPointer(self, xbnds, ybnds) - - def getFloatVals(self, xvals, yvals): - return _CdiObj.CdiGrid_getFloatVals(self, xvals, yvals) - - def getFloatBounds(self, xbnds, ybnds): - return _CdiObj.CdiGrid_getFloatBounds(self, xbnds, ybnds) - -# Register CdiGrid in _CdiObj: -_CdiObj.CdiGrid_swigregister(CdiGrid) - -class CdiTaxis(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def __init__(self, *args): - _CdiObj.CdiTaxis_swiginit(self, _CdiObj.new_CdiTaxis(*args)) - __swig_destroy__ = _CdiObj.delete_CdiTaxis - taxisID = property(_CdiObj.CdiTaxis_taxisID_get, _CdiObj.CdiTaxis_taxisID_set) - ntsteps = property(_CdiObj.CdiTaxis_ntsteps_get, _CdiObj.CdiTaxis_ntsteps_set) - unit = property(_CdiObj.CdiTaxis_unit_get, _CdiObj.CdiTaxis_unit_set) - rdate = property(_CdiObj.CdiTaxis_rdate_get, _CdiObj.CdiTaxis_rdate_set) - rtime = property(_CdiObj.CdiTaxis_rtime_get, _CdiObj.CdiTaxis_rtime_set) - vdate = property(_CdiObj.CdiTaxis_vdate_get, _CdiObj.CdiTaxis_vdate_set) - vtime = property(_CdiObj.CdiTaxis_vtime_get, _CdiObj.CdiTaxis_vtime_set) - type = property(_CdiObj.CdiTaxis_type_get, _CdiObj.CdiTaxis_type_set) - calendar = property(_CdiObj.CdiTaxis_calendar_get, _CdiObj.CdiTaxis_calendar_set) - hasBounds = property(_CdiObj.CdiTaxis_hasBounds_get, _CdiObj.CdiTaxis_hasBounds_set) - name = property(_CdiObj.CdiTaxis_name_get, _CdiObj.CdiTaxis_name_set) - unitname = property(_CdiObj.CdiTaxis_unitname_get, _CdiObj.CdiTaxis_unitname_set) - -# Register CdiTaxis in _CdiObj: -_CdiObj.CdiTaxis_swigregister(CdiTaxis) - -class CdiZaxis(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def __init__(self, *args): - _CdiObj.CdiZaxis_swiginit(self, _CdiObj.new_CdiZaxis(*args)) - __swig_destroy__ = _CdiObj.delete_CdiZaxis - zaxisID = property(_CdiObj.CdiZaxis_zaxisID_get, _CdiObj.CdiZaxis_zaxisID_set) - type = property(_CdiObj.CdiZaxis_type_get, _CdiObj.CdiZaxis_type_set) - ltype = property(_CdiObj.CdiZaxis_ltype_get, _CdiObj.CdiZaxis_ltype_set) - size = property(_CdiObj.CdiZaxis_size_get, _CdiObj.CdiZaxis_size_set) - prec = property(_CdiObj.CdiZaxis_prec_get, _CdiObj.CdiZaxis_prec_set) - plevels = property(_CdiObj.CdiZaxis_plevels_get, _CdiObj.CdiZaxis_plevels_set) - plbounds = property(_CdiObj.CdiZaxis_plbounds_get, _CdiObj.CdiZaxis_plbounds_set) - pubounds = property(_CdiObj.CdiZaxis_pubounds_get, _CdiObj.CdiZaxis_pubounds_set) - pweights = property(_CdiObj.CdiZaxis_pweights_get, _CdiObj.CdiZaxis_pweights_set) - levels = property(_CdiObj.CdiZaxis_levels_get, _CdiObj.CdiZaxis_levels_set) - lbounds = property(_CdiObj.CdiZaxis_lbounds_get, _CdiObj.CdiZaxis_lbounds_set) - ubounds = property(_CdiObj.CdiZaxis_ubounds_get, _CdiObj.CdiZaxis_ubounds_set) - weights = property(_CdiObj.CdiZaxis_weights_get, _CdiObj.CdiZaxis_weights_set) - name = property(_CdiObj.CdiZaxis_name_get, _CdiObj.CdiZaxis_name_set) - longname = property(_CdiObj.CdiZaxis_longname_get, _CdiObj.CdiZaxis_longname_set) - units = property(_CdiObj.CdiZaxis_units_get, _CdiObj.CdiZaxis_units_set) - -# Register CdiZaxis in _CdiObj: -_CdiObj.CdiZaxis_swigregister(CdiZaxis) - -class CdiVariable(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def __init__(self, *args): - _CdiObj.CdiVariable_swiginit(self, _CdiObj.new_CdiVariable(*args)) - __swig_destroy__ = _CdiObj.delete_CdiVariable - varID = property(_CdiObj.CdiVariable_varID_get, _CdiObj.CdiVariable_varID_set) - zaxisID = property(_CdiObj.CdiVariable_zaxisID_get, _CdiObj.CdiVariable_zaxisID_set) - gridID = property(_CdiObj.CdiVariable_gridID_get, _CdiObj.CdiVariable_gridID_set) - taxisID = property(_CdiObj.CdiVariable_taxisID_get, _CdiObj.CdiVariable_taxisID_set) - timeID = property(_CdiObj.CdiVariable_timeID_get, _CdiObj.CdiVariable_timeID_set) - vlistID = property(_CdiObj.CdiVariable_vlistID_get, _CdiObj.CdiVariable_vlistID_set) - size = property(_CdiObj.CdiVariable_size_get, _CdiObj.CdiVariable_size_set) - code = property(_CdiObj.CdiVariable_code_get, _CdiObj.CdiVariable_code_set) - datatype = property(_CdiObj.CdiVariable_datatype_get, _CdiObj.CdiVariable_datatype_set) - streamID = property(_CdiObj.CdiVariable_streamID_get, _CdiObj.CdiVariable_streamID_set) - name = property(_CdiObj.CdiVariable_name_get, _CdiObj.CdiVariable_name_set) - longname = property(_CdiObj.CdiVariable_longname_get, _CdiObj.CdiVariable_longname_set) - units = property(_CdiObj.CdiVariable_units_get, _CdiObj.CdiVariable_units_set) - stdname = property(_CdiObj.CdiVariable_stdname_get, _CdiObj.CdiVariable_stdname_set) - missval = property(_CdiObj.CdiVariable_missval_get, _CdiObj.CdiVariable_missval_set) - values = property(_CdiObj.CdiVariable_values_get, _CdiObj.CdiVariable_values_set) - valuesWithLevel = property(_CdiObj.CdiVariable_valuesWithLevel_get, _CdiObj.CdiVariable_valuesWithLevel_set) - grid = property(_CdiObj.CdiVariable_grid_get, _CdiObj.CdiVariable_grid_set) - zaxis = property(_CdiObj.CdiVariable_zaxis_get, _CdiObj.CdiVariable_zaxis_set) - taxis = property(_CdiObj.CdiVariable_taxis_get, _CdiObj.CdiVariable_taxis_set) - - def sinfo(self): - return _CdiObj.CdiVariable_sinfo(self) - - def getValues(self): - return _CdiObj.CdiVariable_getValues(self) - - def getValuesWithLevel(self, tsID=0): - return _CdiObj.CdiVariable_getValuesWithLevel(self, tsID) - - def getFValues(self): - return _CdiObj.CdiVariable_getFValues(self) - - def getFValuesWithLevel(self, tsID=0): - return _CdiObj.CdiVariable_getFValuesWithLevel(self, tsID) - - def getValuesAsPointer(self): - return _CdiObj.CdiVariable_getValuesAsPointer(self) - - def getValuesWithLevelAsPointer(self, tsID=0): - return _CdiObj.CdiVariable_getValuesWithLevelAsPointer(self, tsID) - -# Register CdiVariable in _CdiObj: -_CdiObj.CdiVariable_swigregister(CdiVariable) - -class Cdi(object): - thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr - - def __init__(self, path): - _CdiObj.Cdi_swiginit(self, _CdiObj.new_Cdi(path)) - __swig_destroy__ = _CdiObj.delete_Cdi - streamID = property(_CdiObj.Cdi_streamID_get, _CdiObj.Cdi_streamID_set) - vlistID = property(_CdiObj.Cdi_vlistID_get, _CdiObj.Cdi_vlistID_set) - nvars = property(_CdiObj.Cdi_nvars_get, _CdiObj.Cdi_nvars_set) - nzaxes = property(_CdiObj.Cdi_nzaxes_get, _CdiObj.Cdi_nzaxes_set) - ngrids = property(_CdiObj.Cdi_ngrids_get, _CdiObj.Cdi_ngrids_set) - ntaxes = property(_CdiObj.Cdi_ntaxes_get, _CdiObj.Cdi_ntaxes_set) - taxisID = property(_CdiObj.Cdi_taxisID_get, _CdiObj.Cdi_taxisID_set) - varnames = property(_CdiObj.Cdi_varnames_get, _CdiObj.Cdi_varnames_set) - codes = property(_CdiObj.Cdi_codes_get, _CdiObj.Cdi_codes_set) - variables = property(_CdiObj.Cdi_variables_get, _CdiObj.Cdi_variables_set) - var = property(_CdiObj.Cdi_var_get, _CdiObj.Cdi_var_set) - varByCode = property(_CdiObj.Cdi_varByCode_get, _CdiObj.Cdi_varByCode_set) - taxes = property(_CdiObj.Cdi_taxes_get, _CdiObj.Cdi_taxes_set) - zaxes = property(_CdiObj.Cdi_zaxes_get, _CdiObj.Cdi_zaxes_set) - grids = property(_CdiObj.Cdi_grids_get, _CdiObj.Cdi_grids_set) - - def griddes(self): - return _CdiObj.Cdi_griddes(self) - -# Register Cdi in _CdiObj: -_CdiObj.Cdi_swigregister(Cdi) - - - diff --git a/interfaces/python/cdilib_wrap.c b/interfaces/python/cdilib_wrap.c deleted file mode 100644 index ba9cba727086196cd9cc418aff2d97a1a12607b3..0000000000000000000000000000000000000000 --- a/interfaces/python/cdilib_wrap.c +++ /dev/null @@ -1,19556 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 4.0.0 - * - * This file is not intended to be easily readable and contains a number of - * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. - * ----------------------------------------------------------------------------- */ - - -#ifndef SWIGPYTHON -#define SWIGPYTHON -#endif - -#define SWIG_PYTHON_DIRECTOR_NO_VTABLE - -/* ----------------------------------------------------------------------------- - * This section contains generic SWIG labels for method/variable - * declarations/attributes, and other compiler dependent labels. - * ----------------------------------------------------------------------------- */ - -/* template workaround for compilers that cannot correctly implement the C++ standard */ -#ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# elif defined(__HP_aCC) -/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ -/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ -# define SWIGTEMPLATEDISAMBIGUATOR template -# else -# define SWIGTEMPLATEDISAMBIGUATOR -# endif -#endif - -/* inline attribute */ -#ifndef SWIGINLINE -# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) -# define SWIGINLINE inline -# else -# define SWIGINLINE -# endif -#endif - -/* attribute recognised by some compilers to avoid 'unused' warnings */ -#ifndef SWIGUNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -# elif defined(__ICC) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -#endif - -#ifndef SWIG_MSC_UNSUPPRESS_4505 -# if defined(_MSC_VER) -# pragma warning(disable : 4505) /* unreferenced local function has been removed */ -# endif -#endif - -#ifndef SWIGUNUSEDPARM -# ifdef __cplusplus -# define SWIGUNUSEDPARM(p) -# else -# define SWIGUNUSEDPARM(p) p SWIGUNUSED -# endif -#endif - -/* internal SWIG method */ -#ifndef SWIGINTERN -# define SWIGINTERN static SWIGUNUSED -#endif - -/* internal inline SWIG method */ -#ifndef SWIGINTERNINLINE -# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE -#endif - -/* exporting methods */ -#if defined(__GNUC__) -# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY -# endif -# endif -#endif - -#ifndef SWIGEXPORT -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# if defined(STATIC_LINKED) -# define SWIGEXPORT -# else -# define SWIGEXPORT __declspec(dllexport) -# endif -# else -# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) -# define SWIGEXPORT __attribute__ ((visibility("default"))) -# else -# define SWIGEXPORT -# endif -# endif -#endif - -/* calling conventions for Windows */ -#ifndef SWIGSTDCALL -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# define SWIGSTDCALL __stdcall -# else -# define SWIGSTDCALL -# endif -#endif - -/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) -# define _CRT_SECURE_NO_DEPRECATE -#endif - -/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ -#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) -# define _SCL_SECURE_NO_DEPRECATE -#endif - -/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ -#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) -# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 -#endif - -/* Intel's compiler complains if a variable which was never initialised is - * cast to void, which is a common idiom which we use to indicate that we - * are aware a variable isn't used. So we just silence that warning. - * See: https://github.com/swig/swig/issues/192 for more discussion. - */ -#ifdef __INTEL_COMPILER -# pragma warning disable 592 -#endif - - -#if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND) -/* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */ -# include <math.h> -#endif - -#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) -/* Use debug wrappers with the Python release dll */ -# undef _DEBUG -# include <Python.h> -# define _DEBUG 1 -#else -# include <Python.h> -#endif - -/* ----------------------------------------------------------------------------- - * swigrun.swg - * - * This file contains generic C API SWIG runtime support for pointer - * type checking. - * ----------------------------------------------------------------------------- */ - -/* This should only be incremented when either the layout of swig_type_info changes, - or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" - -/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ -#ifdef SWIG_TYPE_TABLE -# define SWIG_QUOTE_STRING(x) #x -# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) -# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) -#else -# define SWIG_TYPE_TABLE_NAME -#endif - -/* - You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for - creating a static or dynamic library from the SWIG runtime code. - In 99.9% of the cases, SWIG just needs to declare them as 'static'. - - But only do this if strictly necessary, ie, if you have problems - with your compiler or suchlike. -*/ - -#ifndef SWIGRUNTIME -# define SWIGRUNTIME SWIGINTERN -#endif - -#ifndef SWIGRUNTIMEINLINE -# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE -#endif - -/* Generic buffer size */ -#ifndef SWIG_BUFFER_SIZE -# define SWIG_BUFFER_SIZE 1024 -#endif - -/* Flags for pointer conversions */ -#define SWIG_POINTER_DISOWN 0x1 -#define SWIG_CAST_NEW_MEMORY 0x2 -#define SWIG_POINTER_NO_NULL 0x4 - -/* Flags for new pointer objects */ -#define SWIG_POINTER_OWN 0x1 - - -/* - Flags/methods for returning states. - - The SWIG conversion methods, as ConvertPtr, return an integer - that tells if the conversion was successful or not. And if not, - an error code can be returned (see swigerrors.swg for the codes). - - Use the following macros/flags to set or process the returning - states. - - In old versions of SWIG, code such as the following was usually written: - - if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { - // success code - } else { - //fail code - } - - Now you can be more explicit: - - int res = SWIG_ConvertPtr(obj,vptr,ty.flags); - if (SWIG_IsOK(res)) { - // success code - } else { - // fail code - } - - which is the same really, but now you can also do - - Type *ptr; - int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); - if (SWIG_IsOK(res)) { - // success code - if (SWIG_IsNewObj(res) { - ... - delete *ptr; - } else { - ... - } - } else { - // fail code - } - - I.e., now SWIG_ConvertPtr can return new objects and you can - identify the case and take care of the deallocation. Of course that - also requires SWIG_ConvertPtr to return new result values, such as - - int SWIG_ConvertPtr(obj, ptr,...) { - if (<obj is ok>) { - if (<need new object>) { - *ptr = <ptr to new allocated object>; - return SWIG_NEWOBJ; - } else { - *ptr = <ptr to old object>; - return SWIG_OLDOBJ; - } - } else { - return SWIG_BADOBJ; - } - } - - Of course, returning the plain '0(success)/-1(fail)' still works, but you can be - more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the - SWIG errors code. - - Finally, if the SWIG_CASTRANK_MODE is enabled, the result code - allows to return the 'cast rank', for example, if you have this - - int food(double) - int fooi(int); - - and you call - - food(1) // cast rank '1' (1 -> 1.0) - fooi(1) // cast rank '0' - - just use the SWIG_AddCast()/SWIG_CheckState() -*/ - -#define SWIG_OK (0) -#define SWIG_ERROR (-1) -#define SWIG_IsOK(r) (r >= 0) -#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) - -/* The CastRankLimit says how many bits are used for the cast rank */ -#define SWIG_CASTRANKLIMIT (1 << 8) -/* The NewMask denotes the object was created (using new/malloc) */ -#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) -/* The TmpMask is for in/out typemaps that use temporal objects */ -#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) -/* Simple returning values */ -#define SWIG_BADOBJ (SWIG_ERROR) -#define SWIG_OLDOBJ (SWIG_OK) -#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) -#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) -/* Check, add and del mask methods */ -#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) -#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) -#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) -#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) -#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) -#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) - -/* Cast-Rank Mode */ -#if defined(SWIG_CASTRANK_MODE) -# ifndef SWIG_TypeRank -# define SWIG_TypeRank unsigned long -# endif -# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ -# define SWIG_MAXCASTRANK (2) -# endif -# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) -# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) -SWIGINTERNINLINE int SWIG_AddCast(int r) { - return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; -} -SWIGINTERNINLINE int SWIG_CheckState(int r) { - return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; -} -#else /* no cast-rank mode */ -# define SWIG_AddCast(r) (r) -# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) -#endif - - -#include <string.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void *(*swig_converter_func)(void *, int *); -typedef struct swig_type_info *(*swig_dycast_func)(void **); - -/* Structure to store information on one type */ -typedef struct swig_type_info { - const char *name; /* mangled name of this type */ - const char *str; /* human readable name of this type */ - swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ - struct swig_cast_info *cast; /* linked list of types that can cast into this type */ - void *clientdata; /* language specific type data */ - int owndata; /* flag if the structure owns the clientdata */ -} swig_type_info; - -/* Structure to store a type and conversion function used for casting */ -typedef struct swig_cast_info { - swig_type_info *type; /* pointer to type that is equivalent to this type */ - swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ -} swig_cast_info; - -/* Structure used to store module information - * Each module generates one structure like this, and the runtime collects - * all of these structures and stores them in a circularly linked list.*/ -typedef struct swig_module_info { - swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ - size_t size; /* Number of types in this module */ - struct swig_module_info *next; /* Pointer to next element in circularly linked list */ - swig_type_info **type_initial; /* Array of initially generated type structures */ - swig_cast_info **cast_initial; /* Array of initially generated casting structures */ - void *clientdata; /* Language specific module data */ -} swig_module_info; - -/* - Compare two type names skipping the space characters, therefore - "char*" == "char *" and "Class<int>" == "Class<int >", etc. - - Return 0 when the two name types are equivalent, as in - strncmp, but skipping ' '. -*/ -SWIGRUNTIME int -SWIG_TypeNameComp(const char *f1, const char *l1, - const char *f2, const char *l2) { - for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { - while ((*f1 == ' ') && (f1 != l1)) ++f1; - while ((*f2 == ' ') && (f2 != l2)) ++f2; - if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; - } - return (int)((l1 - f1) - (l2 - f2)); -} - -/* - Check type equivalence in a name list like <name1>|<name2>|... - Return 0 if equal, -1 if nb < tb, 1 if nb > tb -*/ -SWIGRUNTIME int -SWIG_TypeCmp(const char *nb, const char *tb) { - int equiv = 1; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (equiv != 0 && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; - } - equiv = SWIG_TypeNameComp(nb, ne, tb, te); - if (*ne) ++ne; - } - return equiv; -} - -/* - Check type equivalence in a name list like <name1>|<name2>|... - Return 0 if not equal, 1 if equal -*/ -SWIGRUNTIME int -SWIG_TypeEquiv(const char *nb, const char *tb) { - return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; -} - -/* - Check the typename -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheck(const char *c, swig_type_info *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; - } - iter = iter->next; - } - } - return 0; -} - -/* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; - } - iter = iter->next; - } - } - return 0; -} - -/* - Cast a pointer up an inheritance hierarchy -*/ -SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); -} - -/* - Dynamic pointer casting. Down an inheritance hierarchy -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { - swig_type_info *lastty = ty; - if (!ty || !ty->dcast) return ty; - while (ty && (ty->dcast)) { - ty = (*ty->dcast)(ptr); - if (ty) lastty = ty; - } - return lastty; -} - -/* - Return the name associated with this type -*/ -SWIGRUNTIMEINLINE const char * -SWIG_TypeName(const swig_type_info *ty) { - return ty->name; -} - -/* - Return the pretty name associated with this type, - that is an unmangled type name in a form presentable to the user. -*/ -SWIGRUNTIME const char * -SWIG_TypePrettyName(const swig_type_info *type) { - /* The "str" field contains the equivalent pretty names of the - type, separated by vertical-bar characters. We choose - to print the last name, as it is often (?) the most - specific. */ - if (!type) return NULL; - if (type->str != NULL) { - const char *last_name = type->str; - const char *s; - for (s = type->str; *s; s++) - if (*s == '|') last_name = s+1; - return last_name; - } - else - return type->name; -} - -/* - Set the clientdata field for a type -*/ -SWIGRUNTIME void -SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; - /* if (ti->clientdata == clientdata) return; */ - ti->clientdata = clientdata; - - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); - } - } - cast = cast->next; - } -} -SWIGRUNTIME void -SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { - SWIG_TypeClientData(ti, clientdata); - ti->owndata = 1; -} - -/* - Search for a swig_type_info structure only by mangled name - Search is a O(log #types) - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_MangledTypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - swig_module_info *iter = start; - do { - if (iter->size) { - size_t l = 0; - size_t r = iter->size - 1; - do { - /* since l+r >= 0, we can (>> 1) instead (/ 2) */ - size_t i = (l + r) >> 1; - const char *iname = iter->types[i]->name; - if (iname) { - int compare = strcmp(name, iname); - if (compare == 0) { - return iter->types[i]; - } else if (compare < 0) { - if (i) { - r = i - 1; - } else { - break; - } - } else if (compare > 0) { - l = i + 1; - } - } else { - break; /* should never happen */ - } - } while (l <= r); - } - iter = iter->next; - } while (iter != end); - return 0; -} - -/* - Search for a swig_type_info structure for either a mangled name or a human readable name. - It first searches the mangled names of the types, which is a O(log #types) - If a type is not found it then searches the human readable names, which is O(#types). - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - /* STEP 1: Search the name field using binary search */ - swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); - if (ret) { - return ret; - } else { - /* STEP 2: If the type hasn't been found, do a complete search - of the str field (the human readable name) */ - swig_module_info *iter = start; - do { - size_t i = 0; - for (; i < iter->size; ++i) { - if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) - return iter->types[i]; - } - iter = iter->next; - } while (iter != end); - } - - /* neither found a match */ - return 0; -} - -/* - Pack binary data into a string -*/ -SWIGRUNTIME char * -SWIG_PackData(char *c, void *ptr, size_t sz) { - static const char hex[17] = "0123456789abcdef"; - const unsigned char *u = (unsigned char *) ptr; - const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - unsigned char uu = *u; - *(c++) = hex[(uu & 0xf0) >> 4]; - *(c++) = hex[uu & 0xf]; - } - return c; -} - -/* - Unpack binary data from a string -*/ -SWIGRUNTIME const char * -SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - unsigned char *u = (unsigned char *) ptr; - const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - char d = *(c++); - unsigned char uu; - if ((d >= '0') && (d <= '9')) - uu = (unsigned char)((d - '0') << 4); - else if ((d >= 'a') && (d <= 'f')) - uu = (unsigned char)((d - ('a'-10)) << 4); - else - return (char *) 0; - d = *(c++); - if ((d >= '0') && (d <= '9')) - uu |= (unsigned char)(d - '0'); - else if ((d >= 'a') && (d <= 'f')) - uu |= (unsigned char)(d - ('a'-10)); - else - return (char *) 0; - *u = uu; - } - return c; -} - -/* - Pack 'void *' into a string buffer. -*/ -SWIGRUNTIME char * -SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { - char *r = buff; - if ((2*sizeof(void *) + 2) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,&ptr,sizeof(void *)); - if (strlen(name) + 1 > (bsz - (r - buff))) return 0; - strcpy(r,name); - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - *ptr = (void *) 0; - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sizeof(void *)); -} - -SWIGRUNTIME char * -SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { - char *r = buff; - size_t lname = (name ? strlen(name) : 0); - if ((2*sz + 2 + lname) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,ptr,sz); - if (lname) { - strncpy(r,name,lname+1); - } else { - *r = 0; - } - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - memset(ptr,0,sz); - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sz); -} - -#ifdef __cplusplus -} -#endif - -/* Errors in SWIG */ -#define SWIG_UnknownError -1 -#define SWIG_IOError -2 -#define SWIG_RuntimeError -3 -#define SWIG_IndexError -4 -#define SWIG_TypeError -5 -#define SWIG_DivisionByZero -6 -#define SWIG_OverflowError -7 -#define SWIG_SyntaxError -8 -#define SWIG_ValueError -9 -#define SWIG_SystemError -10 -#define SWIG_AttributeError -11 -#define SWIG_MemoryError -12 -#define SWIG_NullReferenceError -13 - - - -/* Compatibility macros for Python 3 */ -#if PY_VERSION_HEX >= 0x03000000 - -#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) -#define PyInt_Check(x) PyLong_Check(x) -#define PyInt_AsLong(x) PyLong_AsLong(x) -#define PyInt_FromLong(x) PyLong_FromLong(x) -#define PyInt_FromSize_t(x) PyLong_FromSize_t(x) -#define PyString_Check(name) PyBytes_Check(name) -#define PyString_FromString(x) PyUnicode_FromString(x) -#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) -#define PyString_AsString(str) PyBytes_AsString(str) -#define PyString_Size(str) PyBytes_Size(str) -#define PyString_InternFromString(key) PyUnicode_InternFromString(key) -#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE -#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x) -#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x) - -#endif - -#ifndef Py_TYPE -# define Py_TYPE(op) ((op)->ob_type) -#endif - -/* SWIG APIs for compatibility of both Python 2 & 3 */ - -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_Python_str_FromFormat PyUnicode_FromFormat -#else -# define SWIG_Python_str_FromFormat PyString_FromFormat -#endif - - -/* Warning: This function will allocate a new string in Python 3, - * so please call SWIG_Python_str_DelForPy3(x) to free the space. - */ -SWIGINTERN char* -SWIG_Python_str_AsChar(PyObject *str) -{ -#if PY_VERSION_HEX >= 0x03000000 - char *newstr = 0; - str = PyUnicode_AsUTF8String(str); - if (str) { - char *cstr; - Py_ssize_t len; - PyBytes_AsStringAndSize(str, &cstr, &len); - newstr = (char *) malloc(len+1); - memcpy(newstr, cstr, len+1); - Py_XDECREF(str); - } - return newstr; -#else - return PyString_AsString(str); -#endif -} - -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) -#else -# define SWIG_Python_str_DelForPy3(x) -#endif - - -SWIGINTERN PyObject* -SWIG_Python_str_FromChar(const char *c) -{ -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromString(c); -#else - return PyString_FromString(c); -#endif -} - -#ifndef PyObject_DEL -# define PyObject_DEL PyObject_Del -#endif - -// SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user -// interface files check for it. -# define SWIGPY_USE_CAPSULE -# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) - -#if PY_VERSION_HEX < 0x03020000 -#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) -#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) -#define Py_hash_t long -#endif - -/* ----------------------------------------------------------------------------- - * error manipulation - * ----------------------------------------------------------------------------- */ - -SWIGRUNTIME PyObject* -SWIG_Python_ErrorType(int code) { - PyObject* type = 0; - switch(code) { - case SWIG_MemoryError: - type = PyExc_MemoryError; - break; - case SWIG_IOError: - type = PyExc_IOError; - break; - case SWIG_RuntimeError: - type = PyExc_RuntimeError; - break; - case SWIG_IndexError: - type = PyExc_IndexError; - break; - case SWIG_TypeError: - type = PyExc_TypeError; - break; - case SWIG_DivisionByZero: - type = PyExc_ZeroDivisionError; - break; - case SWIG_OverflowError: - type = PyExc_OverflowError; - break; - case SWIG_SyntaxError: - type = PyExc_SyntaxError; - break; - case SWIG_ValueError: - type = PyExc_ValueError; - break; - case SWIG_SystemError: - type = PyExc_SystemError; - break; - case SWIG_AttributeError: - type = PyExc_AttributeError; - break; - default: - type = PyExc_RuntimeError; - } - return type; -} - - -SWIGRUNTIME void -SWIG_Python_AddErrorMsg(const char* mesg) -{ - PyObject *type = 0; - PyObject *value = 0; - PyObject *traceback = 0; - - if (PyErr_Occurred()) - PyErr_Fetch(&type, &value, &traceback); - if (value) { - PyObject *old_str = PyObject_Str(value); - const char *tmp = SWIG_Python_str_AsChar(old_str); - PyErr_Clear(); - Py_XINCREF(type); - if (tmp) - PyErr_Format(type, "%s %s", tmp, mesg); - else - PyErr_Format(type, "%s", mesg); - SWIG_Python_str_DelForPy3(tmp); - Py_DECREF(old_str); - Py_DECREF(value); - } else { - PyErr_SetString(PyExc_RuntimeError, mesg); - } -} - -SWIGRUNTIME int -SWIG_Python_TypeErrorOccurred(PyObject *obj) -{ - PyObject *error; - if (obj) - return 0; - error = PyErr_Occurred(); - return error && PyErr_GivenExceptionMatches(error, PyExc_TypeError); -} - -SWIGRUNTIME void -SWIG_Python_RaiseOrModifyTypeError(const char *message) -{ - if (SWIG_Python_TypeErrorOccurred(NULL)) { - /* Use existing TypeError to preserve stacktrace and enhance with given message */ - PyObject *newvalue; - PyObject *type = NULL, *value = NULL, *traceback = NULL; - PyErr_Fetch(&type, &value, &traceback); -#if PY_VERSION_HEX >= 0x03000000 - newvalue = PyUnicode_FromFormat("%S\nAdditional information:\n%s", value, message); -#else - newvalue = PyString_FromFormat("%s\nAdditional information:\n%s", PyString_AsString(value), message); -#endif - Py_XDECREF(value); - PyErr_Restore(type, newvalue, traceback); - } else { - /* Raise TypeError using given message */ - PyErr_SetString(PyExc_TypeError, message); - } -} - -#if defined(SWIG_PYTHON_NO_THREADS) -# if defined(SWIG_PYTHON_THREADS) -# undef SWIG_PYTHON_THREADS -# endif -#endif -#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ -# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) -# define SWIG_PYTHON_USE_GIL -# endif -# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ -# ifndef SWIG_PYTHON_INITIALIZE_THREADS -# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() -# endif -# ifdef __cplusplus /* C++ code */ - class SWIG_Python_Thread_Block { - bool status; - PyGILState_STATE state; - public: - void end() { if (status) { PyGILState_Release(state); status = false;} } - SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} - ~SWIG_Python_Thread_Block() { end(); } - }; - class SWIG_Python_Thread_Allow { - bool status; - PyThreadState *save; - public: - void end() { if (status) { PyEval_RestoreThread(save); status = false; }} - SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} - ~SWIG_Python_Thread_Allow() { end(); } - }; -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block -# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow -# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() -# else /* C code */ -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() -# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() -# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) -# endif -# else /* Old thread way, not implemented, user must provide it */ -# if !defined(SWIG_PYTHON_INITIALIZE_THREADS) -# define SWIG_PYTHON_INITIALIZE_THREADS -# endif -# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK -# endif -# if !defined(SWIG_PYTHON_THREAD_END_BLOCK) -# define SWIG_PYTHON_THREAD_END_BLOCK -# endif -# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW -# endif -# if !defined(SWIG_PYTHON_THREAD_END_ALLOW) -# define SWIG_PYTHON_THREAD_END_ALLOW -# endif -# endif -#else /* No thread support */ -# define SWIG_PYTHON_INITIALIZE_THREADS -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK -# define SWIG_PYTHON_THREAD_END_BLOCK -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW -# define SWIG_PYTHON_THREAD_END_ALLOW -#endif - -/* ----------------------------------------------------------------------------- - * Python API portion that goes into the runtime - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* ----------------------------------------------------------------------------- - * Constant declarations - * ----------------------------------------------------------------------------- */ - -/* Constant Types */ -#define SWIG_PY_POINTER 4 -#define SWIG_PY_BINARY 5 - -/* Constant information structure */ -typedef struct swig_const_info { - int type; - const char *name; - long lvalue; - double dvalue; - void *pvalue; - swig_type_info **ptype; -} swig_const_info; - -#ifdef __cplusplus -} -#endif - - -/* ----------------------------------------------------------------------------- - * pyrun.swg - * - * This file contains the runtime support for Python modules - * and includes code for managing global variables and pointer - * type checking. - * - * ----------------------------------------------------------------------------- */ - -#if PY_VERSION_HEX < 0x02070000 /* 2.7.0 */ -# error "This version of SWIG only supports Python >= 2.7" -#endif - -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000 -# error "This version of SWIG only supports Python 3 >= 3.2" -#endif - -/* Common SWIG API */ - -/* for raw pointers */ -#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) -#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) -#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) - -#ifdef SWIGPYTHON_BUILTIN -#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags) -#else -#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) -#endif - -#define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) - -#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) -#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) -#define swig_owntype int - -/* for raw packed data */ -#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) -#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) - -/* for class or struct pointers */ -#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) -#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) - -/* for C or C++ function pointers */ -#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) -#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0) - -/* for C++ member pointers, ie, member methods */ -#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) -#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) - - -/* Runtime API */ - -#define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata) -#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) -#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) - -#define SWIG_SetErrorObj SWIG_Python_SetErrorObj -#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg -#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) -#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail - - -/* Runtime API implementation */ - -/* Error manipulation */ - -SWIGINTERN void -SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyErr_SetObject(errtype, obj); - Py_DECREF(obj); - SWIG_PYTHON_THREAD_END_BLOCK; -} - -SWIGINTERN void -SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyErr_SetString(errtype, msg); - SWIG_PYTHON_THREAD_END_BLOCK; -} - -#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) - -/* Set a constant value */ - -#if defined(SWIGPYTHON_BUILTIN) - -SWIGINTERN void -SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) { - PyObject *s = PyString_InternFromString(key); - PyList_Append(seq, s); - Py_DECREF(s); -} - -SWIGINTERN void -SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { - PyDict_SetItemString(d, name, obj); - Py_DECREF(obj); - if (public_interface) - SwigPyBuiltin_AddPublicSymbol(public_interface, name); -} - -#else - -SWIGINTERN void -SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { - PyDict_SetItemString(d, name, obj); - Py_DECREF(obj); -} - -#endif - -/* Append a value to the result obj */ - -SWIGINTERN PyObject* -SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { - if (!result) { - result = obj; - } else if (result == Py_None) { - Py_DECREF(result); - result = obj; - } else { - if (!PyList_Check(result)) { - PyObject *o2 = result; - result = PyList_New(1); - PyList_SetItem(result, 0, o2); - } - PyList_Append(result,obj); - Py_DECREF(obj); - } - return result; -} - -/* Unpack the argument tuple */ - -SWIGINTERN Py_ssize_t -SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) -{ - if (!args) { - if (!min && !max) { - return 1; - } else { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", - name, (min == max ? "" : "at least "), (int)min); - return 0; - } - } - if (!PyTuple_Check(args)) { - if (min <= 1 && max >= 1) { - Py_ssize_t i; - objs[0] = args; - for (i = 1; i < max; ++i) { - objs[i] = 0; - } - return 2; - } - PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); - return 0; - } else { - Py_ssize_t l = PyTuple_GET_SIZE(args); - if (l < min) { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", - name, (min == max ? "" : "at least "), (int)min, (int)l); - return 0; - } else if (l > max) { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", - name, (min == max ? "" : "at most "), (int)max, (int)l); - return 0; - } else { - Py_ssize_t i; - for (i = 0; i < l; ++i) { - objs[i] = PyTuple_GET_ITEM(args, i); - } - for (; l < max; ++l) { - objs[l] = 0; - } - return i + 1; - } - } -} - -/* A functor is a function object with one single object argument */ -#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, (char *)"O", obj); - -/* - Helper for static pointer initialization for both C and C++ code, for example - static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); -*/ -#ifdef __cplusplus -#define SWIG_STATIC_POINTER(var) var -#else -#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var -#endif - -/* ----------------------------------------------------------------------------- - * Pointer declarations - * ----------------------------------------------------------------------------- */ - -/* Flags for new pointer objects */ -#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) -#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) - -#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) - -#define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2) -#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN) - -#ifdef __cplusplus -extern "C" { -#endif - -/* The python void return value */ - -SWIGRUNTIMEINLINE PyObject * -SWIG_Py_Void(void) -{ - PyObject *none = Py_None; - Py_INCREF(none); - return none; -} - -/* SwigPyClientData */ - -typedef struct { - PyObject *klass; - PyObject *newraw; - PyObject *newargs; - PyObject *destroy; - int delargs; - int implicitconv; - PyTypeObject *pytype; -} SwigPyClientData; - -SWIGRUNTIMEINLINE int -SWIG_Python_CheckImplicit(swig_type_info *ty) -{ - SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; - int fail = data ? data->implicitconv : 0; - if (fail) - PyErr_SetString(PyExc_TypeError, "Implicit conversion is prohibited for explicit constructors."); - return fail; -} - -SWIGRUNTIMEINLINE PyObject * -SWIG_Python_ExceptionType(swig_type_info *desc) { - SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; - PyObject *klass = data ? data->klass : 0; - return (klass ? klass : PyExc_RuntimeError); -} - - -SWIGRUNTIME SwigPyClientData * -SwigPyClientData_New(PyObject* obj) -{ - if (!obj) { - return 0; - } else { - SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); - /* the klass element */ - data->klass = obj; - Py_INCREF(data->klass); - /* the newraw method and newargs arguments used to create a new raw instance */ - if (PyClass_Check(obj)) { - data->newraw = 0; - data->newargs = obj; - Py_INCREF(obj); - } else { - data->newraw = PyObject_GetAttrString(data->klass, "__new__"); - if (data->newraw) { - Py_INCREF(data->newraw); - data->newargs = PyTuple_New(1); - PyTuple_SetItem(data->newargs, 0, obj); - } else { - data->newargs = obj; - } - Py_INCREF(data->newargs); - } - /* the destroy method, aka as the C++ delete method */ - data->destroy = PyObject_GetAttrString(data->klass, "__swig_destroy__"); - if (PyErr_Occurred()) { - PyErr_Clear(); - data->destroy = 0; - } - if (data->destroy) { - int flags; - Py_INCREF(data->destroy); - flags = PyCFunction_GET_FLAGS(data->destroy); - data->delargs = !(flags & (METH_O)); - } else { - data->delargs = 0; - } - data->implicitconv = 0; - data->pytype = 0; - return data; - } -} - -SWIGRUNTIME void -SwigPyClientData_Del(SwigPyClientData *data) { - Py_XDECREF(data->newraw); - Py_XDECREF(data->newargs); - Py_XDECREF(data->destroy); -} - -/* =============== SwigPyObject =====================*/ - -typedef struct { - PyObject_HEAD - void *ptr; - swig_type_info *ty; - int own; - PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif -} SwigPyObject; - - -#ifdef SWIGPYTHON_BUILTIN - -SWIGRUNTIME PyObject * -SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) -{ - SwigPyObject *sobj = (SwigPyObject *)v; - - if (!sobj->dict) - sobj->dict = PyDict_New(); - - Py_INCREF(sobj->dict); - return sobj->dict; -} - -#endif - -SWIGRUNTIME PyObject * -SwigPyObject_long(SwigPyObject *v) -{ - return PyLong_FromVoidPtr(v->ptr); -} - -SWIGRUNTIME PyObject * -SwigPyObject_format(const char* fmt, SwigPyObject *v) -{ - PyObject *res = NULL; - PyObject *args = PyTuple_New(1); - if (args) { - if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { - PyObject *ofmt = SWIG_Python_str_FromChar(fmt); - if (ofmt) { -#if PY_VERSION_HEX >= 0x03000000 - res = PyUnicode_Format(ofmt,args); -#else - res = PyString_Format(ofmt,args); -#endif - Py_DECREF(ofmt); - } - Py_DECREF(args); - } - } - return res; -} - -SWIGRUNTIME PyObject * -SwigPyObject_oct(SwigPyObject *v) -{ - return SwigPyObject_format("%o",v); -} - -SWIGRUNTIME PyObject * -SwigPyObject_hex(SwigPyObject *v) -{ - return SwigPyObject_format("%x",v); -} - -SWIGRUNTIME PyObject * -SwigPyObject_repr(SwigPyObject *v) -{ - const char *name = SWIG_TypePrettyName(v->ty); - PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v); - if (v->next) { - PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); -# if PY_VERSION_HEX >= 0x03000000 - PyObject *joined = PyUnicode_Concat(repr, nrep); - Py_DecRef(repr); - Py_DecRef(nrep); - repr = joined; -# else - PyString_ConcatAndDel(&repr,nrep); -# endif - } - return repr; -} - -/* We need a version taking two PyObject* parameters so it's a valid - * PyCFunction to use in swigobject_methods[]. */ -SWIGRUNTIME PyObject * -SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) -{ - return SwigPyObject_repr((SwigPyObject*)v); -} - -SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) -{ - void *i = v->ptr; - void *j = w->ptr; - return (i < j) ? -1 : ((i > j) ? 1 : 0); -} - -/* Added for Python 3.x, would it also be useful for Python 2.x? */ -SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) -{ - PyObject* res; - if( op != Py_EQ && op != Py_NE ) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); - return res; -} - - -SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); - -#ifdef SWIGPYTHON_BUILTIN -static swig_type_info *SwigPyObject_stype = 0; -SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { - SwigPyClientData *cd; - assert(SwigPyObject_stype); - cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; - assert(cd); - assert(cd->pytype); - return cd->pytype; -} -#else -SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { - static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); - return type; -} -#endif - -SWIGRUNTIMEINLINE int -SwigPyObject_Check(PyObject *op) { -#ifdef SWIGPYTHON_BUILTIN - PyTypeObject *target_tp = SwigPyObject_type(); - if (PyType_IsSubtype(op->ob_type, target_tp)) - return 1; - return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0); -#else - return (Py_TYPE(op) == SwigPyObject_type()) - || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); -#endif -} - -SWIGRUNTIME PyObject * -SwigPyObject_New(void *ptr, swig_type_info *ty, int own); - -SWIGRUNTIME void -SwigPyObject_dealloc(PyObject *v) -{ - SwigPyObject *sobj = (SwigPyObject *) v; - PyObject *next = sobj->next; - if (sobj->own == SWIG_POINTER_OWN) { - swig_type_info *ty = sobj->ty; - SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; - PyObject *destroy = data ? data->destroy : 0; - if (destroy) { - /* destroy is always a VARARGS method */ - PyObject *res; - - /* PyObject_CallFunction() has the potential to silently drop - the active exception. In cases of unnamed temporary - variable or where we just finished iterating over a generator - StopIteration will be active right now, and this needs to - remain true upon return from SwigPyObject_dealloc. So save - and restore. */ - - PyObject *type = NULL, *value = NULL, *traceback = NULL; - PyErr_Fetch(&type, &value, &traceback); - - if (data->delargs) { - /* we need to create a temporary object to carry the destroy operation */ - PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); - res = SWIG_Python_CallFunctor(destroy, tmp); - Py_DECREF(tmp); - } else { - PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); - PyObject *mself = PyCFunction_GET_SELF(destroy); - res = ((*meth)(mself, v)); - } - if (!res) - PyErr_WriteUnraisable(destroy); - - PyErr_Restore(type, value, traceback); - - Py_XDECREF(res); - } -#if !defined(SWIG_PYTHON_SILENT_MEMLEAK) - else { - const char *name = SWIG_TypePrettyName(ty); - printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); - } -#endif - } - Py_XDECREF(next); - PyObject_DEL(v); -} - -SWIGRUNTIME PyObject* -SwigPyObject_append(PyObject* v, PyObject* next) -{ - SwigPyObject *sobj = (SwigPyObject *) v; - if (!SwigPyObject_Check(next)) { - PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject"); - return NULL; - } - sobj->next = next; - Py_INCREF(next); - return SWIG_Py_Void(); -} - -SWIGRUNTIME PyObject* -SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) -{ - SwigPyObject *sobj = (SwigPyObject *) v; - if (sobj->next) { - Py_INCREF(sobj->next); - return sobj->next; - } else { - return SWIG_Py_Void(); - } -} - -SWIGINTERN PyObject* -SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) -{ - SwigPyObject *sobj = (SwigPyObject *)v; - sobj->own = 0; - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject* -SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) -{ - SwigPyObject *sobj = (SwigPyObject *)v; - sobj->own = SWIG_POINTER_OWN; - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject* -SwigPyObject_own(PyObject *v, PyObject *args) -{ - PyObject *val = 0; - if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) { - return NULL; - } else { - SwigPyObject *sobj = (SwigPyObject *)v; - PyObject *obj = PyBool_FromLong(sobj->own); - if (val) { - if (PyObject_IsTrue(val)) { - SwigPyObject_acquire(v,args); - } else { - SwigPyObject_disown(v,args); - } - } - return obj; - } -} - -static PyMethodDef -swigobject_methods[] = { - {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, - {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, - {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, - {"append", SwigPyObject_append, METH_O, "appends another 'this' object"}, - {"next", SwigPyObject_next, METH_NOARGS, "returns the next 'this' object"}, - {"__repr__",SwigPyObject_repr2, METH_NOARGS, "returns object representation"}, - {0, 0, 0, 0} -}; - -SWIGRUNTIME PyTypeObject* -SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; - - static PyNumberMethods SwigPyObject_as_number = { - (binaryfunc)0, /*nb_add*/ - (binaryfunc)0, /*nb_subtract*/ - (binaryfunc)0, /*nb_multiply*/ - /* nb_divide removed in Python 3 */ -#if PY_VERSION_HEX < 0x03000000 - (binaryfunc)0, /*nb_divide*/ -#endif - (binaryfunc)0, /*nb_remainder*/ - (binaryfunc)0, /*nb_divmod*/ - (ternaryfunc)0,/*nb_power*/ - (unaryfunc)0, /*nb_negative*/ - (unaryfunc)0, /*nb_positive*/ - (unaryfunc)0, /*nb_absolute*/ - (inquiry)0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ -#if PY_VERSION_HEX < 0x03000000 - 0, /*nb_coerce*/ -#endif - (unaryfunc)SwigPyObject_long, /*nb_int*/ -#if PY_VERSION_HEX < 0x03000000 - (unaryfunc)SwigPyObject_long, /*nb_long*/ -#else - 0, /*nb_reserved*/ -#endif - (unaryfunc)0, /*nb_float*/ -#if PY_VERSION_HEX < 0x03000000 - (unaryfunc)SwigPyObject_oct, /*nb_oct*/ - (unaryfunc)SwigPyObject_hex, /*nb_hex*/ -#endif -#if PY_VERSION_HEX >= 0x03050000 /* 3.5 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */ -#elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ -#else - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ -#endif - }; - - static PyTypeObject swigpyobject_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp = { -#if PY_VERSION_HEX >= 0x03000000 - PyVarObject_HEAD_INIT(NULL, 0) -#else - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ -#endif - "SwigPyObject", /* tp_name */ - sizeof(SwigPyObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)SwigPyObject_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX >= 0x03000000 - 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ -#else - (cmpfunc)SwigPyObject_compare, /* tp_compare */ -#endif - (reprfunc)SwigPyObject_repr, /* tp_repr */ - &SwigPyObject_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ - 0, /* tp_del */ - 0, /* tp_version_tag */ -#if PY_VERSION_HEX >= 0x03040000 - 0, /* tp_finalize */ -#endif -#ifdef COUNT_ALLOCS - 0, /* tp_allocs */ - 0, /* tp_frees */ - 0, /* tp_maxalloc */ - 0, /* tp_prev */ - 0 /* tp_next */ -#endif - }; - swigpyobject_type = tmp; - type_init = 1; - if (PyType_Ready(&swigpyobject_type) < 0) - return NULL; - } - return &swigpyobject_type; -} - -SWIGRUNTIME PyObject * -SwigPyObject_New(void *ptr, swig_type_info *ty, int own) -{ - SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); - if (sobj) { - sobj->ptr = ptr; - sobj->ty = ty; - sobj->own = own; - sobj->next = 0; - } - return (PyObject *)sobj; -} - -/* ----------------------------------------------------------------------------- - * Implements a simple Swig Packed type, and use it instead of string - * ----------------------------------------------------------------------------- */ - -typedef struct { - PyObject_HEAD - void *pack; - swig_type_info *ty; - size_t size; -} SwigPyPacked; - -SWIGRUNTIME PyObject * -SwigPyPacked_repr(SwigPyPacked *v) -{ - char result[SWIG_BUFFER_SIZE]; - if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { - return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name); - } else { - return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name); - } -} - -SWIGRUNTIME PyObject * -SwigPyPacked_str(SwigPyPacked *v) -{ - char result[SWIG_BUFFER_SIZE]; - if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ - return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); - } else { - return SWIG_Python_str_FromChar(v->ty->name); - } -} - -SWIGRUNTIME int -SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) -{ - size_t i = v->size; - size_t j = w->size; - int s = (i < j) ? -1 : ((i > j) ? 1 : 0); - return s ? s : strncmp((const char *)v->pack, (const char *)w->pack, 2*v->size); -} - -SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); - -SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { - static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); - return type; -} - -SWIGRUNTIMEINLINE int -SwigPyPacked_Check(PyObject *op) { - return ((op)->ob_type == SwigPyPacked_TypeOnce()) - || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); -} - -SWIGRUNTIME void -SwigPyPacked_dealloc(PyObject *v) -{ - if (SwigPyPacked_Check(v)) { - SwigPyPacked *sobj = (SwigPyPacked *) v; - free(sobj->pack); - } - PyObject_DEL(v); -} - -SWIGRUNTIME PyTypeObject* -SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; - static PyTypeObject swigpypacked_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp = { -#if PY_VERSION_HEX>=0x03000000 - PyVarObject_HEAD_INIT(NULL, 0) -#else - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ -#endif - "SwigPyPacked", /* tp_name */ - sizeof(SwigPyPacked), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 - 0, /* tp_reserved in 3.0.1 */ -#else - (cmpfunc)SwigPyPacked_compare, /* tp_compare */ -#endif - (reprfunc)SwigPyPacked_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)SwigPyPacked_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ - 0, /* tp_del */ - 0, /* tp_version_tag */ -#if PY_VERSION_HEX >= 0x03040000 - 0, /* tp_finalize */ -#endif -#ifdef COUNT_ALLOCS - 0, /* tp_allocs */ - 0, /* tp_frees */ - 0, /* tp_maxalloc */ - 0, /* tp_prev */ - 0 /* tp_next */ -#endif - }; - swigpypacked_type = tmp; - type_init = 1; - if (PyType_Ready(&swigpypacked_type) < 0) - return NULL; - } - return &swigpypacked_type; -} - -SWIGRUNTIME PyObject * -SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) -{ - SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); - if (sobj) { - void *pack = malloc(size); - if (pack) { - memcpy(pack, ptr, size); - sobj->pack = pack; - sobj->ty = ty; - sobj->size = size; - } else { - PyObject_DEL((PyObject *) sobj); - sobj = 0; - } - } - return (PyObject *) sobj; -} - -SWIGRUNTIME swig_type_info * -SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) -{ - if (SwigPyPacked_Check(obj)) { - SwigPyPacked *sobj = (SwigPyPacked *)obj; - if (sobj->size != size) return 0; - memcpy(ptr, sobj->pack, size); - return sobj->ty; - } else { - return 0; - } -} - -/* ----------------------------------------------------------------------------- - * pointers/data manipulation - * ----------------------------------------------------------------------------- */ - -static PyObject *Swig_This_global = NULL; - -SWIGRUNTIME PyObject * -SWIG_This(void) -{ - if (Swig_This_global == NULL) - Swig_This_global = SWIG_Python_str_FromChar("this"); - return Swig_This_global; -} - -/* #define SWIG_PYTHON_SLOW_GETSET_THIS */ - -/* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 -#define SWIG_PYTHON_SLOW_GETSET_THIS -#endif - -SWIGRUNTIME SwigPyObject * -SWIG_Python_GetSwigThis(PyObject *pyobj) -{ - PyObject *obj; - - if (SwigPyObject_Check(pyobj)) - return (SwigPyObject *) pyobj; - -#ifdef SWIGPYTHON_BUILTIN - (void)obj; -# ifdef PyWeakref_CheckProxy - if (PyWeakref_CheckProxy(pyobj)) { - pyobj = PyWeakref_GET_OBJECT(pyobj); - if (pyobj && SwigPyObject_Check(pyobj)) - return (SwigPyObject*) pyobj; - } -# endif - return NULL; -#else - - obj = 0; - -#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) - if (PyInstance_Check(pyobj)) { - obj = _PyInstance_Lookup(pyobj, SWIG_This()); - } else { - PyObject **dictptr = _PyObject_GetDictPtr(pyobj); - if (dictptr != NULL) { - PyObject *dict = *dictptr; - obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; - } else { -#ifdef PyWeakref_CheckProxy - if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); - return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; - } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); - if (obj) { - Py_DECREF(obj); - } else { - if (PyErr_Occurred()) PyErr_Clear(); - return 0; - } - } - } -#else - obj = PyObject_GetAttr(pyobj,SWIG_This()); - if (obj) { - Py_DECREF(obj); - } else { - if (PyErr_Occurred()) PyErr_Clear(); - return 0; - } -#endif - if (obj && !SwigPyObject_Check(obj)) { - /* a PyObject is called 'this', try to get the 'real this' - SwigPyObject from it */ - return SWIG_Python_GetSwigThis(obj); - } - return (SwigPyObject *)obj; -#endif -} - -/* Acquire a pointer value */ - -SWIGRUNTIME int -SWIG_Python_AcquirePtr(PyObject *obj, int own) { - if (own == SWIG_POINTER_OWN) { - SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); - if (sobj) { - int oldown = sobj->own; - sobj->own = own; - return oldown; - } - } - return 0; -} - -/* Convert a pointer value */ - -SWIGRUNTIME int -SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { - int res; - SwigPyObject *sobj; - int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0; - - if (!obj) - return SWIG_ERROR; - if (obj == Py_None && !implicit_conv) { - if (ptr) - *ptr = 0; - return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; - } - - res = SWIG_ERROR; - - sobj = SWIG_Python_GetSwigThis(obj); - if (own) - *own = 0; - while (sobj) { - void *vptr = sobj->ptr; - if (ty) { - swig_type_info *to = sobj->ty; - if (to == ty) { - /* no type cast needed */ - if (ptr) *ptr = vptr; - break; - } else { - swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); - if (!tc) { - sobj = (SwigPyObject *)sobj->next; - } else { - if (ptr) { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,vptr,&newmemory); - if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ - if (own) - *own = *own | SWIG_CAST_NEW_MEMORY; - } - } - break; - } - } - } else { - if (ptr) *ptr = vptr; - break; - } - } - if (sobj) { - if (own) - *own = *own | sobj->own; - if (flags & SWIG_POINTER_DISOWN) { - sobj->own = 0; - } - res = SWIG_OK; - } else { - if (implicit_conv) { - SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; - if (data && !data->implicitconv) { - PyObject *klass = data->klass; - if (klass) { - PyObject *impconv; - data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ - impconv = SWIG_Python_CallFunctor(klass, obj); - data->implicitconv = 0; - if (PyErr_Occurred()) { - PyErr_Clear(); - impconv = 0; - } - if (impconv) { - SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); - if (iobj) { - void *vptr; - res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); - if (SWIG_IsOK(res)) { - if (ptr) { - *ptr = vptr; - /* transfer the ownership to 'ptr' */ - iobj->own = 0; - res = SWIG_AddCast(res); - res = SWIG_AddNewMask(res); - } else { - res = SWIG_AddCast(res); - } - } - } - Py_DECREF(impconv); - } - } - } - if (!SWIG_IsOK(res) && obj == Py_None) { - if (ptr) - *ptr = 0; - if (PyErr_Occurred()) - PyErr_Clear(); - res = SWIG_OK; - } - } - } - return res; -} - -/* Convert a function ptr value */ - -SWIGRUNTIME int -SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { - if (!PyCFunction_Check(obj)) { - return SWIG_ConvertPtr(obj, ptr, ty, 0); - } else { - void *vptr = 0; - swig_cast_info *tc; - - /* here we get the method pointer for callbacks */ - const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); - const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; - if (desc) - desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; - if (!desc) - return SWIG_ERROR; - tc = SWIG_TypeCheck(desc,ty); - if (tc) { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,vptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - } else { - return SWIG_ERROR; - } - return SWIG_OK; - } -} - -/* Convert a packed pointer value */ - -SWIGRUNTIME int -SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { - swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); - if (!to) return SWIG_ERROR; - if (ty) { - if (to != ty) { - /* check type cast? */ - swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); - if (!tc) return SWIG_ERROR; - } - } - return SWIG_OK; -} - -/* ----------------------------------------------------------------------------- - * Create a new pointer object - * ----------------------------------------------------------------------------- */ - -/* - Create a new instance object, without calling __init__, and set the - 'this' attribute. -*/ - -SWIGRUNTIME PyObject* -SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) -{ - PyObject *inst = 0; - PyObject *newraw = data->newraw; - if (newraw) { - inst = PyObject_Call(newraw, data->newargs, NULL); - if (inst) { -#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) - PyObject **dictptr = _PyObject_GetDictPtr(inst); - if (dictptr != NULL) { - PyObject *dict = *dictptr; - if (dict == NULL) { - dict = PyDict_New(); - *dictptr = dict; - PyDict_SetItem(dict, SWIG_This(), swig_this); - } - } -#else - PyObject *key = SWIG_This(); - PyObject_SetAttr(inst, key, swig_this); -#endif - } - } else { -#if PY_VERSION_HEX >= 0x03000000 - PyObject *empty_args = PyTuple_New(0); - if (empty_args) { - PyObject *empty_kwargs = PyDict_New(); - if (empty_kwargs) { - inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, empty_kwargs); - Py_DECREF(empty_kwargs); - if (inst) { - PyObject_SetAttr(inst, SWIG_This(), swig_this); - Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; - } - } - Py_DECREF(empty_args); - } -#else - PyObject *dict = PyDict_New(); - if (dict) { - PyDict_SetItem(dict, SWIG_This(), swig_this); - inst = PyInstance_NewRaw(data->newargs, dict); - Py_DECREF(dict); - } -#endif - } - return inst; -} - -SWIGRUNTIME void -SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) -{ - PyObject *dict; -#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) - PyObject **dictptr = _PyObject_GetDictPtr(inst); - if (dictptr != NULL) { - dict = *dictptr; - if (dict == NULL) { - dict = PyDict_New(); - *dictptr = dict; - } - PyDict_SetItem(dict, SWIG_This(), swig_this); - return; - } -#endif - dict = PyObject_GetAttrString(inst, "__dict__"); - PyDict_SetItem(dict, SWIG_This(), swig_this); - Py_DECREF(dict); -} - - -SWIGINTERN PyObject * -SWIG_Python_InitShadowInstance(PyObject *args) { - PyObject *obj[2]; - if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) { - return NULL; - } else { - SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); - if (sthis) { - SwigPyObject_append((PyObject*) sthis, obj[1]); - } else { - SWIG_Python_SetSwigThis(obj[0], obj[1]); - } - return SWIG_Py_Void(); - } -} - -/* Create a new pointer object */ - -SWIGRUNTIME PyObject * -SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) { - SwigPyClientData *clientdata; - PyObject * robj; - int own; - - if (!ptr) - return SWIG_Py_Void(); - - clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; - own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; - if (clientdata && clientdata->pytype) { - SwigPyObject *newobj; - if (flags & SWIG_BUILTIN_TP_INIT) { - newobj = (SwigPyObject*) self; - if (newobj->ptr) { - PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0); - while (newobj->next) - newobj = (SwigPyObject *) newobj->next; - newobj->next = next_self; - newobj = (SwigPyObject *)next_self; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif - } - } else { - newobj = PyObject_New(SwigPyObject, clientdata->pytype); -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif - } - if (newobj) { - newobj->ptr = ptr; - newobj->ty = type; - newobj->own = own; - newobj->next = 0; - return (PyObject*) newobj; - } - return SWIG_Py_Void(); - } - - assert(!(flags & SWIG_BUILTIN_TP_INIT)); - - robj = SwigPyObject_New(ptr, type, own); - if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { - PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); - Py_DECREF(robj); - robj = inst; - } - return robj; -} - -/* Create a new packed object */ - -SWIGRUNTIMEINLINE PyObject * -SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { - return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); -} - -/* -----------------------------------------------------------------------------* - * Get type list - * -----------------------------------------------------------------------------*/ - -#ifdef SWIG_LINK_RUNTIME -void *SWIG_ReturnGlobalTypeList(void *); -#endif - -SWIGRUNTIME swig_module_info * -SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { - static void *type_pointer = (void *)0; - /* first check if module already created */ - if (!type_pointer) { -#ifdef SWIG_LINK_RUNTIME - type_pointer = SWIG_ReturnGlobalTypeList((void *)0); -#else - type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); - if (PyErr_Occurred()) { - PyErr_Clear(); - type_pointer = (void *)0; - } -#endif - } - return (swig_module_info *) type_pointer; -} - -SWIGRUNTIME void -SWIG_Python_DestroyModule(PyObject *obj) -{ - swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); - swig_type_info **types = swig_module->types; - size_t i; - for (i =0; i < swig_module->size; ++i) { - swig_type_info *ty = types[i]; - if (ty->owndata) { - SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; - if (data) SwigPyClientData_Del(data); - } - } - Py_DECREF(SWIG_This()); - Swig_This_global = NULL; -} - -SWIGRUNTIME void -SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif - PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - PyModule_AddObject(module, "type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); - } else { - Py_XDECREF(pointer); - } -} - -/* The python cached type query */ -SWIGRUNTIME PyObject * -SWIG_Python_TypeCache(void) { - static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); - return cache; -} - -SWIGRUNTIME swig_type_info * -SWIG_Python_TypeQuery(const char *type) -{ - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); - swig_type_info *descriptor; - if (obj) { - descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); - } else { - swig_module_info *swig_module = SWIG_GetModule(0); - descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); - if (descriptor) { - obj = PyCapsule_New((void*) descriptor, NULL, NULL); - PyDict_SetItem(cache, key, obj); - Py_DECREF(obj); - } - } - Py_DECREF(key); - return descriptor; -} - -/* - For backward compatibility only -*/ -#define SWIG_POINTER_EXCEPTION 0 -#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) -#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) - -SWIGRUNTIME int -SWIG_Python_AddErrMesg(const char* mesg, int infront) -{ - if (PyErr_Occurred()) { - PyObject *type = 0; - PyObject *value = 0; - PyObject *traceback = 0; - PyErr_Fetch(&type, &value, &traceback); - if (value) { - PyObject *old_str = PyObject_Str(value); - const char *tmp = SWIG_Python_str_AsChar(old_str); - const char *errmesg = tmp ? tmp : "Invalid error message"; - Py_XINCREF(type); - PyErr_Clear(); - if (infront) { - PyErr_Format(type, "%s %s", mesg, errmesg); - } else { - PyErr_Format(type, "%s %s", errmesg, mesg); - } - SWIG_Python_str_DelForPy3(tmp); - Py_DECREF(old_str); - } - return 1; - } else { - return 0; - } -} - -SWIGRUNTIME int -SWIG_Python_ArgFail(int argnum) -{ - if (PyErr_Occurred()) { - /* add information about failing argument */ - char mesg[256]; - PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); - return SWIG_Python_AddErrMesg(mesg, 1); - } else { - return 0; - } -} - -SWIGRUNTIMEINLINE const char * -SwigPyObject_GetDesc(PyObject *self) -{ - SwigPyObject *v = (SwigPyObject *)self; - swig_type_info *ty = v ? v->ty : 0; - return ty ? ty->str : ""; -} - -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - SWIG_Python_str_DelForPy3(cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - Py_XDECREF(str); - return; - } - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - -/* Convert a pointer value, signal an exception on a type mismatch */ -SWIGRUNTIME void * -SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { - void *result; - if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { - PyErr_Clear(); -#if SWIG_POINTER_EXCEPTION - if (flags) { - SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); - SWIG_Python_ArgFail(argnum); - } -#endif - } - return result; -} - -#ifdef SWIGPYTHON_BUILTIN -SWIGRUNTIME int -SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; - PyObject *descr; - PyObject *encoded_name; - descrsetfunc f; - int res = -1; - -# ifdef Py_USING_UNICODE - if (PyString_Check(name)) { - name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL); - if (!name) - return -1; - } else if (!PyUnicode_Check(name)) -# else - if (!PyString_Check(name)) -# endif - { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); - return -1; - } else { - Py_INCREF(name); - } - - if (!tp->tp_dict) { - if (PyType_Ready(tp) < 0) - goto done; - } - - descr = _PyType_Lookup(tp, name); - f = NULL; - if (descr != NULL) - f = descr->ob_type->tp_descr_set; - if (!f) { - if (PyString_Check(name)) { - encoded_name = name; - Py_INCREF(name); - } else { - encoded_name = PyUnicode_AsUTF8String(name); - if (!encoded_name) - return -1; - } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); - Py_DECREF(encoded_name); - } else { - res = f(descr, obj, value); - } - - done: - Py_DECREF(name); - return res; -} -#endif - - -#ifdef __cplusplus -} -#endif - - - -#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) - -#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else - - - -#ifdef __cplusplus -extern "C" { -#endif - -/* Method creation and docstring support functions */ - -SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name); -SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func); -SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func); - -#ifdef __cplusplus -} -#endif - - -/* -------- TYPES TABLE (BEGIN) -------- */ - -#define SWIGTYPE_p_CdiGribIterator swig_types[0] -#define SWIGTYPE_p_CdiIterator swig_types[1] -#define SWIGTYPE_p_CdiParam swig_types[2] -#define SWIGTYPE_p_FILE swig_types[3] -#define SWIGTYPE_p_a_10__int swig_types[4] -#define SWIGTYPE_p_a_2__int swig_types[5] -#define SWIGTYPE_p_char swig_types[6] -#define SWIGTYPE_p_double swig_types[7] -#define SWIGTYPE_p_float swig_types[8] -#define SWIGTYPE_p_int swig_types[9] -#define SWIGTYPE_p_int64_t swig_types[10] -#define SWIGTYPE_p_long swig_types[11] -#define SWIGTYPE_p_off_t swig_types[12] -#define SWIGTYPE_p_p_char swig_types[13] -#define SWIGTYPE_p_p_p_char swig_types[14] -#define SWIGTYPE_p_size_t swig_types[15] -#define SWIGTYPE_p_subtype_query_t swig_types[16] -#define SWIGTYPE_p_unsigned_char swig_types[17] -static swig_type_info *swig_types[19]; -static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0}; -#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) -#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) - -/* -------- TYPES TABLE (END) -------- */ - -#ifdef SWIG_TypeQuery -# undef SWIG_TypeQuery -#endif -#define SWIG_TypeQuery SWIG_Python_TypeQuery - -/*----------------------------------------------- - @(target):= _CdiLib.so - ------------------------------------------------*/ -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_init PyInit__CdiLib - -#else -# define SWIG_init init_CdiLib - -#endif -#define SWIG_name "_CdiLib" - -#define SWIGVERSION 0x040000 -#define SWIG_VERSION SWIGVERSION - - -#define SWIG_as_voidptr(a) (void *)((const void *)(a)) -#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) - - -#include "cdi.h" - - -SWIGINTERNINLINE PyObject* - SWIG_From_int (int value) -{ - return PyInt_FromLong((long) value); -} - - -#include <limits.h> -#if !defined(SWIG_NO_LLONG_MAX) -# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) -# define LLONG_MAX __LONG_LONG_MAX__ -# define LLONG_MIN (-LLONG_MAX - 1LL) -# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) -# endif -#endif - - -SWIGINTERN int -SWIG_AsVal_double (PyObject *obj, double *val) -{ - int res = SWIG_TypeError; - if (PyFloat_Check(obj)) { - if (val) *val = PyFloat_AsDouble(obj); - return SWIG_OK; -#if PY_VERSION_HEX < 0x03000000 - } else if (PyInt_Check(obj)) { - if (val) *val = (double) PyInt_AsLong(obj); - return SWIG_OK; -#endif - } else if (PyLong_Check(obj)) { - double v = PyLong_AsDouble(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - double d = PyFloat_AsDouble(obj); - if (!PyErr_Occurred()) { - if (val) *val = d; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); - } else { - PyErr_Clear(); - } - } - } -#endif - return res; -} - - -#include <float.h> - - -#include <math.h> - - -SWIGINTERNINLINE int -SWIG_CanCastAsInteger(double *d, double min, double max) { - double x = *d; - if ((min <= x && x <= max)) { - double fx = floor(x); - double cx = ceil(x); - double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ - if ((errno == EDOM) || (errno == ERANGE)) { - errno = 0; - } else { - double summ, reps, diff; - if (rd < x) { - diff = x - rd; - } else if (rd > x) { - diff = rd - x; - } else { - return 1; - } - summ = rd + x; - reps = diff/summ; - if (reps < 8*DBL_EPSILON) { - *d = rd; - return 1; - } - } - } - return 0; -} - - -SWIGINTERN int -SWIG_AsVal_long (PyObject *obj, long* val) -{ -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); - return SWIG_OK; - } else -#endif - if (PyLong_Check(obj)) { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - return SWIG_OverflowError; - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - long v = PyInt_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - double d; - int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { - if (val) *val = (long)(d); - return res; - } - } - } -#endif - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsVal_int (PyObject * obj, int *val) -{ - long v; - int res = SWIG_AsVal_long (obj, &v); - if (SWIG_IsOK(res)) { - if ((v < INT_MIN || v > INT_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = (int)(v); - } - } - return res; -} - - -SWIGINTERN swig_type_info* -SWIG_pchar_descriptor(void) -{ - static int init = 0; - static swig_type_info* info = 0; - if (!init) { - info = SWIG_TypeQuery("_p_char"); - init = 1; - } - return info; -} - - -SWIGINTERNINLINE PyObject * -SWIG_FromCharPtrAndSize(const char* carray, size_t size) -{ - if (carray) { - if (size > INT_MAX) { - swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - return pchar_descriptor ? - SWIG_InternalNewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void(); - } else { -#if PY_VERSION_HEX >= 0x03000000 -#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - return PyBytes_FromStringAndSize(carray, (Py_ssize_t)(size)); -#else - return PyUnicode_DecodeUTF8(carray, (Py_ssize_t)(size), "surrogateescape"); -#endif -#else - return PyString_FromStringAndSize(carray, (Py_ssize_t)(size)); -#endif - } - } else { - return SWIG_Py_Void(); - } -} - - -SWIGINTERNINLINE PyObject * -SWIG_FromCharPtr(const char *cptr) -{ - return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); -} - - - #define SWIG_From_double PyFloat_FromDouble - - -SWIGINTERN int -SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) -{ -#if PY_VERSION_HEX>=0x03000000 -#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - if (PyBytes_Check(obj)) -#else - if (PyUnicode_Check(obj)) -#endif -#else - if (PyString_Check(obj)) -#endif - { - char *cstr; Py_ssize_t len; - int ret = SWIG_OK; -#if PY_VERSION_HEX>=0x03000000 -#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - if (!alloc && cptr) { - /* We can't allow converting without allocation, since the internal - representation of string in Python 3 is UCS-2/UCS-4 but we require - a UTF-8 representation. - TODO(bhy) More detailed explanation */ - return SWIG_RuntimeError; - } - obj = PyUnicode_AsUTF8String(obj); - if (!obj) - return SWIG_TypeError; - if (alloc) - *alloc = SWIG_NEWOBJ; -#endif - PyBytes_AsStringAndSize(obj, &cstr, &len); -#else - PyString_AsStringAndSize(obj, &cstr, &len); -#endif - if (cptr) { - if (alloc) { - if (*alloc == SWIG_NEWOBJ) { - *cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1)); - *alloc = SWIG_NEWOBJ; - } else { - *cptr = cstr; - *alloc = SWIG_OLDOBJ; - } - } else { -#if PY_VERSION_HEX>=0x03000000 -#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - *cptr = PyBytes_AsString(obj); -#else - assert(0); /* Should never reach here with Unicode strings in Python 3 */ -#endif -#else - *cptr = SWIG_Python_str_AsChar(obj); - if (!*cptr) - ret = SWIG_TypeError; -#endif - } - } - if (psize) *psize = len + 1; -#if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - Py_XDECREF(obj); -#endif - return ret; - } else { -#if defined(SWIG_PYTHON_2_UNICODE) -#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) -#error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" -#endif -#if PY_VERSION_HEX<0x03000000 - if (PyUnicode_Check(obj)) { - char *cstr; Py_ssize_t len; - if (!alloc && cptr) { - return SWIG_RuntimeError; - } - obj = PyUnicode_AsUTF8String(obj); - if (!obj) - return SWIG_TypeError; - if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) { - if (cptr) { - if (alloc) *alloc = SWIG_NEWOBJ; - *cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1)); - } - if (psize) *psize = len + 1; - - Py_XDECREF(obj); - return SWIG_OK; - } else { - Py_XDECREF(obj); - } - } -#endif -#endif - - swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - if (pchar_descriptor) { - void* vptr = 0; - if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { - if (cptr) *cptr = (char *) vptr; - if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; - if (alloc) *alloc = SWIG_OLDOBJ; - return SWIG_OK; - } - } - } - return SWIG_TypeError; -} - - - - - - #define SWIG_From_long PyInt_FromLong - - -SWIGINTERNINLINE PyObject* -SWIG_From_unsigned_SS_long (unsigned long value) -{ - return (value > LONG_MAX) ? - PyLong_FromUnsignedLong(value) : PyInt_FromLong((long)(value)); -} - - -#if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE) -# define SWIG_LONG_LONG_AVAILABLE -#endif - - -#ifdef SWIG_LONG_LONG_AVAILABLE -SWIGINTERNINLINE PyObject* -SWIG_From_unsigned_SS_long_SS_long (unsigned long long value) -{ - return (value > LONG_MAX) ? - PyLong_FromUnsignedLongLong(value) : PyInt_FromLong((long)(value)); -} -#endif - - -SWIGINTERNINLINE PyObject * -SWIG_From_size_t (size_t value) -{ -#ifdef SWIG_LONG_LONG_AVAILABLE - if (sizeof(size_t) <= sizeof(unsigned long)) { -#endif - return SWIG_From_unsigned_SS_long ((unsigned long)(value)); -#ifdef SWIG_LONG_LONG_AVAILABLE - } else { - /* assume sizeof(size_t) <= sizeof(unsigned long long) */ - return SWIG_From_unsigned_SS_long_SS_long ((unsigned long long)(value)); - } -#endif -} - - -SWIGINTERN int -SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) -{ -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(obj)) { - long v = PyInt_AsLong(obj); - if (v >= 0) { - if (val) *val = v; - return SWIG_OK; - } else { - return SWIG_OverflowError; - } - } else -#endif - if (PyLong_Check(obj)) { - unsigned long v = PyLong_AsUnsignedLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - return SWIG_OverflowError; - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - unsigned long v = PyLong_AsUnsignedLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - double d; - int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) { - if (val) *val = (unsigned long)(d); - return res; - } - } - } -#endif - return SWIG_TypeError; -} - - -#ifdef SWIG_LONG_LONG_AVAILABLE -SWIGINTERN int -SWIG_AsVal_unsigned_SS_long_SS_long (PyObject *obj, unsigned long long *val) -{ - int res = SWIG_TypeError; - if (PyLong_Check(obj)) { - unsigned long long v = PyLong_AsUnsignedLongLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - res = SWIG_OverflowError; - } - } else { - unsigned long v; - res = SWIG_AsVal_unsigned_SS_long (obj,&v); - if (SWIG_IsOK(res)) { - if (val) *val = v; - return res; - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - const double mant_max = 1LL << DBL_MANT_DIG; - double d; - res = SWIG_AsVal_double (obj,&d); - if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, 0, mant_max)) - return SWIG_OverflowError; - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) { - if (val) *val = (unsigned long long)(d); - return SWIG_AddCast(res); - } - res = SWIG_TypeError; - } -#endif - return res; -} -#endif - - -SWIGINTERNINLINE int -SWIG_AsVal_size_t (PyObject * obj, size_t *val) -{ - int res = SWIG_TypeError; -#ifdef SWIG_LONG_LONG_AVAILABLE - if (sizeof(size_t) <= sizeof(unsigned long)) { -#endif - unsigned long v; - res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = (size_t)(v); -#ifdef SWIG_LONG_LONG_AVAILABLE - } else if (sizeof(size_t) <= sizeof(unsigned long long)) { - unsigned long long v; - res = SWIG_AsVal_unsigned_SS_long_SS_long (obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = (size_t)(v); - } -#endif - return res; -} - -#ifdef __cplusplus -extern "C" { -#endif -SWIGINTERN PyObject *_wrap_subtype_query_t_nAND_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - subtype_query_t *arg1 = (subtype_query_t *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "subtype_query_t_nAND_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_subtype_query_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "subtype_query_t_nAND_set" "', argument " "1"" of type '" "subtype_query_t *""'"); - } - arg1 = (subtype_query_t *)(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "subtype_query_t_nAND_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - if (arg1) (arg1)->nAND = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_subtype_query_t_nAND_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - subtype_query_t *arg1 = (subtype_query_t *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_subtype_query_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "subtype_query_t_nAND_get" "', argument " "1"" of type '" "subtype_query_t *""'"); - } - arg1 = (subtype_query_t *)(argp1); - result = (int) ((arg1)->nAND); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_subtype_query_t_key_value_pairs_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - subtype_query_t *arg1 = (subtype_query_t *) 0 ; - int (*arg2)[10] ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "subtype_query_t_key_value_pairs_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_subtype_query_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "subtype_query_t_key_value_pairs_set" "', argument " "1"" of type '" "subtype_query_t *""'"); - } - arg1 = (subtype_query_t *)(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_a_10__int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "subtype_query_t_key_value_pairs_set" "', argument " "2"" of type '" "int [2][10]""'"); - } - arg2 = (int (*)[10])(argp2); - { - if (arg2) { - size_t ii = 0; - for (; ii < (size_t)2; ++ii) { - if (arg2[ii]) { - size_t jj = 0; - for (; jj < (size_t)10; ++jj) arg1->key_value_pairs[ii][jj] = arg2[ii][jj]; - } else { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""key_value_pairs""' of type '""int [2][10]""'"); - } - } - } else { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""key_value_pairs""' of type '""int [2][10]""'"); - } - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_subtype_query_t_key_value_pairs_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - subtype_query_t *arg1 = (subtype_query_t *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int (*result)[10] = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_subtype_query_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "subtype_query_t_key_value_pairs_get" "', argument " "1"" of type '" "subtype_query_t *""'"); - } - arg1 = (subtype_query_t *)(argp1); - result = (int (*)[10])(int (*)[10]) ((arg1)->key_value_pairs); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_a_10__int, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_subtype_query_t(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - subtype_query_t *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "new_subtype_query_t", 0, 0, 0)) SWIG_fail; - result = (subtype_query_t *)calloc(1, sizeof(subtype_query_t)); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_subtype_query_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_subtype_query_t(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - subtype_query_t *arg1 = (subtype_query_t *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_subtype_query_t, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_subtype_query_t" "', argument " "1"" of type '" "subtype_query_t *""'"); - } - arg1 = (subtype_query_t *)(argp1); - free((char *) arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *subtype_query_t_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_subtype_query_t, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *subtype_query_t_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_CdiParam_discipline_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - struct CdiParam *arg1 = (struct CdiParam *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiParam_discipline_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiParam, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiParam_discipline_set" "', argument " "1"" of type '" "struct CdiParam *""'"); - } - arg1 = (struct CdiParam *)(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiParam_discipline_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - if (arg1) (arg1)->discipline = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiParam_discipline_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - struct CdiParam *arg1 = (struct CdiParam *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiParam, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiParam_discipline_get" "', argument " "1"" of type '" "struct CdiParam *""'"); - } - arg1 = (struct CdiParam *)(argp1); - result = (int) ((arg1)->discipline); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiParam_category_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - struct CdiParam *arg1 = (struct CdiParam *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiParam_category_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiParam, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiParam_category_set" "', argument " "1"" of type '" "struct CdiParam *""'"); - } - arg1 = (struct CdiParam *)(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiParam_category_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - if (arg1) (arg1)->category = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiParam_category_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - struct CdiParam *arg1 = (struct CdiParam *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiParam, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiParam_category_get" "', argument " "1"" of type '" "struct CdiParam *""'"); - } - arg1 = (struct CdiParam *)(argp1); - result = (int) ((arg1)->category); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiParam_number_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - struct CdiParam *arg1 = (struct CdiParam *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiParam_number_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiParam, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiParam_number_set" "', argument " "1"" of type '" "struct CdiParam *""'"); - } - arg1 = (struct CdiParam *)(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiParam_number_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - if (arg1) (arg1)->number = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiParam_number_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - struct CdiParam *arg1 = (struct CdiParam *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiParam, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiParam_number_get" "', argument " "1"" of type '" "struct CdiParam *""'"); - } - arg1 = (struct CdiParam *)(argp1); - result = (int) ((arg1)->number); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_CdiParam(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - struct CdiParam *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "new_CdiParam", 0, 0, 0)) SWIG_fail; - result = (struct CdiParam *)calloc(1, sizeof(struct CdiParam)); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiParam, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_CdiParam(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - struct CdiParam *arg1 = (struct CdiParam *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiParam, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CdiParam" "', argument " "1"" of type '" "struct CdiParam *""'"); - } - arg1 = (struct CdiParam *)(argp1); - free((char *) arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *CdiParam_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_CdiParam, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *CdiParam_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_cdiReset(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - - if (!SWIG_Python_UnpackTuple(args, "cdiReset", 0, 0, 0)) SWIG_fail; - cdiReset(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiStringError(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiStringError" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (char *)cdiStringError(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiDebug(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiDebug" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - cdiDebug(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiLibraryVersion(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "cdiLibraryVersion", 0, 0, 0)) SWIG_fail; - result = (char *)cdiLibraryVersion(); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiPrintVersion(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - - if (!SWIG_Python_UnpackTuple(args, "cdiPrintVersion", 0, 0, 0)) SWIG_fail; - cdiPrintVersion(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiHaveFiletype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiHaveFiletype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)cdiHaveFiletype(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiDefMissval(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - double arg1 ; - double val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_double(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiDefMissval" "', argument " "1"" of type '" "double""'"); - } - arg1 = (double)(val1); - cdiDefMissval(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiInqMissval(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - double result; - - if (!SWIG_Python_UnpackTuple(args, "cdiInqMissval", 0, 0, 0)) SWIG_fail; - result = (double)cdiInqMissval(); - resultobj = SWIG_From_double((double)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiInqGridMissval(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - double result; - - if (!SWIG_Python_UnpackTuple(args, "cdiInqGridMissval", 0, 0, 0)) SWIG_fail; - result = (double)cdiInqGridMissval(); - resultobj = SWIG_From_double((double)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiDefGlobal(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int arg2 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "cdiDefGlobal", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiDefGlobal" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = (char *)(buf1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiDefGlobal" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - cdiDefGlobal((char const *)arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_namespaceNew(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int result; - - if (!SWIG_Python_UnpackTuple(args, "namespaceNew", 0, 0, 0)) SWIG_fail; - result = (int)namespaceNew(); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_namespaceSetActive(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "namespaceSetActive" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - namespaceSetActive(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_namespaceGetActive(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int result; - - if (!SWIG_Python_UnpackTuple(args, "namespaceGetActive", 0, 0, 0)) SWIG_fail; - result = (int)namespaceGetActive(); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_namespaceDelete(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "namespaceDelete" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - namespaceDelete(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiParamToString(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "cdiParamToString", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiParamToString" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiParamToString" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiParamToString" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - cdiParamToString(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiDecodeParam(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int *arg2 = (int *) 0 ; - int *arg3 = (int *) 0 ; - int *arg4 = (int *) 0 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "cdiDecodeParam", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiDecodeParam" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiDecodeParam" "', argument " "2"" of type '" "int *""'"); - } - arg2 = (int *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiDecodeParam" "', argument " "3"" of type '" "int *""'"); - } - arg3 = (int *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiDecodeParam" "', argument " "4"" of type '" "int *""'"); - } - arg4 = (int *)(argp4); - cdiDecodeParam(arg1,arg2,arg3,arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiEncodeParam(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiEncodeParam", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiEncodeParam" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiEncodeParam" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiEncodeParam" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = (int)cdiEncodeParam(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiDecodeDate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int64_t arg1 ; - int *arg2 = (int *) 0 ; - int *arg3 = (int *) 0 ; - int *arg4 = (int *) 0 ; - void *argp1 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "cdiDecodeDate", 4, 4, swig_obj)) SWIG_fail; - { - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_int64_t, 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiDecodeDate" "', argument " "1"" of type '" "int64_t""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "cdiDecodeDate" "', argument " "1"" of type '" "int64_t""'"); - } else { - arg1 = *((int64_t *)(argp1)); - } - } - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiDecodeDate" "', argument " "2"" of type '" "int *""'"); - } - arg2 = (int *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiDecodeDate" "', argument " "3"" of type '" "int *""'"); - } - arg3 = (int *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiDecodeDate" "', argument " "4"" of type '" "int *""'"); - } - arg4 = (int *)(argp4); - cdiDecodeDate(arg1,arg2,arg3,arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiEncodeDate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - int64_t result; - - if (!SWIG_Python_UnpackTuple(args, "cdiEncodeDate", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiEncodeDate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiEncodeDate" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiEncodeDate" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = cdiEncodeDate(arg1,arg2,arg3); - resultobj = SWIG_NewPointerObj((int64_t *)memcpy((int64_t *)calloc(1,sizeof(int64_t)),&result,sizeof(int64_t)), SWIGTYPE_p_int64_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiDecodeTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int *arg2 = (int *) 0 ; - int *arg3 = (int *) 0 ; - int *arg4 = (int *) 0 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "cdiDecodeTime", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiDecodeTime" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiDecodeTime" "', argument " "2"" of type '" "int *""'"); - } - arg2 = (int *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiDecodeTime" "', argument " "3"" of type '" "int *""'"); - } - arg3 = (int *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiDecodeTime" "', argument " "4"" of type '" "int *""'"); - } - arg4 = (int *)(argp4); - cdiDecodeTime(arg1,arg2,arg3,arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiEncodeTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiEncodeTime", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiEncodeTime" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiEncodeTime" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiEncodeTime" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = (int)cdiEncodeTime(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGetFiletype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int *arg2 = (int *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiGetFiletype", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGetFiletype" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = (char *)(buf1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiGetFiletype" "', argument " "2"" of type '" "int *""'"); - } - arg2 = (int *)(argp2); - result = (int)cdiGetFiletype((char const *)arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamOpenRead(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "streamOpenRead" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = (char *)(buf1); - result = (int)streamOpenRead((char const *)arg1); - resultobj = SWIG_From_int((int)(result)); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamOpenWrite(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int arg2 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "streamOpenWrite", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "streamOpenWrite" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = (char *)(buf1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamOpenWrite" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)streamOpenWrite((char const *)arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamOpenAppend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "streamOpenAppend" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = (char *)(buf1); - result = (int)streamOpenAppend((char const *)arg1); - resultobj = SWIG_From_int((int)(result)); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamClose(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamClose" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - streamClose(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamSync(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamSync" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - streamSync(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamDefNumWorker(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "streamDefNumWorker", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamDefNumWorker" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamDefNumWorker" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - streamDefNumWorker(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamDefVlist(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "streamDefVlist", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamDefVlist" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamDefVlist" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - streamDefVlist(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamInqVlist(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamInqVlist" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)streamInqVlist(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamInqFiletype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamInqFiletype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)streamInqFiletype(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamDefByteorder(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "streamDefByteorder", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamDefByteorder" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamDefByteorder" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - streamDefByteorder(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamInqByteorder(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamInqByteorder" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)streamInqByteorder(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamDefCompType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "streamDefCompType", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamDefCompType" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamDefCompType" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - streamDefCompType(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamInqCompType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamInqCompType" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)streamInqCompType(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamDefCompLevel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "streamDefCompLevel", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamDefCompLevel" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamDefCompLevel" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - streamDefCompLevel(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamInqCompLevel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamInqCompLevel" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)streamInqCompLevel(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamDefTimestep(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "streamDefTimestep", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamDefTimestep" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamDefTimestep" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)streamDefTimestep(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamInqTimestep(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "streamInqTimestep", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamInqTimestep" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamInqTimestep" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)streamInqTimestep(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamInqCurTimestepID(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamInqCurTimestepID" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)streamInqCurTimestepID(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamFilename(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamFilename" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (char *)streamFilename(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamFilesuffix(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamFilesuffix" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (char *)streamFilesuffix(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamNvals(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - size_t result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamNvals" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = streamNvals(arg1); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamInqNvars(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamInqNvars" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)streamInqNvars(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamWriteVar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - double *arg3 ; - size_t arg4 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - size_t val4 ; - int ecode4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "streamWriteVar", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamWriteVar" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamWriteVar" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "streamWriteVar" "', argument " "3"" of type '" "double const []""'"); - } - arg3 = (double *)(argp3); - ecode4 = SWIG_AsVal_size_t(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "streamWriteVar" "', argument " "4"" of type '" "size_t""'"); - } - arg4 = (size_t)(val4); - streamWriteVar(arg1,arg2,(double const (*))arg3,arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamWriteVarF(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - float *arg3 ; - size_t arg4 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - size_t val4 ; - int ecode4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "streamWriteVarF", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamWriteVarF" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamWriteVarF" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "streamWriteVarF" "', argument " "3"" of type '" "float const []""'"); - } - arg3 = (float *)(argp3); - ecode4 = SWIG_AsVal_size_t(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "streamWriteVarF" "', argument " "4"" of type '" "size_t""'"); - } - arg4 = (size_t)(val4); - streamWriteVarF(arg1,arg2,(float const (*))arg3,arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamReadVar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - double *arg3 ; - size_t *arg4 = (size_t *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "streamReadVar", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamReadVar" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamReadVar" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "streamReadVar" "', argument " "3"" of type '" "double []""'"); - } - arg3 = (double *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_size_t, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "streamReadVar" "', argument " "4"" of type '" "size_t *""'"); - } - arg4 = (size_t *)(argp4); - streamReadVar(arg1,arg2,arg3,arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamReadVarF(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - float *arg3 ; - size_t *arg4 = (size_t *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "streamReadVarF", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamReadVarF" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamReadVarF" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "streamReadVarF" "', argument " "3"" of type '" "float []""'"); - } - arg3 = (float *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_size_t, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "streamReadVarF" "', argument " "4"" of type '" "size_t *""'"); - } - arg4 = (size_t *)(argp4); - streamReadVarF(arg1,arg2,arg3,arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamReadVarPart(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - size_t arg5 ; - void *arg6 = (void *) 0 ; - size_t *arg7 = (size_t *) 0 ; - int arg8 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - size_t val5 ; - int ecode5 = 0 ; - int res6 ; - void *argp7 = 0 ; - int res7 = 0 ; - int val8 ; - int ecode8 = 0 ; - PyObject *swig_obj[8] ; - - if (!SWIG_Python_UnpackTuple(args, "streamReadVarPart", 8, 8, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamReadVarPart" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamReadVarPart" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "streamReadVarPart" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "streamReadVarPart" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_size_t(swig_obj[4], &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "streamReadVarPart" "', argument " "5"" of type '" "size_t""'"); - } - arg5 = (size_t)(val5); - res6 = SWIG_ConvertPtr(swig_obj[5],SWIG_as_voidptrptr(&arg6), 0, 0); - if (!SWIG_IsOK(res6)) { - SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "streamReadVarPart" "', argument " "6"" of type '" "void *""'"); - } - res7 = SWIG_ConvertPtr(swig_obj[6], &argp7,SWIGTYPE_p_size_t, 0 | 0 ); - if (!SWIG_IsOK(res7)) { - SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "streamReadVarPart" "', argument " "7"" of type '" "size_t *""'"); - } - arg7 = (size_t *)(argp7); - ecode8 = SWIG_AsVal_int(swig_obj[7], &val8); - if (!SWIG_IsOK(ecode8)) { - SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "streamReadVarPart" "', argument " "8"" of type '" "int""'"); - } - arg8 = (int)(val8); - streamReadVarPart(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamWriteVarSlice(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - double *arg4 ; - size_t arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - size_t val5 ; - int ecode5 = 0 ; - PyObject *swig_obj[5] ; - - if (!SWIG_Python_UnpackTuple(args, "streamWriteVarSlice", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamWriteVarSlice" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamWriteVarSlice" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "streamWriteVarSlice" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "streamWriteVarSlice" "', argument " "4"" of type '" "double const []""'"); - } - arg4 = (double *)(argp4); - ecode5 = SWIG_AsVal_size_t(swig_obj[4], &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "streamWriteVarSlice" "', argument " "5"" of type '" "size_t""'"); - } - arg5 = (size_t)(val5); - streamWriteVarSlice(arg1,arg2,arg3,(double const (*))arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamWriteVarSliceF(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - float *arg4 ; - size_t arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - size_t val5 ; - int ecode5 = 0 ; - PyObject *swig_obj[5] ; - - if (!SWIG_Python_UnpackTuple(args, "streamWriteVarSliceF", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamWriteVarSliceF" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamWriteVarSliceF" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "streamWriteVarSliceF" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_float, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "streamWriteVarSliceF" "', argument " "4"" of type '" "float const []""'"); - } - arg4 = (float *)(argp4); - ecode5 = SWIG_AsVal_size_t(swig_obj[4], &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "streamWriteVarSliceF" "', argument " "5"" of type '" "size_t""'"); - } - arg5 = (size_t)(val5); - streamWriteVarSliceF(arg1,arg2,arg3,(float const (*))arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamReadVarSlicePart(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int arg5 ; - size_t arg6 ; - void *arg7 = (void *) 0 ; - size_t *arg8 = (size_t *) 0 ; - int arg9 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int val5 ; - int ecode5 = 0 ; - size_t val6 ; - int ecode6 = 0 ; - int res7 ; - void *argp8 = 0 ; - int res8 = 0 ; - int val9 ; - int ecode9 = 0 ; - PyObject *swig_obj[9] ; - - if (!SWIG_Python_UnpackTuple(args, "streamReadVarSlicePart", 9, 9, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamReadVarSlicePart" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamReadVarSlicePart" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "streamReadVarSlicePart" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "streamReadVarSlicePart" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_int(swig_obj[4], &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "streamReadVarSlicePart" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - ecode6 = SWIG_AsVal_size_t(swig_obj[5], &val6); - if (!SWIG_IsOK(ecode6)) { - SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "streamReadVarSlicePart" "', argument " "6"" of type '" "size_t""'"); - } - arg6 = (size_t)(val6); - res7 = SWIG_ConvertPtr(swig_obj[6],SWIG_as_voidptrptr(&arg7), 0, 0); - if (!SWIG_IsOK(res7)) { - SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "streamReadVarSlicePart" "', argument " "7"" of type '" "void *""'"); - } - res8 = SWIG_ConvertPtr(swig_obj[7], &argp8,SWIGTYPE_p_size_t, 0 | 0 ); - if (!SWIG_IsOK(res8)) { - SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "streamReadVarSlicePart" "', argument " "8"" of type '" "size_t *""'"); - } - arg8 = (size_t *)(argp8); - ecode9 = SWIG_AsVal_int(swig_obj[8], &val9); - if (!SWIG_IsOK(ecode9)) { - SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "streamReadVarSlicePart" "', argument " "9"" of type '" "int""'"); - } - arg9 = (int)(val9); - streamReadVarSlicePart(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamReadVarSlice(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - double *arg4 ; - size_t *arg5 = (size_t *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - void *argp5 = 0 ; - int res5 = 0 ; - PyObject *swig_obj[5] ; - - if (!SWIG_Python_UnpackTuple(args, "streamReadVarSlice", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamReadVarSlice" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamReadVarSlice" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "streamReadVarSlice" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "streamReadVarSlice" "', argument " "4"" of type '" "double []""'"); - } - arg4 = (double *)(argp4); - res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_size_t, 0 | 0 ); - if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "streamReadVarSlice" "', argument " "5"" of type '" "size_t *""'"); - } - arg5 = (size_t *)(argp5); - streamReadVarSlice(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamReadVarSliceF(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - float *arg4 ; - size_t *arg5 = (size_t *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - void *argp5 = 0 ; - int res5 = 0 ; - PyObject *swig_obj[5] ; - - if (!SWIG_Python_UnpackTuple(args, "streamReadVarSliceF", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamReadVarSliceF" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamReadVarSliceF" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "streamReadVarSliceF" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_float, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "streamReadVarSliceF" "', argument " "4"" of type '" "float []""'"); - } - arg4 = (float *)(argp4); - res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_size_t, 0 | 0 ); - if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "streamReadVarSliceF" "', argument " "5"" of type '" "size_t *""'"); - } - arg5 = (size_t *)(argp5); - streamReadVarSliceF(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamWriteVarChunk(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int (*arg3)[2] ; - double *arg4 ; - size_t arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - size_t val5 ; - int ecode5 = 0 ; - PyObject *swig_obj[5] ; - - if (!SWIG_Python_UnpackTuple(args, "streamWriteVarChunk", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamWriteVarChunk" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamWriteVarChunk" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_a_2__int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "streamWriteVarChunk" "', argument " "3"" of type '" "int const [3][2]""'"); - } - arg3 = (int (*)[2])(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "streamWriteVarChunk" "', argument " "4"" of type '" "double const []""'"); - } - arg4 = (double *)(argp4); - ecode5 = SWIG_AsVal_size_t(swig_obj[4], &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "streamWriteVarChunk" "', argument " "5"" of type '" "size_t""'"); - } - arg5 = (size_t)(val5); - streamWriteVarChunk(arg1,arg2,(int const (*)[2])arg3,(double const (*))arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamDefRecord(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "streamDefRecord", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamDefRecord" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamDefRecord" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "streamDefRecord" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - streamDefRecord(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamInqRecord(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int *arg2 = (int *) 0 ; - int *arg3 = (int *) 0 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "streamInqRecord", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamInqRecord" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "streamInqRecord" "', argument " "2"" of type '" "int *""'"); - } - arg2 = (int *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "streamInqRecord" "', argument " "3"" of type '" "int *""'"); - } - arg3 = (int *)(argp3); - streamInqRecord(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamWriteRecord(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - size_t arg3 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - size_t val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "streamWriteRecord", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamWriteRecord" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "streamWriteRecord" "', argument " "2"" of type '" "double const []""'"); - } - arg2 = (double *)(argp2); - ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "streamWriteRecord" "', argument " "3"" of type '" "size_t""'"); - } - arg3 = (size_t)(val3); - streamWriteRecord(arg1,(double const (*))arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamWriteRecordF(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - float *arg2 ; - size_t arg3 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - size_t val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "streamWriteRecordF", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamWriteRecordF" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "streamWriteRecordF" "', argument " "2"" of type '" "float const []""'"); - } - arg2 = (float *)(argp2); - ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "streamWriteRecordF" "', argument " "3"" of type '" "size_t""'"); - } - arg3 = (size_t)(val3); - streamWriteRecordF(arg1,(float const (*))arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamReadRecord(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - size_t *arg3 = (size_t *) 0 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "streamReadRecord", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamReadRecord" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "streamReadRecord" "', argument " "2"" of type '" "double []""'"); - } - arg2 = (double *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_size_t, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "streamReadRecord" "', argument " "3"" of type '" "size_t *""'"); - } - arg3 = (size_t *)(argp3); - streamReadRecord(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamReadRecordF(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - float *arg2 ; - size_t *arg3 = (size_t *) 0 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "streamReadRecordF", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamReadRecordF" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "streamReadRecordF" "', argument " "2"" of type '" "float []""'"); - } - arg2 = (float *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_size_t, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "streamReadRecordF" "', argument " "3"" of type '" "size_t *""'"); - } - arg3 = (size_t *)(argp3); - streamReadRecordF(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamCopyRecord(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "streamCopyRecord", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamCopyRecord" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamCopyRecord" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - streamCopyRecord(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamInqGRIBinfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int *arg2 = (int *) 0 ; - float *arg3 = (float *) 0 ; - off_t *arg4 = (off_t *) 0 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "streamInqGRIBinfo", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamInqGRIBinfo" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "streamInqGRIBinfo" "', argument " "2"" of type '" "int *""'"); - } - arg2 = (int *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "streamInqGRIBinfo" "', argument " "3"" of type '" "float *""'"); - } - arg3 = (float *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_off_t, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "streamInqGRIBinfo" "', argument " "4"" of type '" "off_t *""'"); - } - arg4 = (off_t *)(argp4); - streamInqGRIBinfo(arg1,arg2,arg3,arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_new(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - PyObject *swig_obj[1] ; - CdiIterator *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_new" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = (char *)(buf1); - result = (CdiIterator *)cdiIterator_new((char const *)arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_clone(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - CdiIterator *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_clone" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - result = (CdiIterator *)cdiIterator_clone(arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiIterator, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_serialize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_serialize" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - result = (char *)cdiIterator_serialize(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_deserialize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - PyObject *swig_obj[1] ; - CdiIterator *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_deserialize" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = (char *)(buf1); - result = (CdiIterator *)cdiIterator_deserialize((char const *)arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_print(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - FILE *arg2 = (FILE *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "cdiIterator_print", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_print" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_FILE, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiIterator_print" "', argument " "2"" of type '" "FILE *""'"); - } - arg2 = (FILE *)(argp2); - cdiIterator_print(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_delete" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - cdiIterator_delete(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_nextField(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_nextField" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - result = (int)cdiIterator_nextField(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqStartTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqStartTime" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - result = (char *)cdiIterator_inqStartTime(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqEndTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqEndTime" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - result = (char *)cdiIterator_inqEndTime(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqRTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqRTime" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - result = (char *)cdiIterator_inqRTime(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqVTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqVTime" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - result = (char *)cdiIterator_inqVTime(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqLevelType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - int arg2 ; - char **arg3 = (char **) 0 ; - char **arg4 = (char **) 0 ; - char **arg5 = (char **) 0 ; - char **arg6 = (char **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - void *argp5 = 0 ; - int res5 = 0 ; - void *argp6 = 0 ; - int res6 = 0 ; - PyObject *swig_obj[6] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiIterator_inqLevelType", 6, 6, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqLevelType" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiIterator_inqLevelType" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_p_char, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiIterator_inqLevelType" "', argument " "3"" of type '" "char **""'"); - } - arg3 = (char **)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_p_char, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiIterator_inqLevelType" "', argument " "4"" of type '" "char **""'"); - } - arg4 = (char **)(argp4); - res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_p_char, 0 | 0 ); - if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "cdiIterator_inqLevelType" "', argument " "5"" of type '" "char **""'"); - } - arg5 = (char **)(argp5); - res6 = SWIG_ConvertPtr(swig_obj[5], &argp6,SWIGTYPE_p_p_char, 0 | 0 ); - if (!SWIG_IsOK(res6)) { - SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "cdiIterator_inqLevelType" "', argument " "6"" of type '" "char **""'"); - } - arg6 = (char **)(argp6); - result = (int)cdiIterator_inqLevelType(arg1,arg2,arg3,arg4,arg5,arg6); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqLevel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - int arg2 ; - double *arg3 = (double *) 0 ; - double *arg4 = (double *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiIterator_inqLevel", 4, 4, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqLevel" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiIterator_inqLevel" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiIterator_inqLevel" "', argument " "3"" of type '" "double *""'"); - } - arg3 = (double *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiIterator_inqLevel" "', argument " "4"" of type '" "double *""'"); - } - arg4 = (double *)(argp4); - result = (int)cdiIterator_inqLevel(arg1,arg2,arg3,arg4); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqLevelUuid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - int *arg2 = (int *) 0 ; - int *arg3 = (int *) 0 ; - unsigned char *arg4 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiIterator_inqLevelUuid", 4, 4, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqLevelUuid" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiIterator_inqLevelUuid" "', argument " "2"" of type '" "int *""'"); - } - arg2 = (int *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiIterator_inqLevelUuid" "', argument " "3"" of type '" "int *""'"); - } - arg3 = (int *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_unsigned_char, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiIterator_inqLevelUuid" "', argument " "4"" of type '" "unsigned char [16]""'"); - } - arg4 = (unsigned char *)(argp4); - result = (int)cdiIterator_inqLevelUuid(arg1,arg2,arg3,arg4); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqTile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - int *arg2 = (int *) 0 ; - int *arg3 = (int *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiIterator_inqTile", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqTile" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiIterator_inqTile" "', argument " "2"" of type '" "int *""'"); - } - arg2 = (int *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiIterator_inqTile" "', argument " "3"" of type '" "int *""'"); - } - arg3 = (int *)(argp3); - result = (int)cdiIterator_inqTile(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqTileCount(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - int *arg2 = (int *) 0 ; - int *arg3 = (int *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiIterator_inqTileCount", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqTileCount" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiIterator_inqTileCount" "', argument " "2"" of type '" "int *""'"); - } - arg2 = (int *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiIterator_inqTileCount" "', argument " "3"" of type '" "int *""'"); - } - arg3 = (int *)(argp3); - result = (int)cdiIterator_inqTileCount(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqParam(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - CdiParam result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqParam" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - result = cdiIterator_inqParam(arg1); - resultobj = SWIG_NewPointerObj((CdiParam *)memcpy((CdiParam *)calloc(1,sizeof(CdiParam)),&result,sizeof(CdiParam)), SWIGTYPE_p_CdiParam, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqParamParts(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - int *arg2 = (int *) 0 ; - int *arg3 = (int *) 0 ; - int *arg4 = (int *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "cdiIterator_inqParamParts", 4, 4, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqParamParts" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiIterator_inqParamParts" "', argument " "2"" of type '" "int *""'"); - } - arg2 = (int *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiIterator_inqParamParts" "', argument " "3"" of type '" "int *""'"); - } - arg3 = (int *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiIterator_inqParamParts" "', argument " "4"" of type '" "int *""'"); - } - arg4 = (int *)(argp4); - cdiIterator_inqParamParts(arg1,arg2,arg3,arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqDatatype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqDatatype" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - result = (int)cdiIterator_inqDatatype(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqFiletype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqFiletype" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - result = (int)cdiIterator_inqFiletype(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqTsteptype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqTsteptype" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - result = (int)cdiIterator_inqTsteptype(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqVariableName(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqVariableName" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - result = (char *)cdiIterator_inqVariableName(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_inqGridId(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_inqGridId" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - result = (int)cdiIterator_inqGridId(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_readField(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - double *arg2 ; - size_t *arg3 = (size_t *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "cdiIterator_readField", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_readField" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiIterator_readField" "', argument " "2"" of type '" "double []""'"); - } - arg2 = (double *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_size_t, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiIterator_readField" "', argument " "3"" of type '" "size_t *""'"); - } - arg3 = (size_t *)(argp3); - cdiIterator_readField(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiIterator_readFieldF(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - float *arg2 ; - size_t *arg3 = (size_t *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "cdiIterator_readFieldF", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiIterator_readFieldF" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiIterator_readFieldF" "', argument " "2"" of type '" "float []""'"); - } - arg2 = (float *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_size_t, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiIterator_readFieldF" "', argument " "3"" of type '" "size_t *""'"); - } - arg3 = (size_t *)(argp3); - cdiIterator_readFieldF(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGribIterator_clone(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiIterator *arg1 = (CdiIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - CdiGribIterator *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGribIterator_clone" "', argument " "1"" of type '" "CdiIterator *""'"); - } - arg1 = (CdiIterator *)(argp1); - result = (CdiGribIterator *)cdiGribIterator_clone(arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiGribIterator, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGribIterator_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGribIterator *arg1 = (CdiGribIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGribIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGribIterator_delete" "', argument " "1"" of type '" "CdiGribIterator *""'"); - } - arg1 = (CdiGribIterator *)(argp1); - cdiGribIterator_delete(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGribIterator_getLong(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGribIterator *arg1 = (CdiGribIterator *) 0 ; - char *arg2 = (char *) 0 ; - long *arg3 = (long *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiGribIterator_getLong", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGribIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGribIterator_getLong" "', argument " "1"" of type '" "CdiGribIterator *""'"); - } - arg1 = (CdiGribIterator *)(argp1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiGribIterator_getLong" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_long, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiGribIterator_getLong" "', argument " "3"" of type '" "long *""'"); - } - arg3 = (long *)(argp3); - result = (int)cdiGribIterator_getLong(arg1,(char const *)arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGribIterator_getDouble(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGribIterator *arg1 = (CdiGribIterator *) 0 ; - char *arg2 = (char *) 0 ; - double *arg3 = (double *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiGribIterator_getDouble", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGribIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGribIterator_getDouble" "', argument " "1"" of type '" "CdiGribIterator *""'"); - } - arg1 = (CdiGribIterator *)(argp1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiGribIterator_getDouble" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiGribIterator_getDouble" "', argument " "3"" of type '" "double *""'"); - } - arg3 = (double *)(argp3); - result = (int)cdiGribIterator_getDouble(arg1,(char const *)arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGribIterator_getLength(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGribIterator *arg1 = (CdiGribIterator *) 0 ; - char *arg2 = (char *) 0 ; - size_t *arg3 = (size_t *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiGribIterator_getLength", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGribIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGribIterator_getLength" "', argument " "1"" of type '" "CdiGribIterator *""'"); - } - arg1 = (CdiGribIterator *)(argp1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiGribIterator_getLength" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_size_t, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiGribIterator_getLength" "', argument " "3"" of type '" "size_t *""'"); - } - arg3 = (size_t *)(argp3); - result = (int)cdiGribIterator_getLength(arg1,(char const *)arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGribIterator_getString(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGribIterator *arg1 = (CdiGribIterator *) 0 ; - char *arg2 = (char *) 0 ; - char *arg3 = (char *) 0 ; - size_t *arg4 = (size_t *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiGribIterator_getString", 4, 4, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGribIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGribIterator_getString" "', argument " "1"" of type '" "CdiGribIterator *""'"); - } - arg1 = (CdiGribIterator *)(argp1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiGribIterator_getString" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiGribIterator_getString" "', argument " "3"" of type '" "char *""'"); - } - arg3 = (char *)(buf3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_size_t, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiGribIterator_getString" "', argument " "4"" of type '" "size_t *""'"); - } - arg4 = (size_t *)(argp4); - result = (int)cdiGribIterator_getString(arg1,(char const *)arg2,arg3,arg4); - resultobj = SWIG_From_int((int)(result)); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGribIterator_getSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGribIterator *arg1 = (CdiGribIterator *) 0 ; - char *arg2 = (char *) 0 ; - size_t *arg3 = (size_t *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiGribIterator_getSize", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGribIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGribIterator_getSize" "', argument " "1"" of type '" "CdiGribIterator *""'"); - } - arg1 = (CdiGribIterator *)(argp1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiGribIterator_getSize" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_size_t, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiGribIterator_getSize" "', argument " "3"" of type '" "size_t *""'"); - } - arg3 = (size_t *)(argp3); - result = (int)cdiGribIterator_getSize(arg1,(char const *)arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGribIterator_getLongArray(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGribIterator *arg1 = (CdiGribIterator *) 0 ; - char *arg2 = (char *) 0 ; - long *arg3 = (long *) 0 ; - size_t *arg4 = (size_t *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiGribIterator_getLongArray", 4, 4, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGribIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGribIterator_getLongArray" "', argument " "1"" of type '" "CdiGribIterator *""'"); - } - arg1 = (CdiGribIterator *)(argp1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiGribIterator_getLongArray" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_long, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiGribIterator_getLongArray" "', argument " "3"" of type '" "long *""'"); - } - arg3 = (long *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_size_t, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiGribIterator_getLongArray" "', argument " "4"" of type '" "size_t *""'"); - } - arg4 = (size_t *)(argp4); - result = (int)cdiGribIterator_getLongArray(arg1,(char const *)arg2,arg3,arg4); - resultobj = SWIG_From_int((int)(result)); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGribIterator_getDoubleArray(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGribIterator *arg1 = (CdiGribIterator *) 0 ; - char *arg2 = (char *) 0 ; - double *arg3 = (double *) 0 ; - size_t *arg4 = (size_t *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiGribIterator_getDoubleArray", 4, 4, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGribIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGribIterator_getDoubleArray" "', argument " "1"" of type '" "CdiGribIterator *""'"); - } - arg1 = (CdiGribIterator *)(argp1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiGribIterator_getDoubleArray" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiGribIterator_getDoubleArray" "', argument " "3"" of type '" "double *""'"); - } - arg3 = (double *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_size_t, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiGribIterator_getDoubleArray" "', argument " "4"" of type '" "size_t *""'"); - } - arg4 = (size_t *)(argp4); - result = (int)cdiGribIterator_getDoubleArray(arg1,(char const *)arg2,arg3,arg4); - resultobj = SWIG_From_int((int)(result)); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGribIterator_inqEdition(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGribIterator *arg1 = (CdiGribIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGribIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGribIterator_inqEdition" "', argument " "1"" of type '" "CdiGribIterator *""'"); - } - arg1 = (CdiGribIterator *)(argp1); - result = (int)cdiGribIterator_inqEdition(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGribIterator_inqLongValue(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGribIterator *arg1 = (CdiGribIterator *) 0 ; - char *arg2 = (char *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - long result; - - if (!SWIG_Python_UnpackTuple(args, "cdiGribIterator_inqLongValue", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGribIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGribIterator_inqLongValue" "', argument " "1"" of type '" "CdiGribIterator *""'"); - } - arg1 = (CdiGribIterator *)(argp1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiGribIterator_inqLongValue" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - result = (long)cdiGribIterator_inqLongValue(arg1,(char const *)arg2); - resultobj = SWIG_From_long((long)(result)); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGribIterator_inqLongDefaultValue(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGribIterator *arg1 = (CdiGribIterator *) 0 ; - char *arg2 = (char *) 0 ; - long arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - long val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - long result; - - if (!SWIG_Python_UnpackTuple(args, "cdiGribIterator_inqLongDefaultValue", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGribIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGribIterator_inqLongDefaultValue" "', argument " "1"" of type '" "CdiGribIterator *""'"); - } - arg1 = (CdiGribIterator *)(argp1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiGribIterator_inqLongDefaultValue" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - ecode3 = SWIG_AsVal_long(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiGribIterator_inqLongDefaultValue" "', argument " "3"" of type '" "long""'"); - } - arg3 = (long)(val3); - result = (long)cdiGribIterator_inqLongDefaultValue(arg1,(char const *)arg2,arg3); - resultobj = SWIG_From_long((long)(result)); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGribIterator_inqDoubleValue(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGribIterator *arg1 = (CdiGribIterator *) 0 ; - char *arg2 = (char *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - double result; - - if (!SWIG_Python_UnpackTuple(args, "cdiGribIterator_inqDoubleValue", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGribIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGribIterator_inqDoubleValue" "', argument " "1"" of type '" "CdiGribIterator *""'"); - } - arg1 = (CdiGribIterator *)(argp1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiGribIterator_inqDoubleValue" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - result = (double)cdiGribIterator_inqDoubleValue(arg1,(char const *)arg2); - resultobj = SWIG_From_double((double)(result)); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGribIterator_inqDoubleDefaultValue(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGribIterator *arg1 = (CdiGribIterator *) 0 ; - char *arg2 = (char *) 0 ; - double arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - double val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - double result; - - if (!SWIG_Python_UnpackTuple(args, "cdiGribIterator_inqDoubleDefaultValue", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGribIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGribIterator_inqDoubleDefaultValue" "', argument " "1"" of type '" "CdiGribIterator *""'"); - } - arg1 = (CdiGribIterator *)(argp1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiGribIterator_inqDoubleDefaultValue" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiGribIterator_inqDoubleDefaultValue" "', argument " "3"" of type '" "double""'"); - } - arg3 = (double)(val3); - result = (double)cdiGribIterator_inqDoubleDefaultValue(arg1,(char const *)arg2,arg3); - resultobj = SWIG_From_double((double)(result)); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGribIterator_inqStringValue(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGribIterator *arg1 = (CdiGribIterator *) 0 ; - char *arg2 = (char *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - char *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "cdiGribIterator_inqStringValue", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGribIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiGribIterator_inqStringValue" "', argument " "1"" of type '" "CdiGribIterator *""'"); - } - arg1 = (CdiGribIterator *)(argp1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "cdiGribIterator_inqStringValue" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - result = (char *)cdiGribIterator_inqStringValue(arg1,(char const *)arg2); - resultobj = SWIG_FromCharPtr((const char *)result); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistCreate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistCreate", 0, 0, 0)) SWIG_fail; - result = (int)vlistCreate(); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDestroy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDestroy" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - vlistDestroy(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDuplicate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDuplicate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)vlistDuplicate(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistCopy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistCopy", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistCopy" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistCopy" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - vlistCopy(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistCopyFlag(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistCopyFlag", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistCopyFlag" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistCopyFlag" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - vlistCopyFlag(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistClearFlag(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistClearFlag" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - vlistClearFlag(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistCat(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistCat", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistCat" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistCat" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - vlistCat(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistMerge(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistMerge", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistMerge" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistMerge" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - vlistMerge(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistPrint(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistPrint" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - vlistPrint(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistNumber(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistNumber" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)vlistNumber(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistNvars(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistNvars" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)vlistNvars(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistNgrids(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistNgrids" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)vlistNgrids(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistNzaxis(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistNzaxis" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)vlistNzaxis(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistNsubtypes(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistNsubtypes" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)vlistNsubtypes(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefNtsteps(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefNtsteps", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefNtsteps" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefNtsteps" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - vlistDefNtsteps(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistNtsteps(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistNtsteps" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)vlistNtsteps(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistGridsizeMax(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - size_t result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistGridsizeMax" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = vlistGridsizeMax(arg1); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistGrid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistGrid", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistGrid" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistGrid" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistGrid(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistGridIndex(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistGridIndex", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistGridIndex" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistGridIndex" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistGridIndex(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistChangeGridIndex(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistChangeGridIndex", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistChangeGridIndex" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistChangeGridIndex" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistChangeGridIndex" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistChangeGridIndex(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistChangeGrid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistChangeGrid", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistChangeGrid" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistChangeGrid" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistChangeGrid" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistChangeGrid(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistZaxis(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistZaxis", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistZaxis" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistZaxis" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistZaxis(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistZaxisIndex(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistZaxisIndex", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistZaxisIndex" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistZaxisIndex" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistZaxisIndex(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistChangeZaxisIndex(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistChangeZaxisIndex", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistChangeZaxisIndex" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistChangeZaxisIndex" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistChangeZaxisIndex" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistChangeZaxisIndex(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistChangeZaxis(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistChangeZaxis", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistChangeZaxis" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistChangeZaxis" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistChangeZaxis" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistChangeZaxis(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistNrecs(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistNrecs" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)vlistNrecs(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistSubtype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistSubtype", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistSubtype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistSubtype" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistSubtype(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistSubtypeIndex(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistSubtypeIndex", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistSubtypeIndex" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistSubtypeIndex" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistSubtypeIndex(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefTaxis(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefTaxis", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefTaxis" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefTaxis" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - vlistDefTaxis(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqTaxis(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqTaxis" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)vlistInqTaxis(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefTable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefTable", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefTable" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefTable" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - vlistDefTable(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqTable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqTable" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)vlistInqTable(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefInstitut(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefInstitut", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefInstitut" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefInstitut" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - vlistDefInstitut(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqInstitut(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqInstitut" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)vlistInqInstitut(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefModel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefModel", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefModel" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefModel" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - vlistDefModel(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqModel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqModel" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)vlistInqModel(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarTiles(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int val5 ; - int ecode5 = 0 ; - PyObject *swig_obj[5] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarTiles", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarTiles" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarTiles" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarTiles" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "vlistDefVarTiles" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_int(swig_obj[4], &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "vlistDefVarTiles" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - result = (int)vlistDefVarTiles(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVar", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVar" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVar" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVar" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "vlistDefVar" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - result = (int)vlistDefVar(arg1,arg2,arg3,arg4); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistChangeVarGrid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistChangeVarGrid", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistChangeVarGrid" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistChangeVarGrid" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistChangeVarGrid" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistChangeVarGrid(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistChangeVarZaxis(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistChangeVarZaxis", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistChangeVarZaxis" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistChangeVarZaxis" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistChangeVarZaxis" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistChangeVarZaxis(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 = (int *) 0 ; - int *arg4 = (int *) 0 ; - int *arg5 = (int *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - void *argp5 = 0 ; - int res5 = 0 ; - PyObject *swig_obj[5] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVar", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVar" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVar" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistInqVar" "', argument " "3"" of type '" "int *""'"); - } - arg3 = (int *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "vlistInqVar" "', argument " "4"" of type '" "int *""'"); - } - arg4 = (int *)(argp4); - res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "vlistInqVar" "', argument " "5"" of type '" "int *""'"); - } - arg5 = (int *)(argp5); - vlistInqVar(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarGrid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarGrid", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarGrid" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarGrid" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarGrid(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarZaxis(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarZaxis", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarZaxis" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarZaxis" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarZaxis(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarID(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarID", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarID" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarID" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarID(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarTimetype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarTimetype", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarTimetype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarTimetype" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarTimetype" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistDefVarTimetype(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarTimetype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarTimetype", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarTimetype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarTimetype" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarTimetype(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarTsteptype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarTsteptype", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarTsteptype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarTsteptype" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarTsteptype" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistDefVarTsteptype(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarTsteptype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarTsteptype", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarTsteptype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarTsteptype" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarTsteptype(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarCompType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarCompType", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarCompType" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarCompType" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarCompType" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistDefVarCompType(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarCompType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarCompType", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarCompType" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarCompType" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarCompType(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarCompLevel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarCompLevel", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarCompLevel" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarCompLevel" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarCompLevel" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistDefVarCompLevel(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarCompLevel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarCompLevel", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarCompLevel" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarCompLevel" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarCompLevel(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarParam(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarParam", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarParam" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarParam" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarParam" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistDefVarParam(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarParam(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarParam", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarParam" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarParam" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarParam(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarCode(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarCode", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarCode" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarCode" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarCode" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistDefVarCode(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarCode(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarCode", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarCode" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarCode" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarCode(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarDatatype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarDatatype", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarDatatype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarDatatype" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarDatatype" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistDefVarDatatype(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarDatatype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarDatatype", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarDatatype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarDatatype" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarDatatype(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarChunkType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarChunkType", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarChunkType" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarChunkType" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarChunkType" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistDefVarChunkType(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarChunkType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarChunkType", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarChunkType" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarChunkType" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarChunkType(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarXYZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarXYZ", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarXYZ" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarXYZ" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarXYZ" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistDefVarXYZ(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarXYZ(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarXYZ", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarXYZ" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarXYZ" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarXYZ(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarNumber(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarNumber", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarNumber" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarNumber" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarNumber(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarInstitut(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarInstitut", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarInstitut" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarInstitut" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarInstitut" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistDefVarInstitut(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarInstitut(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarInstitut", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarInstitut" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarInstitut" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarInstitut(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarModel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarModel", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarModel" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarModel" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarModel" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistDefVarModel(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarModel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarModel", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarModel" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarModel" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarModel(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarTable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarTable", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarTable" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarTable" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarTable" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistDefVarTable(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarTable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarTable", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarTable" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarTable" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarTable(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarName(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarName", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarName" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarName" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistDefVarName" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - vlistDefVarName(arg1,arg2,(char const *)arg3); - resultobj = SWIG_Py_Void(); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarName(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarName", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarName" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarName" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistInqVarName" "', argument " "3"" of type '" "char *""'"); - } - arg3 = (char *)(buf3); - vlistInqVarName(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistCopyVarName(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - char *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "vlistCopyVarName", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistCopyVarName" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistCopyVarName" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (char *)vlistCopyVarName(arg1,arg2); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarStdname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarStdname", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarStdname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarStdname" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistDefVarStdname" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - vlistDefVarStdname(arg1,arg2,(char const *)arg3); - resultobj = SWIG_Py_Void(); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarStdname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarStdname", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarStdname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarStdname" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistInqVarStdname" "', argument " "3"" of type '" "char *""'"); - } - arg3 = (char *)(buf3); - vlistInqVarStdname(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarLongname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarLongname", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarLongname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarLongname" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistDefVarLongname" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - vlistDefVarLongname(arg1,arg2,(char const *)arg3); - resultobj = SWIG_Py_Void(); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarLongname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarLongname", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarLongname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarLongname" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistInqVarLongname" "', argument " "3"" of type '" "char *""'"); - } - arg3 = (char *)(buf3); - vlistInqVarLongname(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarUnits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarUnits", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarUnits" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarUnits" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistDefVarUnits" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - vlistDefVarUnits(arg1,arg2,(char const *)arg3); - resultobj = SWIG_Py_Void(); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarUnits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarUnits", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarUnits" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarUnits" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistInqVarUnits" "', argument " "3"" of type '" "char *""'"); - } - arg3 = (char *)(buf3); - vlistInqVarUnits(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarMissval(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - double arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - double val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarMissval", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarMissval" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarMissval" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarMissval" "', argument " "3"" of type '" "double""'"); - } - arg3 = (double)(val3); - vlistDefVarMissval(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarMissval(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - double result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarMissval", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarMissval" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarMissval" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (double)vlistInqVarMissval(arg1,arg2); - resultobj = SWIG_From_double((double)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarExtra(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarExtra", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarExtra" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarExtra" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistDefVarExtra" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - vlistDefVarExtra(arg1,arg2,(char const *)arg3); - resultobj = SWIG_Py_Void(); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarExtra(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarExtra", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarExtra" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarExtra" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistInqVarExtra" "', argument " "3"" of type '" "char *""'"); - } - arg3 = (char *)(buf3); - vlistInqVarExtra(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarScalefactor(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - double arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - double val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarScalefactor", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarScalefactor" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarScalefactor" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarScalefactor" "', argument " "3"" of type '" "double""'"); - } - arg3 = (double)(val3); - vlistDefVarScalefactor(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarScalefactor(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - double result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarScalefactor", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarScalefactor" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarScalefactor" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (double)vlistInqVarScalefactor(arg1,arg2); - resultobj = SWIG_From_double((double)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarAddoffset(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - double arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - double val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarAddoffset", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarAddoffset" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarAddoffset" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarAddoffset" "', argument " "3"" of type '" "double""'"); - } - arg3 = (double)(val3); - vlistDefVarAddoffset(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarAddoffset(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - double result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarAddoffset", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarAddoffset" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarAddoffset" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (double)vlistInqVarAddoffset(arg1,arg2); - resultobj = SWIG_From_double((double)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarTimave(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarTimave", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarTimave" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarTimave" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefVarTimave" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - vlistDefVarTimave(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarTimave(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarTimave", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarTimave" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarTimave" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarTimave(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - size_t result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarSize", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarSize" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarSize" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = vlistInqVarSize(arg1,arg2); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefIndex(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefIndex", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefIndex" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefIndex" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefIndex" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "vlistDefIndex" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - vlistDefIndex(arg1,arg2,arg3,arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqIndex(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqIndex", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqIndex" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqIndex" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistInqIndex" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = (int)vlistInqIndex(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefFlag(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefFlag", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefFlag" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefFlag" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistDefFlag" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "vlistDefFlag" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - vlistDefFlag(arg1,arg2,arg3,arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqFlag(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqFlag", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqFlag" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqFlag" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistInqFlag" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = (int)vlistInqFlag(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistFindVar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistFindVar", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistFindVar" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistFindVar" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistFindVar(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistFindLevel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistFindLevel", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistFindLevel" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistFindLevel" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistFindLevel" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = (int)vlistFindLevel(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistMergedVar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistMergedVar", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistMergedVar" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistMergedVar" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistMergedVar(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistMergedLevel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistMergedLevel", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistMergedLevel" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistMergedLevel" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "vlistMergedLevel" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = (int)vlistMergedLevel(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiClearAdditionalKeys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - - if (!SWIG_Python_UnpackTuple(args, "cdiClearAdditionalKeys", 0, 0, 0)) SWIG_fail; - cdiClearAdditionalKeys(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiDefAdditionalKey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "cdiDefAdditionalKey" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = (char *)(buf1); - cdiDefAdditionalKey((char const *)arg1); - resultobj = SWIG_Py_Void(); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarIntKey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int arg4 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - int val4 ; - int ecode4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarIntKey", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarIntKey" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarIntKey" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistDefVarIntKey" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "vlistDefVarIntKey" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - vlistDefVarIntKey(arg1,arg2,(char const *)arg3,arg4); - resultobj = SWIG_Py_Void(); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistDefVarDblKey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - double arg4 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - double val4 ; - int ecode4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "vlistDefVarDblKey", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistDefVarDblKey" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistDefVarDblKey" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistDefVarDblKey" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - ecode4 = SWIG_AsVal_double(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "vlistDefVarDblKey" "', argument " "4"" of type '" "double""'"); - } - arg4 = (double)(val4); - vlistDefVarDblKey(arg1,arg2,(char const *)arg3,arg4); - resultobj = SWIG_Py_Void(); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistHasVarKey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistHasVarKey", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistHasVarKey" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistHasVarKey" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistHasVarKey" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - result = (int)vlistHasVarKey(arg1,arg2,(char const *)arg3); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarDblKey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - double result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarDblKey", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarDblKey" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarDblKey" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistInqVarDblKey" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - result = (double)vlistInqVarDblKey(arg1,arg2,(char const *)arg3); - resultobj = SWIG_From_double((double)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarIntKey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarIntKey", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarIntKey" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarIntKey" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "vlistInqVarIntKey" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - result = (int)vlistInqVarIntKey(arg1,arg2,(char const *)arg3); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiInqNatts(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 = (int *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiInqNatts", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiInqNatts" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiInqNatts" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiInqNatts" "', argument " "3"" of type '" "int *""'"); - } - arg3 = (int *)(argp3); - result = (int)cdiInqNatts(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiInqAtt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - char *arg4 = (char *) 0 ; - int *arg5 = (int *) 0 ; - int *arg6 = (int *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int res4 ; - char *buf4 = 0 ; - int alloc4 = 0 ; - void *argp5 = 0 ; - int res5 = 0 ; - void *argp6 = 0 ; - int res6 = 0 ; - PyObject *swig_obj[6] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiInqAtt", 6, 6, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiInqAtt" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiInqAtt" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiInqAtt" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_AsCharPtrAndSize(swig_obj[3], &buf4, NULL, &alloc4); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiInqAtt" "', argument " "4"" of type '" "char *""'"); - } - arg4 = (char *)(buf4); - res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "cdiInqAtt" "', argument " "5"" of type '" "int *""'"); - } - arg5 = (int *)(argp5); - res6 = SWIG_ConvertPtr(swig_obj[5], &argp6,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res6)) { - SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "cdiInqAtt" "', argument " "6"" of type '" "int *""'"); - } - arg6 = (int *)(argp6); - result = (int)cdiInqAtt(arg1,arg2,arg3,arg4,arg5,arg6); - resultobj = SWIG_From_int((int)(result)); - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return resultobj; -fail: - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiDelAtt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiDelAtt", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiDelAtt" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiDelAtt" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiDelAtt" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - result = (int)cdiDelAtt(arg1,arg2,(char const *)arg3); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiCopyAtts(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiCopyAtts", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiCopyAtts" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiCopyAtts" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiCopyAtts" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "cdiCopyAtts" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - result = (int)cdiCopyAtts(arg1,arg2,arg3,arg4); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiDefAttInt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int arg4 ; - int arg5 ; - int *arg6 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int val5 ; - int ecode5 = 0 ; - void *argp6 = 0 ; - int res6 = 0 ; - PyObject *swig_obj[6] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiDefAttInt", 6, 6, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiDefAttInt" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiDefAttInt" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiDefAttInt" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "cdiDefAttInt" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_int(swig_obj[4], &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "cdiDefAttInt" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - res6 = SWIG_ConvertPtr(swig_obj[5], &argp6,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res6)) { - SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "cdiDefAttInt" "', argument " "6"" of type '" "int const []""'"); - } - arg6 = (int *)(argp6); - result = (int)cdiDefAttInt(arg1,arg2,(char const *)arg3,arg4,arg5,(int const (*))arg6); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiDefAttFlt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int arg4 ; - int arg5 ; - double *arg6 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int val5 ; - int ecode5 = 0 ; - void *argp6 = 0 ; - int res6 = 0 ; - PyObject *swig_obj[6] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiDefAttFlt", 6, 6, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiDefAttFlt" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiDefAttFlt" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiDefAttFlt" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "cdiDefAttFlt" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_int(swig_obj[4], &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "cdiDefAttFlt" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - res6 = SWIG_ConvertPtr(swig_obj[5], &argp6,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res6)) { - SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "cdiDefAttFlt" "', argument " "6"" of type '" "double const []""'"); - } - arg6 = (double *)(argp6); - result = (int)cdiDefAttFlt(arg1,arg2,(char const *)arg3,arg4,arg5,(double const (*))arg6); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiDefAttTxt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int arg4 ; - char *arg5 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int res5 ; - char *buf5 = 0 ; - int alloc5 = 0 ; - PyObject *swig_obj[5] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiDefAttTxt", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiDefAttTxt" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiDefAttTxt" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiDefAttTxt" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "cdiDefAttTxt" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - res5 = SWIG_AsCharPtrAndSize(swig_obj[4], &buf5, NULL, &alloc5); - if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "cdiDefAttTxt" "', argument " "5"" of type '" "char const *""'"); - } - arg5 = (char *)(buf5); - result = (int)cdiDefAttTxt(arg1,arg2,(char const *)arg3,arg4,(char const *)arg5); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - if (alloc5 == SWIG_NEWOBJ) free((char*)buf5); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - if (alloc5 == SWIG_NEWOBJ) free((char*)buf5); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiInqAttInt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int arg4 ; - int *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - int val4 ; - int ecode4 = 0 ; - void *argp5 = 0 ; - int res5 = 0 ; - PyObject *swig_obj[5] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiInqAttInt", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiInqAttInt" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiInqAttInt" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiInqAttInt" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "cdiInqAttInt" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "cdiInqAttInt" "', argument " "5"" of type '" "int []""'"); - } - arg5 = (int *)(argp5); - result = (int)cdiInqAttInt(arg1,arg2,(char const *)arg3,arg4,arg5); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiInqAttFlt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int arg4 ; - double *arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - int val4 ; - int ecode4 = 0 ; - void *argp5 = 0 ; - int res5 = 0 ; - PyObject *swig_obj[5] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiInqAttFlt", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiInqAttFlt" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiInqAttFlt" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiInqAttFlt" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "cdiInqAttFlt" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "cdiInqAttFlt" "', argument " "5"" of type '" "double []""'"); - } - arg5 = (double *)(argp5); - result = (int)cdiInqAttFlt(arg1,arg2,(char const *)arg3,arg4,arg5); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiInqAttTxt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int arg4 ; - char *arg5 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int res5 ; - char *buf5 = 0 ; - int alloc5 = 0 ; - PyObject *swig_obj[5] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiInqAttTxt", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiInqAttTxt" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiInqAttTxt" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiInqAttTxt" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "cdiInqAttTxt" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - res5 = SWIG_AsCharPtrAndSize(swig_obj[4], &buf5, NULL, &alloc5); - if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "cdiInqAttTxt" "', argument " "5"" of type '" "char *""'"); - } - arg5 = (char *)(buf5); - result = (int)cdiInqAttTxt(arg1,arg2,(char const *)arg3,arg4,arg5); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - if (alloc5 == SWIG_NEWOBJ) free((char*)buf5); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - if (alloc5 == SWIG_NEWOBJ) free((char*)buf5); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridName(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridName", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridName" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridName" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - gridName(arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridNamePtr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridNamePtr" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (char *)gridNamePtr(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridCompress(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridCompress" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - gridCompress(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefMaskGME(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefMaskGME", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefMaskGME" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridDefMaskGME" "', argument " "2"" of type '" "int const []""'"); - } - arg2 = (int *)(argp2); - gridDefMaskGME(arg1,(int const (*))arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqMaskGME(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqMaskGME", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqMaskGME" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqMaskGME" "', argument " "2"" of type '" "int []""'"); - } - arg2 = (int *)(argp2); - result = (int)gridInqMaskGME(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefMask(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefMask", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefMask" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridDefMask" "', argument " "2"" of type '" "int const []""'"); - } - arg2 = (int *)(argp2); - gridDefMask(arg1,(int const (*))arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqMask(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqMask", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqMask" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqMask" "', argument " "2"" of type '" "int []""'"); - } - arg2 = (int *)(argp2); - result = (int)gridInqMask(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridCreate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - size_t arg2 ; - int val1 ; - int ecode1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "gridCreate", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridCreate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridCreate" "', argument " "2"" of type '" "size_t""'"); - } - arg2 = (size_t)(val2); - result = (int)gridCreate(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDestroy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDestroy" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - gridDestroy(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDuplicate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDuplicate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridDuplicate(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefProj(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefProj", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefProj" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefProj" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - gridDefProj(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqProj(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqProj" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridInqProj(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqProjType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqProjType" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridInqProjType(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqType" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridInqType(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - size_t result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqSize" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = gridInqSize(arg1); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefXsize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - size_t arg2 ; - int val1 ; - int ecode1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefXsize", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefXsize" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefXsize" "', argument " "2"" of type '" "size_t""'"); - } - arg2 = (size_t)(val2); - gridDefXsize(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqXsize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - size_t result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqXsize" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = gridInqXsize(arg1); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefYsize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - size_t arg2 ; - int val1 ; - int ecode1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefYsize", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefYsize" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefYsize" "', argument " "2"" of type '" "size_t""'"); - } - arg2 = (size_t)(val2); - gridDefYsize(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqYsize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - size_t result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqYsize" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = gridInqYsize(arg1); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefNP(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefNP", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefNP" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefNP" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - gridDefNP(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqNP(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqNP" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridInqNP(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefXvals(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefXvals", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefXvals" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridDefXvals" "', argument " "2"" of type '" "double const []""'"); - } - arg2 = (double *)(argp2); - gridDefXvals(arg1,(double const (*))arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqXvals(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - size_t result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqXvals", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqXvals" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqXvals" "', argument " "2"" of type '" "double []""'"); - } - arg2 = (double *)(argp2); - result = gridInqXvals(arg1,arg2); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqXvalsPart(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - size_t arg3 ; - double *arg4 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - size_t val3 ; - int ecode3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - size_t result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqXvalsPart", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqXvalsPart" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridInqXvalsPart" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "gridInqXvalsPart" "', argument " "3"" of type '" "size_t""'"); - } - arg3 = (size_t)(val3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "gridInqXvalsPart" "', argument " "4"" of type '" "double []""'"); - } - arg4 = (double *)(argp4); - result = gridInqXvalsPart(arg1,arg2,arg3,arg4); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqXIsc(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqXIsc" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridInqXIsc(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqXCvals(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char **arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - size_t result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqXCvals", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqXCvals" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_p_char, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqXCvals" "', argument " "2"" of type '" "char *[]""'"); - } - arg2 = (char **)(argp2); - result = gridInqXCvals(arg1,arg2); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefYvals(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefYvals", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefYvals" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridDefYvals" "', argument " "2"" of type '" "double const []""'"); - } - arg2 = (double *)(argp2); - gridDefYvals(arg1,(double const (*))arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqYvals(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - size_t result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqYvals", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqYvals" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqYvals" "', argument " "2"" of type '" "double []""'"); - } - arg2 = (double *)(argp2); - result = gridInqYvals(arg1,arg2); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqYvalsPart(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - size_t arg3 ; - double *arg4 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - size_t val3 ; - int ecode3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - size_t result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqYvalsPart", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqYvalsPart" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridInqYvalsPart" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "gridInqYvalsPart" "', argument " "3"" of type '" "size_t""'"); - } - arg3 = (size_t)(val3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "gridInqYvalsPart" "', argument " "4"" of type '" "double []""'"); - } - arg4 = (double *)(argp4); - result = gridInqYvalsPart(arg1,arg2,arg3,arg4); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqYIsc(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqYIsc" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridInqYIsc(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqYCvals(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char **arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - size_t result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqYCvals", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqYCvals" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_p_char, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqYCvals" "', argument " "2"" of type '" "char *[]""'"); - } - arg2 = (char **)(argp2); - result = gridInqYCvals(arg1,arg2); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiDefKeyInt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiDefKeyInt", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiDefKeyInt" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiDefKeyInt" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiDefKeyInt" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "cdiDefKeyInt" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - result = (int)cdiDefKeyInt(arg1,arg2,arg3,arg4); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiInqKeyInt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int *arg4 = (int *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiInqKeyInt", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiInqKeyInt" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiInqKeyInt" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiInqKeyInt" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiInqKeyInt" "', argument " "4"" of type '" "int *""'"); - } - arg4 = (int *)(argp4); - result = (int)cdiInqKeyInt(arg1,arg2,arg3,arg4); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiDefKeyBytes(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - unsigned char *arg4 ; - int arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - int val5 ; - int ecode5 = 0 ; - PyObject *swig_obj[5] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiDefKeyBytes", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiDefKeyBytes" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiDefKeyBytes" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiDefKeyBytes" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_unsigned_char, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiDefKeyBytes" "', argument " "4"" of type '" "unsigned char const []""'"); - } - arg4 = (unsigned char *)(argp4); - ecode5 = SWIG_AsVal_int(swig_obj[4], &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "cdiDefKeyBytes" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - result = (int)cdiDefKeyBytes(arg1,arg2,arg3,(unsigned char const (*))arg4,arg5); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiInqKeyBytes(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - unsigned char *arg4 ; - int *arg5 = (int *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - void *argp5 = 0 ; - int res5 = 0 ; - PyObject *swig_obj[5] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiInqKeyBytes", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiInqKeyBytes" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiInqKeyBytes" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiInqKeyBytes" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_unsigned_char, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiInqKeyBytes" "', argument " "4"" of type '" "unsigned char []""'"); - } - arg4 = (unsigned char *)(argp4); - res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "cdiInqKeyBytes" "', argument " "5"" of type '" "int *""'"); - } - arg5 = (int *)(argp5); - result = (int)cdiInqKeyBytes(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiDefKeyString(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - char *arg4 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int res4 ; - char *buf4 = 0 ; - int alloc4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiDefKeyString", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiDefKeyString" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiDefKeyString" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiDefKeyString" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_AsCharPtrAndSize(swig_obj[3], &buf4, NULL, &alloc4); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiDefKeyString" "', argument " "4"" of type '" "char const *""'"); - } - arg4 = (char *)(buf4); - result = (int)cdiDefKeyString(arg1,arg2,arg3,(char const *)arg4); - resultobj = SWIG_From_int((int)(result)); - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return resultobj; -fail: - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiInqKeyString(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - char *arg4 = (char *) 0 ; - int *arg5 = (int *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int res4 ; - char *buf4 = 0 ; - int alloc4 = 0 ; - void *argp5 = 0 ; - int res5 = 0 ; - PyObject *swig_obj[5] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiInqKeyString", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiInqKeyString" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiInqKeyString" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiInqKeyString" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_AsCharPtrAndSize(swig_obj[3], &buf4, NULL, &alloc4); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiInqKeyString" "', argument " "4"" of type '" "char *""'"); - } - arg4 = (char *)(buf4); - res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "cdiInqKeyString" "', argument " "5"" of type '" "int *""'"); - } - arg5 = (int *)(argp5); - result = (int)cdiInqKeyString(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_From_int((int)(result)); - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return resultobj; -fail: - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiInqKeyLen(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int *arg4 = (int *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiInqKeyLen", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiInqKeyLen" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiInqKeyLen" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiInqKeyLen" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiInqKeyLen" "', argument " "4"" of type '" "int *""'"); - } - arg4 = (int *)(argp4); - result = (int)cdiInqKeyLen(arg1,arg2,arg3,arg4); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiCopyKeys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiCopyKeys", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiCopyKeys" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiCopyKeys" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiCopyKeys" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "cdiCopyKeys" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - result = (int)cdiCopyKeys(arg1,arg2,arg3,arg4); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGridDefKeyStr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - char *arg4 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int res4 ; - char *buf4 = 0 ; - int alloc4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiGridDefKeyStr", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiGridDefKeyStr" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiGridDefKeyStr" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiGridDefKeyStr" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_AsCharPtrAndSize(swig_obj[3], &buf4, NULL, &alloc4); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiGridDefKeyStr" "', argument " "4"" of type '" "char const *""'"); - } - arg4 = (char *)(buf4); - result = (int)cdiGridDefKeyStr(arg1,arg2,arg3,(char const *)arg4); - resultobj = SWIG_From_int((int)(result)); - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return resultobj; -fail: - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiGridInqKeyStr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - char *arg4 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int res4 ; - char *buf4 = 0 ; - int alloc4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiGridInqKeyStr", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiGridInqKeyStr" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiGridInqKeyStr" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiGridInqKeyStr" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_AsCharPtrAndSize(swig_obj[3], &buf4, NULL, &alloc4); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiGridInqKeyStr" "', argument " "4"" of type '" "char *""'"); - } - arg4 = (char *)(buf4); - result = (int)cdiGridInqKeyStr(arg1,arg2,arg3,arg4); - resultobj = SWIG_From_int((int)(result)); - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return resultobj; -fail: - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiZaxisDefKeyStr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - char *arg4 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int res4 ; - char *buf4 = 0 ; - int alloc4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiZaxisDefKeyStr", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiZaxisDefKeyStr" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiZaxisDefKeyStr" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiZaxisDefKeyStr" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_AsCharPtrAndSize(swig_obj[3], &buf4, NULL, &alloc4); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiZaxisDefKeyStr" "', argument " "4"" of type '" "char const *""'"); - } - arg4 = (char *)(buf4); - result = (int)cdiZaxisDefKeyStr(arg1,arg2,arg3,(char const *)arg4); - resultobj = SWIG_From_int((int)(result)); - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return resultobj; -fail: - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiZaxisInqKeyStr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - char *arg4 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int res4 ; - char *buf4 = 0 ; - int alloc4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiZaxisInqKeyStr", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiZaxisInqKeyStr" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiZaxisInqKeyStr" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiZaxisInqKeyStr" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_AsCharPtrAndSize(swig_obj[3], &buf4, NULL, &alloc4); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "cdiZaxisInqKeyStr" "', argument " "4"" of type '" "char *""'"); - } - arg4 = (char *)(buf4); - result = (int)cdiZaxisInqKeyStr(arg1,arg2,arg3,arg4); - resultobj = SWIG_From_int((int)(result)); - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return resultobj; -fail: - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiZaxisDefKeyFlt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - double arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - double val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiZaxisDefKeyFlt", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiZaxisDefKeyFlt" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiZaxisDefKeyFlt" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "cdiZaxisDefKeyFlt" "', argument " "3"" of type '" "double""'"); - } - arg3 = (double)(val3); - result = (int)cdiZaxisDefKeyFlt(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_cdiZaxisInqKeyFlt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - double *arg3 = (double *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "cdiZaxisInqKeyFlt", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "cdiZaxisInqKeyFlt" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "cdiZaxisInqKeyFlt" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "cdiZaxisInqKeyFlt" "', argument " "3"" of type '" "double *""'"); - } - arg3 = (double *)(argp3); - result = (int)cdiZaxisInqKeyFlt(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefXname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefXname", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefXname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridDefXname" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - gridDefXname(arg1,(char const *)arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqXname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridInqXname", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqXname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqXname" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - gridInqXname(arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefXlongname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefXlongname", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefXlongname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridDefXlongname" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - gridDefXlongname(arg1,(char const *)arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqXlongname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridInqXlongname", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqXlongname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqXlongname" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - gridInqXlongname(arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefXunits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefXunits", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefXunits" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridDefXunits" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - gridDefXunits(arg1,(char const *)arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqXunits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridInqXunits", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqXunits" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqXunits" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - gridInqXunits(arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefYname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefYname", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefYname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridDefYname" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - gridDefYname(arg1,(char const *)arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqYname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridInqYname", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqYname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqYname" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - gridInqYname(arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefYlongname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefYlongname", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefYlongname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridDefYlongname" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - gridDefYlongname(arg1,(char const *)arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqYlongname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridInqYlongname", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqYlongname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqYlongname" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - gridInqYlongname(arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefYunits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefYunits", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefYunits" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridDefYunits" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - gridDefYunits(arg1,(char const *)arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqYunits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridInqYunits", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqYunits" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqYunits" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - gridInqYunits(arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqXstdname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridInqXstdname", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqXstdname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqXstdname" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - gridInqXstdname(arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqYstdname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridInqYstdname", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqYstdname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqYstdname" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - gridInqYstdname(arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefDatatype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefDatatype", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefDatatype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefDatatype" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - gridDefDatatype(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqDatatype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqDatatype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridInqDatatype(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqXval(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - size_t arg2 ; - int val1 ; - int ecode1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - double result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqXval", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqXval" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridInqXval" "', argument " "2"" of type '" "size_t""'"); - } - arg2 = (size_t)(val2); - result = (double)gridInqXval(arg1,arg2); - resultobj = SWIG_From_double((double)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqYval(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - size_t arg2 ; - int val1 ; - int ecode1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - double result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqYval", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqYval" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridInqYval" "', argument " "2"" of type '" "size_t""'"); - } - arg2 = (size_t)(val2); - result = (double)gridInqYval(arg1,arg2); - resultobj = SWIG_From_double((double)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqXinc(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - double result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqXinc" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (double)gridInqXinc(arg1); - resultobj = SWIG_From_double((double)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqYinc(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - double result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqYinc" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (double)gridInqYinc(arg1); - resultobj = SWIG_From_double((double)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridIsCircular(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridIsCircular" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridIsCircular(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqTrunc(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqTrunc" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridInqTrunc(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefTrunc(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefTrunc", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefTrunc" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefTrunc" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - gridDefTrunc(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefNumber(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefNumber", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefNumber" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefNumber" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - gridDefNumber(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqNumber(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqNumber" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridInqNumber(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefPosition(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefPosition", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefPosition" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefPosition" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - gridDefPosition(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqPosition(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqPosition" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridInqPosition(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefReference(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefReference", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefReference" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridDefReference" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - gridDefReference(arg1,(char const *)arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqReference(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqReference", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqReference" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqReference" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - result = (int)gridInqReference(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefUUID(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - unsigned char *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefUUID", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefUUID" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_unsigned_char, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridDefUUID" "', argument " "2"" of type '" "unsigned char const [16]""'"); - } - arg2 = (unsigned char *)(argp2); - gridDefUUID(arg1,(unsigned char const (*))arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqUUID(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - unsigned char *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridInqUUID", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqUUID" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_unsigned_char, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqUUID" "', argument " "2"" of type '" "unsigned char [16]""'"); - } - arg2 = (unsigned char *)(argp2); - gridInqUUID(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefParamRLL(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double arg2 ; - double arg3 ; - double arg4 ; - int val1 ; - int ecode1 = 0 ; - double val2 ; - int ecode2 = 0 ; - double val3 ; - int ecode3 = 0 ; - double val4 ; - int ecode4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefParamRLL", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefParamRLL" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefParamRLL" "', argument " "2"" of type '" "double""'"); - } - arg2 = (double)(val2); - ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "gridDefParamRLL" "', argument " "3"" of type '" "double""'"); - } - arg3 = (double)(val3); - ecode4 = SWIG_AsVal_double(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "gridDefParamRLL" "', argument " "4"" of type '" "double""'"); - } - arg4 = (double)(val4); - gridDefParamRLL(arg1,arg2,arg3,arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqParamRLL(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 = (double *) 0 ; - double *arg3 = (double *) 0 ; - double *arg4 = (double *) 0 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - - if (!SWIG_Python_UnpackTuple(args, "gridInqParamRLL", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqParamRLL" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqParamRLL" "', argument " "2"" of type '" "double *""'"); - } - arg2 = (double *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "gridInqParamRLL" "', argument " "3"" of type '" "double *""'"); - } - arg3 = (double *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "gridInqParamRLL" "', argument " "4"" of type '" "double *""'"); - } - arg4 = (double *)(argp4); - gridInqParamRLL(arg1,arg2,arg3,arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefParamGME(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int arg4 ; - int arg5 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int val4 ; - int ecode4 = 0 ; - int val5 ; - int ecode5 = 0 ; - PyObject *swig_obj[5] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefParamGME", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefParamGME" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefParamGME" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "gridDefParamGME" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "gridDefParamGME" "', argument " "4"" of type '" "int""'"); - } - arg4 = (int)(val4); - ecode5 = SWIG_AsVal_int(swig_obj[4], &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "gridDefParamGME" "', argument " "5"" of type '" "int""'"); - } - arg5 = (int)(val5); - gridDefParamGME(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqParamGME(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int *arg2 = (int *) 0 ; - int *arg3 = (int *) 0 ; - int *arg4 = (int *) 0 ; - int *arg5 = (int *) 0 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - void *argp5 = 0 ; - int res5 = 0 ; - PyObject *swig_obj[5] ; - - if (!SWIG_Python_UnpackTuple(args, "gridInqParamGME", 5, 5, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqParamGME" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqParamGME" "', argument " "2"" of type '" "int *""'"); - } - arg2 = (int *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "gridInqParamGME" "', argument " "3"" of type '" "int *""'"); - } - arg3 = (int *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "gridInqParamGME" "', argument " "4"" of type '" "int *""'"); - } - arg4 = (int *)(argp4); - res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "gridInqParamGME" "', argument " "5"" of type '" "int *""'"); - } - arg5 = (int *)(argp5); - gridInqParamGME(arg1,arg2,arg3,arg4,arg5); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefParamLCC(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double arg2 ; - double arg3 ; - double arg4 ; - double arg5 ; - double arg6 ; - double arg7 ; - double arg8 ; - double arg9 ; - double arg10 ; - double arg11 ; - double arg12 ; - int val1 ; - int ecode1 = 0 ; - double val2 ; - int ecode2 = 0 ; - double val3 ; - int ecode3 = 0 ; - double val4 ; - int ecode4 = 0 ; - double val5 ; - int ecode5 = 0 ; - double val6 ; - int ecode6 = 0 ; - double val7 ; - int ecode7 = 0 ; - double val8 ; - int ecode8 = 0 ; - double val9 ; - int ecode9 = 0 ; - double val10 ; - int ecode10 = 0 ; - double val11 ; - int ecode11 = 0 ; - double val12 ; - int ecode12 = 0 ; - PyObject *swig_obj[12] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefParamLCC", 12, 12, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefParamLCC" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefParamLCC" "', argument " "2"" of type '" "double""'"); - } - arg2 = (double)(val2); - ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "gridDefParamLCC" "', argument " "3"" of type '" "double""'"); - } - arg3 = (double)(val3); - ecode4 = SWIG_AsVal_double(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "gridDefParamLCC" "', argument " "4"" of type '" "double""'"); - } - arg4 = (double)(val4); - ecode5 = SWIG_AsVal_double(swig_obj[4], &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "gridDefParamLCC" "', argument " "5"" of type '" "double""'"); - } - arg5 = (double)(val5); - ecode6 = SWIG_AsVal_double(swig_obj[5], &val6); - if (!SWIG_IsOK(ecode6)) { - SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "gridDefParamLCC" "', argument " "6"" of type '" "double""'"); - } - arg6 = (double)(val6); - ecode7 = SWIG_AsVal_double(swig_obj[6], &val7); - if (!SWIG_IsOK(ecode7)) { - SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "gridDefParamLCC" "', argument " "7"" of type '" "double""'"); - } - arg7 = (double)(val7); - ecode8 = SWIG_AsVal_double(swig_obj[7], &val8); - if (!SWIG_IsOK(ecode8)) { - SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "gridDefParamLCC" "', argument " "8"" of type '" "double""'"); - } - arg8 = (double)(val8); - ecode9 = SWIG_AsVal_double(swig_obj[8], &val9); - if (!SWIG_IsOK(ecode9)) { - SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "gridDefParamLCC" "', argument " "9"" of type '" "double""'"); - } - arg9 = (double)(val9); - ecode10 = SWIG_AsVal_double(swig_obj[9], &val10); - if (!SWIG_IsOK(ecode10)) { - SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "gridDefParamLCC" "', argument " "10"" of type '" "double""'"); - } - arg10 = (double)(val10); - ecode11 = SWIG_AsVal_double(swig_obj[10], &val11); - if (!SWIG_IsOK(ecode11)) { - SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "gridDefParamLCC" "', argument " "11"" of type '" "double""'"); - } - arg11 = (double)(val11); - ecode12 = SWIG_AsVal_double(swig_obj[11], &val12); - if (!SWIG_IsOK(ecode12)) { - SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "gridDefParamLCC" "', argument " "12"" of type '" "double""'"); - } - arg12 = (double)(val12); - gridDefParamLCC(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqParamLCC(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double arg2 ; - double *arg3 = (double *) 0 ; - double *arg4 = (double *) 0 ; - double *arg5 = (double *) 0 ; - double *arg6 = (double *) 0 ; - double *arg7 = (double *) 0 ; - double *arg8 = (double *) 0 ; - double *arg9 = (double *) 0 ; - double *arg10 = (double *) 0 ; - double *arg11 = (double *) 0 ; - double *arg12 = (double *) 0 ; - int val1 ; - int ecode1 = 0 ; - double val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - void *argp5 = 0 ; - int res5 = 0 ; - void *argp6 = 0 ; - int res6 = 0 ; - void *argp7 = 0 ; - int res7 = 0 ; - void *argp8 = 0 ; - int res8 = 0 ; - void *argp9 = 0 ; - int res9 = 0 ; - void *argp10 = 0 ; - int res10 = 0 ; - void *argp11 = 0 ; - int res11 = 0 ; - void *argp12 = 0 ; - int res12 = 0 ; - PyObject *swig_obj[12] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqParamLCC", 12, 12, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqParamLCC" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridInqParamLCC" "', argument " "2"" of type '" "double""'"); - } - arg2 = (double)(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "gridInqParamLCC" "', argument " "3"" of type '" "double *""'"); - } - arg3 = (double *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "gridInqParamLCC" "', argument " "4"" of type '" "double *""'"); - } - arg4 = (double *)(argp4); - res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "gridInqParamLCC" "', argument " "5"" of type '" "double *""'"); - } - arg5 = (double *)(argp5); - res6 = SWIG_ConvertPtr(swig_obj[5], &argp6,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res6)) { - SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "gridInqParamLCC" "', argument " "6"" of type '" "double *""'"); - } - arg6 = (double *)(argp6); - res7 = SWIG_ConvertPtr(swig_obj[6], &argp7,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res7)) { - SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "gridInqParamLCC" "', argument " "7"" of type '" "double *""'"); - } - arg7 = (double *)(argp7); - res8 = SWIG_ConvertPtr(swig_obj[7], &argp8,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res8)) { - SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "gridInqParamLCC" "', argument " "8"" of type '" "double *""'"); - } - arg8 = (double *)(argp8); - res9 = SWIG_ConvertPtr(swig_obj[8], &argp9,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res9)) { - SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "gridInqParamLCC" "', argument " "9"" of type '" "double *""'"); - } - arg9 = (double *)(argp9); - res10 = SWIG_ConvertPtr(swig_obj[9], &argp10,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res10)) { - SWIG_exception_fail(SWIG_ArgError(res10), "in method '" "gridInqParamLCC" "', argument " "10"" of type '" "double *""'"); - } - arg10 = (double *)(argp10); - res11 = SWIG_ConvertPtr(swig_obj[10], &argp11,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res11)) { - SWIG_exception_fail(SWIG_ArgError(res11), "in method '" "gridInqParamLCC" "', argument " "11"" of type '" "double *""'"); - } - arg11 = (double *)(argp11); - res12 = SWIG_ConvertPtr(swig_obj[11], &argp12,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res12)) { - SWIG_exception_fail(SWIG_ArgError(res12), "in method '" "gridInqParamLCC" "', argument " "12"" of type '" "double *""'"); - } - arg12 = (double *)(argp12); - result = (int)gridInqParamLCC(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefParamSTERE(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double arg2 ; - double arg3 ; - double arg4 ; - double arg5 ; - double arg6 ; - double arg7 ; - double arg8 ; - double arg9 ; - double arg10 ; - int val1 ; - int ecode1 = 0 ; - double val2 ; - int ecode2 = 0 ; - double val3 ; - int ecode3 = 0 ; - double val4 ; - int ecode4 = 0 ; - double val5 ; - int ecode5 = 0 ; - double val6 ; - int ecode6 = 0 ; - double val7 ; - int ecode7 = 0 ; - double val8 ; - int ecode8 = 0 ; - double val9 ; - int ecode9 = 0 ; - double val10 ; - int ecode10 = 0 ; - PyObject *swig_obj[10] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefParamSTERE", 10, 10, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefParamSTERE" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefParamSTERE" "', argument " "2"" of type '" "double""'"); - } - arg2 = (double)(val2); - ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "gridDefParamSTERE" "', argument " "3"" of type '" "double""'"); - } - arg3 = (double)(val3); - ecode4 = SWIG_AsVal_double(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "gridDefParamSTERE" "', argument " "4"" of type '" "double""'"); - } - arg4 = (double)(val4); - ecode5 = SWIG_AsVal_double(swig_obj[4], &val5); - if (!SWIG_IsOK(ecode5)) { - SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "gridDefParamSTERE" "', argument " "5"" of type '" "double""'"); - } - arg5 = (double)(val5); - ecode6 = SWIG_AsVal_double(swig_obj[5], &val6); - if (!SWIG_IsOK(ecode6)) { - SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "gridDefParamSTERE" "', argument " "6"" of type '" "double""'"); - } - arg6 = (double)(val6); - ecode7 = SWIG_AsVal_double(swig_obj[6], &val7); - if (!SWIG_IsOK(ecode7)) { - SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "gridDefParamSTERE" "', argument " "7"" of type '" "double""'"); - } - arg7 = (double)(val7); - ecode8 = SWIG_AsVal_double(swig_obj[7], &val8); - if (!SWIG_IsOK(ecode8)) { - SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "gridDefParamSTERE" "', argument " "8"" of type '" "double""'"); - } - arg8 = (double)(val8); - ecode9 = SWIG_AsVal_double(swig_obj[8], &val9); - if (!SWIG_IsOK(ecode9)) { - SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "gridDefParamSTERE" "', argument " "9"" of type '" "double""'"); - } - arg9 = (double)(val9); - ecode10 = SWIG_AsVal_double(swig_obj[9], &val10); - if (!SWIG_IsOK(ecode10)) { - SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "gridDefParamSTERE" "', argument " "10"" of type '" "double""'"); - } - arg10 = (double)(val10); - gridDefParamSTERE(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqParamSTERE(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double arg2 ; - double *arg3 = (double *) 0 ; - double *arg4 = (double *) 0 ; - double *arg5 = (double *) 0 ; - double *arg6 = (double *) 0 ; - double *arg7 = (double *) 0 ; - double *arg8 = (double *) 0 ; - double *arg9 = (double *) 0 ; - double *arg10 = (double *) 0 ; - int val1 ; - int ecode1 = 0 ; - double val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - void *argp5 = 0 ; - int res5 = 0 ; - void *argp6 = 0 ; - int res6 = 0 ; - void *argp7 = 0 ; - int res7 = 0 ; - void *argp8 = 0 ; - int res8 = 0 ; - void *argp9 = 0 ; - int res9 = 0 ; - void *argp10 = 0 ; - int res10 = 0 ; - PyObject *swig_obj[10] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqParamSTERE", 10, 10, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqParamSTERE" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridInqParamSTERE" "', argument " "2"" of type '" "double""'"); - } - arg2 = (double)(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "gridInqParamSTERE" "', argument " "3"" of type '" "double *""'"); - } - arg3 = (double *)(argp3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "gridInqParamSTERE" "', argument " "4"" of type '" "double *""'"); - } - arg4 = (double *)(argp4); - res5 = SWIG_ConvertPtr(swig_obj[4], &argp5,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "gridInqParamSTERE" "', argument " "5"" of type '" "double *""'"); - } - arg5 = (double *)(argp5); - res6 = SWIG_ConvertPtr(swig_obj[5], &argp6,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res6)) { - SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "gridInqParamSTERE" "', argument " "6"" of type '" "double *""'"); - } - arg6 = (double *)(argp6); - res7 = SWIG_ConvertPtr(swig_obj[6], &argp7,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res7)) { - SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "gridInqParamSTERE" "', argument " "7"" of type '" "double *""'"); - } - arg7 = (double *)(argp7); - res8 = SWIG_ConvertPtr(swig_obj[7], &argp8,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res8)) { - SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "gridInqParamSTERE" "', argument " "8"" of type '" "double *""'"); - } - arg8 = (double *)(argp8); - res9 = SWIG_ConvertPtr(swig_obj[8], &argp9,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res9)) { - SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "gridInqParamSTERE" "', argument " "9"" of type '" "double *""'"); - } - arg9 = (double *)(argp9); - res10 = SWIG_ConvertPtr(swig_obj[9], &argp10,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res10)) { - SWIG_exception_fail(SWIG_ArgError(res10), "in method '" "gridInqParamSTERE" "', argument " "10"" of type '" "double *""'"); - } - arg10 = (double *)(argp10); - result = (int)gridInqParamSTERE(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefArea(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefArea", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefArea" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridDefArea" "', argument " "2"" of type '" "double const []""'"); - } - arg2 = (double *)(argp2); - gridDefArea(arg1,(double const (*))arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqArea(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridInqArea", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqArea" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqArea" "', argument " "2"" of type '" "double []""'"); - } - arg2 = (double *)(argp2); - gridInqArea(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridHasArea(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridHasArea" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridHasArea(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefNvertex(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefNvertex", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefNvertex" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefNvertex" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - gridDefNvertex(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqNvertex(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqNvertex" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridInqNvertex(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefXbounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefXbounds", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefXbounds" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridDefXbounds" "', argument " "2"" of type '" "double const []""'"); - } - arg2 = (double *)(argp2); - gridDefXbounds(arg1,(double const (*))arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqXbounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - size_t result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqXbounds", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqXbounds" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqXbounds" "', argument " "2"" of type '" "double []""'"); - } - arg2 = (double *)(argp2); - result = gridInqXbounds(arg1,arg2); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqXboundsPart(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - size_t arg3 ; - double *arg4 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - size_t val3 ; - int ecode3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - size_t result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqXboundsPart", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqXboundsPart" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridInqXboundsPart" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "gridInqXboundsPart" "', argument " "3"" of type '" "size_t""'"); - } - arg3 = (size_t)(val3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "gridInqXboundsPart" "', argument " "4"" of type '" "double []""'"); - } - arg4 = (double *)(argp4); - result = gridInqXboundsPart(arg1,arg2,arg3,arg4); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefYbounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefYbounds", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefYbounds" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridDefYbounds" "', argument " "2"" of type '" "double const []""'"); - } - arg2 = (double *)(argp2); - gridDefYbounds(arg1,(double const (*))arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqYbounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - size_t result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqYbounds", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqYbounds" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqYbounds" "', argument " "2"" of type '" "double []""'"); - } - arg2 = (double *)(argp2); - result = gridInqYbounds(arg1,arg2); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqYboundsPart(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - size_t arg3 ; - double *arg4 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - size_t val3 ; - int ecode3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - size_t result; - - if (!SWIG_Python_UnpackTuple(args, "gridInqYboundsPart", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqYboundsPart" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridInqYboundsPart" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "gridInqYboundsPart" "', argument " "3"" of type '" "size_t""'"); - } - arg3 = (size_t)(val3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "gridInqYboundsPart" "', argument " "4"" of type '" "double []""'"); - } - arg4 = (double *)(argp4); - result = gridInqYboundsPart(arg1,arg2,arg3,arg4); - resultobj = SWIG_From_size_t((size_t)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefReducedPoints(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int *arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefReducedPoints", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefReducedPoints" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefReducedPoints" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "gridDefReducedPoints" "', argument " "3"" of type '" "int const []""'"); - } - arg3 = (int *)(argp3); - gridDefReducedPoints(arg1,arg2,(int const (*))arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqReducedPoints(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridInqReducedPoints", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqReducedPoints" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gridInqReducedPoints" "', argument " "2"" of type '" "int []""'"); - } - arg2 = (int *)(argp2); - gridInqReducedPoints(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridChangeType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridChangeType", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridChangeType" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridChangeType" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - gridChangeType(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefComplexPacking(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefComplexPacking", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefComplexPacking" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefComplexPacking" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - gridDefComplexPacking(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqComplexPacking(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqComplexPacking" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridInqComplexPacking(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridDefScanningMode(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "gridDefScanningMode", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridDefScanningMode" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "gridDefScanningMode" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - gridDefScanningMode(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gridInqScanningMode(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "gridInqScanningMode" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)gridInqScanningMode(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisName(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisName", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisName" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisName" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - zaxisName(arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisNamePtr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisNamePtr" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (char *)zaxisNamePtr(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisCreate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "zaxisCreate", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisCreate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "zaxisCreate" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)zaxisCreate(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDestroy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDestroy" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - zaxisDestroy(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqType" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)zaxisInqType(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqSize" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)zaxisInqSize(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDuplicate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDuplicate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)zaxisDuplicate(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefLevels(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefLevels", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefLevels" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisDefLevels" "', argument " "2"" of type '" "double const []""'"); - } - arg2 = (double *)(argp2); - zaxisDefLevels(arg1,(double const (*))arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefCvals(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char **arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefCvals", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefCvals" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_p_char, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisDefCvals" "', argument " "2"" of type '" "char const *[]""'"); - } - arg2 = (char **)(argp2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "zaxisDefCvals" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - zaxisDefCvals(arg1,(char const *(*))arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqLevels(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "zaxisInqLevels", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqLevels" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisInqLevels" "', argument " "2"" of type '" "double []""'"); - } - arg2 = (double *)(argp2); - result = (int)zaxisInqLevels(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqCLen(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqCLen" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)zaxisInqCLen(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqCVals(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char ***arg2 = (char ***) 0 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "zaxisInqCVals", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqCVals" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_p_p_char, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisInqCVals" "', argument " "2"" of type '" "char ***""'"); - } - arg2 = (char ***)(argp2); - result = (int)zaxisInqCVals(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefLevel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - double arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - double val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefLevel", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefLevel" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "zaxisDefLevel" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "zaxisDefLevel" "', argument " "3"" of type '" "double""'"); - } - arg3 = (double)(val3); - zaxisDefLevel(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqLevel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - double result; - - if (!SWIG_Python_UnpackTuple(args, "zaxisInqLevel", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqLevel" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "zaxisInqLevel" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (double)zaxisInqLevel(arg1,arg2); - resultobj = SWIG_From_double((double)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefNlevRef(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefNlevRef", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefNlevRef" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "zaxisDefNlevRef" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - zaxisDefNlevRef(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqNlevRef(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqNlevRef" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)zaxisInqNlevRef(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefNumber(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefNumber", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefNumber" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "zaxisDefNumber" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - zaxisDefNumber(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqNumber(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqNumber" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)zaxisInqNumber(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefUUID(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - unsigned char *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefUUID", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefUUID" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_unsigned_char, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisDefUUID" "', argument " "2"" of type '" "unsigned char const [16]""'"); - } - arg2 = (unsigned char *)(argp2); - zaxisDefUUID(arg1,(unsigned char const (*))arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqUUID(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - unsigned char *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisInqUUID", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqUUID" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_unsigned_char, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisInqUUID" "', argument " "2"" of type '" "unsigned char [16]""'"); - } - arg2 = (unsigned char *)(argp2); - zaxisInqUUID(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefName(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefName", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefName" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisDefName" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - zaxisDefName(arg1,(char const *)arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqName(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisInqName", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqName" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisInqName" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - zaxisInqName(arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefLongname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefLongname", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefLongname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisDefLongname" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - zaxisDefLongname(arg1,(char const *)arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqLongname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisInqLongname", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqLongname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisInqLongname" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - zaxisInqLongname(arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefUnits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefUnits", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefUnits" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisDefUnits" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = (char *)(buf2); - zaxisDefUnits(arg1,(char const *)arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqUnits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisInqUnits", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqUnits" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisInqUnits" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - zaxisInqUnits(arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqStdname(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisInqStdname", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqStdname" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisInqStdname" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - zaxisInqStdname(arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefDatatype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefDatatype", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefDatatype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "zaxisDefDatatype" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - zaxisDefDatatype(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqDatatype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqDatatype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)zaxisInqDatatype(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefPositive(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefPositive", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefPositive" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "zaxisDefPositive" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - zaxisDefPositive(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqPositive(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqPositive" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)zaxisInqPositive(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefScalar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefScalar" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - zaxisDefScalar(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqScalar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqScalar" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)zaxisInqScalar(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefLtype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefLtype", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefLtype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "zaxisDefLtype" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - zaxisDefLtype(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqLtype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqLtype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)zaxisInqLtype(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefLtype2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefLtype2", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefLtype2" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "zaxisDefLtype2" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - zaxisDefLtype2(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqLtype2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqLtype2" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)zaxisInqLtype2(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefVct(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - double *arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefVct", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefVct" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "zaxisDefVct" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "zaxisDefVct" "', argument " "3"" of type '" "double const []""'"); - } - arg3 = (double *)(argp3); - zaxisDefVct(arg1,arg2,(double const (*))arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqVct(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisInqVct", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqVct" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisInqVct" "', argument " "2"" of type '" "double []""'"); - } - arg2 = (double *)(argp2); - zaxisInqVct(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqVctSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqVctSize" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)zaxisInqVctSize(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqVctPtr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - double *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqVctPtr" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (double *)zaxisInqVctPtr(arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefLbounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefLbounds", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefLbounds" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisDefLbounds" "', argument " "2"" of type '" "double const []""'"); - } - arg2 = (double *)(argp2); - zaxisDefLbounds(arg1,(double const (*))arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqLbounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "zaxisInqLbounds", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqLbounds" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisInqLbounds" "', argument " "2"" of type '" "double []""'"); - } - arg2 = (double *)(argp2); - result = (int)zaxisInqLbounds(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqLbound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - double result; - - if (!SWIG_Python_UnpackTuple(args, "zaxisInqLbound", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqLbound" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "zaxisInqLbound" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (double)zaxisInqLbound(arg1,arg2); - resultobj = SWIG_From_double((double)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefUbounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefUbounds", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefUbounds" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisDefUbounds" "', argument " "2"" of type '" "double const []""'"); - } - arg2 = (double *)(argp2); - zaxisDefUbounds(arg1,(double const (*))arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqUbounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "zaxisInqUbounds", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqUbounds" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisInqUbounds" "', argument " "2"" of type '" "double []""'"); - } - arg2 = (double *)(argp2); - result = (int)zaxisInqUbounds(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqUbound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - double result; - - if (!SWIG_Python_UnpackTuple(args, "zaxisInqUbound", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqUbound" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "zaxisInqUbound" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (double)zaxisInqUbound(arg1,arg2); - resultobj = SWIG_From_double((double)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisDefWeights(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisDefWeights", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisDefWeights" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisDefWeights" "', argument " "2"" of type '" "double const []""'"); - } - arg2 = (double *)(argp2); - zaxisDefWeights(arg1,(double const (*))arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisInqWeights(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double *arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "zaxisInqWeights", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisInqWeights" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "zaxisInqWeights" "', argument " "2"" of type '" "double []""'"); - } - arg2 = (double *)(argp2); - result = (int)zaxisInqWeights(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_zaxisChangeType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "zaxisChangeType", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "zaxisChangeType" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "zaxisChangeType" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - zaxisChangeType(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisCreate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisCreate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)taxisCreate(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDestroy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDestroy" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - taxisDestroy(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDuplicate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDuplicate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)taxisDuplicate(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisCopyTimestep(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisCopyTimestep", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisCopyTimestep" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "taxisCopyTimestep" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - taxisCopyTimestep(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDefType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisDefType", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDefType" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "taxisDefType" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - taxisDefType(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisInqType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisInqType" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)taxisInqType(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDefVdate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int64_t arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisDefVdate", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDefVdate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - { - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_int64_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "taxisDefVdate" "', argument " "2"" of type '" "int64_t""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "taxisDefVdate" "', argument " "2"" of type '" "int64_t""'"); - } else { - arg2 = *((int64_t *)(argp2)); - } - } - taxisDefVdate(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDefVtime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisDefVtime", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDefVtime" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "taxisDefVtime" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - taxisDefVtime(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisInqVdate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int64_t result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisInqVdate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = taxisInqVdate(arg1); - resultobj = SWIG_NewPointerObj((int64_t *)memcpy((int64_t *)calloc(1,sizeof(int64_t)),&result,sizeof(int64_t)), SWIGTYPE_p_int64_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisInqVtime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisInqVtime" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)taxisInqVtime(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDefRdate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int64_t arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisDefRdate", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDefRdate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - { - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_int64_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "taxisDefRdate" "', argument " "2"" of type '" "int64_t""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "taxisDefRdate" "', argument " "2"" of type '" "int64_t""'"); - } else { - arg2 = *((int64_t *)(argp2)); - } - } - taxisDefRdate(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDefRtime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisDefRtime", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDefRtime" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "taxisDefRtime" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - taxisDefRtime(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisInqRdate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int64_t result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisInqRdate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = taxisInqRdate(arg1); - resultobj = SWIG_NewPointerObj((int64_t *)memcpy((int64_t *)calloc(1,sizeof(int64_t)),&result,sizeof(int64_t)), SWIGTYPE_p_int64_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisInqRtime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisInqRtime" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)taxisInqRtime(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDefFdate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int64_t arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisDefFdate", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDefFdate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - { - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_int64_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "taxisDefFdate" "', argument " "2"" of type '" "int64_t""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "taxisDefFdate" "', argument " "2"" of type '" "int64_t""'"); - } else { - arg2 = *((int64_t *)(argp2)); - } - } - taxisDefFdate(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDefFtime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisDefFtime", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDefFtime" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "taxisDefFtime" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - taxisDefFtime(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisInqFdate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int64_t result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisInqFdate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = taxisInqFdate(arg1); - resultobj = SWIG_NewPointerObj((int64_t *)memcpy((int64_t *)calloc(1,sizeof(int64_t)),&result,sizeof(int64_t)), SWIGTYPE_p_int64_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisInqFtime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisInqFtime" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)taxisInqFtime(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisHasBounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisHasBounds" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)taxisHasBounds(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisWithBounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisWithBounds" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - taxisWithBounds(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDeleteBounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDeleteBounds" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - taxisDeleteBounds(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDefVdateBounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int64_t arg2 ; - int64_t arg3 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 ; - int res2 = 0 ; - void *argp3 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisDefVdateBounds", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDefVdateBounds" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - { - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_int64_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "taxisDefVdateBounds" "', argument " "2"" of type '" "int64_t""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "taxisDefVdateBounds" "', argument " "2"" of type '" "int64_t""'"); - } else { - arg2 = *((int64_t *)(argp2)); - } - } - { - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_int64_t, 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "taxisDefVdateBounds" "', argument " "3"" of type '" "int64_t""'"); - } - if (!argp3) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "taxisDefVdateBounds" "', argument " "3"" of type '" "int64_t""'"); - } else { - arg3 = *((int64_t *)(argp3)); - } - } - taxisDefVdateBounds(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDefVtimeBounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisDefVtimeBounds", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDefVtimeBounds" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "taxisDefVtimeBounds" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "taxisDefVtimeBounds" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - taxisDefVtimeBounds(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisInqVdateBounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int64_t *arg2 = (int64_t *) 0 ; - int64_t *arg3 = (int64_t *) 0 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisInqVdateBounds", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisInqVdateBounds" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int64_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "taxisInqVdateBounds" "', argument " "2"" of type '" "int64_t *""'"); - } - arg2 = (int64_t *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int64_t, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "taxisInqVdateBounds" "', argument " "3"" of type '" "int64_t *""'"); - } - arg3 = (int64_t *)(argp3); - taxisInqVdateBounds(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisInqVtimeBounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int *arg2 = (int *) 0 ; - int *arg3 = (int *) 0 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisInqVtimeBounds", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisInqVtimeBounds" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "taxisInqVtimeBounds" "', argument " "2"" of type '" "int *""'"); - } - arg2 = (int *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "taxisInqVtimeBounds" "', argument " "3"" of type '" "int *""'"); - } - arg3 = (int *)(argp3); - taxisInqVtimeBounds(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDefCalendar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisDefCalendar", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDefCalendar" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "taxisDefCalendar" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - taxisDefCalendar(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisInqCalendar(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisInqCalendar" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)taxisInqCalendar(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDefTunit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisDefTunit", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDefTunit" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "taxisDefTunit" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - taxisDefTunit(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisInqTunit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisInqTunit" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)taxisInqTunit(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDefForecastTunit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisDefForecastTunit", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDefForecastTunit" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "taxisDefForecastTunit" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - taxisDefForecastTunit(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisInqForecastTunit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisInqForecastTunit" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)taxisInqForecastTunit(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDefForecastPeriod(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - double arg2 ; - int val1 ; - int ecode1 = 0 ; - double val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisDefForecastPeriod", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDefForecastPeriod" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "taxisDefForecastPeriod" "', argument " "2"" of type '" "double""'"); - } - arg2 = (double)(val2); - taxisDefForecastPeriod(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisInqForecastPeriod(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - double result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisInqForecastPeriod" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (double)taxisInqForecastPeriod(arg1); - resultobj = SWIG_From_double((double)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisDefNumavg(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "taxisDefNumavg", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisDefNumavg" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "taxisDefNumavg" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - taxisDefNumavg(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_taxisInqNumavg(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "taxisInqNumavg" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)taxisInqNumavg(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_tunitNamePtr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "tunitNamePtr" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (char *)tunitNamePtr(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_institutDef(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - int res4 ; - char *buf4 = 0 ; - int alloc4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "institutDef", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "institutDef" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "institutDef" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "institutDef" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - res4 = SWIG_AsCharPtrAndSize(swig_obj[3], &buf4, NULL, &alloc4); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "institutDef" "', argument " "4"" of type '" "char const *""'"); - } - arg4 = (char *)(buf4); - result = (int)institutDef(arg1,arg2,(char const *)arg3,(char const *)arg4); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_institutInq(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - char *arg4 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - int res4 ; - char *buf4 = 0 ; - int alloc4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "institutInq", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "institutInq" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "institutInq" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "institutInq" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - res4 = SWIG_AsCharPtrAndSize(swig_obj[3], &buf4, NULL, &alloc4); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "institutInq" "', argument " "4"" of type '" "char const *""'"); - } - arg4 = (char *)(buf4); - result = (int)institutInq(arg1,arg2,(char const *)arg3,(char const *)arg4); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_institutInqNumber(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int result; - - if (!SWIG_Python_UnpackTuple(args, "institutInqNumber", 0, 0, 0)) SWIG_fail; - result = (int)institutInqNumber(); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_institutInqCenter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "institutInqCenter" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)institutInqCenter(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_institutInqSubcenter(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "institutInqSubcenter" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)institutInqSubcenter(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_institutInqNamePtr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "institutInqNamePtr" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (char *)institutInqNamePtr(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_institutInqLongnamePtr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "institutInqLongnamePtr" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (char *)institutInqLongnamePtr(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_modelDef(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "modelDef", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "modelDef" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "modelDef" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "modelDef" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - result = (int)modelDef(arg1,arg2,(char const *)arg3); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_modelInq(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "modelInq", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "modelInq" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "modelInq" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "modelInq" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - result = (int)modelInq(arg1,arg2,(char const *)arg3); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_modelInqInstitut(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "modelInqInstitut" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)modelInqInstitut(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_modelInqGribID(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "modelInqGribID" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)modelInqGribID(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_modelInqNamePtr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "modelInqNamePtr" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (char *)modelInqNamePtr(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_tableFWriteC(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - FILE *arg1 = (FILE *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "tableFWriteC", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_FILE, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tableFWriteC" "', argument " "1"" of type '" "FILE *""'"); - } - arg1 = (FILE *)(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "tableFWriteC" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - tableFWriteC(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_tableWrite(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int arg2 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "tableWrite", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tableWrite" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = (char *)(buf1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "tableWrite" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - tableWrite((char const *)arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_tableRead(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tableRead" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = (char *)(buf1); - result = (int)tableRead((char const *)arg1); - resultobj = SWIG_From_int((int)(result)); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_tableDef(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "tableDef", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "tableDef" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "tableDef" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "tableDef" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - result = (int)tableDef(arg1,arg2,(char const *)arg3); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_tableInqNamePtr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "tableInqNamePtr" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (char *)tableInqNamePtr(arg1); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_tableInq(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "tableInq", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "tableInq" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "tableInq" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "tableInq" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - result = (int)tableInq(arg1,arg2,(char const *)arg3); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_tableInqNumber(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int result; - - if (!SWIG_Python_UnpackTuple(args, "tableInqNumber", 0, 0, 0)) SWIG_fail; - result = (int)tableInqNumber(); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_tableInqNum(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "tableInqNum" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)tableInqNum(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_tableInqModel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "tableInqModel" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)tableInqModel(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_tableInqEntry(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - char *arg4 = (char *) 0 ; - char *arg5 = (char *) 0 ; - char *arg6 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - int res4 ; - char *buf4 = 0 ; - int alloc4 = 0 ; - int res5 ; - char *buf5 = 0 ; - int alloc5 = 0 ; - int res6 ; - char *buf6 = 0 ; - int alloc6 = 0 ; - PyObject *swig_obj[6] ; - - if (!SWIG_Python_UnpackTuple(args, "tableInqEntry", 6, 6, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "tableInqEntry" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "tableInqEntry" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "tableInqEntry" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - res4 = SWIG_AsCharPtrAndSize(swig_obj[3], &buf4, NULL, &alloc4); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "tableInqEntry" "', argument " "4"" of type '" "char *""'"); - } - arg4 = (char *)(buf4); - res5 = SWIG_AsCharPtrAndSize(swig_obj[4], &buf5, NULL, &alloc5); - if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "tableInqEntry" "', argument " "5"" of type '" "char *""'"); - } - arg5 = (char *)(buf5); - res6 = SWIG_AsCharPtrAndSize(swig_obj[5], &buf6, NULL, &alloc6); - if (!SWIG_IsOK(res6)) { - SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "tableInqEntry" "', argument " "6"" of type '" "char *""'"); - } - arg6 = (char *)(buf6); - tableInqEntry(arg1,arg2,arg3,arg4,arg5,arg6); - resultobj = SWIG_Py_Void(); - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - if (alloc5 == SWIG_NEWOBJ) free((char*)buf5); - if (alloc6 == SWIG_NEWOBJ) free((char*)buf6); - return resultobj; -fail: - if (alloc4 == SWIG_NEWOBJ) free((char*)buf4); - if (alloc5 == SWIG_NEWOBJ) free((char*)buf5); - if (alloc6 == SWIG_NEWOBJ) free((char*)buf6); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamDefHistory(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "streamDefHistory", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamDefHistory" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "streamDefHistory" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "streamDefHistory" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - streamDefHistory(arg1,arg2,(char const *)arg3); - resultobj = SWIG_Py_Void(); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamInqHistorySize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamInqHistorySize" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)streamInqHistorySize(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_streamInqHistoryString(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - char *arg2 = (char *) 0 ; - int val1 ; - int ecode1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "streamInqHistoryString", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "streamInqHistoryString" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "streamInqHistoryString" "', argument " "2"" of type '" "char *""'"); - } - arg2 = (char *)(buf2); - streamInqHistoryString(arg1,arg2); - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_subtypeCreate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "subtypeCreate" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)subtypeCreate(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_subtypePrint(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "subtypePrint" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - subtypePrint(arg1); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_subtypeCompare(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "subtypeCompare", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "subtypeCompare" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "subtypeCompare" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)subtypeCompare(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_subtypeInqSize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "subtypeInqSize" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)subtypeInqSize(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_subtypeInqActiveIndex(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "subtypeInqActiveIndex" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - result = (int)subtypeInqActiveIndex(arg1); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_subtypeDefActiveIndex(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "subtypeDefActiveIndex", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "subtypeDefActiveIndex" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "subtypeDefActiveIndex" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - subtypeDefActiveIndex(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_keyValuePair(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int arg2 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - subtype_query_t result; - - if (!SWIG_Python_UnpackTuple(args, "keyValuePair", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "keyValuePair" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = (char *)(buf1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "keyValuePair" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = keyValuePair((char const *)arg1,arg2); - resultobj = SWIG_NewPointerObj((subtype_query_t *)memcpy((subtype_query_t *)calloc(1,sizeof(subtype_query_t)),&result,sizeof(subtype_query_t)), SWIGTYPE_p_subtype_query_t, SWIG_POINTER_OWN | 0 ); - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_matchAND(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - subtype_query_t arg1 ; - subtype_query_t arg2 ; - void *argp1 ; - int res1 = 0 ; - void *argp2 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - subtype_query_t result; - - if (!SWIG_Python_UnpackTuple(args, "matchAND", 2, 2, swig_obj)) SWIG_fail; - { - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_subtype_query_t, 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "matchAND" "', argument " "1"" of type '" "subtype_query_t""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "matchAND" "', argument " "1"" of type '" "subtype_query_t""'"); - } else { - arg1 = *((subtype_query_t *)(argp1)); - } - } - { - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_subtype_query_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "matchAND" "', argument " "2"" of type '" "subtype_query_t""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "matchAND" "', argument " "2"" of type '" "subtype_query_t""'"); - } else { - arg2 = *((subtype_query_t *)(argp2)); - } - } - result = matchAND(arg1,arg2); - resultobj = SWIG_NewPointerObj((subtype_query_t *)memcpy((subtype_query_t *)calloc(1,sizeof(subtype_query_t)),&result,sizeof(subtype_query_t)), SWIGTYPE_p_subtype_query_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_subtypeInqSubEntry(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - subtype_query_t arg2 ; - int val1 ; - int ecode1 = 0 ; - void *argp2 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "subtypeInqSubEntry", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "subtypeInqSubEntry" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - { - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_subtype_query_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "subtypeInqSubEntry" "', argument " "2"" of type '" "subtype_query_t""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "subtypeInqSubEntry" "', argument " "2"" of type '" "subtype_query_t""'"); - } else { - arg2 = *((subtype_query_t *)(argp2)); - } - } - result = (int)subtypeInqSubEntry(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_subtypeInqTile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "subtypeInqTile", 3, 3, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "subtypeInqTile" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "subtypeInqTile" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "subtypeInqTile" "', argument " "3"" of type '" "int""'"); - } - arg3 = (int)(val3); - result = (int)subtypeInqTile(arg1,arg2,arg3); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_subtypeInqAttribute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - char *arg3 = (char *) 0 ; - int *arg4 = (int *) 0 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int res3 ; - char *buf3 = 0 ; - int alloc3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - PyObject *swig_obj[4] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "subtypeInqAttribute", 4, 4, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "subtypeInqAttribute" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "subtypeInqAttribute" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - res3 = SWIG_AsCharPtrAndSize(swig_obj[2], &buf3, NULL, &alloc3); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "subtypeInqAttribute" "', argument " "3"" of type '" "char const *""'"); - } - arg3 = (char *)(buf3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "subtypeInqAttribute" "', argument " "4"" of type '" "int *""'"); - } - arg4 = (int *)(argp4); - result = (int)subtypeInqAttribute(arg1,arg2,(char const *)arg3,arg4); - resultobj = SWIG_From_int((int)(result)); - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return resultobj; -fail: - if (alloc3 == SWIG_NEWOBJ) free((char*)buf3); - return NULL; -} - - -SWIGINTERN PyObject *_wrap_vlistInqVarSubtype(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - int result; - - if (!SWIG_Python_UnpackTuple(args, "vlistInqVarSubtype", 2, 2, swig_obj)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "vlistInqVarSubtype" "', argument " "1"" of type '" "int""'"); - } - arg1 = (int)(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "vlistInqVarSubtype" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - result = (int)vlistInqVarSubtype(arg1,arg2); - resultobj = SWIG_From_int((int)(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gribapiLibraryVersion(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - int *arg1 = (int *) 0 ; - int *arg2 = (int *) 0 ; - int *arg3 = (int *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "gribapiLibraryVersion", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "gribapiLibraryVersion" "', argument " "1"" of type '" "int *""'"); - } - arg1 = (int *)(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gribapiLibraryVersion" "', argument " "2"" of type '" "int *""'"); - } - arg2 = (int *)(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_int, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "gribapiLibraryVersion" "', argument " "3"" of type '" "int *""'"); - } - arg3 = (int *)(argp3); - gribapiLibraryVersion(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_gaussianLatitudes(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - double *arg1 = (double *) 0 ; - double *arg2 = (double *) 0 ; - size_t arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - size_t val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "gaussianLatitudes", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "gaussianLatitudes" "', argument " "1"" of type '" "double *""'"); - } - arg1 = (double *)(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "gaussianLatitudes" "', argument " "2"" of type '" "double *""'"); - } - arg2 = (double *)(argp2); - ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "gaussianLatitudes" "', argument " "3"" of type '" "size_t""'"); - } - arg3 = (size_t)(val3); - gaussianLatitudes(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -static PyMethodDef SwigMethods[] = { - { "SWIG_PyInstanceMethod_New", SWIG_PyInstanceMethod_New, METH_O, NULL}, - { "subtype_query_t_nAND_set", _wrap_subtype_query_t_nAND_set, METH_VARARGS, NULL}, - { "subtype_query_t_nAND_get", _wrap_subtype_query_t_nAND_get, METH_O, NULL}, - { "subtype_query_t_key_value_pairs_set", _wrap_subtype_query_t_key_value_pairs_set, METH_VARARGS, NULL}, - { "subtype_query_t_key_value_pairs_get", _wrap_subtype_query_t_key_value_pairs_get, METH_O, NULL}, - { "new_subtype_query_t", _wrap_new_subtype_query_t, METH_NOARGS, NULL}, - { "delete_subtype_query_t", _wrap_delete_subtype_query_t, METH_O, NULL}, - { "subtype_query_t_swigregister", subtype_query_t_swigregister, METH_O, NULL}, - { "subtype_query_t_swiginit", subtype_query_t_swiginit, METH_VARARGS, NULL}, - { "CdiParam_discipline_set", _wrap_CdiParam_discipline_set, METH_VARARGS, NULL}, - { "CdiParam_discipline_get", _wrap_CdiParam_discipline_get, METH_O, NULL}, - { "CdiParam_category_set", _wrap_CdiParam_category_set, METH_VARARGS, NULL}, - { "CdiParam_category_get", _wrap_CdiParam_category_get, METH_O, NULL}, - { "CdiParam_number_set", _wrap_CdiParam_number_set, METH_VARARGS, NULL}, - { "CdiParam_number_get", _wrap_CdiParam_number_get, METH_O, NULL}, - { "new_CdiParam", _wrap_new_CdiParam, METH_NOARGS, NULL}, - { "delete_CdiParam", _wrap_delete_CdiParam, METH_O, NULL}, - { "CdiParam_swigregister", CdiParam_swigregister, METH_O, NULL}, - { "CdiParam_swiginit", CdiParam_swiginit, METH_VARARGS, NULL}, - { "cdiReset", _wrap_cdiReset, METH_NOARGS, NULL}, - { "cdiStringError", _wrap_cdiStringError, METH_O, NULL}, - { "cdiDebug", _wrap_cdiDebug, METH_O, NULL}, - { "cdiLibraryVersion", _wrap_cdiLibraryVersion, METH_NOARGS, NULL}, - { "cdiPrintVersion", _wrap_cdiPrintVersion, METH_NOARGS, NULL}, - { "cdiHaveFiletype", _wrap_cdiHaveFiletype, METH_O, NULL}, - { "cdiDefMissval", _wrap_cdiDefMissval, METH_O, NULL}, - { "cdiInqMissval", _wrap_cdiInqMissval, METH_NOARGS, NULL}, - { "cdiInqGridMissval", _wrap_cdiInqGridMissval, METH_NOARGS, NULL}, - { "cdiDefGlobal", _wrap_cdiDefGlobal, METH_VARARGS, NULL}, - { "namespaceNew", _wrap_namespaceNew, METH_NOARGS, NULL}, - { "namespaceSetActive", _wrap_namespaceSetActive, METH_O, NULL}, - { "namespaceGetActive", _wrap_namespaceGetActive, METH_NOARGS, NULL}, - { "namespaceDelete", _wrap_namespaceDelete, METH_O, NULL}, - { "cdiParamToString", _wrap_cdiParamToString, METH_VARARGS, NULL}, - { "cdiDecodeParam", _wrap_cdiDecodeParam, METH_VARARGS, NULL}, - { "cdiEncodeParam", _wrap_cdiEncodeParam, METH_VARARGS, NULL}, - { "cdiDecodeDate", _wrap_cdiDecodeDate, METH_VARARGS, NULL}, - { "cdiEncodeDate", _wrap_cdiEncodeDate, METH_VARARGS, NULL}, - { "cdiDecodeTime", _wrap_cdiDecodeTime, METH_VARARGS, NULL}, - { "cdiEncodeTime", _wrap_cdiEncodeTime, METH_VARARGS, NULL}, - { "cdiGetFiletype", _wrap_cdiGetFiletype, METH_VARARGS, NULL}, - { "streamOpenRead", _wrap_streamOpenRead, METH_O, NULL}, - { "streamOpenWrite", _wrap_streamOpenWrite, METH_VARARGS, NULL}, - { "streamOpenAppend", _wrap_streamOpenAppend, METH_O, NULL}, - { "streamClose", _wrap_streamClose, METH_O, NULL}, - { "streamSync", _wrap_streamSync, METH_O, NULL}, - { "streamDefNumWorker", _wrap_streamDefNumWorker, METH_VARARGS, NULL}, - { "streamDefVlist", _wrap_streamDefVlist, METH_VARARGS, NULL}, - { "streamInqVlist", _wrap_streamInqVlist, METH_O, NULL}, - { "streamInqFiletype", _wrap_streamInqFiletype, METH_O, NULL}, - { "streamDefByteorder", _wrap_streamDefByteorder, METH_VARARGS, NULL}, - { "streamInqByteorder", _wrap_streamInqByteorder, METH_O, NULL}, - { "streamDefCompType", _wrap_streamDefCompType, METH_VARARGS, NULL}, - { "streamInqCompType", _wrap_streamInqCompType, METH_O, NULL}, - { "streamDefCompLevel", _wrap_streamDefCompLevel, METH_VARARGS, NULL}, - { "streamInqCompLevel", _wrap_streamInqCompLevel, METH_O, NULL}, - { "streamDefTimestep", _wrap_streamDefTimestep, METH_VARARGS, NULL}, - { "streamInqTimestep", _wrap_streamInqTimestep, METH_VARARGS, NULL}, - { "streamInqCurTimestepID", _wrap_streamInqCurTimestepID, METH_O, NULL}, - { "streamFilename", _wrap_streamFilename, METH_O, NULL}, - { "streamFilesuffix", _wrap_streamFilesuffix, METH_O, NULL}, - { "streamNvals", _wrap_streamNvals, METH_O, NULL}, - { "streamInqNvars", _wrap_streamInqNvars, METH_O, NULL}, - { "streamWriteVar", _wrap_streamWriteVar, METH_VARARGS, NULL}, - { "streamWriteVarF", _wrap_streamWriteVarF, METH_VARARGS, NULL}, - { "streamReadVar", _wrap_streamReadVar, METH_VARARGS, NULL}, - { "streamReadVarF", _wrap_streamReadVarF, METH_VARARGS, NULL}, - { "streamReadVarPart", _wrap_streamReadVarPart, METH_VARARGS, NULL}, - { "streamWriteVarSlice", _wrap_streamWriteVarSlice, METH_VARARGS, NULL}, - { "streamWriteVarSliceF", _wrap_streamWriteVarSliceF, METH_VARARGS, NULL}, - { "streamReadVarSlicePart", _wrap_streamReadVarSlicePart, METH_VARARGS, NULL}, - { "streamReadVarSlice", _wrap_streamReadVarSlice, METH_VARARGS, NULL}, - { "streamReadVarSliceF", _wrap_streamReadVarSliceF, METH_VARARGS, NULL}, - { "streamWriteVarChunk", _wrap_streamWriteVarChunk, METH_VARARGS, NULL}, - { "streamDefRecord", _wrap_streamDefRecord, METH_VARARGS, NULL}, - { "streamInqRecord", _wrap_streamInqRecord, METH_VARARGS, NULL}, - { "streamWriteRecord", _wrap_streamWriteRecord, METH_VARARGS, NULL}, - { "streamWriteRecordF", _wrap_streamWriteRecordF, METH_VARARGS, NULL}, - { "streamReadRecord", _wrap_streamReadRecord, METH_VARARGS, NULL}, - { "streamReadRecordF", _wrap_streamReadRecordF, METH_VARARGS, NULL}, - { "streamCopyRecord", _wrap_streamCopyRecord, METH_VARARGS, NULL}, - { "streamInqGRIBinfo", _wrap_streamInqGRIBinfo, METH_VARARGS, NULL}, - { "cdiIterator_new", _wrap_cdiIterator_new, METH_O, NULL}, - { "cdiIterator_clone", _wrap_cdiIterator_clone, METH_O, NULL}, - { "cdiIterator_serialize", _wrap_cdiIterator_serialize, METH_O, NULL}, - { "cdiIterator_deserialize", _wrap_cdiIterator_deserialize, METH_O, NULL}, - { "cdiIterator_print", _wrap_cdiIterator_print, METH_VARARGS, NULL}, - { "cdiIterator_delete", _wrap_cdiIterator_delete, METH_O, NULL}, - { "cdiIterator_nextField", _wrap_cdiIterator_nextField, METH_O, NULL}, - { "cdiIterator_inqStartTime", _wrap_cdiIterator_inqStartTime, METH_O, NULL}, - { "cdiIterator_inqEndTime", _wrap_cdiIterator_inqEndTime, METH_O, NULL}, - { "cdiIterator_inqRTime", _wrap_cdiIterator_inqRTime, METH_O, NULL}, - { "cdiIterator_inqVTime", _wrap_cdiIterator_inqVTime, METH_O, NULL}, - { "cdiIterator_inqLevelType", _wrap_cdiIterator_inqLevelType, METH_VARARGS, NULL}, - { "cdiIterator_inqLevel", _wrap_cdiIterator_inqLevel, METH_VARARGS, NULL}, - { "cdiIterator_inqLevelUuid", _wrap_cdiIterator_inqLevelUuid, METH_VARARGS, NULL}, - { "cdiIterator_inqTile", _wrap_cdiIterator_inqTile, METH_VARARGS, NULL}, - { "cdiIterator_inqTileCount", _wrap_cdiIterator_inqTileCount, METH_VARARGS, NULL}, - { "cdiIterator_inqParam", _wrap_cdiIterator_inqParam, METH_O, NULL}, - { "cdiIterator_inqParamParts", _wrap_cdiIterator_inqParamParts, METH_VARARGS, NULL}, - { "cdiIterator_inqDatatype", _wrap_cdiIterator_inqDatatype, METH_O, NULL}, - { "cdiIterator_inqFiletype", _wrap_cdiIterator_inqFiletype, METH_O, NULL}, - { "cdiIterator_inqTsteptype", _wrap_cdiIterator_inqTsteptype, METH_O, NULL}, - { "cdiIterator_inqVariableName", _wrap_cdiIterator_inqVariableName, METH_O, NULL}, - { "cdiIterator_inqGridId", _wrap_cdiIterator_inqGridId, METH_O, NULL}, - { "cdiIterator_readField", _wrap_cdiIterator_readField, METH_VARARGS, NULL}, - { "cdiIterator_readFieldF", _wrap_cdiIterator_readFieldF, METH_VARARGS, NULL}, - { "cdiGribIterator_clone", _wrap_cdiGribIterator_clone, METH_O, NULL}, - { "cdiGribIterator_delete", _wrap_cdiGribIterator_delete, METH_O, NULL}, - { "cdiGribIterator_getLong", _wrap_cdiGribIterator_getLong, METH_VARARGS, NULL}, - { "cdiGribIterator_getDouble", _wrap_cdiGribIterator_getDouble, METH_VARARGS, NULL}, - { "cdiGribIterator_getLength", _wrap_cdiGribIterator_getLength, METH_VARARGS, NULL}, - { "cdiGribIterator_getString", _wrap_cdiGribIterator_getString, METH_VARARGS, NULL}, - { "cdiGribIterator_getSize", _wrap_cdiGribIterator_getSize, METH_VARARGS, NULL}, - { "cdiGribIterator_getLongArray", _wrap_cdiGribIterator_getLongArray, METH_VARARGS, NULL}, - { "cdiGribIterator_getDoubleArray", _wrap_cdiGribIterator_getDoubleArray, METH_VARARGS, NULL}, - { "cdiGribIterator_inqEdition", _wrap_cdiGribIterator_inqEdition, METH_O, NULL}, - { "cdiGribIterator_inqLongValue", _wrap_cdiGribIterator_inqLongValue, METH_VARARGS, NULL}, - { "cdiGribIterator_inqLongDefaultValue", _wrap_cdiGribIterator_inqLongDefaultValue, METH_VARARGS, NULL}, - { "cdiGribIterator_inqDoubleValue", _wrap_cdiGribIterator_inqDoubleValue, METH_VARARGS, NULL}, - { "cdiGribIterator_inqDoubleDefaultValue", _wrap_cdiGribIterator_inqDoubleDefaultValue, METH_VARARGS, NULL}, - { "cdiGribIterator_inqStringValue", _wrap_cdiGribIterator_inqStringValue, METH_VARARGS, NULL}, - { "vlistCreate", _wrap_vlistCreate, METH_NOARGS, NULL}, - { "vlistDestroy", _wrap_vlistDestroy, METH_O, NULL}, - { "vlistDuplicate", _wrap_vlistDuplicate, METH_O, NULL}, - { "vlistCopy", _wrap_vlistCopy, METH_VARARGS, NULL}, - { "vlistCopyFlag", _wrap_vlistCopyFlag, METH_VARARGS, NULL}, - { "vlistClearFlag", _wrap_vlistClearFlag, METH_O, NULL}, - { "vlistCat", _wrap_vlistCat, METH_VARARGS, NULL}, - { "vlistMerge", _wrap_vlistMerge, METH_VARARGS, NULL}, - { "vlistPrint", _wrap_vlistPrint, METH_O, NULL}, - { "vlistNumber", _wrap_vlistNumber, METH_O, NULL}, - { "vlistNvars", _wrap_vlistNvars, METH_O, NULL}, - { "vlistNgrids", _wrap_vlistNgrids, METH_O, NULL}, - { "vlistNzaxis", _wrap_vlistNzaxis, METH_O, NULL}, - { "vlistNsubtypes", _wrap_vlistNsubtypes, METH_O, NULL}, - { "vlistDefNtsteps", _wrap_vlistDefNtsteps, METH_VARARGS, NULL}, - { "vlistNtsteps", _wrap_vlistNtsteps, METH_O, NULL}, - { "vlistGridsizeMax", _wrap_vlistGridsizeMax, METH_O, NULL}, - { "vlistGrid", _wrap_vlistGrid, METH_VARARGS, NULL}, - { "vlistGridIndex", _wrap_vlistGridIndex, METH_VARARGS, NULL}, - { "vlistChangeGridIndex", _wrap_vlistChangeGridIndex, METH_VARARGS, NULL}, - { "vlistChangeGrid", _wrap_vlistChangeGrid, METH_VARARGS, NULL}, - { "vlistZaxis", _wrap_vlistZaxis, METH_VARARGS, NULL}, - { "vlistZaxisIndex", _wrap_vlistZaxisIndex, METH_VARARGS, NULL}, - { "vlistChangeZaxisIndex", _wrap_vlistChangeZaxisIndex, METH_VARARGS, NULL}, - { "vlistChangeZaxis", _wrap_vlistChangeZaxis, METH_VARARGS, NULL}, - { "vlistNrecs", _wrap_vlistNrecs, METH_O, NULL}, - { "vlistSubtype", _wrap_vlistSubtype, METH_VARARGS, NULL}, - { "vlistSubtypeIndex", _wrap_vlistSubtypeIndex, METH_VARARGS, NULL}, - { "vlistDefTaxis", _wrap_vlistDefTaxis, METH_VARARGS, NULL}, - { "vlistInqTaxis", _wrap_vlistInqTaxis, METH_O, NULL}, - { "vlistDefTable", _wrap_vlistDefTable, METH_VARARGS, NULL}, - { "vlistInqTable", _wrap_vlistInqTable, METH_O, NULL}, - { "vlistDefInstitut", _wrap_vlistDefInstitut, METH_VARARGS, NULL}, - { "vlistInqInstitut", _wrap_vlistInqInstitut, METH_O, NULL}, - { "vlistDefModel", _wrap_vlistDefModel, METH_VARARGS, NULL}, - { "vlistInqModel", _wrap_vlistInqModel, METH_O, NULL}, - { "vlistDefVarTiles", _wrap_vlistDefVarTiles, METH_VARARGS, NULL}, - { "vlistDefVar", _wrap_vlistDefVar, METH_VARARGS, NULL}, - { "vlistChangeVarGrid", _wrap_vlistChangeVarGrid, METH_VARARGS, NULL}, - { "vlistChangeVarZaxis", _wrap_vlistChangeVarZaxis, METH_VARARGS, NULL}, - { "vlistInqVar", _wrap_vlistInqVar, METH_VARARGS, NULL}, - { "vlistInqVarGrid", _wrap_vlistInqVarGrid, METH_VARARGS, NULL}, - { "vlistInqVarZaxis", _wrap_vlistInqVarZaxis, METH_VARARGS, NULL}, - { "vlistInqVarID", _wrap_vlistInqVarID, METH_VARARGS, NULL}, - { "vlistDefVarTimetype", _wrap_vlistDefVarTimetype, METH_VARARGS, NULL}, - { "vlistInqVarTimetype", _wrap_vlistInqVarTimetype, METH_VARARGS, NULL}, - { "vlistDefVarTsteptype", _wrap_vlistDefVarTsteptype, METH_VARARGS, NULL}, - { "vlistInqVarTsteptype", _wrap_vlistInqVarTsteptype, METH_VARARGS, NULL}, - { "vlistDefVarCompType", _wrap_vlistDefVarCompType, METH_VARARGS, NULL}, - { "vlistInqVarCompType", _wrap_vlistInqVarCompType, METH_VARARGS, NULL}, - { "vlistDefVarCompLevel", _wrap_vlistDefVarCompLevel, METH_VARARGS, NULL}, - { "vlistInqVarCompLevel", _wrap_vlistInqVarCompLevel, METH_VARARGS, NULL}, - { "vlistDefVarParam", _wrap_vlistDefVarParam, METH_VARARGS, NULL}, - { "vlistInqVarParam", _wrap_vlistInqVarParam, METH_VARARGS, NULL}, - { "vlistDefVarCode", _wrap_vlistDefVarCode, METH_VARARGS, NULL}, - { "vlistInqVarCode", _wrap_vlistInqVarCode, METH_VARARGS, NULL}, - { "vlistDefVarDatatype", _wrap_vlistDefVarDatatype, METH_VARARGS, NULL}, - { "vlistInqVarDatatype", _wrap_vlistInqVarDatatype, METH_VARARGS, NULL}, - { "vlistDefVarChunkType", _wrap_vlistDefVarChunkType, METH_VARARGS, NULL}, - { "vlistInqVarChunkType", _wrap_vlistInqVarChunkType, METH_VARARGS, NULL}, - { "vlistDefVarXYZ", _wrap_vlistDefVarXYZ, METH_VARARGS, NULL}, - { "vlistInqVarXYZ", _wrap_vlistInqVarXYZ, METH_VARARGS, NULL}, - { "vlistInqVarNumber", _wrap_vlistInqVarNumber, METH_VARARGS, NULL}, - { "vlistDefVarInstitut", _wrap_vlistDefVarInstitut, METH_VARARGS, NULL}, - { "vlistInqVarInstitut", _wrap_vlistInqVarInstitut, METH_VARARGS, NULL}, - { "vlistDefVarModel", _wrap_vlistDefVarModel, METH_VARARGS, NULL}, - { "vlistInqVarModel", _wrap_vlistInqVarModel, METH_VARARGS, NULL}, - { "vlistDefVarTable", _wrap_vlistDefVarTable, METH_VARARGS, NULL}, - { "vlistInqVarTable", _wrap_vlistInqVarTable, METH_VARARGS, NULL}, - { "vlistDefVarName", _wrap_vlistDefVarName, METH_VARARGS, NULL}, - { "vlistInqVarName", _wrap_vlistInqVarName, METH_VARARGS, NULL}, - { "vlistCopyVarName", _wrap_vlistCopyVarName, METH_VARARGS, NULL}, - { "vlistDefVarStdname", _wrap_vlistDefVarStdname, METH_VARARGS, NULL}, - { "vlistInqVarStdname", _wrap_vlistInqVarStdname, METH_VARARGS, NULL}, - { "vlistDefVarLongname", _wrap_vlistDefVarLongname, METH_VARARGS, NULL}, - { "vlistInqVarLongname", _wrap_vlistInqVarLongname, METH_VARARGS, NULL}, - { "vlistDefVarUnits", _wrap_vlistDefVarUnits, METH_VARARGS, NULL}, - { "vlistInqVarUnits", _wrap_vlistInqVarUnits, METH_VARARGS, NULL}, - { "vlistDefVarMissval", _wrap_vlistDefVarMissval, METH_VARARGS, NULL}, - { "vlistInqVarMissval", _wrap_vlistInqVarMissval, METH_VARARGS, NULL}, - { "vlistDefVarExtra", _wrap_vlistDefVarExtra, METH_VARARGS, NULL}, - { "vlistInqVarExtra", _wrap_vlistInqVarExtra, METH_VARARGS, NULL}, - { "vlistDefVarScalefactor", _wrap_vlistDefVarScalefactor, METH_VARARGS, NULL}, - { "vlistInqVarScalefactor", _wrap_vlistInqVarScalefactor, METH_VARARGS, NULL}, - { "vlistDefVarAddoffset", _wrap_vlistDefVarAddoffset, METH_VARARGS, NULL}, - { "vlistInqVarAddoffset", _wrap_vlistInqVarAddoffset, METH_VARARGS, NULL}, - { "vlistDefVarTimave", _wrap_vlistDefVarTimave, METH_VARARGS, NULL}, - { "vlistInqVarTimave", _wrap_vlistInqVarTimave, METH_VARARGS, NULL}, - { "vlistInqVarSize", _wrap_vlistInqVarSize, METH_VARARGS, NULL}, - { "vlistDefIndex", _wrap_vlistDefIndex, METH_VARARGS, NULL}, - { "vlistInqIndex", _wrap_vlistInqIndex, METH_VARARGS, NULL}, - { "vlistDefFlag", _wrap_vlistDefFlag, METH_VARARGS, NULL}, - { "vlistInqFlag", _wrap_vlistInqFlag, METH_VARARGS, NULL}, - { "vlistFindVar", _wrap_vlistFindVar, METH_VARARGS, NULL}, - { "vlistFindLevel", _wrap_vlistFindLevel, METH_VARARGS, NULL}, - { "vlistMergedVar", _wrap_vlistMergedVar, METH_VARARGS, NULL}, - { "vlistMergedLevel", _wrap_vlistMergedLevel, METH_VARARGS, NULL}, - { "cdiClearAdditionalKeys", _wrap_cdiClearAdditionalKeys, METH_NOARGS, NULL}, - { "cdiDefAdditionalKey", _wrap_cdiDefAdditionalKey, METH_O, NULL}, - { "vlistDefVarIntKey", _wrap_vlistDefVarIntKey, METH_VARARGS, NULL}, - { "vlistDefVarDblKey", _wrap_vlistDefVarDblKey, METH_VARARGS, NULL}, - { "vlistHasVarKey", _wrap_vlistHasVarKey, METH_VARARGS, NULL}, - { "vlistInqVarDblKey", _wrap_vlistInqVarDblKey, METH_VARARGS, NULL}, - { "vlistInqVarIntKey", _wrap_vlistInqVarIntKey, METH_VARARGS, NULL}, - { "cdiInqNatts", _wrap_cdiInqNatts, METH_VARARGS, NULL}, - { "cdiInqAtt", _wrap_cdiInqAtt, METH_VARARGS, NULL}, - { "cdiDelAtt", _wrap_cdiDelAtt, METH_VARARGS, NULL}, - { "cdiCopyAtts", _wrap_cdiCopyAtts, METH_VARARGS, NULL}, - { "cdiDefAttInt", _wrap_cdiDefAttInt, METH_VARARGS, NULL}, - { "cdiDefAttFlt", _wrap_cdiDefAttFlt, METH_VARARGS, NULL}, - { "cdiDefAttTxt", _wrap_cdiDefAttTxt, METH_VARARGS, NULL}, - { "cdiInqAttInt", _wrap_cdiInqAttInt, METH_VARARGS, NULL}, - { "cdiInqAttFlt", _wrap_cdiInqAttFlt, METH_VARARGS, NULL}, - { "cdiInqAttTxt", _wrap_cdiInqAttTxt, METH_VARARGS, NULL}, - { "gridName", _wrap_gridName, METH_VARARGS, NULL}, - { "gridNamePtr", _wrap_gridNamePtr, METH_O, NULL}, - { "gridCompress", _wrap_gridCompress, METH_O, NULL}, - { "gridDefMaskGME", _wrap_gridDefMaskGME, METH_VARARGS, NULL}, - { "gridInqMaskGME", _wrap_gridInqMaskGME, METH_VARARGS, NULL}, - { "gridDefMask", _wrap_gridDefMask, METH_VARARGS, NULL}, - { "gridInqMask", _wrap_gridInqMask, METH_VARARGS, NULL}, - { "gridCreate", _wrap_gridCreate, METH_VARARGS, NULL}, - { "gridDestroy", _wrap_gridDestroy, METH_O, NULL}, - { "gridDuplicate", _wrap_gridDuplicate, METH_O, NULL}, - { "gridDefProj", _wrap_gridDefProj, METH_VARARGS, NULL}, - { "gridInqProj", _wrap_gridInqProj, METH_O, NULL}, - { "gridInqProjType", _wrap_gridInqProjType, METH_O, NULL}, - { "gridInqType", _wrap_gridInqType, METH_O, NULL}, - { "gridInqSize", _wrap_gridInqSize, METH_O, NULL}, - { "gridDefXsize", _wrap_gridDefXsize, METH_VARARGS, NULL}, - { "gridInqXsize", _wrap_gridInqXsize, METH_O, NULL}, - { "gridDefYsize", _wrap_gridDefYsize, METH_VARARGS, NULL}, - { "gridInqYsize", _wrap_gridInqYsize, METH_O, NULL}, - { "gridDefNP", _wrap_gridDefNP, METH_VARARGS, NULL}, - { "gridInqNP", _wrap_gridInqNP, METH_O, NULL}, - { "gridDefXvals", _wrap_gridDefXvals, METH_VARARGS, NULL}, - { "gridInqXvals", _wrap_gridInqXvals, METH_VARARGS, NULL}, - { "gridInqXvalsPart", _wrap_gridInqXvalsPart, METH_VARARGS, NULL}, - { "gridInqXIsc", _wrap_gridInqXIsc, METH_O, NULL}, - { "gridInqXCvals", _wrap_gridInqXCvals, METH_VARARGS, NULL}, - { "gridDefYvals", _wrap_gridDefYvals, METH_VARARGS, NULL}, - { "gridInqYvals", _wrap_gridInqYvals, METH_VARARGS, NULL}, - { "gridInqYvalsPart", _wrap_gridInqYvalsPart, METH_VARARGS, NULL}, - { "gridInqYIsc", _wrap_gridInqYIsc, METH_O, NULL}, - { "gridInqYCvals", _wrap_gridInqYCvals, METH_VARARGS, NULL}, - { "cdiDefKeyInt", _wrap_cdiDefKeyInt, METH_VARARGS, NULL}, - { "cdiInqKeyInt", _wrap_cdiInqKeyInt, METH_VARARGS, NULL}, - { "cdiDefKeyBytes", _wrap_cdiDefKeyBytes, METH_VARARGS, NULL}, - { "cdiInqKeyBytes", _wrap_cdiInqKeyBytes, METH_VARARGS, NULL}, - { "cdiDefKeyString", _wrap_cdiDefKeyString, METH_VARARGS, NULL}, - { "cdiInqKeyString", _wrap_cdiInqKeyString, METH_VARARGS, NULL}, - { "cdiInqKeyLen", _wrap_cdiInqKeyLen, METH_VARARGS, NULL}, - { "cdiCopyKeys", _wrap_cdiCopyKeys, METH_VARARGS, NULL}, - { "cdiGridDefKeyStr", _wrap_cdiGridDefKeyStr, METH_VARARGS, NULL}, - { "cdiGridInqKeyStr", _wrap_cdiGridInqKeyStr, METH_VARARGS, NULL}, - { "cdiZaxisDefKeyStr", _wrap_cdiZaxisDefKeyStr, METH_VARARGS, NULL}, - { "cdiZaxisInqKeyStr", _wrap_cdiZaxisInqKeyStr, METH_VARARGS, NULL}, - { "cdiZaxisDefKeyFlt", _wrap_cdiZaxisDefKeyFlt, METH_VARARGS, NULL}, - { "cdiZaxisInqKeyFlt", _wrap_cdiZaxisInqKeyFlt, METH_VARARGS, NULL}, - { "gridDefXname", _wrap_gridDefXname, METH_VARARGS, NULL}, - { "gridInqXname", _wrap_gridInqXname, METH_VARARGS, NULL}, - { "gridDefXlongname", _wrap_gridDefXlongname, METH_VARARGS, NULL}, - { "gridInqXlongname", _wrap_gridInqXlongname, METH_VARARGS, NULL}, - { "gridDefXunits", _wrap_gridDefXunits, METH_VARARGS, NULL}, - { "gridInqXunits", _wrap_gridInqXunits, METH_VARARGS, NULL}, - { "gridDefYname", _wrap_gridDefYname, METH_VARARGS, NULL}, - { "gridInqYname", _wrap_gridInqYname, METH_VARARGS, NULL}, - { "gridDefYlongname", _wrap_gridDefYlongname, METH_VARARGS, NULL}, - { "gridInqYlongname", _wrap_gridInqYlongname, METH_VARARGS, NULL}, - { "gridDefYunits", _wrap_gridDefYunits, METH_VARARGS, NULL}, - { "gridInqYunits", _wrap_gridInqYunits, METH_VARARGS, NULL}, - { "gridInqXstdname", _wrap_gridInqXstdname, METH_VARARGS, NULL}, - { "gridInqYstdname", _wrap_gridInqYstdname, METH_VARARGS, NULL}, - { "gridDefDatatype", _wrap_gridDefDatatype, METH_VARARGS, NULL}, - { "gridInqDatatype", _wrap_gridInqDatatype, METH_O, NULL}, - { "gridInqXval", _wrap_gridInqXval, METH_VARARGS, NULL}, - { "gridInqYval", _wrap_gridInqYval, METH_VARARGS, NULL}, - { "gridInqXinc", _wrap_gridInqXinc, METH_O, NULL}, - { "gridInqYinc", _wrap_gridInqYinc, METH_O, NULL}, - { "gridIsCircular", _wrap_gridIsCircular, METH_O, NULL}, - { "gridInqTrunc", _wrap_gridInqTrunc, METH_O, NULL}, - { "gridDefTrunc", _wrap_gridDefTrunc, METH_VARARGS, NULL}, - { "gridDefNumber", _wrap_gridDefNumber, METH_VARARGS, NULL}, - { "gridInqNumber", _wrap_gridInqNumber, METH_O, NULL}, - { "gridDefPosition", _wrap_gridDefPosition, METH_VARARGS, NULL}, - { "gridInqPosition", _wrap_gridInqPosition, METH_O, NULL}, - { "gridDefReference", _wrap_gridDefReference, METH_VARARGS, NULL}, - { "gridInqReference", _wrap_gridInqReference, METH_VARARGS, NULL}, - { "gridDefUUID", _wrap_gridDefUUID, METH_VARARGS, NULL}, - { "gridInqUUID", _wrap_gridInqUUID, METH_VARARGS, NULL}, - { "gridDefParamRLL", _wrap_gridDefParamRLL, METH_VARARGS, NULL}, - { "gridInqParamRLL", _wrap_gridInqParamRLL, METH_VARARGS, NULL}, - { "gridDefParamGME", _wrap_gridDefParamGME, METH_VARARGS, NULL}, - { "gridInqParamGME", _wrap_gridInqParamGME, METH_VARARGS, NULL}, - { "gridDefParamLCC", _wrap_gridDefParamLCC, METH_VARARGS, NULL}, - { "gridInqParamLCC", _wrap_gridInqParamLCC, METH_VARARGS, NULL}, - { "gridDefParamSTERE", _wrap_gridDefParamSTERE, METH_VARARGS, NULL}, - { "gridInqParamSTERE", _wrap_gridInqParamSTERE, METH_VARARGS, NULL}, - { "gridDefArea", _wrap_gridDefArea, METH_VARARGS, NULL}, - { "gridInqArea", _wrap_gridInqArea, METH_VARARGS, NULL}, - { "gridHasArea", _wrap_gridHasArea, METH_O, NULL}, - { "gridDefNvertex", _wrap_gridDefNvertex, METH_VARARGS, NULL}, - { "gridInqNvertex", _wrap_gridInqNvertex, METH_O, NULL}, - { "gridDefXbounds", _wrap_gridDefXbounds, METH_VARARGS, NULL}, - { "gridInqXbounds", _wrap_gridInqXbounds, METH_VARARGS, NULL}, - { "gridInqXboundsPart", _wrap_gridInqXboundsPart, METH_VARARGS, NULL}, - { "gridDefYbounds", _wrap_gridDefYbounds, METH_VARARGS, NULL}, - { "gridInqYbounds", _wrap_gridInqYbounds, METH_VARARGS, NULL}, - { "gridInqYboundsPart", _wrap_gridInqYboundsPart, METH_VARARGS, NULL}, - { "gridDefReducedPoints", _wrap_gridDefReducedPoints, METH_VARARGS, NULL}, - { "gridInqReducedPoints", _wrap_gridInqReducedPoints, METH_VARARGS, NULL}, - { "gridChangeType", _wrap_gridChangeType, METH_VARARGS, NULL}, - { "gridDefComplexPacking", _wrap_gridDefComplexPacking, METH_VARARGS, NULL}, - { "gridInqComplexPacking", _wrap_gridInqComplexPacking, METH_O, NULL}, - { "gridDefScanningMode", _wrap_gridDefScanningMode, METH_VARARGS, NULL}, - { "gridInqScanningMode", _wrap_gridInqScanningMode, METH_O, NULL}, - { "zaxisName", _wrap_zaxisName, METH_VARARGS, NULL}, - { "zaxisNamePtr", _wrap_zaxisNamePtr, METH_O, NULL}, - { "zaxisCreate", _wrap_zaxisCreate, METH_VARARGS, NULL}, - { "zaxisDestroy", _wrap_zaxisDestroy, METH_O, NULL}, - { "zaxisInqType", _wrap_zaxisInqType, METH_O, NULL}, - { "zaxisInqSize", _wrap_zaxisInqSize, METH_O, NULL}, - { "zaxisDuplicate", _wrap_zaxisDuplicate, METH_O, NULL}, - { "zaxisDefLevels", _wrap_zaxisDefLevels, METH_VARARGS, NULL}, - { "zaxisDefCvals", _wrap_zaxisDefCvals, METH_VARARGS, NULL}, - { "zaxisInqLevels", _wrap_zaxisInqLevels, METH_VARARGS, NULL}, - { "zaxisInqCLen", _wrap_zaxisInqCLen, METH_O, NULL}, - { "zaxisInqCVals", _wrap_zaxisInqCVals, METH_VARARGS, NULL}, - { "zaxisDefLevel", _wrap_zaxisDefLevel, METH_VARARGS, NULL}, - { "zaxisInqLevel", _wrap_zaxisInqLevel, METH_VARARGS, NULL}, - { "zaxisDefNlevRef", _wrap_zaxisDefNlevRef, METH_VARARGS, NULL}, - { "zaxisInqNlevRef", _wrap_zaxisInqNlevRef, METH_O, NULL}, - { "zaxisDefNumber", _wrap_zaxisDefNumber, METH_VARARGS, NULL}, - { "zaxisInqNumber", _wrap_zaxisInqNumber, METH_O, NULL}, - { "zaxisDefUUID", _wrap_zaxisDefUUID, METH_VARARGS, NULL}, - { "zaxisInqUUID", _wrap_zaxisInqUUID, METH_VARARGS, NULL}, - { "zaxisDefName", _wrap_zaxisDefName, METH_VARARGS, NULL}, - { "zaxisInqName", _wrap_zaxisInqName, METH_VARARGS, NULL}, - { "zaxisDefLongname", _wrap_zaxisDefLongname, METH_VARARGS, NULL}, - { "zaxisInqLongname", _wrap_zaxisInqLongname, METH_VARARGS, NULL}, - { "zaxisDefUnits", _wrap_zaxisDefUnits, METH_VARARGS, NULL}, - { "zaxisInqUnits", _wrap_zaxisInqUnits, METH_VARARGS, NULL}, - { "zaxisInqStdname", _wrap_zaxisInqStdname, METH_VARARGS, NULL}, - { "zaxisDefDatatype", _wrap_zaxisDefDatatype, METH_VARARGS, NULL}, - { "zaxisInqDatatype", _wrap_zaxisInqDatatype, METH_O, NULL}, - { "zaxisDefPositive", _wrap_zaxisDefPositive, METH_VARARGS, NULL}, - { "zaxisInqPositive", _wrap_zaxisInqPositive, METH_O, NULL}, - { "zaxisDefScalar", _wrap_zaxisDefScalar, METH_O, NULL}, - { "zaxisInqScalar", _wrap_zaxisInqScalar, METH_O, NULL}, - { "zaxisDefLtype", _wrap_zaxisDefLtype, METH_VARARGS, NULL}, - { "zaxisInqLtype", _wrap_zaxisInqLtype, METH_O, NULL}, - { "zaxisDefLtype2", _wrap_zaxisDefLtype2, METH_VARARGS, NULL}, - { "zaxisInqLtype2", _wrap_zaxisInqLtype2, METH_O, NULL}, - { "zaxisDefVct", _wrap_zaxisDefVct, METH_VARARGS, NULL}, - { "zaxisInqVct", _wrap_zaxisInqVct, METH_VARARGS, NULL}, - { "zaxisInqVctSize", _wrap_zaxisInqVctSize, METH_O, NULL}, - { "zaxisInqVctPtr", _wrap_zaxisInqVctPtr, METH_O, NULL}, - { "zaxisDefLbounds", _wrap_zaxisDefLbounds, METH_VARARGS, NULL}, - { "zaxisInqLbounds", _wrap_zaxisInqLbounds, METH_VARARGS, NULL}, - { "zaxisInqLbound", _wrap_zaxisInqLbound, METH_VARARGS, NULL}, - { "zaxisDefUbounds", _wrap_zaxisDefUbounds, METH_VARARGS, NULL}, - { "zaxisInqUbounds", _wrap_zaxisInqUbounds, METH_VARARGS, NULL}, - { "zaxisInqUbound", _wrap_zaxisInqUbound, METH_VARARGS, NULL}, - { "zaxisDefWeights", _wrap_zaxisDefWeights, METH_VARARGS, NULL}, - { "zaxisInqWeights", _wrap_zaxisInqWeights, METH_VARARGS, NULL}, - { "zaxisChangeType", _wrap_zaxisChangeType, METH_VARARGS, NULL}, - { "taxisCreate", _wrap_taxisCreate, METH_O, NULL}, - { "taxisDestroy", _wrap_taxisDestroy, METH_O, NULL}, - { "taxisDuplicate", _wrap_taxisDuplicate, METH_O, NULL}, - { "taxisCopyTimestep", _wrap_taxisCopyTimestep, METH_VARARGS, NULL}, - { "taxisDefType", _wrap_taxisDefType, METH_VARARGS, NULL}, - { "taxisInqType", _wrap_taxisInqType, METH_O, NULL}, - { "taxisDefVdate", _wrap_taxisDefVdate, METH_VARARGS, NULL}, - { "taxisDefVtime", _wrap_taxisDefVtime, METH_VARARGS, NULL}, - { "taxisInqVdate", _wrap_taxisInqVdate, METH_O, NULL}, - { "taxisInqVtime", _wrap_taxisInqVtime, METH_O, NULL}, - { "taxisDefRdate", _wrap_taxisDefRdate, METH_VARARGS, NULL}, - { "taxisDefRtime", _wrap_taxisDefRtime, METH_VARARGS, NULL}, - { "taxisInqRdate", _wrap_taxisInqRdate, METH_O, NULL}, - { "taxisInqRtime", _wrap_taxisInqRtime, METH_O, NULL}, - { "taxisDefFdate", _wrap_taxisDefFdate, METH_VARARGS, NULL}, - { "taxisDefFtime", _wrap_taxisDefFtime, METH_VARARGS, NULL}, - { "taxisInqFdate", _wrap_taxisInqFdate, METH_O, NULL}, - { "taxisInqFtime", _wrap_taxisInqFtime, METH_O, NULL}, - { "taxisHasBounds", _wrap_taxisHasBounds, METH_O, NULL}, - { "taxisWithBounds", _wrap_taxisWithBounds, METH_O, NULL}, - { "taxisDeleteBounds", _wrap_taxisDeleteBounds, METH_O, NULL}, - { "taxisDefVdateBounds", _wrap_taxisDefVdateBounds, METH_VARARGS, NULL}, - { "taxisDefVtimeBounds", _wrap_taxisDefVtimeBounds, METH_VARARGS, NULL}, - { "taxisInqVdateBounds", _wrap_taxisInqVdateBounds, METH_VARARGS, NULL}, - { "taxisInqVtimeBounds", _wrap_taxisInqVtimeBounds, METH_VARARGS, NULL}, - { "taxisDefCalendar", _wrap_taxisDefCalendar, METH_VARARGS, NULL}, - { "taxisInqCalendar", _wrap_taxisInqCalendar, METH_O, NULL}, - { "taxisDefTunit", _wrap_taxisDefTunit, METH_VARARGS, NULL}, - { "taxisInqTunit", _wrap_taxisInqTunit, METH_O, NULL}, - { "taxisDefForecastTunit", _wrap_taxisDefForecastTunit, METH_VARARGS, NULL}, - { "taxisInqForecastTunit", _wrap_taxisInqForecastTunit, METH_O, NULL}, - { "taxisDefForecastPeriod", _wrap_taxisDefForecastPeriod, METH_VARARGS, NULL}, - { "taxisInqForecastPeriod", _wrap_taxisInqForecastPeriod, METH_O, NULL}, - { "taxisDefNumavg", _wrap_taxisDefNumavg, METH_VARARGS, NULL}, - { "taxisInqNumavg", _wrap_taxisInqNumavg, METH_O, NULL}, - { "tunitNamePtr", _wrap_tunitNamePtr, METH_O, NULL}, - { "institutDef", _wrap_institutDef, METH_VARARGS, NULL}, - { "institutInq", _wrap_institutInq, METH_VARARGS, NULL}, - { "institutInqNumber", _wrap_institutInqNumber, METH_NOARGS, NULL}, - { "institutInqCenter", _wrap_institutInqCenter, METH_O, NULL}, - { "institutInqSubcenter", _wrap_institutInqSubcenter, METH_O, NULL}, - { "institutInqNamePtr", _wrap_institutInqNamePtr, METH_O, NULL}, - { "institutInqLongnamePtr", _wrap_institutInqLongnamePtr, METH_O, NULL}, - { "modelDef", _wrap_modelDef, METH_VARARGS, NULL}, - { "modelInq", _wrap_modelInq, METH_VARARGS, NULL}, - { "modelInqInstitut", _wrap_modelInqInstitut, METH_O, NULL}, - { "modelInqGribID", _wrap_modelInqGribID, METH_O, NULL}, - { "modelInqNamePtr", _wrap_modelInqNamePtr, METH_O, NULL}, - { "tableFWriteC", _wrap_tableFWriteC, METH_VARARGS, NULL}, - { "tableWrite", _wrap_tableWrite, METH_VARARGS, NULL}, - { "tableRead", _wrap_tableRead, METH_O, NULL}, - { "tableDef", _wrap_tableDef, METH_VARARGS, NULL}, - { "tableInqNamePtr", _wrap_tableInqNamePtr, METH_O, NULL}, - { "tableInq", _wrap_tableInq, METH_VARARGS, NULL}, - { "tableInqNumber", _wrap_tableInqNumber, METH_NOARGS, NULL}, - { "tableInqNum", _wrap_tableInqNum, METH_O, NULL}, - { "tableInqModel", _wrap_tableInqModel, METH_O, NULL}, - { "tableInqEntry", _wrap_tableInqEntry, METH_VARARGS, NULL}, - { "streamDefHistory", _wrap_streamDefHistory, METH_VARARGS, NULL}, - { "streamInqHistorySize", _wrap_streamInqHistorySize, METH_O, NULL}, - { "streamInqHistoryString", _wrap_streamInqHistoryString, METH_VARARGS, NULL}, - { "subtypeCreate", _wrap_subtypeCreate, METH_O, NULL}, - { "subtypePrint", _wrap_subtypePrint, METH_O, NULL}, - { "subtypeCompare", _wrap_subtypeCompare, METH_VARARGS, NULL}, - { "subtypeInqSize", _wrap_subtypeInqSize, METH_O, NULL}, - { "subtypeInqActiveIndex", _wrap_subtypeInqActiveIndex, METH_O, NULL}, - { "subtypeDefActiveIndex", _wrap_subtypeDefActiveIndex, METH_VARARGS, NULL}, - { "keyValuePair", _wrap_keyValuePair, METH_VARARGS, NULL}, - { "matchAND", _wrap_matchAND, METH_VARARGS, NULL}, - { "subtypeInqSubEntry", _wrap_subtypeInqSubEntry, METH_VARARGS, NULL}, - { "subtypeInqTile", _wrap_subtypeInqTile, METH_VARARGS, NULL}, - { "subtypeInqAttribute", _wrap_subtypeInqAttribute, METH_VARARGS, NULL}, - { "vlistInqVarSubtype", _wrap_vlistInqVarSubtype, METH_VARARGS, NULL}, - { "gribapiLibraryVersion", _wrap_gribapiLibraryVersion, METH_VARARGS, NULL}, - { "gaussianLatitudes", _wrap_gaussianLatitudes, METH_VARARGS, NULL}, - { NULL, NULL, 0, NULL } -}; - -static PyMethodDef SwigMethods_proxydocs[] = { - { NULL, NULL, 0, NULL } -}; - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ - -static swig_type_info _swigt__p_CdiGribIterator = {"_p_CdiGribIterator", "struct CdiGribIterator *|CdiGribIterator *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_CdiIterator = {"_p_CdiIterator", "struct CdiIterator *|CdiIterator *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_CdiParam = {"_p_CdiParam", "struct CdiParam *|CdiParam *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_FILE = {"_p_FILE", "FILE *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_a_10__int = {"_p_a_10__int", "int (*)[10]", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_a_2__int = {"_p_a_2__int", "int (*)[2]", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_float = {"_p_float", "float *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_int64_t = {"_p_int64_t", "int64_t *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_long = {"_p_long", "long *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_off_t = {"_p_off_t", "off_t *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_p_p_char = {"_p_p_p_char", "char ***", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_size_t = {"_p_size_t", "size_t *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_subtype_query_t = {"_p_subtype_query_t", "subtype_query_t *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *", 0, 0, (void*)0, 0}; - -static swig_type_info *swig_type_initial[] = { - &_swigt__p_CdiGribIterator, - &_swigt__p_CdiIterator, - &_swigt__p_CdiParam, - &_swigt__p_FILE, - &_swigt__p_a_10__int, - &_swigt__p_a_2__int, - &_swigt__p_char, - &_swigt__p_double, - &_swigt__p_float, - &_swigt__p_int, - &_swigt__p_int64_t, - &_swigt__p_long, - &_swigt__p_off_t, - &_swigt__p_p_char, - &_swigt__p_p_p_char, - &_swigt__p_size_t, - &_swigt__p_subtype_query_t, - &_swigt__p_unsigned_char, -}; - -static swig_cast_info _swigc__p_CdiGribIterator[] = { {&_swigt__p_CdiGribIterator, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_CdiIterator[] = { {&_swigt__p_CdiIterator, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_CdiParam[] = { {&_swigt__p_CdiParam, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_FILE[] = { {&_swigt__p_FILE, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_a_10__int[] = { {&_swigt__p_a_10__int, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_a_2__int[] = { {&_swigt__p_a_2__int, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_double[] = { {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_float[] = { {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_int64_t[] = { {&_swigt__p_int64_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_long[] = { {&_swigt__p_long, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_off_t[] = { {&_swigt__p_off_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_p_p_char[] = { {&_swigt__p_p_p_char, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_size_t[] = { {&_swigt__p_size_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_subtype_query_t[] = { {&_swigt__p_subtype_query_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}}; - -static swig_cast_info *swig_cast_initial[] = { - _swigc__p_CdiGribIterator, - _swigc__p_CdiIterator, - _swigc__p_CdiParam, - _swigc__p_FILE, - _swigc__p_a_10__int, - _swigc__p_a_2__int, - _swigc__p_char, - _swigc__p_double, - _swigc__p_float, - _swigc__p_int, - _swigc__p_int64_t, - _swigc__p_long, - _swigc__p_off_t, - _swigc__p_p_char, - _swigc__p_p_p_char, - _swigc__p_size_t, - _swigc__p_subtype_query_t, - _swigc__p_unsigned_char, -}; - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ - -static swig_const_info swig_const_table[] = { -{0, 0, 0, 0.0, 0, 0}}; - -#ifdef __cplusplus -} -#endif -/* ----------------------------------------------------------------------------- - * Type initialization: - * This problem is tough by the requirement that no dynamic - * memory is used. Also, since swig_type_info structures store pointers to - * swig_cast_info structures and swig_cast_info structures store pointers back - * to swig_type_info structures, we need some lookup code at initialization. - * The idea is that swig generates all the structures that are needed. - * The runtime then collects these partially filled structures. - * The SWIG_InitializeModule function takes these initial arrays out of - * swig_module, and does all the lookup, filling in the swig_module.types - * array with the correct data and linking the correct swig_cast_info - * structures together. - * - * The generated swig_type_info structures are assigned statically to an initial - * array. We just loop through that array, and handle each type individually. - * First we lookup if this type has been already loaded, and if so, use the - * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a - * two-dimensional array. Each row corresponds to a type (there are the same - * number of rows as there are in the swig_type_initial array). Each entry in - * a column is one of the swig_cast_info structures for that type. - * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. - * - * First off, we lookup the cast->type name to see if it is already loaded. - * There are three cases to handle: - * 1) If the cast->type has already been loaded AND the type we are adding - * casting info to has not been loaded (it is in this module), THEN we - * replace the cast->type pointer with the type pointer that has already - * been loaded. - * 2) If BOTH types (the one we are adding casting info to, and the - * cast->type) are loaded, THEN the cast info has already been loaded by - * the previous module so we just ignore it. - * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will - * be correct. - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#if 0 -} /* c-mode */ -#endif -#endif - -#if 0 -#define SWIGRUNTIME_DEBUG -#endif - - -SWIGRUNTIME void -SWIG_InitializeModule(void *clientdata) { - size_t i; - swig_module_info *module_head, *iter; - int init; - - /* check to see if the circular list has been setup, if not, set it up */ - if (swig_module.next==0) { - /* Initialize the swig_module */ - swig_module.type_initial = swig_type_initial; - swig_module.cast_initial = swig_cast_initial; - swig_module.next = &swig_module; - init = 1; - } else { - init = 0; - } - - /* Try and load any already created modules */ - module_head = SWIG_GetModule(clientdata); - if (!module_head) { - /* This is the first module loaded for this interpreter */ - /* so set the swig module into the interpreter */ - SWIG_SetModule(clientdata, &swig_module); - } else { - /* the interpreter has loaded a SWIG module, but has it loaded this one? */ - iter=module_head; - do { - if (iter==&swig_module) { - /* Our module is already in the list, so there's nothing more to do. */ - return; - } - iter=iter->next; - } while (iter!= module_head); - - /* otherwise we must add our module into the list */ - swig_module.next = module_head->next; - module_head->next = &swig_module; - } - - /* When multiple interpreters are used, a module could have already been initialized in - a different interpreter, but not yet have a pointer in this interpreter. - In this case, we do not want to continue adding types... everything should be - set up already */ - if (init == 0) return; - - /* Now work on filling in swig_module.types */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size); -#endif - for (i = 0; i < swig_module.size; ++i) { - swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; - -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); -#endif - - /* if there is another module already loaded */ - if (swig_module.next != &swig_module) { - type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); - } - if (type) { - /* Overwrite clientdata field */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found type %s\n", type->name); -#endif - if (swig_module.type_initial[i]->clientdata) { - type->clientdata = swig_module.type_initial[i]->clientdata; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); -#endif - } - } else { - type = swig_module.type_initial[i]; - } - - /* Insert casting types */ - cast = swig_module.cast_initial[i]; - while (cast->type) { - /* Don't need to add information already in the list */ - ret = 0; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); -#endif - if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); -#ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); -#endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); -#endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); -#ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); -#endif - if (!ocast) ret = 0; - } - } - - if (!ret) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); -#endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; - } - type->cast = cast; - } - cast++; - } - /* Set entry in modules->types array equal to the type */ - swig_module.types[i] = type; - } - swig_module.types[i] = 0; - -#ifdef SWIGRUNTIME_DEBUG - printf("**** SWIG_InitializeModule: Cast List ******\n"); - for (i = 0; i < swig_module.size; ++i) { - int j = 0; - swig_cast_info *cast = swig_module.cast_initial[i]; - printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); - while (cast->type) { - printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); - cast++; - ++j; - } - printf("---- Total casts: %d\n",j); - } - printf("**** SWIG_InitializeModule: Cast List ******\n"); -#endif -} - -/* This function will propagate the clientdata field of type to -* any new swig_type_info structures that have been added into the list -* of equivalent types. It is like calling -* SWIG_TypeClientData(type, clientdata) a second time. -*/ -SWIGRUNTIME void -SWIG_PropagateClientData(void) { - size_t i; - swig_cast_info *equiv; - static int init_run = 0; - - if (init_run) return; - init_run = 1; - - for (i = 0; i < swig_module.size; i++) { - if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); - } - equiv = equiv->next; - } - } - } -} - -#ifdef __cplusplus -#if 0 -{ - /* c-mode */ -#endif -} -#endif - - - -#ifdef __cplusplus -extern "C" { -#endif - - /* Python-specific SWIG API */ -#define SWIG_newvarlink() SWIG_Python_newvarlink() -#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) -#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) - - /* ----------------------------------------------------------------------------- - * global variable support code. - * ----------------------------------------------------------------------------- */ - - typedef struct swig_globalvar { - char *name; /* Name of global variable */ - PyObject *(*get_attr)(void); /* Return the current value */ - int (*set_attr)(PyObject *); /* Set the value */ - struct swig_globalvar *next; - } swig_globalvar; - - typedef struct swig_varlinkobject { - PyObject_HEAD - swig_globalvar *vars; - } swig_varlinkobject; - - SWIGINTERN PyObject * - swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_InternFromString("<Swig global variables>"); -#else - return PyString_FromString("<Swig global variables>"); -#endif - } - - SWIGINTERN PyObject * - swig_varlink_str(swig_varlinkobject *v) { -#if PY_VERSION_HEX >= 0x03000000 - PyObject *str = PyUnicode_InternFromString("("); - PyObject *tail; - PyObject *joined; - swig_globalvar *var; - for (var = v->vars; var; var=var->next) { - tail = PyUnicode_FromString(var->name); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; - if (var->next) { - tail = PyUnicode_InternFromString(", "); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; - } - } - tail = PyUnicode_InternFromString(")"); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; -#else - PyObject *str = PyString_FromString("("); - swig_globalvar *var; - for (var = v->vars; var; var=var->next) { - PyString_ConcatAndDel(&str,PyString_FromString(var->name)); - if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); - } - PyString_ConcatAndDel(&str,PyString_FromString(")")); -#endif - return str; - } - - SWIGINTERN void - swig_varlink_dealloc(swig_varlinkobject *v) { - swig_globalvar *var = v->vars; - while (var) { - swig_globalvar *n = var->next; - free(var->name); - free(var); - var = n; - } - } - - SWIGINTERN PyObject * - swig_varlink_getattr(swig_varlinkobject *v, char *n) { - PyObject *res = NULL; - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - res = (*var->get_attr)(); - break; - } - var = var->next; - } - if (res == NULL && !PyErr_Occurred()) { - PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); - } - return res; - } - - SWIGINTERN int - swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { - int res = 1; - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - res = (*var->set_attr)(p); - break; - } - var = var->next; - } - if (res == 1 && !PyErr_Occurred()) { - PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); - } - return res; - } - - SWIGINTERN PyTypeObject* - swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; - static PyTypeObject varlink_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp = { -#if PY_VERSION_HEX >= 0x03000000 - PyVarObject_HEAD_INIT(NULL, 0) -#else - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ -#endif - "swigvarlink", /* tp_name */ - sizeof(swig_varlinkobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ - 0, /* tp_del */ - 0, /* tp_version_tag */ -#if PY_VERSION_HEX >= 0x03040000 - 0, /* tp_finalize */ -#endif -#ifdef COUNT_ALLOCS - 0, /* tp_allocs */ - 0, /* tp_frees */ - 0, /* tp_maxalloc */ - 0, /* tp_prev */ - 0 /* tp_next */ -#endif - }; - varlink_type = tmp; - type_init = 1; - if (PyType_Ready(&varlink_type) < 0) - return NULL; - } - return &varlink_type; - } - - /* Create a variable linking object for use later */ - SWIGINTERN PyObject * - SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); - if (result) { - result->vars = 0; - } - return ((PyObject*) result); - } - - SWIGINTERN void - SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { - swig_varlinkobject *v = (swig_varlinkobject *) p; - swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); - if (gv) { - size_t size = strlen(name)+1; - gv->name = (char *)malloc(size); - if (gv->name) { - memcpy(gv->name, name, size); - gv->get_attr = get_attr; - gv->set_attr = set_attr; - gv->next = v->vars; - } - } - v->vars = gv; - } - - SWIGINTERN PyObject * - SWIG_globals(void) { - static PyObject *globals = 0; - if (!globals) { - globals = SWIG_newvarlink(); - } - return globals; - } - - /* ----------------------------------------------------------------------------- - * constants/methods manipulation - * ----------------------------------------------------------------------------- */ - - /* Install Constants */ - SWIGINTERN void - SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { - PyObject *obj = 0; - size_t i; - for (i = 0; constants[i].type; ++i) { - switch(constants[i].type) { - case SWIG_PY_POINTER: - obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); - break; - case SWIG_PY_BINARY: - obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); - break; - default: - obj = 0; - break; - } - if (obj) { - PyDict_SetItemString(d, constants[i].name, obj); - Py_DECREF(obj); - } - } - } - - /* -----------------------------------------------------------------------------*/ - /* Fix SwigMethods to carry the callback ptrs when needed */ - /* -----------------------------------------------------------------------------*/ - - SWIGINTERN void - SWIG_Python_FixMethods(PyMethodDef *methods, - swig_const_info *const_table, - swig_type_info **types, - swig_type_info **types_initial) { - size_t i; - for (i = 0; methods[i].ml_name; ++i) { - const char *c = methods[i].ml_doc; - if (!c) continue; - c = strstr(c, "swig_ptr: "); - if (c) { - int j; - swig_const_info *ci = 0; - const char *name = c + 10; - for (j = 0; const_table[j].type; ++j) { - if (strncmp(const_table[j].name, name, - strlen(const_table[j].name)) == 0) { - ci = &(const_table[j]); - break; - } - } - if (ci) { - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - memcpy(buff, methods[i].ml_doc, ldoc); - buff += ldoc; - memcpy(buff, "swig_ptr: ", 10); - buff += 10; - SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); - methods[i].ml_doc = ndoc; - } - } - } - } - } - } - - /* ----------------------------------------------------------------------------- - * Method creation and docstring support functions - * ----------------------------------------------------------------------------- */ - - /* ----------------------------------------------------------------------------- - * Function to find the method definition with the correct docstring for the - * proxy module as opposed to the low-level API - * ----------------------------------------------------------------------------- */ - - SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name) { - /* Find the function in the modified method table */ - size_t offset = 0; - int found = 0; - while (SwigMethods_proxydocs[offset].ml_meth != NULL) { - if (strcmp(SwigMethods_proxydocs[offset].ml_name, name) == 0) { - found = 1; - break; - } - offset++; - } - /* Use the copy with the modified docstring if available */ - return found ? &SwigMethods_proxydocs[offset] : NULL; - } - - /* ----------------------------------------------------------------------------- - * Wrapper of PyInstanceMethod_New() used in Python 3 - * It is exported to the generated module, used for -fastproxy - * ----------------------------------------------------------------------------- */ - - SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) { - if (PyCFunction_Check(func)) { - PyCFunctionObject *funcobj = (PyCFunctionObject *)func; - PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name); - if (ml) - func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module); - } -#if PY_VERSION_HEX >= 0x03000000 - return PyInstanceMethod_New(func); -#else - return PyMethod_New(func, NULL, NULL); -#endif - } - - /* ----------------------------------------------------------------------------- - * Wrapper of PyStaticMethod_New() - * It is exported to the generated module, used for -fastproxy - * ----------------------------------------------------------------------------- */ - - SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) { - if (PyCFunction_Check(func)) { - PyCFunctionObject *funcobj = (PyCFunctionObject *)func; - PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name); - if (ml) - func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module); - } - return PyStaticMethod_New(func); - } - -#ifdef __cplusplus -} -#endif - -/* -----------------------------------------------------------------------------* - * Partial Init method - * -----------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" -#endif - -SWIGEXPORT -#if PY_VERSION_HEX >= 0x03000000 -PyObject* -#else -void -#endif -SWIG_init(void) { - PyObject *m, *d, *md, *globals; - -#if PY_VERSION_HEX >= 0x03000000 - static struct PyModuleDef SWIG_module = { - PyModuleDef_HEAD_INIT, - SWIG_name, - NULL, - -1, - SwigMethods, - NULL, - NULL, - NULL, - NULL - }; -#endif - -#if defined(SWIGPYTHON_BUILTIN) - static SwigPyClientData SwigPyObject_clientdata = { - 0, 0, 0, 0, 0, 0, 0 - }; - static PyGetSetDef this_getset_def = { - (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL - }; - static SwigPyGetSet thisown_getset_closure = { - SwigPyObject_own, - SwigPyObject_own - }; - static PyGetSetDef thisown_getset_def = { - (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure - }; - PyTypeObject *builtin_pytype; - int builtin_base_count; - swig_type_info *builtin_basetype; - PyObject *tuple; - PyGetSetDescrObject *static_getset; - PyTypeObject *metatype; - PyTypeObject *swigpyobject; - SwigPyClientData *cd; - PyObject *public_interface, *public_symbol; - PyObject *this_descr; - PyObject *thisown_descr; - PyObject *self = 0; - int i; - - (void)builtin_pytype; - (void)builtin_base_count; - (void)builtin_basetype; - (void)tuple; - (void)static_getset; - (void)self; - - /* Metaclass is used to implement static member variables */ - metatype = SwigPyObjectType(); - assert(metatype); -#endif - - (void)globals; - - /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ - SWIG_This(); - SWIG_Python_TypeCache(); - SwigPyPacked_type(); -#ifndef SWIGPYTHON_BUILTIN - SwigPyObject_type(); -#endif - - /* Fix SwigMethods to carry the callback ptrs when needed */ - SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); - -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule(SWIG_name, SwigMethods); -#endif - - md = d = PyModule_GetDict(m); - (void)md; - - SWIG_InitializeModule(0); - -#ifdef SWIGPYTHON_BUILTIN - swigpyobject = SwigPyObject_TypeOnce(); - - SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject"); - assert(SwigPyObject_stype); - cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; - if (!cd) { - SwigPyObject_stype->clientdata = &SwigPyObject_clientdata; - SwigPyObject_clientdata.pytype = swigpyobject; - } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { - PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif - } - - /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); - (void)this_descr; - - /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); - (void)thisown_descr; - - public_interface = PyList_New(0); - public_symbol = 0; - (void)public_symbol; - - PyDict_SetItemString(md, "__all__", public_interface); - Py_DECREF(public_interface); - for (i = 0; SwigMethods[i].ml_name != NULL; ++i) - SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name); - for (i = 0; swig_const_table[i].name != 0; ++i) - SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name); -#endif - - SWIG_InstallConstants(d,swig_const_table); - - SWIG_Python_SetConstant(d, "CDI_MAX_NAME",SWIG_From_int((int)(256))); - SWIG_Python_SetConstant(d, "CDI_UNDEFID",SWIG_From_int((int)(-1))); - SWIG_Python_SetConstant(d, "CDI_GLOBAL",SWIG_From_int((int)(-1))); - SWIG_Python_SetConstant(d, "CDI_BIGENDIAN",SWIG_From_int((int)(0))); - SWIG_Python_SetConstant(d, "CDI_LITTLEENDIAN",SWIG_From_int((int)(1))); - SWIG_Python_SetConstant(d, "CDI_PDPENDIAN",SWIG_From_int((int)(2))); - SWIG_Python_SetConstant(d, "CDI_REAL",SWIG_From_int((int)(1))); - SWIG_Python_SetConstant(d, "CDI_COMP",SWIG_From_int((int)(2))); - SWIG_Python_SetConstant(d, "CDI_BOTH",SWIG_From_int((int)(3))); - SWIG_Python_SetConstant(d, "CDI_NOERR",SWIG_From_int((int)(0))); - SWIG_Python_SetConstant(d, "CDI_EEOF",SWIG_From_int((int)(-1))); - SWIG_Python_SetConstant(d, "CDI_ETMOF",SWIG_From_int((int)(-9))); - SWIG_Python_SetConstant(d, "CDI_ESYSTEM",SWIG_From_int((int)(-10))); - SWIG_Python_SetConstant(d, "CDI_EINVAL",SWIG_From_int((int)(-20))); - SWIG_Python_SetConstant(d, "CDI_EISDIR",SWIG_From_int((int)(-21))); - SWIG_Python_SetConstant(d, "CDI_EISEMPTY",SWIG_From_int((int)(-22))); - SWIG_Python_SetConstant(d, "CDI_EUFTYPE",SWIG_From_int((int)(-23))); - SWIG_Python_SetConstant(d, "CDI_ELIBNAVAIL",SWIG_From_int((int)(-24))); - SWIG_Python_SetConstant(d, "CDI_EUFSTRUCT",SWIG_From_int((int)(-25))); - SWIG_Python_SetConstant(d, "CDI_EUNC4",SWIG_From_int((int)(-26))); - SWIG_Python_SetConstant(d, "CDI_EDIMSIZE",SWIG_From_int((int)(-27))); - SWIG_Python_SetConstant(d, "CDI_ELIMIT",SWIG_From_int((int)(-99))); - SWIG_Python_SetConstant(d, "CDI_FILETYPE_GRB",SWIG_From_int((int)(1))); - SWIG_Python_SetConstant(d, "CDI_FILETYPE_GRB2",SWIG_From_int((int)(2))); - SWIG_Python_SetConstant(d, "CDI_FILETYPE_NC",SWIG_From_int((int)(3))); - SWIG_Python_SetConstant(d, "CDI_FILETYPE_NC2",SWIG_From_int((int)(4))); - SWIG_Python_SetConstant(d, "CDI_FILETYPE_NC4",SWIG_From_int((int)(5))); - SWIG_Python_SetConstant(d, "CDI_FILETYPE_NC4C",SWIG_From_int((int)(6))); - SWIG_Python_SetConstant(d, "CDI_FILETYPE_NC5",SWIG_From_int((int)(7))); - SWIG_Python_SetConstant(d, "CDI_FILETYPE_SRV",SWIG_From_int((int)(8))); - SWIG_Python_SetConstant(d, "CDI_FILETYPE_EXT",SWIG_From_int((int)(9))); - SWIG_Python_SetConstant(d, "CDI_FILETYPE_IEG",SWIG_From_int((int)(10))); - SWIG_Python_SetConstant(d, "CDI_COMPRESS_NONE",SWIG_From_int((int)(0))); - SWIG_Python_SetConstant(d, "CDI_COMPRESS_SZIP",SWIG_From_int((int)(1))); - SWIG_Python_SetConstant(d, "CDI_COMPRESS_AEC",SWIG_From_int((int)(2))); - SWIG_Python_SetConstant(d, "CDI_COMPRESS_ZIP",SWIG_From_int((int)(3))); - SWIG_Python_SetConstant(d, "CDI_COMPRESS_JPEG",SWIG_From_int((int)(4))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK",SWIG_From_int((int)(0))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK1",SWIG_From_int((int)(1))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK2",SWIG_From_int((int)(2))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK3",SWIG_From_int((int)(3))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK4",SWIG_From_int((int)(4))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK5",SWIG_From_int((int)(5))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK6",SWIG_From_int((int)(6))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK7",SWIG_From_int((int)(7))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK8",SWIG_From_int((int)(8))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK9",SWIG_From_int((int)(9))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK10",SWIG_From_int((int)(10))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK11",SWIG_From_int((int)(11))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK12",SWIG_From_int((int)(12))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK13",SWIG_From_int((int)(13))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK14",SWIG_From_int((int)(14))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK15",SWIG_From_int((int)(15))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK16",SWIG_From_int((int)(16))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK17",SWIG_From_int((int)(17))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK18",SWIG_From_int((int)(18))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK19",SWIG_From_int((int)(19))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK20",SWIG_From_int((int)(20))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK21",SWIG_From_int((int)(21))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK22",SWIG_From_int((int)(22))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK23",SWIG_From_int((int)(23))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK24",SWIG_From_int((int)(24))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK25",SWIG_From_int((int)(25))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK26",SWIG_From_int((int)(26))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK27",SWIG_From_int((int)(27))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK28",SWIG_From_int((int)(28))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK29",SWIG_From_int((int)(29))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK30",SWIG_From_int((int)(30))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK31",SWIG_From_int((int)(31))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_PACK32",SWIG_From_int((int)(32))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_CPX32",SWIG_From_int((int)(64))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_CPX64",SWIG_From_int((int)(128))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_FLT32",SWIG_From_int((int)(132))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_FLT64",SWIG_From_int((int)(164))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_INT8",SWIG_From_int((int)(208))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_INT16",SWIG_From_int((int)(216))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_INT32",SWIG_From_int((int)(232))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_UINT8",SWIG_From_int((int)(308))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_UINT16",SWIG_From_int((int)(316))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_UINT32",SWIG_From_int((int)(332))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_INT",SWIG_From_int((int)(251))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_FLT",SWIG_From_int((int)(252))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_TXT",SWIG_From_int((int)(253))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_CPX",SWIG_From_int((int)(254))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_UCHAR",SWIG_From_int((int)(255))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_LONG",SWIG_From_int((int)(256))); - SWIG_Python_SetConstant(d, "CDI_DATATYPE_UINT",SWIG_From_int((int)(257))); - SWIG_Python_SetConstant(d, "CDI_CHUNK_AUTO",SWIG_From_int((int)(1))); - SWIG_Python_SetConstant(d, "CDI_CHUNK_GRID",SWIG_From_int((int)(2))); - SWIG_Python_SetConstant(d, "CDI_CHUNK_LINES",SWIG_From_int((int)(3))); - SWIG_Python_SetConstant(d, "GRID_GENERIC",SWIG_From_int((int)(1))); - SWIG_Python_SetConstant(d, "GRID_GAUSSIAN",SWIG_From_int((int)(2))); - SWIG_Python_SetConstant(d, "GRID_GAUSSIAN_REDUCED",SWIG_From_int((int)(3))); - SWIG_Python_SetConstant(d, "GRID_LONLAT",SWIG_From_int((int)(4))); - SWIG_Python_SetConstant(d, "GRID_SPECTRAL",SWIG_From_int((int)(5))); - SWIG_Python_SetConstant(d, "GRID_FOURIER",SWIG_From_int((int)(6))); - SWIG_Python_SetConstant(d, "GRID_GME",SWIG_From_int((int)(7))); - SWIG_Python_SetConstant(d, "GRID_TRAJECTORY",SWIG_From_int((int)(8))); - SWIG_Python_SetConstant(d, "GRID_UNSTRUCTURED",SWIG_From_int((int)(9))); - SWIG_Python_SetConstant(d, "GRID_CURVILINEAR",SWIG_From_int((int)(10))); - SWIG_Python_SetConstant(d, "GRID_PROJECTION",SWIG_From_int((int)(12))); - SWIG_Python_SetConstant(d, "GRID_CHARXY",SWIG_From_int((int)(13))); - SWIG_Python_SetConstant(d, "CDI_PROJ_RLL",SWIG_From_int((int)(21))); - SWIG_Python_SetConstant(d, "CDI_PROJ_LCC",SWIG_From_int((int)(22))); - SWIG_Python_SetConstant(d, "CDI_PROJ_LAEA",SWIG_From_int((int)(23))); - SWIG_Python_SetConstant(d, "CDI_PROJ_SINU",SWIG_From_int((int)(24))); - SWIG_Python_SetConstant(d, "CDI_PROJ_STERE",SWIG_From_int((int)(25))); - SWIG_Python_SetConstant(d, "ZAXIS_SURFACE",SWIG_From_int((int)(0))); - SWIG_Python_SetConstant(d, "ZAXIS_GENERIC",SWIG_From_int((int)(1))); - SWIG_Python_SetConstant(d, "ZAXIS_HYBRID",SWIG_From_int((int)(2))); - SWIG_Python_SetConstant(d, "ZAXIS_HYBRID_HALF",SWIG_From_int((int)(3))); - SWIG_Python_SetConstant(d, "ZAXIS_PRESSURE",SWIG_From_int((int)(4))); - SWIG_Python_SetConstant(d, "ZAXIS_HEIGHT",SWIG_From_int((int)(5))); - SWIG_Python_SetConstant(d, "ZAXIS_DEPTH_BELOW_SEA",SWIG_From_int((int)(6))); - SWIG_Python_SetConstant(d, "ZAXIS_DEPTH_BELOW_LAND",SWIG_From_int((int)(7))); - SWIG_Python_SetConstant(d, "ZAXIS_ISENTROPIC",SWIG_From_int((int)(8))); - SWIG_Python_SetConstant(d, "ZAXIS_TRAJECTORY",SWIG_From_int((int)(9))); - SWIG_Python_SetConstant(d, "ZAXIS_ALTITUDE",SWIG_From_int((int)(10))); - SWIG_Python_SetConstant(d, "ZAXIS_SIGMA",SWIG_From_int((int)(11))); - SWIG_Python_SetConstant(d, "ZAXIS_MEANSEA",SWIG_From_int((int)(12))); - SWIG_Python_SetConstant(d, "ZAXIS_TOA",SWIG_From_int((int)(13))); - SWIG_Python_SetConstant(d, "ZAXIS_SEA_BOTTOM",SWIG_From_int((int)(14))); - SWIG_Python_SetConstant(d, "ZAXIS_ATMOSPHERE",SWIG_From_int((int)(15))); - SWIG_Python_SetConstant(d, "ZAXIS_CLOUD_BASE",SWIG_From_int((int)(16))); - SWIG_Python_SetConstant(d, "ZAXIS_CLOUD_TOP",SWIG_From_int((int)(17))); - SWIG_Python_SetConstant(d, "ZAXIS_ISOTHERM_ZERO",SWIG_From_int((int)(18))); - SWIG_Python_SetConstant(d, "ZAXIS_SNOW",SWIG_From_int((int)(19))); - SWIG_Python_SetConstant(d, "ZAXIS_LAKE_BOTTOM",SWIG_From_int((int)(20))); - SWIG_Python_SetConstant(d, "ZAXIS_SEDIMENT_BOTTOM",SWIG_From_int((int)(21))); - SWIG_Python_SetConstant(d, "ZAXIS_SEDIMENT_BOTTOM_TA",SWIG_From_int((int)(22))); - SWIG_Python_SetConstant(d, "ZAXIS_SEDIMENT_BOTTOM_TW",SWIG_From_int((int)(23))); - SWIG_Python_SetConstant(d, "ZAXIS_MIX_LAYER",SWIG_From_int((int)(24))); - SWIG_Python_SetConstant(d, "ZAXIS_REFERENCE",SWIG_From_int((int)(25))); - SWIG_Python_SetConstant(d, "ZAXIS_CHAR",SWIG_From_int((int)(26))); - SWIG_Python_SetConstant(d, "SUBTYPE_TILES",SWIG_From_int((int)(SUBTYPE_TILES))); - SWIG_Python_SetConstant(d, "MAX_KV_PAIRS_MATCH",SWIG_From_int((int)(10))); - SWIG_Python_SetConstant(d, "TIME_CONSTANT",SWIG_From_int((int)(0))); - SWIG_Python_SetConstant(d, "TIME_VARYING",SWIG_From_int((int)(1))); - SWIG_Python_SetConstant(d, "TIME_VARIABLE",SWIG_From_int((int)(1))); - SWIG_Python_SetConstant(d, "TSTEP_INSTANT",SWIG_From_int((int)(1))); - SWIG_Python_SetConstant(d, "TSTEP_AVG",SWIG_From_int((int)(2))); - SWIG_Python_SetConstant(d, "TSTEP_ACCUM",SWIG_From_int((int)(3))); - SWIG_Python_SetConstant(d, "TSTEP_MAX",SWIG_From_int((int)(4))); - SWIG_Python_SetConstant(d, "TSTEP_MIN",SWIG_From_int((int)(5))); - SWIG_Python_SetConstant(d, "TSTEP_DIFF",SWIG_From_int((int)(6))); - SWIG_Python_SetConstant(d, "TSTEP_RMS",SWIG_From_int((int)(7))); - SWIG_Python_SetConstant(d, "TSTEP_SD",SWIG_From_int((int)(8))); - SWIG_Python_SetConstant(d, "TSTEP_COV",SWIG_From_int((int)(9))); - SWIG_Python_SetConstant(d, "TSTEP_RATIO",SWIG_From_int((int)(10))); - SWIG_Python_SetConstant(d, "TSTEP_SUM",SWIG_From_int((int)(11))); - SWIG_Python_SetConstant(d, "TSTEP_RANGE",SWIG_From_int((int)(12))); - SWIG_Python_SetConstant(d, "TSTEP_INSTANT2",SWIG_From_int((int)(13))); - SWIG_Python_SetConstant(d, "TSTEP_INSTANT3",SWIG_From_int((int)(14))); - SWIG_Python_SetConstant(d, "TAXIS_ABSOLUTE",SWIG_From_int((int)(1))); - SWIG_Python_SetConstant(d, "TAXIS_RELATIVE",SWIG_From_int((int)(2))); - SWIG_Python_SetConstant(d, "TAXIS_FORECAST",SWIG_From_int((int)(3))); - SWIG_Python_SetConstant(d, "TUNIT_SECOND",SWIG_From_int((int)(1))); - SWIG_Python_SetConstant(d, "TUNIT_MINUTE",SWIG_From_int((int)(2))); - SWIG_Python_SetConstant(d, "TUNIT_QUARTER",SWIG_From_int((int)(3))); - SWIG_Python_SetConstant(d, "TUNIT_30MINUTES",SWIG_From_int((int)(4))); - SWIG_Python_SetConstant(d, "TUNIT_HOUR",SWIG_From_int((int)(5))); - SWIG_Python_SetConstant(d, "TUNIT_3HOURS",SWIG_From_int((int)(6))); - SWIG_Python_SetConstant(d, "TUNIT_6HOURS",SWIG_From_int((int)(7))); - SWIG_Python_SetConstant(d, "TUNIT_12HOURS",SWIG_From_int((int)(8))); - SWIG_Python_SetConstant(d, "TUNIT_DAY",SWIG_From_int((int)(9))); - SWIG_Python_SetConstant(d, "TUNIT_MONTH",SWIG_From_int((int)(10))); - SWIG_Python_SetConstant(d, "TUNIT_YEAR",SWIG_From_int((int)(11))); - SWIG_Python_SetConstant(d, "CALENDAR_STANDARD",SWIG_From_int((int)(0))); - SWIG_Python_SetConstant(d, "CALENDAR_GREGORIAN",SWIG_From_int((int)(1))); - SWIG_Python_SetConstant(d, "CALENDAR_PROLEPTIC",SWIG_From_int((int)(2))); - SWIG_Python_SetConstant(d, "CALENDAR_360DAYS",SWIG_From_int((int)(3))); - SWIG_Python_SetConstant(d, "CALENDAR_365DAYS",SWIG_From_int((int)(4))); - SWIG_Python_SetConstant(d, "CALENDAR_366DAYS",SWIG_From_int((int)(5))); - SWIG_Python_SetConstant(d, "CALENDAR_NONE",SWIG_From_int((int)(6))); - SWIG_Python_SetConstant(d, "CDI_UUID_SIZE",SWIG_From_int((int)(16))); - SWIG_Python_SetConstant(d, "CDI_KEY_TABLESVERSION",SWIG_From_int((int)(801))); - SWIG_Python_SetConstant(d, "CDI_KEY_LOCALTABLESVERSION",SWIG_From_int((int)(802))); - SWIG_Python_SetConstant(d, "CDI_KEY_TYPEOFGENERATINGPROCESS",SWIG_From_int((int)(803))); - SWIG_Python_SetConstant(d, "CDI_KEY_PRODUCTDEFINITIONTEMPLATE",SWIG_From_int((int)(804))); - SWIG_Python_SetConstant(d, "CDI_KEY_TYPEOFPROCESSEDDATA",SWIG_From_int((int)(805))); - SWIG_Python_SetConstant(d, "CDI_KEY_SHAPEOFTHEEARTH",SWIG_From_int((int)(806))); - SWIG_Python_SetConstant(d, "CDI_KEY_BACKGROUNDPROCESS",SWIG_From_int((int)(807))); - SWIG_Python_SetConstant(d, "CDI_KEY_TYPEOFENSEMBLEFORECAST",SWIG_From_int((int)(808))); - SWIG_Python_SetConstant(d, "CDI_KEY_NUMBEROFFORECASTSINENSEMBLE",SWIG_From_int((int)(809))); - SWIG_Python_SetConstant(d, "CDI_KEY_PERTURBATIONNUMBER",SWIG_From_int((int)(810))); - SWIG_Python_SetConstant(d, "CDI_KEY_CENTRE",SWIG_From_int((int)(811))); - SWIG_Python_SetConstant(d, "CDI_KEY_SUBCENTRE",SWIG_From_int((int)(812))); - SWIG_Python_SetConstant(d, "CDI_KEY_MPIMTYPE",SWIG_From_int((int)(813))); - SWIG_Python_SetConstant(d, "CDI_KEY_MPIMCLASS",SWIG_From_int((int)(814))); - SWIG_Python_SetConstant(d, "CDI_KEY_MPIMUSER",SWIG_From_int((int)(815))); - SWIG_Python_SetConstant(d, "CDI_KEY_REVSTATUS",SWIG_From_int((int)(816))); - SWIG_Python_SetConstant(d, "CDI_KEY_REVNUMBER",SWIG_From_int((int)(817))); - SWIG_Python_SetConstant(d, "CDI_KEY_GRIB2LOCALSECTIONNUMBER",SWIG_From_int((int)(818))); - SWIG_Python_SetConstant(d, "CDI_KEY_SECTION2PADDINGLENGTH",SWIG_From_int((int)(819))); - SWIG_Python_SetConstant(d, "CDI_KEY_SECTION2PADDING",SWIG_From_int((int)(820))); - SWIG_Python_SetConstant(d, "CDI_KEY_UVRELATIVETOGRID",SWIG_From_int((int)(821))); - SWIG_Python_SetConstant(d, "CDI_KEY_CONSTITUENTTYPE",SWIG_From_int((int)(822))); - SWIG_Python_SetConstant(d, "CDI_KEY_XNAME",SWIG_From_int((int)(901))); - SWIG_Python_SetConstant(d, "CDI_KEY_XDIMNAME",SWIG_From_int((int)(902))); - SWIG_Python_SetConstant(d, "CDI_KEY_XLONGNAME",SWIG_From_int((int)(903))); - SWIG_Python_SetConstant(d, "CDI_KEY_XUNITS",SWIG_From_int((int)(904))); - SWIG_Python_SetConstant(d, "CDI_KEY_YNAME",SWIG_From_int((int)(911))); - SWIG_Python_SetConstant(d, "CDI_KEY_YDIMNAME",SWIG_From_int((int)(912))); - SWIG_Python_SetConstant(d, "CDI_KEY_YLONGNAME",SWIG_From_int((int)(913))); - SWIG_Python_SetConstant(d, "CDI_KEY_YUNITS",SWIG_From_int((int)(914))); - SWIG_Python_SetConstant(d, "CDI_KEY_VDIMNAME",SWIG_From_int((int)(920))); - SWIG_Python_SetConstant(d, "CDI_KEY_MAPPING",SWIG_From_int((int)(921))); - SWIG_Python_SetConstant(d, "CDI_KEY_MAPNAME",SWIG_From_int((int)(922))); - SWIG_Python_SetConstant(d, "CDI_KEY_NAME",SWIG_From_int((int)(941))); - SWIG_Python_SetConstant(d, "CDI_KEY_DIMNAME",SWIG_From_int((int)(942))); - SWIG_Python_SetConstant(d, "CDI_KEY_LONGNAME",SWIG_From_int((int)(943))); - SWIG_Python_SetConstant(d, "CDI_KEY_UNITS",SWIG_From_int((int)(944))); - SWIG_Python_SetConstant(d, "CDI_KEY_PSNAME",SWIG_From_int((int)(950))); - SWIG_Python_SetConstant(d, "CDI_KEY_P0NAME",SWIG_From_int((int)(951))); - SWIG_Python_SetConstant(d, "CDI_KEY_P0VALUE",SWIG_From_int((int)(952))); -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif -} - diff --git a/interfaces/python/cdiobj_wrap.cpp b/interfaces/python/cdiobj_wrap.cpp deleted file mode 100644 index ca35828c617c3ff41b352c00cd26c789e9a5d0aa..0000000000000000000000000000000000000000 --- a/interfaces/python/cdiobj_wrap.cpp +++ /dev/null @@ -1,29347 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 4.0.0 - * - * This file is not intended to be easily readable and contains a number of - * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. - * ----------------------------------------------------------------------------- */ - - -#ifndef SWIGPYTHON -#define SWIGPYTHON -#endif - -#define SWIG_PYTHON_DIRECTOR_NO_VTABLE - - -#ifdef __cplusplus -/* SwigValueWrapper is described in swig.swg */ -template<typename T> class SwigValueWrapper { - struct SwigMovePointer { - T *ptr; - SwigMovePointer(T *p) : ptr(p) { } - ~SwigMovePointer() { delete ptr; } - SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } - } pointer; - SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); - SwigValueWrapper(const SwigValueWrapper<T>& rhs); -public: - SwigValueWrapper() : pointer(0) { } - SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } - operator T&() const { return *pointer.ptr; } - T *operator&() { return pointer.ptr; } -}; - -template <typename T> T SwigValueInit() { - return T(); -} -#endif - -/* ----------------------------------------------------------------------------- - * This section contains generic SWIG labels for method/variable - * declarations/attributes, and other compiler dependent labels. - * ----------------------------------------------------------------------------- */ - -/* template workaround for compilers that cannot correctly implement the C++ standard */ -#ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# elif defined(__HP_aCC) -/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ -/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ -# define SWIGTEMPLATEDISAMBIGUATOR template -# else -# define SWIGTEMPLATEDISAMBIGUATOR -# endif -#endif - -/* inline attribute */ -#ifndef SWIGINLINE -# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) -# define SWIGINLINE inline -# else -# define SWIGINLINE -# endif -#endif - -/* attribute recognised by some compilers to avoid 'unused' warnings */ -#ifndef SWIGUNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -# elif defined(__ICC) -# define SWIGUNUSED __attribute__ ((__unused__)) -# else -# define SWIGUNUSED -# endif -#endif - -#ifndef SWIG_MSC_UNSUPPRESS_4505 -# if defined(_MSC_VER) -# pragma warning(disable : 4505) /* unreferenced local function has been removed */ -# endif -#endif - -#ifndef SWIGUNUSEDPARM -# ifdef __cplusplus -# define SWIGUNUSEDPARM(p) -# else -# define SWIGUNUSEDPARM(p) p SWIGUNUSED -# endif -#endif - -/* internal SWIG method */ -#ifndef SWIGINTERN -# define SWIGINTERN static SWIGUNUSED -#endif - -/* internal inline SWIG method */ -#ifndef SWIGINTERNINLINE -# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE -#endif - -/* exporting methods */ -#if defined(__GNUC__) -# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY -# endif -# endif -#endif - -#ifndef SWIGEXPORT -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# if defined(STATIC_LINKED) -# define SWIGEXPORT -# else -# define SWIGEXPORT __declspec(dllexport) -# endif -# else -# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) -# define SWIGEXPORT __attribute__ ((visibility("default"))) -# else -# define SWIGEXPORT -# endif -# endif -#endif - -/* calling conventions for Windows */ -#ifndef SWIGSTDCALL -# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# define SWIGSTDCALL __stdcall -# else -# define SWIGSTDCALL -# endif -#endif - -/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) -# define _CRT_SECURE_NO_DEPRECATE -#endif - -/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ -#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) -# define _SCL_SECURE_NO_DEPRECATE -#endif - -/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ -#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) -# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 -#endif - -/* Intel's compiler complains if a variable which was never initialised is - * cast to void, which is a common idiom which we use to indicate that we - * are aware a variable isn't used. So we just silence that warning. - * See: https://github.com/swig/swig/issues/192 for more discussion. - */ -#ifdef __INTEL_COMPILER -# pragma warning disable 592 -#endif - - -#if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND) -/* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */ -# include <math.h> -#endif - -#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) -/* Use debug wrappers with the Python release dll */ -# undef _DEBUG -# include <Python.h> -# define _DEBUG 1 -#else -# include <Python.h> -#endif - -/* ----------------------------------------------------------------------------- - * swigrun.swg - * - * This file contains generic C API SWIG runtime support for pointer - * type checking. - * ----------------------------------------------------------------------------- */ - -/* This should only be incremented when either the layout of swig_type_info changes, - or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" - -/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ -#ifdef SWIG_TYPE_TABLE -# define SWIG_QUOTE_STRING(x) #x -# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) -# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) -#else -# define SWIG_TYPE_TABLE_NAME -#endif - -/* - You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for - creating a static or dynamic library from the SWIG runtime code. - In 99.9% of the cases, SWIG just needs to declare them as 'static'. - - But only do this if strictly necessary, ie, if you have problems - with your compiler or suchlike. -*/ - -#ifndef SWIGRUNTIME -# define SWIGRUNTIME SWIGINTERN -#endif - -#ifndef SWIGRUNTIMEINLINE -# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE -#endif - -/* Generic buffer size */ -#ifndef SWIG_BUFFER_SIZE -# define SWIG_BUFFER_SIZE 1024 -#endif - -/* Flags for pointer conversions */ -#define SWIG_POINTER_DISOWN 0x1 -#define SWIG_CAST_NEW_MEMORY 0x2 -#define SWIG_POINTER_NO_NULL 0x4 - -/* Flags for new pointer objects */ -#define SWIG_POINTER_OWN 0x1 - - -/* - Flags/methods for returning states. - - The SWIG conversion methods, as ConvertPtr, return an integer - that tells if the conversion was successful or not. And if not, - an error code can be returned (see swigerrors.swg for the codes). - - Use the following macros/flags to set or process the returning - states. - - In old versions of SWIG, code such as the following was usually written: - - if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { - // success code - } else { - //fail code - } - - Now you can be more explicit: - - int res = SWIG_ConvertPtr(obj,vptr,ty.flags); - if (SWIG_IsOK(res)) { - // success code - } else { - // fail code - } - - which is the same really, but now you can also do - - Type *ptr; - int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); - if (SWIG_IsOK(res)) { - // success code - if (SWIG_IsNewObj(res) { - ... - delete *ptr; - } else { - ... - } - } else { - // fail code - } - - I.e., now SWIG_ConvertPtr can return new objects and you can - identify the case and take care of the deallocation. Of course that - also requires SWIG_ConvertPtr to return new result values, such as - - int SWIG_ConvertPtr(obj, ptr,...) { - if (<obj is ok>) { - if (<need new object>) { - *ptr = <ptr to new allocated object>; - return SWIG_NEWOBJ; - } else { - *ptr = <ptr to old object>; - return SWIG_OLDOBJ; - } - } else { - return SWIG_BADOBJ; - } - } - - Of course, returning the plain '0(success)/-1(fail)' still works, but you can be - more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the - SWIG errors code. - - Finally, if the SWIG_CASTRANK_MODE is enabled, the result code - allows to return the 'cast rank', for example, if you have this - - int food(double) - int fooi(int); - - and you call - - food(1) // cast rank '1' (1 -> 1.0) - fooi(1) // cast rank '0' - - just use the SWIG_AddCast()/SWIG_CheckState() -*/ - -#define SWIG_OK (0) -#define SWIG_ERROR (-1) -#define SWIG_IsOK(r) (r >= 0) -#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) - -/* The CastRankLimit says how many bits are used for the cast rank */ -#define SWIG_CASTRANKLIMIT (1 << 8) -/* The NewMask denotes the object was created (using new/malloc) */ -#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) -/* The TmpMask is for in/out typemaps that use temporal objects */ -#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) -/* Simple returning values */ -#define SWIG_BADOBJ (SWIG_ERROR) -#define SWIG_OLDOBJ (SWIG_OK) -#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) -#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) -/* Check, add and del mask methods */ -#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) -#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) -#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) -#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) -#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) -#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) - -/* Cast-Rank Mode */ -#if defined(SWIG_CASTRANK_MODE) -# ifndef SWIG_TypeRank -# define SWIG_TypeRank unsigned long -# endif -# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ -# define SWIG_MAXCASTRANK (2) -# endif -# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) -# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) -SWIGINTERNINLINE int SWIG_AddCast(int r) { - return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; -} -SWIGINTERNINLINE int SWIG_CheckState(int r) { - return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; -} -#else /* no cast-rank mode */ -# define SWIG_AddCast(r) (r) -# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) -#endif - - -#include <string.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void *(*swig_converter_func)(void *, int *); -typedef struct swig_type_info *(*swig_dycast_func)(void **); - -/* Structure to store information on one type */ -typedef struct swig_type_info { - const char *name; /* mangled name of this type */ - const char *str; /* human readable name of this type */ - swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ - struct swig_cast_info *cast; /* linked list of types that can cast into this type */ - void *clientdata; /* language specific type data */ - int owndata; /* flag if the structure owns the clientdata */ -} swig_type_info; - -/* Structure to store a type and conversion function used for casting */ -typedef struct swig_cast_info { - swig_type_info *type; /* pointer to type that is equivalent to this type */ - swig_converter_func converter; /* function to cast the void pointers */ - struct swig_cast_info *next; /* pointer to next cast in linked list */ - struct swig_cast_info *prev; /* pointer to the previous cast */ -} swig_cast_info; - -/* Structure used to store module information - * Each module generates one structure like this, and the runtime collects - * all of these structures and stores them in a circularly linked list.*/ -typedef struct swig_module_info { - swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ - size_t size; /* Number of types in this module */ - struct swig_module_info *next; /* Pointer to next element in circularly linked list */ - swig_type_info **type_initial; /* Array of initially generated type structures */ - swig_cast_info **cast_initial; /* Array of initially generated casting structures */ - void *clientdata; /* Language specific module data */ -} swig_module_info; - -/* - Compare two type names skipping the space characters, therefore - "char*" == "char *" and "Class<int>" == "Class<int >", etc. - - Return 0 when the two name types are equivalent, as in - strncmp, but skipping ' '. -*/ -SWIGRUNTIME int -SWIG_TypeNameComp(const char *f1, const char *l1, - const char *f2, const char *l2) { - for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { - while ((*f1 == ' ') && (f1 != l1)) ++f1; - while ((*f2 == ' ') && (f2 != l2)) ++f2; - if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; - } - return (int)((l1 - f1) - (l2 - f2)); -} - -/* - Check type equivalence in a name list like <name1>|<name2>|... - Return 0 if equal, -1 if nb < tb, 1 if nb > tb -*/ -SWIGRUNTIME int -SWIG_TypeCmp(const char *nb, const char *tb) { - int equiv = 1; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (equiv != 0 && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; - } - equiv = SWIG_TypeNameComp(nb, ne, tb, te); - if (*ne) ++ne; - } - return equiv; -} - -/* - Check type equivalence in a name list like <name1>|<name2>|... - Return 0 if not equal, 1 if equal -*/ -SWIGRUNTIME int -SWIG_TypeEquiv(const char *nb, const char *tb) { - return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; -} - -/* - Check the typename -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheck(const char *c, swig_type_info *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (strcmp(iter->type->name, c) == 0) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; - } - iter = iter->next; - } - } - return 0; -} - -/* - Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison -*/ -SWIGRUNTIME swig_cast_info * -SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { - if (ty) { - swig_cast_info *iter = ty->cast; - while (iter) { - if (iter->type == from) { - if (iter == ty->cast) - return iter; - /* Move iter to the top of the linked list */ - iter->prev->next = iter->next; - if (iter->next) - iter->next->prev = iter->prev; - iter->next = ty->cast; - iter->prev = 0; - if (ty->cast) ty->cast->prev = iter; - ty->cast = iter; - return iter; - } - iter = iter->next; - } - } - return 0; -} - -/* - Cast a pointer up an inheritance hierarchy -*/ -SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); -} - -/* - Dynamic pointer casting. Down an inheritance hierarchy -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { - swig_type_info *lastty = ty; - if (!ty || !ty->dcast) return ty; - while (ty && (ty->dcast)) { - ty = (*ty->dcast)(ptr); - if (ty) lastty = ty; - } - return lastty; -} - -/* - Return the name associated with this type -*/ -SWIGRUNTIMEINLINE const char * -SWIG_TypeName(const swig_type_info *ty) { - return ty->name; -} - -/* - Return the pretty name associated with this type, - that is an unmangled type name in a form presentable to the user. -*/ -SWIGRUNTIME const char * -SWIG_TypePrettyName(const swig_type_info *type) { - /* The "str" field contains the equivalent pretty names of the - type, separated by vertical-bar characters. We choose - to print the last name, as it is often (?) the most - specific. */ - if (!type) return NULL; - if (type->str != NULL) { - const char *last_name = type->str; - const char *s; - for (s = type->str; *s; s++) - if (*s == '|') last_name = s+1; - return last_name; - } - else - return type->name; -} - -/* - Set the clientdata field for a type -*/ -SWIGRUNTIME void -SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { - swig_cast_info *cast = ti->cast; - /* if (ti->clientdata == clientdata) return; */ - ti->clientdata = clientdata; - - while (cast) { - if (!cast->converter) { - swig_type_info *tc = cast->type; - if (!tc->clientdata) { - SWIG_TypeClientData(tc, clientdata); - } - } - cast = cast->next; - } -} -SWIGRUNTIME void -SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { - SWIG_TypeClientData(ti, clientdata); - ti->owndata = 1; -} - -/* - Search for a swig_type_info structure only by mangled name - Search is a O(log #types) - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_MangledTypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - swig_module_info *iter = start; - do { - if (iter->size) { - size_t l = 0; - size_t r = iter->size - 1; - do { - /* since l+r >= 0, we can (>> 1) instead (/ 2) */ - size_t i = (l + r) >> 1; - const char *iname = iter->types[i]->name; - if (iname) { - int compare = strcmp(name, iname); - if (compare == 0) { - return iter->types[i]; - } else if (compare < 0) { - if (i) { - r = i - 1; - } else { - break; - } - } else if (compare > 0) { - l = i + 1; - } - } else { - break; /* should never happen */ - } - } while (l <= r); - } - iter = iter->next; - } while (iter != end); - return 0; -} - -/* - Search for a swig_type_info structure for either a mangled name or a human readable name. - It first searches the mangled names of the types, which is a O(log #types) - If a type is not found it then searches the human readable names, which is O(#types). - - We start searching at module start, and finish searching when start == end. - Note: if start == end at the beginning of the function, we go all the way around - the circular list. -*/ -SWIGRUNTIME swig_type_info * -SWIG_TypeQueryModule(swig_module_info *start, - swig_module_info *end, - const char *name) { - /* STEP 1: Search the name field using binary search */ - swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); - if (ret) { - return ret; - } else { - /* STEP 2: If the type hasn't been found, do a complete search - of the str field (the human readable name) */ - swig_module_info *iter = start; - do { - size_t i = 0; - for (; i < iter->size; ++i) { - if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) - return iter->types[i]; - } - iter = iter->next; - } while (iter != end); - } - - /* neither found a match */ - return 0; -} - -/* - Pack binary data into a string -*/ -SWIGRUNTIME char * -SWIG_PackData(char *c, void *ptr, size_t sz) { - static const char hex[17] = "0123456789abcdef"; - const unsigned char *u = (unsigned char *) ptr; - const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - unsigned char uu = *u; - *(c++) = hex[(uu & 0xf0) >> 4]; - *(c++) = hex[uu & 0xf]; - } - return c; -} - -/* - Unpack binary data from a string -*/ -SWIGRUNTIME const char * -SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - unsigned char *u = (unsigned char *) ptr; - const unsigned char *eu = u + sz; - for (; u != eu; ++u) { - char d = *(c++); - unsigned char uu; - if ((d >= '0') && (d <= '9')) - uu = (unsigned char)((d - '0') << 4); - else if ((d >= 'a') && (d <= 'f')) - uu = (unsigned char)((d - ('a'-10)) << 4); - else - return (char *) 0; - d = *(c++); - if ((d >= '0') && (d <= '9')) - uu |= (unsigned char)(d - '0'); - else if ((d >= 'a') && (d <= 'f')) - uu |= (unsigned char)(d - ('a'-10)); - else - return (char *) 0; - *u = uu; - } - return c; -} - -/* - Pack 'void *' into a string buffer. -*/ -SWIGRUNTIME char * -SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { - char *r = buff; - if ((2*sizeof(void *) + 2) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,&ptr,sizeof(void *)); - if (strlen(name) + 1 > (bsz - (r - buff))) return 0; - strcpy(r,name); - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - *ptr = (void *) 0; - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sizeof(void *)); -} - -SWIGRUNTIME char * -SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { - char *r = buff; - size_t lname = (name ? strlen(name) : 0); - if ((2*sz + 2 + lname) > bsz) return 0; - *(r++) = '_'; - r = SWIG_PackData(r,ptr,sz); - if (lname) { - strncpy(r,name,lname+1); - } else { - *r = 0; - } - return buff; -} - -SWIGRUNTIME const char * -SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { - if (*c != '_') { - if (strcmp(c,"NULL") == 0) { - memset(ptr,0,sz); - return name; - } else { - return 0; - } - } - return SWIG_UnpackData(++c,ptr,sz); -} - -#ifdef __cplusplus -} -#endif - -/* Errors in SWIG */ -#define SWIG_UnknownError -1 -#define SWIG_IOError -2 -#define SWIG_RuntimeError -3 -#define SWIG_IndexError -4 -#define SWIG_TypeError -5 -#define SWIG_DivisionByZero -6 -#define SWIG_OverflowError -7 -#define SWIG_SyntaxError -8 -#define SWIG_ValueError -9 -#define SWIG_SystemError -10 -#define SWIG_AttributeError -11 -#define SWIG_MemoryError -12 -#define SWIG_NullReferenceError -13 - - - -/* Compatibility macros for Python 3 */ -#if PY_VERSION_HEX >= 0x03000000 - -#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) -#define PyInt_Check(x) PyLong_Check(x) -#define PyInt_AsLong(x) PyLong_AsLong(x) -#define PyInt_FromLong(x) PyLong_FromLong(x) -#define PyInt_FromSize_t(x) PyLong_FromSize_t(x) -#define PyString_Check(name) PyBytes_Check(name) -#define PyString_FromString(x) PyUnicode_FromString(x) -#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args) -#define PyString_AsString(str) PyBytes_AsString(str) -#define PyString_Size(str) PyBytes_Size(str) -#define PyString_InternFromString(key) PyUnicode_InternFromString(key) -#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE -#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x) -#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x) - -#endif - -#ifndef Py_TYPE -# define Py_TYPE(op) ((op)->ob_type) -#endif - -/* SWIG APIs for compatibility of both Python 2 & 3 */ - -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_Python_str_FromFormat PyUnicode_FromFormat -#else -# define SWIG_Python_str_FromFormat PyString_FromFormat -#endif - - -/* Warning: This function will allocate a new string in Python 3, - * so please call SWIG_Python_str_DelForPy3(x) to free the space. - */ -SWIGINTERN char* -SWIG_Python_str_AsChar(PyObject *str) -{ -#if PY_VERSION_HEX >= 0x03000000 - char *newstr = 0; - str = PyUnicode_AsUTF8String(str); - if (str) { - char *cstr; - Py_ssize_t len; - PyBytes_AsStringAndSize(str, &cstr, &len); - newstr = (char *) malloc(len+1); - memcpy(newstr, cstr, len+1); - Py_XDECREF(str); - } - return newstr; -#else - return PyString_AsString(str); -#endif -} - -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) ) -#else -# define SWIG_Python_str_DelForPy3(x) -#endif - - -SWIGINTERN PyObject* -SWIG_Python_str_FromChar(const char *c) -{ -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_FromString(c); -#else - return PyString_FromString(c); -#endif -} - -#ifndef PyObject_DEL -# define PyObject_DEL PyObject_Del -#endif - -// SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user -// interface files check for it. -# define SWIGPY_USE_CAPSULE -# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME) - -#if PY_VERSION_HEX < 0x03020000 -#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type) -#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name) -#define Py_hash_t long -#endif - -/* ----------------------------------------------------------------------------- - * error manipulation - * ----------------------------------------------------------------------------- */ - -SWIGRUNTIME PyObject* -SWIG_Python_ErrorType(int code) { - PyObject* type = 0; - switch(code) { - case SWIG_MemoryError: - type = PyExc_MemoryError; - break; - case SWIG_IOError: - type = PyExc_IOError; - break; - case SWIG_RuntimeError: - type = PyExc_RuntimeError; - break; - case SWIG_IndexError: - type = PyExc_IndexError; - break; - case SWIG_TypeError: - type = PyExc_TypeError; - break; - case SWIG_DivisionByZero: - type = PyExc_ZeroDivisionError; - break; - case SWIG_OverflowError: - type = PyExc_OverflowError; - break; - case SWIG_SyntaxError: - type = PyExc_SyntaxError; - break; - case SWIG_ValueError: - type = PyExc_ValueError; - break; - case SWIG_SystemError: - type = PyExc_SystemError; - break; - case SWIG_AttributeError: - type = PyExc_AttributeError; - break; - default: - type = PyExc_RuntimeError; - } - return type; -} - - -SWIGRUNTIME void -SWIG_Python_AddErrorMsg(const char* mesg) -{ - PyObject *type = 0; - PyObject *value = 0; - PyObject *traceback = 0; - - if (PyErr_Occurred()) - PyErr_Fetch(&type, &value, &traceback); - if (value) { - PyObject *old_str = PyObject_Str(value); - const char *tmp = SWIG_Python_str_AsChar(old_str); - PyErr_Clear(); - Py_XINCREF(type); - if (tmp) - PyErr_Format(type, "%s %s", tmp, mesg); - else - PyErr_Format(type, "%s", mesg); - SWIG_Python_str_DelForPy3(tmp); - Py_DECREF(old_str); - Py_DECREF(value); - } else { - PyErr_SetString(PyExc_RuntimeError, mesg); - } -} - -SWIGRUNTIME int -SWIG_Python_TypeErrorOccurred(PyObject *obj) -{ - PyObject *error; - if (obj) - return 0; - error = PyErr_Occurred(); - return error && PyErr_GivenExceptionMatches(error, PyExc_TypeError); -} - -SWIGRUNTIME void -SWIG_Python_RaiseOrModifyTypeError(const char *message) -{ - if (SWIG_Python_TypeErrorOccurred(NULL)) { - /* Use existing TypeError to preserve stacktrace and enhance with given message */ - PyObject *newvalue; - PyObject *type = NULL, *value = NULL, *traceback = NULL; - PyErr_Fetch(&type, &value, &traceback); -#if PY_VERSION_HEX >= 0x03000000 - newvalue = PyUnicode_FromFormat("%S\nAdditional information:\n%s", value, message); -#else - newvalue = PyString_FromFormat("%s\nAdditional information:\n%s", PyString_AsString(value), message); -#endif - Py_XDECREF(value); - PyErr_Restore(type, newvalue, traceback); - } else { - /* Raise TypeError using given message */ - PyErr_SetString(PyExc_TypeError, message); - } -} - -#if defined(SWIG_PYTHON_NO_THREADS) -# if defined(SWIG_PYTHON_THREADS) -# undef SWIG_PYTHON_THREADS -# endif -#endif -#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ -# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) -# define SWIG_PYTHON_USE_GIL -# endif -# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ -# ifndef SWIG_PYTHON_INITIALIZE_THREADS -# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() -# endif -# ifdef __cplusplus /* C++ code */ - class SWIG_Python_Thread_Block { - bool status; - PyGILState_STATE state; - public: - void end() { if (status) { PyGILState_Release(state); status = false;} } - SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} - ~SWIG_Python_Thread_Block() { end(); } - }; - class SWIG_Python_Thread_Allow { - bool status; - PyThreadState *save; - public: - void end() { if (status) { PyEval_RestoreThread(save); status = false; }} - SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} - ~SWIG_Python_Thread_Allow() { end(); } - }; -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block -# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow -# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() -# else /* C code */ -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() -# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() -# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) -# endif -# else /* Old thread way, not implemented, user must provide it */ -# if !defined(SWIG_PYTHON_INITIALIZE_THREADS) -# define SWIG_PYTHON_INITIALIZE_THREADS -# endif -# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK -# endif -# if !defined(SWIG_PYTHON_THREAD_END_BLOCK) -# define SWIG_PYTHON_THREAD_END_BLOCK -# endif -# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW -# endif -# if !defined(SWIG_PYTHON_THREAD_END_ALLOW) -# define SWIG_PYTHON_THREAD_END_ALLOW -# endif -# endif -#else /* No thread support */ -# define SWIG_PYTHON_INITIALIZE_THREADS -# define SWIG_PYTHON_THREAD_BEGIN_BLOCK -# define SWIG_PYTHON_THREAD_END_BLOCK -# define SWIG_PYTHON_THREAD_BEGIN_ALLOW -# define SWIG_PYTHON_THREAD_END_ALLOW -#endif - -/* ----------------------------------------------------------------------------- - * Python API portion that goes into the runtime - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* ----------------------------------------------------------------------------- - * Constant declarations - * ----------------------------------------------------------------------------- */ - -/* Constant Types */ -#define SWIG_PY_POINTER 4 -#define SWIG_PY_BINARY 5 - -/* Constant information structure */ -typedef struct swig_const_info { - int type; - const char *name; - long lvalue; - double dvalue; - void *pvalue; - swig_type_info **ptype; -} swig_const_info; - -#ifdef __cplusplus -} -#endif - - -/* ----------------------------------------------------------------------------- - * pyrun.swg - * - * This file contains the runtime support for Python modules - * and includes code for managing global variables and pointer - * type checking. - * - * ----------------------------------------------------------------------------- */ - -#if PY_VERSION_HEX < 0x02070000 /* 2.7.0 */ -# error "This version of SWIG only supports Python >= 2.7" -#endif - -#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000 -# error "This version of SWIG only supports Python 3 >= 3.2" -#endif - -/* Common SWIG API */ - -/* for raw pointers */ -#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) -#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) -#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) - -#ifdef SWIGPYTHON_BUILTIN -#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags) -#else -#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) -#endif - -#define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) - -#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) -#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) -#define swig_owntype int - -/* for raw packed data */ -#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) -#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) - -/* for class or struct pointers */ -#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) -#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) - -/* for C or C++ function pointers */ -#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) -#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0) - -/* for C++ member pointers, ie, member methods */ -#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) -#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) - - -/* Runtime API */ - -#define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata) -#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) -#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) - -#define SWIG_SetErrorObj SWIG_Python_SetErrorObj -#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg -#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) -#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail - - -/* Runtime API implementation */ - -/* Error manipulation */ - -SWIGINTERN void -SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyErr_SetObject(errtype, obj); - Py_DECREF(obj); - SWIG_PYTHON_THREAD_END_BLOCK; -} - -SWIGINTERN void -SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - PyErr_SetString(errtype, msg); - SWIG_PYTHON_THREAD_END_BLOCK; -} - -#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) - -/* Set a constant value */ - -#if defined(SWIGPYTHON_BUILTIN) - -SWIGINTERN void -SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) { - PyObject *s = PyString_InternFromString(key); - PyList_Append(seq, s); - Py_DECREF(s); -} - -SWIGINTERN void -SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) { - PyDict_SetItemString(d, name, obj); - Py_DECREF(obj); - if (public_interface) - SwigPyBuiltin_AddPublicSymbol(public_interface, name); -} - -#else - -SWIGINTERN void -SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { - PyDict_SetItemString(d, name, obj); - Py_DECREF(obj); -} - -#endif - -/* Append a value to the result obj */ - -SWIGINTERN PyObject* -SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { - if (!result) { - result = obj; - } else if (result == Py_None) { - Py_DECREF(result); - result = obj; - } else { - if (!PyList_Check(result)) { - PyObject *o2 = result; - result = PyList_New(1); - PyList_SetItem(result, 0, o2); - } - PyList_Append(result,obj); - Py_DECREF(obj); - } - return result; -} - -/* Unpack the argument tuple */ - -SWIGINTERN Py_ssize_t -SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) -{ - if (!args) { - if (!min && !max) { - return 1; - } else { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", - name, (min == max ? "" : "at least "), (int)min); - return 0; - } - } - if (!PyTuple_Check(args)) { - if (min <= 1 && max >= 1) { - Py_ssize_t i; - objs[0] = args; - for (i = 1; i < max; ++i) { - objs[i] = 0; - } - return 2; - } - PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); - return 0; - } else { - Py_ssize_t l = PyTuple_GET_SIZE(args); - if (l < min) { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", - name, (min == max ? "" : "at least "), (int)min, (int)l); - return 0; - } else if (l > max) { - PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", - name, (min == max ? "" : "at most "), (int)max, (int)l); - return 0; - } else { - Py_ssize_t i; - for (i = 0; i < l; ++i) { - objs[i] = PyTuple_GET_ITEM(args, i); - } - for (; l < max; ++l) { - objs[l] = 0; - } - return i + 1; - } - } -} - -/* A functor is a function object with one single object argument */ -#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, (char *)"O", obj); - -/* - Helper for static pointer initialization for both C and C++ code, for example - static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); -*/ -#ifdef __cplusplus -#define SWIG_STATIC_POINTER(var) var -#else -#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var -#endif - -/* ----------------------------------------------------------------------------- - * Pointer declarations - * ----------------------------------------------------------------------------- */ - -/* Flags for new pointer objects */ -#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) -#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) - -#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) - -#define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2) -#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN) - -#ifdef __cplusplus -extern "C" { -#endif - -/* The python void return value */ - -SWIGRUNTIMEINLINE PyObject * -SWIG_Py_Void(void) -{ - PyObject *none = Py_None; - Py_INCREF(none); - return none; -} - -/* SwigPyClientData */ - -typedef struct { - PyObject *klass; - PyObject *newraw; - PyObject *newargs; - PyObject *destroy; - int delargs; - int implicitconv; - PyTypeObject *pytype; -} SwigPyClientData; - -SWIGRUNTIMEINLINE int -SWIG_Python_CheckImplicit(swig_type_info *ty) -{ - SwigPyClientData *data = (SwigPyClientData *)ty->clientdata; - int fail = data ? data->implicitconv : 0; - if (fail) - PyErr_SetString(PyExc_TypeError, "Implicit conversion is prohibited for explicit constructors."); - return fail; -} - -SWIGRUNTIMEINLINE PyObject * -SWIG_Python_ExceptionType(swig_type_info *desc) { - SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0; - PyObject *klass = data ? data->klass : 0; - return (klass ? klass : PyExc_RuntimeError); -} - - -SWIGRUNTIME SwigPyClientData * -SwigPyClientData_New(PyObject* obj) -{ - if (!obj) { - return 0; - } else { - SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData)); - /* the klass element */ - data->klass = obj; - Py_INCREF(data->klass); - /* the newraw method and newargs arguments used to create a new raw instance */ - if (PyClass_Check(obj)) { - data->newraw = 0; - data->newargs = obj; - Py_INCREF(obj); - } else { - data->newraw = PyObject_GetAttrString(data->klass, "__new__"); - if (data->newraw) { - Py_INCREF(data->newraw); - data->newargs = PyTuple_New(1); - PyTuple_SetItem(data->newargs, 0, obj); - } else { - data->newargs = obj; - } - Py_INCREF(data->newargs); - } - /* the destroy method, aka as the C++ delete method */ - data->destroy = PyObject_GetAttrString(data->klass, "__swig_destroy__"); - if (PyErr_Occurred()) { - PyErr_Clear(); - data->destroy = 0; - } - if (data->destroy) { - int flags; - Py_INCREF(data->destroy); - flags = PyCFunction_GET_FLAGS(data->destroy); - data->delargs = !(flags & (METH_O)); - } else { - data->delargs = 0; - } - data->implicitconv = 0; - data->pytype = 0; - return data; - } -} - -SWIGRUNTIME void -SwigPyClientData_Del(SwigPyClientData *data) { - Py_XDECREF(data->newraw); - Py_XDECREF(data->newargs); - Py_XDECREF(data->destroy); -} - -/* =============== SwigPyObject =====================*/ - -typedef struct { - PyObject_HEAD - void *ptr; - swig_type_info *ty; - int own; - PyObject *next; -#ifdef SWIGPYTHON_BUILTIN - PyObject *dict; -#endif -} SwigPyObject; - - -#ifdef SWIGPYTHON_BUILTIN - -SWIGRUNTIME PyObject * -SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) -{ - SwigPyObject *sobj = (SwigPyObject *)v; - - if (!sobj->dict) - sobj->dict = PyDict_New(); - - Py_INCREF(sobj->dict); - return sobj->dict; -} - -#endif - -SWIGRUNTIME PyObject * -SwigPyObject_long(SwigPyObject *v) -{ - return PyLong_FromVoidPtr(v->ptr); -} - -SWIGRUNTIME PyObject * -SwigPyObject_format(const char* fmt, SwigPyObject *v) -{ - PyObject *res = NULL; - PyObject *args = PyTuple_New(1); - if (args) { - if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) { - PyObject *ofmt = SWIG_Python_str_FromChar(fmt); - if (ofmt) { -#if PY_VERSION_HEX >= 0x03000000 - res = PyUnicode_Format(ofmt,args); -#else - res = PyString_Format(ofmt,args); -#endif - Py_DECREF(ofmt); - } - Py_DECREF(args); - } - } - return res; -} - -SWIGRUNTIME PyObject * -SwigPyObject_oct(SwigPyObject *v) -{ - return SwigPyObject_format("%o",v); -} - -SWIGRUNTIME PyObject * -SwigPyObject_hex(SwigPyObject *v) -{ - return SwigPyObject_format("%x",v); -} - -SWIGRUNTIME PyObject * -SwigPyObject_repr(SwigPyObject *v) -{ - const char *name = SWIG_TypePrettyName(v->ty); - PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v); - if (v->next) { - PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); -# if PY_VERSION_HEX >= 0x03000000 - PyObject *joined = PyUnicode_Concat(repr, nrep); - Py_DecRef(repr); - Py_DecRef(nrep); - repr = joined; -# else - PyString_ConcatAndDel(&repr,nrep); -# endif - } - return repr; -} - -/* We need a version taking two PyObject* parameters so it's a valid - * PyCFunction to use in swigobject_methods[]. */ -SWIGRUNTIME PyObject * -SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) -{ - return SwigPyObject_repr((SwigPyObject*)v); -} - -SWIGRUNTIME int -SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) -{ - void *i = v->ptr; - void *j = w->ptr; - return (i < j) ? -1 : ((i > j) ? 1 : 0); -} - -/* Added for Python 3.x, would it also be useful for Python 2.x? */ -SWIGRUNTIME PyObject* -SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) -{ - PyObject* res; - if( op != Py_EQ && op != Py_NE ) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0); - return res; -} - - -SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void); - -#ifdef SWIGPYTHON_BUILTIN -static swig_type_info *SwigPyObject_stype = 0; -SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { - SwigPyClientData *cd; - assert(SwigPyObject_stype); - cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; - assert(cd); - assert(cd->pytype); - return cd->pytype; -} -#else -SWIGRUNTIME PyTypeObject* -SwigPyObject_type(void) { - static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce(); - return type; -} -#endif - -SWIGRUNTIMEINLINE int -SwigPyObject_Check(PyObject *op) { -#ifdef SWIGPYTHON_BUILTIN - PyTypeObject *target_tp = SwigPyObject_type(); - if (PyType_IsSubtype(op->ob_type, target_tp)) - return 1; - return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0); -#else - return (Py_TYPE(op) == SwigPyObject_type()) - || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0); -#endif -} - -SWIGRUNTIME PyObject * -SwigPyObject_New(void *ptr, swig_type_info *ty, int own); - -SWIGRUNTIME void -SwigPyObject_dealloc(PyObject *v) -{ - SwigPyObject *sobj = (SwigPyObject *) v; - PyObject *next = sobj->next; - if (sobj->own == SWIG_POINTER_OWN) { - swig_type_info *ty = sobj->ty; - SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; - PyObject *destroy = data ? data->destroy : 0; - if (destroy) { - /* destroy is always a VARARGS method */ - PyObject *res; - - /* PyObject_CallFunction() has the potential to silently drop - the active exception. In cases of unnamed temporary - variable or where we just finished iterating over a generator - StopIteration will be active right now, and this needs to - remain true upon return from SwigPyObject_dealloc. So save - and restore. */ - - PyObject *type = NULL, *value = NULL, *traceback = NULL; - PyErr_Fetch(&type, &value, &traceback); - - if (data->delargs) { - /* we need to create a temporary object to carry the destroy operation */ - PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); - res = SWIG_Python_CallFunctor(destroy, tmp); - Py_DECREF(tmp); - } else { - PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); - PyObject *mself = PyCFunction_GET_SELF(destroy); - res = ((*meth)(mself, v)); - } - if (!res) - PyErr_WriteUnraisable(destroy); - - PyErr_Restore(type, value, traceback); - - Py_XDECREF(res); - } -#if !defined(SWIG_PYTHON_SILENT_MEMLEAK) - else { - const char *name = SWIG_TypePrettyName(ty); - printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); - } -#endif - } - Py_XDECREF(next); - PyObject_DEL(v); -} - -SWIGRUNTIME PyObject* -SwigPyObject_append(PyObject* v, PyObject* next) -{ - SwigPyObject *sobj = (SwigPyObject *) v; - if (!SwigPyObject_Check(next)) { - PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject"); - return NULL; - } - sobj->next = next; - Py_INCREF(next); - return SWIG_Py_Void(); -} - -SWIGRUNTIME PyObject* -SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) -{ - SwigPyObject *sobj = (SwigPyObject *) v; - if (sobj->next) { - Py_INCREF(sobj->next); - return sobj->next; - } else { - return SWIG_Py_Void(); - } -} - -SWIGINTERN PyObject* -SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) -{ - SwigPyObject *sobj = (SwigPyObject *)v; - sobj->own = 0; - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject* -SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) -{ - SwigPyObject *sobj = (SwigPyObject *)v; - sobj->own = SWIG_POINTER_OWN; - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject* -SwigPyObject_own(PyObject *v, PyObject *args) -{ - PyObject *val = 0; - if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) { - return NULL; - } else { - SwigPyObject *sobj = (SwigPyObject *)v; - PyObject *obj = PyBool_FromLong(sobj->own); - if (val) { - if (PyObject_IsTrue(val)) { - SwigPyObject_acquire(v,args); - } else { - SwigPyObject_disown(v,args); - } - } - return obj; - } -} - -static PyMethodDef -swigobject_methods[] = { - {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"}, - {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"}, - {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"}, - {"append", SwigPyObject_append, METH_O, "appends another 'this' object"}, - {"next", SwigPyObject_next, METH_NOARGS, "returns the next 'this' object"}, - {"__repr__",SwigPyObject_repr2, METH_NOARGS, "returns object representation"}, - {0, 0, 0, 0} -}; - -SWIGRUNTIME PyTypeObject* -SwigPyObject_TypeOnce(void) { - static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; - - static PyNumberMethods SwigPyObject_as_number = { - (binaryfunc)0, /*nb_add*/ - (binaryfunc)0, /*nb_subtract*/ - (binaryfunc)0, /*nb_multiply*/ - /* nb_divide removed in Python 3 */ -#if PY_VERSION_HEX < 0x03000000 - (binaryfunc)0, /*nb_divide*/ -#endif - (binaryfunc)0, /*nb_remainder*/ - (binaryfunc)0, /*nb_divmod*/ - (ternaryfunc)0,/*nb_power*/ - (unaryfunc)0, /*nb_negative*/ - (unaryfunc)0, /*nb_positive*/ - (unaryfunc)0, /*nb_absolute*/ - (inquiry)0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ -#if PY_VERSION_HEX < 0x03000000 - 0, /*nb_coerce*/ -#endif - (unaryfunc)SwigPyObject_long, /*nb_int*/ -#if PY_VERSION_HEX < 0x03000000 - (unaryfunc)SwigPyObject_long, /*nb_long*/ -#else - 0, /*nb_reserved*/ -#endif - (unaryfunc)0, /*nb_float*/ -#if PY_VERSION_HEX < 0x03000000 - (unaryfunc)SwigPyObject_oct, /*nb_oct*/ - (unaryfunc)SwigPyObject_hex, /*nb_hex*/ -#endif -#if PY_VERSION_HEX >= 0x03050000 /* 3.5 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */ -#elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */ -#else - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ -#endif - }; - - static PyTypeObject swigpyobject_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp = { -#if PY_VERSION_HEX >= 0x03000000 - PyVarObject_HEAD_INIT(NULL, 0) -#else - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ -#endif - "SwigPyObject", /* tp_name */ - sizeof(SwigPyObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)SwigPyObject_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX >= 0x03000000 - 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */ -#else - (cmpfunc)SwigPyObject_compare, /* tp_compare */ -#endif - (reprfunc)SwigPyObject_repr, /* tp_repr */ - &SwigPyObject_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigobject_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - swigobject_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ - 0, /* tp_del */ - 0, /* tp_version_tag */ -#if PY_VERSION_HEX >= 0x03040000 - 0, /* tp_finalize */ -#endif -#ifdef COUNT_ALLOCS - 0, /* tp_allocs */ - 0, /* tp_frees */ - 0, /* tp_maxalloc */ - 0, /* tp_prev */ - 0 /* tp_next */ -#endif - }; - swigpyobject_type = tmp; - type_init = 1; - if (PyType_Ready(&swigpyobject_type) < 0) - return NULL; - } - return &swigpyobject_type; -} - -SWIGRUNTIME PyObject * -SwigPyObject_New(void *ptr, swig_type_info *ty, int own) -{ - SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type()); - if (sobj) { - sobj->ptr = ptr; - sobj->ty = ty; - sobj->own = own; - sobj->next = 0; - } - return (PyObject *)sobj; -} - -/* ----------------------------------------------------------------------------- - * Implements a simple Swig Packed type, and use it instead of string - * ----------------------------------------------------------------------------- */ - -typedef struct { - PyObject_HEAD - void *pack; - swig_type_info *ty; - size_t size; -} SwigPyPacked; - -SWIGRUNTIME PyObject * -SwigPyPacked_repr(SwigPyPacked *v) -{ - char result[SWIG_BUFFER_SIZE]; - if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { - return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name); - } else { - return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name); - } -} - -SWIGRUNTIME PyObject * -SwigPyPacked_str(SwigPyPacked *v) -{ - char result[SWIG_BUFFER_SIZE]; - if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ - return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name); - } else { - return SWIG_Python_str_FromChar(v->ty->name); - } -} - -SWIGRUNTIME int -SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) -{ - size_t i = v->size; - size_t j = w->size; - int s = (i < j) ? -1 : ((i > j) ? 1 : 0); - return s ? s : strncmp((const char *)v->pack, (const char *)w->pack, 2*v->size); -} - -SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void); - -SWIGRUNTIME PyTypeObject* -SwigPyPacked_type(void) { - static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce(); - return type; -} - -SWIGRUNTIMEINLINE int -SwigPyPacked_Check(PyObject *op) { - return ((op)->ob_type == SwigPyPacked_TypeOnce()) - || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0); -} - -SWIGRUNTIME void -SwigPyPacked_dealloc(PyObject *v) -{ - if (SwigPyPacked_Check(v)) { - SwigPyPacked *sobj = (SwigPyPacked *) v; - free(sobj->pack); - } - PyObject_DEL(v); -} - -SWIGRUNTIME PyTypeObject* -SwigPyPacked_TypeOnce(void) { - static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; - static PyTypeObject swigpypacked_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp = { -#if PY_VERSION_HEX>=0x03000000 - PyVarObject_HEAD_INIT(NULL, 0) -#else - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ -#endif - "SwigPyPacked", /* tp_name */ - sizeof(SwigPyPacked), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)SwigPyPacked_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ -#if PY_VERSION_HEX>=0x03000000 - 0, /* tp_reserved in 3.0.1 */ -#else - (cmpfunc)SwigPyPacked_compare, /* tp_compare */ -#endif - (reprfunc)SwigPyPacked_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)SwigPyPacked_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - swigpacked_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ - 0, /* tp_del */ - 0, /* tp_version_tag */ -#if PY_VERSION_HEX >= 0x03040000 - 0, /* tp_finalize */ -#endif -#ifdef COUNT_ALLOCS - 0, /* tp_allocs */ - 0, /* tp_frees */ - 0, /* tp_maxalloc */ - 0, /* tp_prev */ - 0 /* tp_next */ -#endif - }; - swigpypacked_type = tmp; - type_init = 1; - if (PyType_Ready(&swigpypacked_type) < 0) - return NULL; - } - return &swigpypacked_type; -} - -SWIGRUNTIME PyObject * -SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) -{ - SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type()); - if (sobj) { - void *pack = malloc(size); - if (pack) { - memcpy(pack, ptr, size); - sobj->pack = pack; - sobj->ty = ty; - sobj->size = size; - } else { - PyObject_DEL((PyObject *) sobj); - sobj = 0; - } - } - return (PyObject *) sobj; -} - -SWIGRUNTIME swig_type_info * -SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) -{ - if (SwigPyPacked_Check(obj)) { - SwigPyPacked *sobj = (SwigPyPacked *)obj; - if (sobj->size != size) return 0; - memcpy(ptr, sobj->pack, size); - return sobj->ty; - } else { - return 0; - } -} - -/* ----------------------------------------------------------------------------- - * pointers/data manipulation - * ----------------------------------------------------------------------------- */ - -static PyObject *Swig_This_global = NULL; - -SWIGRUNTIME PyObject * -SWIG_This(void) -{ - if (Swig_This_global == NULL) - Swig_This_global = SWIG_Python_str_FromChar("this"); - return Swig_This_global; -} - -/* #define SWIG_PYTHON_SLOW_GETSET_THIS */ - -/* TODO: I don't know how to implement the fast getset in Python 3 right now */ -#if PY_VERSION_HEX>=0x03000000 -#define SWIG_PYTHON_SLOW_GETSET_THIS -#endif - -SWIGRUNTIME SwigPyObject * -SWIG_Python_GetSwigThis(PyObject *pyobj) -{ - PyObject *obj; - - if (SwigPyObject_Check(pyobj)) - return (SwigPyObject *) pyobj; - -#ifdef SWIGPYTHON_BUILTIN - (void)obj; -# ifdef PyWeakref_CheckProxy - if (PyWeakref_CheckProxy(pyobj)) { - pyobj = PyWeakref_GET_OBJECT(pyobj); - if (pyobj && SwigPyObject_Check(pyobj)) - return (SwigPyObject*) pyobj; - } -# endif - return NULL; -#else - - obj = 0; - -#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) - if (PyInstance_Check(pyobj)) { - obj = _PyInstance_Lookup(pyobj, SWIG_This()); - } else { - PyObject **dictptr = _PyObject_GetDictPtr(pyobj); - if (dictptr != NULL) { - PyObject *dict = *dictptr; - obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; - } else { -#ifdef PyWeakref_CheckProxy - if (PyWeakref_CheckProxy(pyobj)) { - PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); - return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; - } -#endif - obj = PyObject_GetAttr(pyobj,SWIG_This()); - if (obj) { - Py_DECREF(obj); - } else { - if (PyErr_Occurred()) PyErr_Clear(); - return 0; - } - } - } -#else - obj = PyObject_GetAttr(pyobj,SWIG_This()); - if (obj) { - Py_DECREF(obj); - } else { - if (PyErr_Occurred()) PyErr_Clear(); - return 0; - } -#endif - if (obj && !SwigPyObject_Check(obj)) { - /* a PyObject is called 'this', try to get the 'real this' - SwigPyObject from it */ - return SWIG_Python_GetSwigThis(obj); - } - return (SwigPyObject *)obj; -#endif -} - -/* Acquire a pointer value */ - -SWIGRUNTIME int -SWIG_Python_AcquirePtr(PyObject *obj, int own) { - if (own == SWIG_POINTER_OWN) { - SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj); - if (sobj) { - int oldown = sobj->own; - sobj->own = own; - return oldown; - } - } - return 0; -} - -/* Convert a pointer value */ - -SWIGRUNTIME int -SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { - int res; - SwigPyObject *sobj; - int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0; - - if (!obj) - return SWIG_ERROR; - if (obj == Py_None && !implicit_conv) { - if (ptr) - *ptr = 0; - return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; - } - - res = SWIG_ERROR; - - sobj = SWIG_Python_GetSwigThis(obj); - if (own) - *own = 0; - while (sobj) { - void *vptr = sobj->ptr; - if (ty) { - swig_type_info *to = sobj->ty; - if (to == ty) { - /* no type cast needed */ - if (ptr) *ptr = vptr; - break; - } else { - swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); - if (!tc) { - sobj = (SwigPyObject *)sobj->next; - } else { - if (ptr) { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,vptr,&newmemory); - if (newmemory == SWIG_CAST_NEW_MEMORY) { - assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ - if (own) - *own = *own | SWIG_CAST_NEW_MEMORY; - } - } - break; - } - } - } else { - if (ptr) *ptr = vptr; - break; - } - } - if (sobj) { - if (own) - *own = *own | sobj->own; - if (flags & SWIG_POINTER_DISOWN) { - sobj->own = 0; - } - res = SWIG_OK; - } else { - if (implicit_conv) { - SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0; - if (data && !data->implicitconv) { - PyObject *klass = data->klass; - if (klass) { - PyObject *impconv; - data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ - impconv = SWIG_Python_CallFunctor(klass, obj); - data->implicitconv = 0; - if (PyErr_Occurred()) { - PyErr_Clear(); - impconv = 0; - } - if (impconv) { - SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv); - if (iobj) { - void *vptr; - res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); - if (SWIG_IsOK(res)) { - if (ptr) { - *ptr = vptr; - /* transfer the ownership to 'ptr' */ - iobj->own = 0; - res = SWIG_AddCast(res); - res = SWIG_AddNewMask(res); - } else { - res = SWIG_AddCast(res); - } - } - } - Py_DECREF(impconv); - } - } - } - if (!SWIG_IsOK(res) && obj == Py_None) { - if (ptr) - *ptr = 0; - if (PyErr_Occurred()) - PyErr_Clear(); - res = SWIG_OK; - } - } - } - return res; -} - -/* Convert a function ptr value */ - -SWIGRUNTIME int -SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { - if (!PyCFunction_Check(obj)) { - return SWIG_ConvertPtr(obj, ptr, ty, 0); - } else { - void *vptr = 0; - swig_cast_info *tc; - - /* here we get the method pointer for callbacks */ - const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); - const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; - if (desc) - desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; - if (!desc) - return SWIG_ERROR; - tc = SWIG_TypeCheck(desc,ty); - if (tc) { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc,vptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - } else { - return SWIG_ERROR; - } - return SWIG_OK; - } -} - -/* Convert a packed pointer value */ - -SWIGRUNTIME int -SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { - swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz); - if (!to) return SWIG_ERROR; - if (ty) { - if (to != ty) { - /* check type cast? */ - swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); - if (!tc) return SWIG_ERROR; - } - } - return SWIG_OK; -} - -/* ----------------------------------------------------------------------------- - * Create a new pointer object - * ----------------------------------------------------------------------------- */ - -/* - Create a new instance object, without calling __init__, and set the - 'this' attribute. -*/ - -SWIGRUNTIME PyObject* -SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) -{ - PyObject *inst = 0; - PyObject *newraw = data->newraw; - if (newraw) { - inst = PyObject_Call(newraw, data->newargs, NULL); - if (inst) { -#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) - PyObject **dictptr = _PyObject_GetDictPtr(inst); - if (dictptr != NULL) { - PyObject *dict = *dictptr; - if (dict == NULL) { - dict = PyDict_New(); - *dictptr = dict; - PyDict_SetItem(dict, SWIG_This(), swig_this); - } - } -#else - PyObject *key = SWIG_This(); - PyObject_SetAttr(inst, key, swig_this); -#endif - } - } else { -#if PY_VERSION_HEX >= 0x03000000 - PyObject *empty_args = PyTuple_New(0); - if (empty_args) { - PyObject *empty_kwargs = PyDict_New(); - if (empty_kwargs) { - inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, empty_kwargs); - Py_DECREF(empty_kwargs); - if (inst) { - PyObject_SetAttr(inst, SWIG_This(), swig_this); - Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; - } - } - Py_DECREF(empty_args); - } -#else - PyObject *dict = PyDict_New(); - if (dict) { - PyDict_SetItem(dict, SWIG_This(), swig_this); - inst = PyInstance_NewRaw(data->newargs, dict); - Py_DECREF(dict); - } -#endif - } - return inst; -} - -SWIGRUNTIME void -SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) -{ - PyObject *dict; -#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) - PyObject **dictptr = _PyObject_GetDictPtr(inst); - if (dictptr != NULL) { - dict = *dictptr; - if (dict == NULL) { - dict = PyDict_New(); - *dictptr = dict; - } - PyDict_SetItem(dict, SWIG_This(), swig_this); - return; - } -#endif - dict = PyObject_GetAttrString(inst, "__dict__"); - PyDict_SetItem(dict, SWIG_This(), swig_this); - Py_DECREF(dict); -} - - -SWIGINTERN PyObject * -SWIG_Python_InitShadowInstance(PyObject *args) { - PyObject *obj[2]; - if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) { - return NULL; - } else { - SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]); - if (sthis) { - SwigPyObject_append((PyObject*) sthis, obj[1]); - } else { - SWIG_Python_SetSwigThis(obj[0], obj[1]); - } - return SWIG_Py_Void(); - } -} - -/* Create a new pointer object */ - -SWIGRUNTIME PyObject * -SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) { - SwigPyClientData *clientdata; - PyObject * robj; - int own; - - if (!ptr) - return SWIG_Py_Void(); - - clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0; - own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; - if (clientdata && clientdata->pytype) { - SwigPyObject *newobj; - if (flags & SWIG_BUILTIN_TP_INIT) { - newobj = (SwigPyObject*) self; - if (newobj->ptr) { - PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0); - while (newobj->next) - newobj = (SwigPyObject *) newobj->next; - newobj->next = next_self; - newobj = (SwigPyObject *)next_self; -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif - } - } else { - newobj = PyObject_New(SwigPyObject, clientdata->pytype); -#ifdef SWIGPYTHON_BUILTIN - newobj->dict = 0; -#endif - } - if (newobj) { - newobj->ptr = ptr; - newobj->ty = type; - newobj->own = own; - newobj->next = 0; - return (PyObject*) newobj; - } - return SWIG_Py_Void(); - } - - assert(!(flags & SWIG_BUILTIN_TP_INIT)); - - robj = SwigPyObject_New(ptr, type, own); - if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { - PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); - Py_DECREF(robj); - robj = inst; - } - return robj; -} - -/* Create a new packed object */ - -SWIGRUNTIMEINLINE PyObject * -SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { - return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); -} - -/* -----------------------------------------------------------------------------* - * Get type list - * -----------------------------------------------------------------------------*/ - -#ifdef SWIG_LINK_RUNTIME -void *SWIG_ReturnGlobalTypeList(void *); -#endif - -SWIGRUNTIME swig_module_info * -SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) { - static void *type_pointer = (void *)0; - /* first check if module already created */ - if (!type_pointer) { -#ifdef SWIG_LINK_RUNTIME - type_pointer = SWIG_ReturnGlobalTypeList((void *)0); -#else - type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0); - if (PyErr_Occurred()) { - PyErr_Clear(); - type_pointer = (void *)0; - } -#endif - } - return (swig_module_info *) type_pointer; -} - -SWIGRUNTIME void -SWIG_Python_DestroyModule(PyObject *obj) -{ - swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME); - swig_type_info **types = swig_module->types; - size_t i; - for (i =0; i < swig_module->size; ++i) { - swig_type_info *ty = types[i]; - if (ty->owndata) { - SwigPyClientData *data = (SwigPyClientData *) ty->clientdata; - if (data) SwigPyClientData_Del(data); - } - } - Py_DECREF(SWIG_This()); - Swig_This_global = NULL; -} - -SWIGRUNTIME void -SWIG_Python_SetModule(swig_module_info *swig_module) { -#if PY_VERSION_HEX >= 0x03000000 - /* Add a dummy module object into sys.modules */ - PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION); -#else - static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */ - PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table); -#endif - PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule); - if (pointer && module) { - PyModule_AddObject(module, "type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer); - } else { - Py_XDECREF(pointer); - } -} - -/* The python cached type query */ -SWIGRUNTIME PyObject * -SWIG_Python_TypeCache(void) { - static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); - return cache; -} - -SWIGRUNTIME swig_type_info * -SWIG_Python_TypeQuery(const char *type) -{ - PyObject *cache = SWIG_Python_TypeCache(); - PyObject *key = SWIG_Python_str_FromChar(type); - PyObject *obj = PyDict_GetItem(cache, key); - swig_type_info *descriptor; - if (obj) { - descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL); - } else { - swig_module_info *swig_module = SWIG_GetModule(0); - descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); - if (descriptor) { - obj = PyCapsule_New((void*) descriptor, NULL, NULL); - PyDict_SetItem(cache, key, obj); - Py_DECREF(obj); - } - } - Py_DECREF(key); - return descriptor; -} - -/* - For backward compatibility only -*/ -#define SWIG_POINTER_EXCEPTION 0 -#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) -#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) - -SWIGRUNTIME int -SWIG_Python_AddErrMesg(const char* mesg, int infront) -{ - if (PyErr_Occurred()) { - PyObject *type = 0; - PyObject *value = 0; - PyObject *traceback = 0; - PyErr_Fetch(&type, &value, &traceback); - if (value) { - PyObject *old_str = PyObject_Str(value); - const char *tmp = SWIG_Python_str_AsChar(old_str); - const char *errmesg = tmp ? tmp : "Invalid error message"; - Py_XINCREF(type); - PyErr_Clear(); - if (infront) { - PyErr_Format(type, "%s %s", mesg, errmesg); - } else { - PyErr_Format(type, "%s %s", errmesg, mesg); - } - SWIG_Python_str_DelForPy3(tmp); - Py_DECREF(old_str); - } - return 1; - } else { - return 0; - } -} - -SWIGRUNTIME int -SWIG_Python_ArgFail(int argnum) -{ - if (PyErr_Occurred()) { - /* add information about failing argument */ - char mesg[256]; - PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); - return SWIG_Python_AddErrMesg(mesg, 1); - } else { - return 0; - } -} - -SWIGRUNTIMEINLINE const char * -SwigPyObject_GetDesc(PyObject *self) -{ - SwigPyObject *v = (SwigPyObject *)self; - swig_type_info *ty = v ? v->ty : 0; - return ty ? ty->str : ""; -} - -SWIGRUNTIME void -SWIG_Python_TypeError(const char *type, PyObject *obj) -{ - if (type) { -#if defined(SWIG_COBJECT_TYPES) - if (obj && SwigPyObject_Check(obj)) { - const char *otype = (const char *) SwigPyObject_GetDesc(obj); - if (otype) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received", - type, otype); - return; - } - } else -#endif - { - const char *otype = (obj ? obj->ob_type->tp_name : 0); - if (otype) { - PyObject *str = PyObject_Str(obj); - const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0; - if (cstr) { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", - type, otype, cstr); - SWIG_Python_str_DelForPy3(cstr); - } else { - PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", - type, otype); - } - Py_XDECREF(str); - return; - } - } - PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); - } else { - PyErr_Format(PyExc_TypeError, "unexpected type is received"); - } -} - - -/* Convert a pointer value, signal an exception on a type mismatch */ -SWIGRUNTIME void * -SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) { - void *result; - if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { - PyErr_Clear(); -#if SWIG_POINTER_EXCEPTION - if (flags) { - SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); - SWIG_Python_ArgFail(argnum); - } -#endif - } - return result; -} - -#ifdef SWIGPYTHON_BUILTIN -SWIGRUNTIME int -SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) { - PyTypeObject *tp = obj->ob_type; - PyObject *descr; - PyObject *encoded_name; - descrsetfunc f; - int res = -1; - -# ifdef Py_USING_UNICODE - if (PyString_Check(name)) { - name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL); - if (!name) - return -1; - } else if (!PyUnicode_Check(name)) -# else - if (!PyString_Check(name)) -# endif - { - PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name); - return -1; - } else { - Py_INCREF(name); - } - - if (!tp->tp_dict) { - if (PyType_Ready(tp) < 0) - goto done; - } - - descr = _PyType_Lookup(tp, name); - f = NULL; - if (descr != NULL) - f = descr->ob_type->tp_descr_set; - if (!f) { - if (PyString_Check(name)) { - encoded_name = name; - Py_INCREF(name); - } else { - encoded_name = PyUnicode_AsUTF8String(name); - if (!encoded_name) - return -1; - } - PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name)); - Py_DECREF(encoded_name); - } else { - res = f(descr, obj, value); - } - - done: - Py_DECREF(name); - return res; -} -#endif - - -#ifdef __cplusplus -} -#endif - - - -#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) - -#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else - - - -#ifdef __cplusplus -extern "C" { -#endif - -/* Method creation and docstring support functions */ - -SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name); -SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func); -SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func); - -#ifdef __cplusplus -} -#endif - - - #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) - - -/* -------- TYPES TABLE (BEGIN) -------- */ - -#define SWIGTYPE_p_Cdi swig_types[0] -#define SWIGTYPE_p_CdiGrid swig_types[1] -#define SWIGTYPE_p_CdiTaxis swig_types[2] -#define SWIGTYPE_p_CdiVariable swig_types[3] -#define SWIGTYPE_p_CdiZaxis swig_types[4] -#define SWIGTYPE_p_allocator_type swig_types[5] -#define SWIGTYPE_p_char swig_types[6] -#define SWIGTYPE_p_difference_type swig_types[7] -#define SWIGTYPE_p_double swig_types[8] -#define SWIGTYPE_p_float swig_types[9] -#define SWIGTYPE_p_key_type swig_types[10] -#define SWIGTYPE_p_mapped_type swig_types[11] -#define SWIGTYPE_p_p_PyObject swig_types[12] -#define SWIGTYPE_p_p_double swig_types[13] -#define SWIGTYPE_p_size_type swig_types[14] -#define SWIGTYPE_p_std__allocatorT_CdiVariable_t swig_types[15] -#define SWIGTYPE_p_std__allocatorT_double_t swig_types[16] -#define SWIGTYPE_p_std__allocatorT_int_t swig_types[17] -#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t swig_types[18] -#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t swig_types[19] -#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t swig_types[20] -#define SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t swig_types[21] -#define SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t swig_types[22] -#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[23] -#define SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t swig_types[24] -#define SWIGTYPE_p_std__invalid_argument swig_types[25] -#define SWIGTYPE_p_std__lessT_int_t swig_types[26] -#define SWIGTYPE_p_std__lessT_std__string_t swig_types[27] -#define SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t swig_types[28] -#define SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t swig_types[29] -#define SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t swig_types[30] -#define SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t swig_types[31] -#define SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t swig_types[32] -#define SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t swig_types[33] -#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[34] -#define SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t swig_types[35] -#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[36] -#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[37] -#define SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t swig_types[38] -#define SWIGTYPE_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t swig_types[39] -#define SWIGTYPE_p_swig__SwigPyIterator swig_types[40] -#define SWIGTYPE_p_value_type swig_types[41] -static swig_type_info *swig_types[43]; -static swig_module_info swig_module = {swig_types, 42, 0, 0, 0, 0}; -#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) -#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) - -/* -------- TYPES TABLE (END) -------- */ - -#ifdef SWIG_TypeQuery -# undef SWIG_TypeQuery -#endif -#define SWIG_TypeQuery SWIG_Python_TypeQuery - -/*----------------------------------------------- - @(target):= _CdiObj.so - ------------------------------------------------*/ -#if PY_VERSION_HEX >= 0x03000000 -# define SWIG_init PyInit__CdiObj - -#else -# define SWIG_init init_CdiObj - -#endif -#define SWIG_name "_CdiObj" - -#define SWIGVERSION 0x040000 -#define SWIG_VERSION SWIGVERSION - - -#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) -#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) - - -#include <stdexcept> - - -namespace swig { - class SwigPtr_PyObject { - protected: - PyObject *_obj; - - public: - SwigPtr_PyObject() :_obj(0) - { - } - - SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj) - { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - Py_XINCREF(_obj); - SWIG_PYTHON_THREAD_END_BLOCK; - } - - SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj) - { - if (initial_ref) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - Py_XINCREF(_obj); - SWIG_PYTHON_THREAD_END_BLOCK; - } - } - - SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item) - { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - Py_XINCREF(item._obj); - Py_XDECREF(_obj); - _obj = item._obj; - SWIG_PYTHON_THREAD_END_BLOCK; - return *this; - } - - ~SwigPtr_PyObject() - { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - Py_XDECREF(_obj); - SWIG_PYTHON_THREAD_END_BLOCK; - } - - operator PyObject *() const - { - return _obj; - } - - PyObject *operator->() const - { - return _obj; - } - }; -} - - -namespace swig { - struct SwigVar_PyObject : SwigPtr_PyObject { - SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { } - - SwigVar_PyObject & operator = (PyObject* obj) - { - Py_XDECREF(_obj); - _obj = obj; - return *this; - } - }; -} - - -#define SWIG_FILE_WITH_INIT -#include "cdi.hpp" - - -#include <typeinfo> -#include <stdexcept> - - -#if defined(__GNUC__) -# if __GNUC__ == 2 && __GNUC_MINOR <= 96 -# define SWIG_STD_NOMODERN_STL -# endif -#endif - - -#include <string> - - -#include <stddef.h> - - -#include <iostream> - -#if PY_VERSION_HEX >= 0x03020000 -# define SWIGPY_SLICE_ARG(obj) ((PyObject*) (obj)) -#else -# define SWIGPY_SLICE_ARG(obj) ((PySliceObject*) (obj)) -#endif - - -namespace swig { - struct stop_iteration { - }; - - struct SwigPyIterator { - private: - SwigPtr_PyObject _seq; - - protected: - SwigPyIterator(PyObject *seq) : _seq(seq) - { - } - - public: - virtual ~SwigPyIterator() {} - - // Access iterator method, required by Python - virtual PyObject *value() const = 0; - - // Forward iterator method, required by Python - virtual SwigPyIterator *incr(size_t n = 1) = 0; - - // Backward iterator method, very common in C++, but not required in Python - virtual SwigPyIterator *decr(size_t /*n*/ = 1) - { - throw stop_iteration(); - } - - // Random access iterator methods, but not required in Python - virtual ptrdiff_t distance(const SwigPyIterator &/*x*/) const - { - throw std::invalid_argument("operation not supported"); - } - - virtual bool equal (const SwigPyIterator &/*x*/) const - { - throw std::invalid_argument("operation not supported"); - } - - // C++ common/needed methods - virtual SwigPyIterator *copy() const = 0; - - PyObject *next() - { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; // disable threads - PyObject *obj = value(); - incr(); - SWIG_PYTHON_THREAD_END_BLOCK; // re-enable threads - return obj; - } - - /* Make an alias for Python 3.x */ - PyObject *__next__() - { - return next(); - } - - PyObject *previous() - { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; // disable threads - decr(); - PyObject *obj = value(); - SWIG_PYTHON_THREAD_END_BLOCK; // re-enable threads - return obj; - } - - SwigPyIterator *advance(ptrdiff_t n) - { - return (n > 0) ? incr(n) : decr(-n); - } - - bool operator == (const SwigPyIterator& x) const - { - return equal(x); - } - - bool operator != (const SwigPyIterator& x) const - { - return ! operator==(x); - } - - SwigPyIterator& operator += (ptrdiff_t n) - { - return *advance(n); - } - - SwigPyIterator& operator -= (ptrdiff_t n) - { - return *advance(-n); - } - - SwigPyIterator* operator + (ptrdiff_t n) const - { - return copy()->advance(n); - } - - SwigPyIterator* operator - (ptrdiff_t n) const - { - return copy()->advance(-n); - } - - ptrdiff_t operator - (const SwigPyIterator& x) const - { - return x.distance(*this); - } - - static swig_type_info* descriptor() { - static int init = 0; - static swig_type_info* desc = 0; - if (!init) { - desc = SWIG_TypeQuery("swig::SwigPyIterator *"); - init = 1; - } - return desc; - } - }; - -#if defined(SWIGPYTHON_BUILTIN) - inline PyObject* make_output_iterator_builtin (PyObject *pyself) - { - Py_INCREF(pyself); - return pyself; - } -#endif -} - - -SWIGINTERN int -SWIG_AsVal_double (PyObject *obj, double *val) -{ - int res = SWIG_TypeError; - if (PyFloat_Check(obj)) { - if (val) *val = PyFloat_AsDouble(obj); - return SWIG_OK; -#if PY_VERSION_HEX < 0x03000000 - } else if (PyInt_Check(obj)) { - if (val) *val = (double) PyInt_AsLong(obj); - return SWIG_OK; -#endif - } else if (PyLong_Check(obj)) { - double v = PyLong_AsDouble(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - double d = PyFloat_AsDouble(obj); - if (!PyErr_Occurred()) { - if (val) *val = d; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); - } else { - PyErr_Clear(); - } - } - } -#endif - return res; -} - - -#include <float.h> - - -#include <math.h> - - -SWIGINTERNINLINE int -SWIG_CanCastAsInteger(double *d, double min, double max) { - double x = *d; - if ((min <= x && x <= max)) { - double fx = floor(x); - double cx = ceil(x); - double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ - if ((errno == EDOM) || (errno == ERANGE)) { - errno = 0; - } else { - double summ, reps, diff; - if (rd < x) { - diff = x - rd; - } else if (rd > x) { - diff = rd - x; - } else { - return 1; - } - summ = rd + x; - reps = diff/summ; - if (reps < 8*DBL_EPSILON) { - *d = rd; - return 1; - } - } - } - return 0; -} - - -SWIGINTERN int -SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) -{ -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(obj)) { - long v = PyInt_AsLong(obj); - if (v >= 0) { - if (val) *val = v; - return SWIG_OK; - } else { - return SWIG_OverflowError; - } - } else -#endif - if (PyLong_Check(obj)) { - unsigned long v = PyLong_AsUnsignedLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - return SWIG_OverflowError; - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - unsigned long v = PyLong_AsUnsignedLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - double d; - int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) { - if (val) *val = (unsigned long)(d); - return res; - } - } - } -#endif - return SWIG_TypeError; -} - - -#include <limits.h> -#if !defined(SWIG_NO_LLONG_MAX) -# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) -# define LLONG_MAX __LONG_LONG_MAX__ -# define LLONG_MIN (-LLONG_MAX - 1LL) -# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) -# endif -#endif - - -#if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE) -# define SWIG_LONG_LONG_AVAILABLE -#endif - - -#ifdef SWIG_LONG_LONG_AVAILABLE -SWIGINTERN int -SWIG_AsVal_unsigned_SS_long_SS_long (PyObject *obj, unsigned long long *val) -{ - int res = SWIG_TypeError; - if (PyLong_Check(obj)) { - unsigned long long v = PyLong_AsUnsignedLongLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - res = SWIG_OverflowError; - } - } else { - unsigned long v; - res = SWIG_AsVal_unsigned_SS_long (obj,&v); - if (SWIG_IsOK(res)) { - if (val) *val = v; - return res; - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - const double mant_max = 1LL << DBL_MANT_DIG; - double d; - res = SWIG_AsVal_double (obj,&d); - if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, 0, mant_max)) - return SWIG_OverflowError; - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) { - if (val) *val = (unsigned long long)(d); - return SWIG_AddCast(res); - } - res = SWIG_TypeError; - } -#endif - return res; -} -#endif - - -SWIGINTERNINLINE int -SWIG_AsVal_size_t (PyObject * obj, size_t *val) -{ - int res = SWIG_TypeError; -#ifdef SWIG_LONG_LONG_AVAILABLE - if (sizeof(size_t) <= sizeof(unsigned long)) { -#endif - unsigned long v; - res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v); -#ifdef SWIG_LONG_LONG_AVAILABLE - } else if (sizeof(size_t) <= sizeof(unsigned long long)) { - unsigned long long v; - res = SWIG_AsVal_unsigned_SS_long_SS_long (obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v); - } -#endif - return res; -} - - - #define SWIG_From_long PyInt_FromLong - - -#ifdef SWIG_LONG_LONG_AVAILABLE -SWIGINTERNINLINE PyObject* -SWIG_From_long_SS_long (long long value) -{ - return ((value < LONG_MIN) || (value > LONG_MAX)) ? - PyLong_FromLongLong(value) : PyInt_FromLong(static_cast< long >(value)); -} -#endif - - -SWIGINTERNINLINE PyObject * -SWIG_From_ptrdiff_t (ptrdiff_t value) -{ -#ifdef SWIG_LONG_LONG_AVAILABLE - if (sizeof(ptrdiff_t) <= sizeof(long)) { -#endif - return SWIG_From_long (static_cast< long >(value)); -#ifdef SWIG_LONG_LONG_AVAILABLE - } else { - /* assume sizeof(ptrdiff_t) <= sizeof(long long) */ - return SWIG_From_long_SS_long (static_cast< long long >(value)); - } -#endif -} - - -SWIGINTERNINLINE PyObject* - SWIG_From_bool (bool value) -{ - return PyBool_FromLong(value ? 1 : 0); -} - - -SWIGINTERN int -SWIG_AsVal_long (PyObject *obj, long* val) -{ -#if PY_VERSION_HEX < 0x03000000 - if (PyInt_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); - return SWIG_OK; - } else -#endif - if (PyLong_Check(obj)) { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - return SWIG_OverflowError; - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - long v = PyInt_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - double d; - int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { - if (val) *val = (long)(d); - return res; - } - } - } -#endif - return SWIG_TypeError; -} - - -#ifdef SWIG_LONG_LONG_AVAILABLE -SWIGINTERN int -SWIG_AsVal_long_SS_long (PyObject *obj, long long *val) -{ - int res = SWIG_TypeError; - if (PyLong_Check(obj)) { - long long v = PyLong_AsLongLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - res = SWIG_OverflowError; - } - } else { - long v; - res = SWIG_AsVal_long (obj,&v); - if (SWIG_IsOK(res)) { - if (val) *val = v; - return res; - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - const double mant_max = 1LL << DBL_MANT_DIG; - const double mant_min = -mant_max; - double d; - res = SWIG_AsVal_double (obj,&d); - if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, mant_min, mant_max)) - return SWIG_OverflowError; - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, mant_min, mant_max)) { - if (val) *val = (long long)(d); - return SWIG_AddCast(res); - } - res = SWIG_TypeError; - } -#endif - return res; -} -#endif - - -SWIGINTERNINLINE int -SWIG_AsVal_ptrdiff_t (PyObject * obj, ptrdiff_t *val) -{ - int res = SWIG_TypeError; -#ifdef SWIG_LONG_LONG_AVAILABLE - if (sizeof(ptrdiff_t) <= sizeof(long)) { -#endif - long v; - res = SWIG_AsVal_long (obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v); -#ifdef SWIG_LONG_LONG_AVAILABLE - } else if (sizeof(ptrdiff_t) <= sizeof(long long)) { - long long v; - res = SWIG_AsVal_long_SS_long (obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v); - } -#endif - return res; -} - - -#include <algorithm> - - -#include <vector> - - -#include <utility> - - -#include <map> - - -#include <algorithm> - - -namespace swig { - template <class Type> - struct noconst_traits { - typedef Type noconst_type; - }; - - template <class Type> - struct noconst_traits<const Type> { - typedef Type noconst_type; - }; - - /* - type categories - */ - struct pointer_category { }; - struct value_category { }; - - /* - General traits that provides type_name and type_info - */ - template <class Type> struct traits { }; - - template <class Type> - inline const char* type_name() { - return traits<typename noconst_traits<Type >::noconst_type >::type_name(); - } - - template <class Type> struct traits_info { - static swig_type_info *type_query(std::string name) { - name += " *"; - return SWIG_TypeQuery(name.c_str()); - } - static swig_type_info *type_info() { - static swig_type_info *info = type_query(type_name<Type>()); - return info; - } - }; - - /* - Partial specialization for pointers (traits_info) - */ - template <class Type> struct traits_info<Type *> { - static swig_type_info *type_query(std::string name) { - name += " *"; - return SWIG_TypeQuery(name.c_str()); - } - static swig_type_info *type_info() { - static swig_type_info *info = type_query(type_name<Type>()); - return info; - } - }; - - template <class Type> - inline swig_type_info *type_info() { - return traits_info<Type>::type_info(); - } - - /* - Partial specialization for pointers (traits) - */ - template <class Type> struct traits <Type *> { - typedef pointer_category category; - static std::string make_ptr_name(const char* name) { - std::string ptrname = name; - ptrname += " *"; - return ptrname; - } - static const char* type_name() { - static std::string name = make_ptr_name(swig::type_name<Type>()); - return name.c_str(); - } - }; - - template <class Type, class Category> - struct traits_as { }; - - template <class Type, class Category> - struct traits_check { }; - -} - - -namespace swig { - /* - Traits that provides the from method - */ - template <class Type> struct traits_from_ptr { - static PyObject *from(Type *val, int owner = 0) { - return SWIG_InternalNewPointerObj(val, type_info<Type>(), owner); - } - }; - - template <class Type> struct traits_from { - static PyObject *from(const Type& val) { - return traits_from_ptr<Type>::from(new Type(val), 1); - } - }; - - template <class Type> struct traits_from<Type *> { - static PyObject *from(Type* val) { - return traits_from_ptr<Type>::from(val, 0); - } - }; - - template <class Type> struct traits_from<const Type *> { - static PyObject *from(const Type* val) { - return traits_from_ptr<Type>::from(const_cast<Type*>(val), 0); - } - }; - - - template <class Type> - inline PyObject *from(const Type& val) { - return traits_from<Type>::from(val); - } - - template <class Type> - inline PyObject *from_ptr(Type* val, int owner) { - return traits_from_ptr<Type>::from(val, owner); - } - - /* - Traits that provides the asval/as/check method - */ - template <class Type> - struct traits_asptr { - static int asptr(PyObject *obj, Type **val) { - Type *p = 0; - swig_type_info *descriptor = type_info<Type>(); - int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; - if (SWIG_IsOK(res)) { - if (val) *val = p; - } - return res; - } - }; - - template <class Type> - inline int asptr(PyObject *obj, Type **vptr) { - return traits_asptr<Type>::asptr(obj, vptr); - } - - template <class Type> - struct traits_asval { - static int asval(PyObject *obj, Type *val) { - if (val) { - Type *p = 0; - int res = traits_asptr<Type>::asptr(obj, &p); - if (!SWIG_IsOK(res)) return res; - if (p) { - typedef typename noconst_traits<Type>::noconst_type noconst_type; - *(const_cast<noconst_type*>(val)) = *p; - if (SWIG_IsNewObj(res)){ - delete p; - res = SWIG_DelNewMask(res); - } - return res; - } else { - return SWIG_ERROR; - } - } else { - return traits_asptr<Type>::asptr(obj, (Type **)(0)); - } - } - }; - - template <class Type> struct traits_asval<Type*> { - static int asval(PyObject *obj, Type **val) { - if (val) { - typedef typename noconst_traits<Type>::noconst_type noconst_type; - noconst_type *p = 0; - int res = traits_asptr<noconst_type>::asptr(obj, &p); - if (SWIG_IsOK(res)) { - *(const_cast<noconst_type**>(val)) = p; - } - return res; - } else { - return traits_asptr<Type>::asptr(obj, (Type **)(0)); - } - } - }; - - template <class Type> - inline int asval(PyObject *obj, Type *val) { - return traits_asval<Type>::asval(obj, val); - } - - template <class Type> - struct traits_as<Type, value_category> { - static Type as(PyObject *obj) { - Type v; - int res = asval(obj, &v); - if (!obj || !SWIG_IsOK(res)) { - if (!PyErr_Occurred()) { - ::SWIG_Error(SWIG_TypeError, swig::type_name<Type>()); - } - throw std::invalid_argument("bad type"); - } - return v; - } - }; - - template <class Type> - struct traits_as<Type, pointer_category> { - static Type as(PyObject *obj) { - Type *v = 0; - int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR); - if (SWIG_IsOK(res) && v) { - if (SWIG_IsNewObj(res)) { - Type r(*v); - delete v; - return r; - } else { - return *v; - } - } else { - if (!PyErr_Occurred()) { - SWIG_Error(SWIG_TypeError, swig::type_name<Type>()); - } - throw std::invalid_argument("bad type"); - } - } - }; - - template <class Type> - struct traits_as<Type*, pointer_category> { - static Type* as(PyObject *obj) { - Type *v = 0; - int res = (obj ? traits_asptr<Type>::asptr(obj, &v) : SWIG_ERROR); - if (SWIG_IsOK(res)) { - return v; - } else { - if (!PyErr_Occurred()) { - SWIG_Error(SWIG_TypeError, swig::type_name<Type>()); - } - throw std::invalid_argument("bad type"); - } - } - }; - - template <class Type> - inline Type as(PyObject *obj) { - return traits_as<Type, typename traits<Type>::category>::as(obj); - } - - template <class Type> - struct traits_check<Type, value_category> { - static bool check(PyObject *obj) { - int res = obj ? asval(obj, (Type *)(0)) : SWIG_ERROR; - return SWIG_IsOK(res) ? true : false; - } - }; - - template <class Type> - struct traits_check<Type, pointer_category> { - static bool check(PyObject *obj) { - int res = obj ? asptr(obj, (Type **)(0)) : SWIG_ERROR; - return SWIG_IsOK(res) ? true : false; - } - }; - - template <class Type> - inline bool check(PyObject *obj) { - return traits_check<Type, typename traits<Type>::category>::check(obj); - } -} - - -#include <functional> - -namespace std { - template <> - struct less <PyObject *> - { - bool - operator()(PyObject * v, PyObject *w) const - { - bool res; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - res = PyObject_RichCompareBool(v, w, Py_LT) ? true : false; - /* This may fall into a case of inconsistent - eg. ObjA > ObjX > ObjB - but ObjA < ObjB - */ - if( PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_TypeError) ) - { - /* Objects can't be compared, this mostly occurred in Python 3.0 */ - /* Compare their ptr directly for a workaround */ - res = (v < w); - PyErr_Clear(); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return res; - } - }; - - template <> - struct less <swig::SwigPtr_PyObject> - { - bool - operator()(const swig::SwigPtr_PyObject& v, const swig::SwigPtr_PyObject& w) const - { - return std::less<PyObject *>()(v, w); - } - }; - - template <> - struct less <swig::SwigVar_PyObject> - { - bool - operator()(const swig::SwigVar_PyObject& v, const swig::SwigVar_PyObject& w) const - { - return std::less<PyObject *>()(v, w); - } - }; - -} - -namespace swig { - template <> struct traits<PyObject *> { - typedef value_category category; - static const char* type_name() { return "PyObject *"; } - }; - - template <> struct traits_asval<PyObject * > { - typedef PyObject * value_type; - static int asval(PyObject *obj, value_type *val) { - if (val) *val = obj; - return SWIG_OK; - } - }; - - template <> - struct traits_check<PyObject *, value_category> { - static bool check(PyObject *) { - return true; - } - }; - - template <> struct traits_from<PyObject *> { - typedef PyObject * value_type; - static PyObject *from(const value_type& val) { - Py_XINCREF(val); - return val; - } - }; - -} - -namespace swig { - template <class Difference> - inline size_t - check_index(Difference i, size_t size, bool insert = false) { - if ( i < 0 ) { - if ((size_t) (-i) <= size) - return (size_t) (i + size); - } else if ( (size_t) i < size ) { - return (size_t) i; - } else if (insert && ((size_t) i == size)) { - return size; - } - throw std::out_of_range("index out of range"); - } - - template <class Difference> - void - slice_adjust(Difference i, Difference j, Py_ssize_t step, size_t size, Difference &ii, Difference &jj, bool insert = false) { - if (step == 0) { - throw std::invalid_argument("slice step cannot be zero"); - } else if (step > 0) { - // Required range: 0 <= i < size, 0 <= j < size, i <= j - if (i < 0) { - ii = 0; - } else if (i < (Difference)size) { - ii = i; - } else if (insert && (i >= (Difference)size)) { - ii = (Difference)size; - } - if (j < 0) { - jj = 0; - } else { - jj = (j < (Difference)size) ? j : (Difference)size; - } - if (jj < ii) - jj = ii; - } else { - // Required range: -1 <= i < size-1, -1 <= j < size-1, i >= j - if (i < -1) { - ii = -1; - } else if (i < (Difference) size) { - ii = i; - } else if (i >= (Difference)(size-1)) { - ii = (Difference)(size-1); - } - if (j < -1) { - jj = -1; - } else { - jj = (j < (Difference)size ) ? j : (Difference)(size-1); - } - if (ii < jj) - ii = jj; - } - } - - template <class Sequence, class Difference> - inline typename Sequence::iterator - getpos(Sequence* self, Difference i) { - typename Sequence::iterator pos = self->begin(); - std::advance(pos, check_index(i,self->size())); - return pos; - } - - template <class Sequence, class Difference> - inline typename Sequence::const_iterator - cgetpos(const Sequence* self, Difference i) { - typename Sequence::const_iterator pos = self->begin(); - std::advance(pos, check_index(i,self->size())); - return pos; - } - - template <class Sequence> - inline void - erase(Sequence* seq, const typename Sequence::iterator& position) { - seq->erase(position); - } - - template <class Sequence> - struct traits_reserve { - static void reserve(Sequence & /*seq*/, typename Sequence::size_type /*n*/) { - // This should be specialized for types that support reserve - } - }; - - template <class Sequence, class Difference> - inline Sequence* - getslice(const Sequence* self, Difference i, Difference j, Py_ssize_t step) { - typename Sequence::size_type size = self->size(); - Difference ii = 0; - Difference jj = 0; - swig::slice_adjust(i, j, step, size, ii, jj); - - if (step > 0) { - typename Sequence::const_iterator sb = self->begin(); - typename Sequence::const_iterator se = self->begin(); - std::advance(sb,ii); - std::advance(se,jj); - if (step == 1) { - return new Sequence(sb, se); - } else { - Sequence *sequence = new Sequence(); - swig::traits_reserve<Sequence>::reserve(*sequence, (jj - ii + step - 1) / step); - typename Sequence::const_iterator it = sb; - while (it!=se) { - sequence->push_back(*it); - for (Py_ssize_t c=0; c<step && it!=se; ++c) - it++; - } - return sequence; - } - } else { - Sequence *sequence = new Sequence(); - swig::traits_reserve<Sequence>::reserve(*sequence, (ii - jj - step - 1) / -step); - typename Sequence::const_reverse_iterator sb = self->rbegin(); - typename Sequence::const_reverse_iterator se = self->rbegin(); - std::advance(sb,size-ii-1); - std::advance(se,size-jj-1); - typename Sequence::const_reverse_iterator it = sb; - while (it!=se) { - sequence->push_back(*it); - for (Py_ssize_t c=0; c<-step && it!=se; ++c) - it++; - } - return sequence; - } - } - - template <class Sequence, class Difference, class InputSeq> - inline void - setslice(Sequence* self, Difference i, Difference j, Py_ssize_t step, const InputSeq& is = InputSeq()) { - typename Sequence::size_type size = self->size(); - Difference ii = 0; - Difference jj = 0; - swig::slice_adjust(i, j, step, size, ii, jj, true); - if (step > 0) { - if (step == 1) { - size_t ssize = jj - ii; - if (ssize <= is.size()) { - // expanding/staying the same size - swig::traits_reserve<Sequence>::reserve(*self, self->size() - ssize + is.size()); - typename Sequence::iterator sb = self->begin(); - typename InputSeq::const_iterator isit = is.begin(); - std::advance(sb,ii); - std::advance(isit, jj - ii); - self->insert(std::copy(is.begin(), isit, sb), isit, is.end()); - } else { - // shrinking - typename Sequence::iterator sb = self->begin(); - typename Sequence::iterator se = self->begin(); - std::advance(sb,ii); - std::advance(se,jj); - self->erase(sb,se); - sb = self->begin(); - std::advance(sb,ii); - self->insert(sb, is.begin(), is.end()); - } - } else { - size_t replacecount = (jj - ii + step - 1) / step; - if (is.size() != replacecount) { - char msg[1024]; - sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); - throw std::invalid_argument(msg); - } - typename Sequence::const_iterator isit = is.begin(); - typename Sequence::iterator it = self->begin(); - std::advance(it,ii); - for (size_t rc=0; rc<replacecount && it != self->end(); ++rc) { - *it++ = *isit++; - for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c) - it++; - } - } - } else { - size_t replacecount = (ii - jj - step - 1) / -step; - if (is.size() != replacecount) { - char msg[1024]; - sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount); - throw std::invalid_argument(msg); - } - typename Sequence::const_iterator isit = is.begin(); - typename Sequence::reverse_iterator it = self->rbegin(); - std::advance(it,size-ii-1); - for (size_t rc=0; rc<replacecount && it != self->rend(); ++rc) { - *it++ = *isit++; - for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c) - it++; - } - } - } - - template <class Sequence, class Difference> - inline void - delslice(Sequence* self, Difference i, Difference j, Py_ssize_t step) { - typename Sequence::size_type size = self->size(); - Difference ii = 0; - Difference jj = 0; - swig::slice_adjust(i, j, step, size, ii, jj, true); - if (step > 0) { - typename Sequence::iterator sb = self->begin(); - std::advance(sb,ii); - if (step == 1) { - typename Sequence::iterator se = self->begin(); - std::advance(se,jj); - self->erase(sb,se); - } else { - typename Sequence::iterator it = sb; - size_t delcount = (jj - ii + step - 1) / step; - while (delcount) { - it = self->erase(it); - for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c) - it++; - delcount--; - } - } - } else { - typename Sequence::reverse_iterator sb = self->rbegin(); - std::advance(sb,size-ii-1); - typename Sequence::reverse_iterator it = sb; - size_t delcount = (ii - jj - step - 1) / -step; - while (delcount) { - it = typename Sequence::reverse_iterator(self->erase((++it).base())); - for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c) - it++; - delcount--; - } - } - } -} - - -#if defined(__SUNPRO_CC) && defined(_RWSTD_VER) -# if !defined(SWIG_NO_STD_NOITERATOR_TRAITS_STL) -# define SWIG_STD_NOITERATOR_TRAITS_STL -# endif -#endif - -#if !defined(SWIG_STD_NOITERATOR_TRAITS_STL) -#include <iterator> -#else -namespace std { - template <class Iterator> - struct iterator_traits { - typedef ptrdiff_t difference_type; - typedef typename Iterator::value_type value_type; - }; - - template <class Iterator, class Category,class T, class Reference, class Pointer, class Distance> - struct iterator_traits<__reverse_bi_iterator<Iterator,Category,T,Reference,Pointer,Distance> > { - typedef Distance difference_type; - typedef T value_type; - }; - - template <class T> - struct iterator_traits<T*> { - typedef T value_type; - typedef ptrdiff_t difference_type; - }; - - template<typename _InputIterator> - inline typename iterator_traits<_InputIterator>::difference_type - distance(_InputIterator __first, _InputIterator __last) - { - typename iterator_traits<_InputIterator>::difference_type __n = 0; - while (__first != __last) { - ++__first; ++__n; - } - return __n; - } -} -#endif - - -namespace swig { - template<typename OutIterator> - class SwigPyIterator_T : public SwigPyIterator - { - public: - typedef OutIterator out_iterator; - typedef typename std::iterator_traits<out_iterator>::value_type value_type; - typedef SwigPyIterator_T<out_iterator> self_type; - - SwigPyIterator_T(out_iterator curr, PyObject *seq) - : SwigPyIterator(seq), current(curr) - { - } - - const out_iterator& get_current() const - { - return current; - } - - - bool equal (const SwigPyIterator &iter) const - { - const self_type *iters = dynamic_cast<const self_type *>(&iter); - if (iters) { - return (current == iters->get_current()); - } else { - throw std::invalid_argument("bad iterator type"); - } - } - - ptrdiff_t distance(const SwigPyIterator &iter) const - { - const self_type *iters = dynamic_cast<const self_type *>(&iter); - if (iters) { - return std::distance(current, iters->get_current()); - } else { - throw std::invalid_argument("bad iterator type"); - } - } - - protected: - out_iterator current; - }; - - template <class ValueType> - struct from_oper - { - typedef const ValueType& argument_type; - typedef PyObject *result_type; - result_type operator()(argument_type v) const - { - return swig::from(v); - } - }; - - template<typename OutIterator, - typename ValueType = typename std::iterator_traits<OutIterator>::value_type, - typename FromOper = from_oper<ValueType> > - class SwigPyForwardIteratorOpen_T : public SwigPyIterator_T<OutIterator> - { - public: - FromOper from; - typedef OutIterator out_iterator; - typedef ValueType value_type; - typedef SwigPyIterator_T<out_iterator> base; - typedef SwigPyForwardIteratorOpen_T<OutIterator, ValueType, FromOper> self_type; - - SwigPyForwardIteratorOpen_T(out_iterator curr, PyObject *seq) - : SwigPyIterator_T<OutIterator>(curr, seq) - { - } - - PyObject *value() const { - return from(static_cast<const value_type&>(*(base::current))); - } - - SwigPyIterator *copy() const - { - return new self_type(*this); - } - - SwigPyIterator *incr(size_t n = 1) - { - while (n--) { - ++base::current; - } - return this; - } - - }; - - template<typename OutIterator, - typename ValueType = typename std::iterator_traits<OutIterator>::value_type, - typename FromOper = from_oper<ValueType> > - class SwigPyIteratorOpen_T : public SwigPyForwardIteratorOpen_T<OutIterator, ValueType, FromOper> - { - public: - FromOper from; - typedef OutIterator out_iterator; - typedef ValueType value_type; - typedef SwigPyIterator_T<out_iterator> base; - typedef SwigPyIteratorOpen_T<OutIterator, ValueType, FromOper> self_type; - - SwigPyIteratorOpen_T(out_iterator curr, PyObject *seq) - : SwigPyForwardIteratorOpen_T<OutIterator>(curr, seq) - { - } - - SwigPyIterator *decr(size_t n = 1) - { - while (n--) { - --base::current; - } - return this; - } - }; - - template<typename OutIterator, - typename ValueType = typename std::iterator_traits<OutIterator>::value_type, - typename FromOper = from_oper<ValueType> > - class SwigPyForwardIteratorClosed_T : public SwigPyIterator_T<OutIterator> - { - public: - FromOper from; - typedef OutIterator out_iterator; - typedef ValueType value_type; - typedef SwigPyIterator_T<out_iterator> base; - typedef SwigPyForwardIteratorClosed_T<OutIterator, ValueType, FromOper> self_type; - - SwigPyForwardIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq) - : SwigPyIterator_T<OutIterator>(curr, seq), begin(first), end(last) - { - } - - PyObject *value() const { - if (base::current == end) { - throw stop_iteration(); - } else { - return from(static_cast<const value_type&>(*(base::current))); - } - } - - SwigPyIterator *copy() const - { - return new self_type(*this); - } - - SwigPyIterator *incr(size_t n = 1) - { - while (n--) { - if (base::current == end) { - throw stop_iteration(); - } else { - ++base::current; - } - } - return this; - } - - protected: - out_iterator begin; - out_iterator end; - }; - - template<typename OutIterator, - typename ValueType = typename std::iterator_traits<OutIterator>::value_type, - typename FromOper = from_oper<ValueType> > - class SwigPyIteratorClosed_T : public SwigPyForwardIteratorClosed_T<OutIterator,ValueType,FromOper> - { - public: - FromOper from; - typedef OutIterator out_iterator; - typedef ValueType value_type; - typedef SwigPyIterator_T<out_iterator> base; - typedef SwigPyForwardIteratorClosed_T<OutIterator, ValueType, FromOper> base0; - typedef SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper> self_type; - - SwigPyIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq) - : SwigPyForwardIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq) - { - } - - SwigPyIterator *decr(size_t n = 1) - { - while (n--) { - if (base::current == base0::begin) { - throw stop_iteration(); - } else { - --base::current; - } - } - return this; - } - }; - - - template<typename OutIter> - inline SwigPyIterator* - make_output_forward_iterator(const OutIter& current, const OutIter& begin,const OutIter& end, PyObject *seq = 0) - { - return new SwigPyForwardIteratorClosed_T<OutIter>(current, begin, end, seq); - } - - template<typename OutIter> - inline SwigPyIterator* - make_output_iterator(const OutIter& current, const OutIter& begin,const OutIter& end, PyObject *seq = 0) - { - return new SwigPyIteratorClosed_T<OutIter>(current, begin, end, seq); - } - - template<typename OutIter> - inline SwigPyIterator* - make_output_forward_iterator(const OutIter& current, PyObject *seq = 0) - { - return new SwigPyForwardIteratorOpen_T<OutIter>(current, seq); - } - - template<typename OutIter> - inline SwigPyIterator* - make_output_iterator(const OutIter& current, PyObject *seq = 0) - { - return new SwigPyIteratorOpen_T<OutIter>(current, seq); - } - -} - - -namespace swig -{ - template <class T> - struct SwigPySequence_Ref - { - SwigPySequence_Ref(PyObject* seq, Py_ssize_t index) - : _seq(seq), _index(index) - { - } - - operator T () const - { - swig::SwigVar_PyObject item = PySequence_GetItem(_seq, _index); - try { - return swig::as<T>(item); - } catch (const std::invalid_argument& e) { - char msg[1024]; - sprintf(msg, "in sequence element %d ", (int)_index); - if (!PyErr_Occurred()) { - ::SWIG_Error(SWIG_TypeError, swig::type_name<T>()); - } - SWIG_Python_AddErrorMsg(msg); - SWIG_Python_AddErrorMsg(e.what()); - throw; - } - } - - SwigPySequence_Ref& operator=(const T& v) - { - PySequence_SetItem(_seq, _index, swig::from<T>(v)); - return *this; - } - - private: - PyObject* _seq; - Py_ssize_t _index; - }; - - template <class T> - struct SwigPySequence_ArrowProxy - { - SwigPySequence_ArrowProxy(const T& x): m_value(x) {} - const T* operator->() const { return &m_value; } - operator const T*() const { return &m_value; } - T m_value; - }; - - template <class T, class Reference > - struct SwigPySequence_InputIterator - { - typedef SwigPySequence_InputIterator<T, Reference > self; - - typedef std::random_access_iterator_tag iterator_category; - typedef Reference reference; - typedef T value_type; - typedef T* pointer; - typedef Py_ssize_t difference_type; - - SwigPySequence_InputIterator() - { - } - - SwigPySequence_InputIterator(PyObject* seq, Py_ssize_t index) - : _seq(seq), _index(index) - { - } - - reference operator*() const - { - return reference(_seq, _index); - } - - SwigPySequence_ArrowProxy<T> - operator->() const { - return SwigPySequence_ArrowProxy<T>(operator*()); - } - - bool operator==(const self& ri) const - { - return (_index == ri._index) && (_seq == ri._seq); - } - - bool operator!=(const self& ri) const - { - return !(operator==(ri)); - } - - self& operator ++ () - { - ++_index; - return *this; - } - - self& operator -- () - { - --_index; - return *this; - } - - self& operator += (difference_type n) - { - _index += n; - return *this; - } - - self operator +(difference_type n) const - { - return self(_seq, _index + n); - } - - self& operator -= (difference_type n) - { - _index -= n; - return *this; - } - - self operator -(difference_type n) const - { - return self(_seq, _index - n); - } - - difference_type operator - (const self& ri) const - { - return _index - ri._index; - } - - bool operator < (const self& ri) const - { - return _index < ri._index; - } - - reference - operator[](difference_type n) const - { - return reference(_seq, _index + n); - } - - private: - PyObject* _seq; - difference_type _index; - }; - - // STL container wrapper around a Python sequence - template <class T> - struct SwigPySequence_Cont - { - typedef SwigPySequence_Ref<T> reference; - typedef const SwigPySequence_Ref<T> const_reference; - typedef T value_type; - typedef T* pointer; - typedef Py_ssize_t difference_type; - typedef size_t size_type; - typedef const pointer const_pointer; - typedef SwigPySequence_InputIterator<T, reference> iterator; - typedef SwigPySequence_InputIterator<T, const_reference> const_iterator; - - SwigPySequence_Cont(PyObject* seq) : _seq(0) - { - if (!PySequence_Check(seq)) { - throw std::invalid_argument("a sequence is expected"); - } - _seq = seq; - Py_INCREF(_seq); - } - - ~SwigPySequence_Cont() - { - Py_XDECREF(_seq); - } - - size_type size() const - { - return static_cast<size_type>(PySequence_Size(_seq)); - } - - bool empty() const - { - return size() == 0; - } - - iterator begin() - { - return iterator(_seq, 0); - } - - const_iterator begin() const - { - return const_iterator(_seq, 0); - } - - iterator end() - { - return iterator(_seq, size()); - } - - const_iterator end() const - { - return const_iterator(_seq, size()); - } - - reference operator[](difference_type n) - { - return reference(_seq, n); - } - - const_reference operator[](difference_type n) const - { - return const_reference(_seq, n); - } - - bool check(bool set_err = true) const - { - Py_ssize_t s = size(); - for (Py_ssize_t i = 0; i < s; ++i) { - swig::SwigVar_PyObject item = PySequence_GetItem(_seq, i); - if (!swig::check<value_type>(item)) { - if (set_err) { - char msg[1024]; - sprintf(msg, "in sequence element %d", (int)i); - SWIG_Error(SWIG_RuntimeError, msg); - } - return false; - } - } - return true; - } - - private: - PyObject* _seq; - }; - -} - - -SWIGINTERN int -SWIG_AsVal_int (PyObject * obj, int *val) -{ - long v; - int res = SWIG_AsVal_long (obj, &v); - if (SWIG_IsOK(res)) { - if ((v < INT_MIN || v > INT_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = static_cast< int >(v); - } - } - return res; -} - - -SWIGINTERNINLINE PyObject* - SWIG_From_int (int value) -{ - return PyInt_FromLong((long) value); -} - - -namespace swig { - template <> struct traits< int > { - typedef value_category category; - static const char* type_name() { return"int"; } - }; - template <> struct traits_asval< int > { - typedef int value_type; - static int asval(PyObject *obj, value_type *val) { - return SWIG_AsVal_int (obj, val); - } - }; - template <> struct traits_from< int > { - typedef int value_type; - static PyObject *from(const value_type& val) { - return SWIG_From_int (val); - } - }; -} - - -namespace swig { - template <class SwigPySeq, class Seq> - inline void - assign(const SwigPySeq& swigpyseq, Seq* seq) { - // seq->assign(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented - typedef typename SwigPySeq::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - seq->insert(seq->end(),(value_type)(*it)); - } - } - - template <class Seq, class T = typename Seq::value_type > - struct traits_asptr_stdseq { - typedef Seq sequence; - typedef T value_type; - - static int asptr(PyObject *obj, sequence **seq) { - if (obj == Py_None || SWIG_Python_GetSwigThis(obj)) { - sequence *p; - swig_type_info *descriptor = swig::type_info<sequence>(); - if (descriptor && SWIG_IsOK(::SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0))) { - if (seq) *seq = p; - return SWIG_OLDOBJ; - } - } else if (PySequence_Check(obj)) { - try { - SwigPySequence_Cont<value_type> swigpyseq(obj); - if (seq) { - sequence *pseq = new sequence(); - assign(swigpyseq, pseq); - *seq = pseq; - return SWIG_NEWOBJ; - } else { - return swigpyseq.check() ? SWIG_OK : SWIG_ERROR; - } - } catch (std::exception& e) { - if (seq) { - if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, e.what()); - } - } - return SWIG_ERROR; - } - } - return SWIG_ERROR; - } - }; - - template <class Seq, class T = typename Seq::value_type > - struct traits_from_stdseq { - typedef Seq sequence; - typedef T value_type; - typedef typename Seq::size_type size_type; - typedef typename sequence::const_iterator const_iterator; - - static PyObject *from(const sequence& seq) { -#ifdef SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS - swig_type_info *desc = swig::type_info<sequence>(); - if (desc && desc->clientdata) { - return SWIG_InternalNewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN); - } -#endif - size_type size = seq.size(); - if (size <= (size_type)INT_MAX) { - PyObject *obj = PyTuple_New((Py_ssize_t)size); - Py_ssize_t i = 0; - for (const_iterator it = seq.begin(); it != seq.end(); ++it, ++i) { - PyTuple_SetItem(obj,i,swig::from<value_type>(*it)); - } - return obj; - } else { - PyErr_SetString(PyExc_OverflowError,"sequence size not valid in python"); - return NULL; - } - } - }; -} - - - namespace swig { - template <class T> - struct traits_reserve<std::vector<T> > { - static void reserve(std::vector<T> &seq, typename std::vector<T>::size_type n) { - seq.reserve(n); - } - }; - - template <class T> - struct traits_asptr<std::vector<T> > { - static int asptr(PyObject *obj, std::vector<T> **vec) { - return traits_asptr_stdseq<std::vector<T> >::asptr(obj, vec); - } - }; - - template <class T> - struct traits_from<std::vector<T> > { - static PyObject *from(const std::vector<T>& vec) { - return traits_from_stdseq<std::vector<T> >::from(vec); - } - }; - } - - - namespace swig { - template <> struct traits<std::vector< int, std::allocator< int > > > { - typedef pointer_category category; - static const char* type_name() { - return "std::vector<" "int" "," "std::allocator< int >" " >"; - } - }; - } - -SWIGINTERN swig::SwigPyIterator *std_vector_Sl_int_Sg__iterator(std::vector< int > *self,PyObject **PYTHON_SELF){ - return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN bool std_vector_Sl_int_Sg____nonzero__(std::vector< int > const *self){ - return !(self->empty()); - } -SWIGINTERN bool std_vector_Sl_int_Sg____bool__(std::vector< int > const *self){ - return !(self->empty()); - } -SWIGINTERN std::vector< int >::size_type std_vector_Sl_int_Sg____len__(std::vector< int > const *self){ - return self->size(); - } - -SWIGINTERNINLINE PyObject* -SWIG_From_unsigned_SS_long (unsigned long value) -{ - return (value > LONG_MAX) ? - PyLong_FromUnsignedLong(value) : PyInt_FromLong(static_cast< long >(value)); -} - - -#ifdef SWIG_LONG_LONG_AVAILABLE -SWIGINTERNINLINE PyObject* -SWIG_From_unsigned_SS_long_SS_long (unsigned long long value) -{ - return (value > LONG_MAX) ? - PyLong_FromUnsignedLongLong(value) : PyInt_FromLong(static_cast< long >(value)); -} -#endif - - -SWIGINTERNINLINE PyObject * -SWIG_From_size_t (size_t value) -{ -#ifdef SWIG_LONG_LONG_AVAILABLE - if (sizeof(size_t) <= sizeof(unsigned long)) { -#endif - return SWIG_From_unsigned_SS_long (static_cast< unsigned long >(value)); -#ifdef SWIG_LONG_LONG_AVAILABLE - } else { - /* assume sizeof(size_t) <= sizeof(unsigned long long) */ - return SWIG_From_unsigned_SS_long_SS_long (static_cast< unsigned long long >(value)); - } -#endif -} - -SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg____getslice__(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j){ - return swig::getslice(self, i, j, 1); - } -SWIGINTERN void std_vector_Sl_int_Sg____setslice____SWIG_0(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j){ - swig::setslice(self, i, j, 1, std::vector< int,std::allocator< int > >()); - } -SWIGINTERN void std_vector_Sl_int_Sg____setslice____SWIG_1(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j,std::vector< int,std::allocator< int > > const &v){ - swig::setslice(self, i, j, 1, v); - } -SWIGINTERN void std_vector_Sl_int_Sg____delslice__(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::difference_type j){ - swig::delslice(self, i, j, 1); - } -SWIGINTERN void std_vector_Sl_int_Sg____delitem____SWIG_0(std::vector< int > *self,std::vector< int >::difference_type i){ - swig::erase(self, swig::getpos(self, i)); - } -SWIGINTERN std::vector< int,std::allocator< int > > *std_vector_Sl_int_Sg____getitem____SWIG_0(std::vector< int > *self,PySliceObject *slice){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return NULL; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< int,std::allocator< int > >::difference_type id = i; - std::vector< int,std::allocator< int > >::difference_type jd = j; - return swig::getslice(self, id, jd, step); - } -SWIGINTERN void std_vector_Sl_int_Sg____setitem____SWIG_0(std::vector< int > *self,PySliceObject *slice,std::vector< int,std::allocator< int > > const &v){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< int,std::allocator< int > >::difference_type id = i; - std::vector< int,std::allocator< int > >::difference_type jd = j; - swig::setslice(self, id, jd, step, v); - } -SWIGINTERN void std_vector_Sl_int_Sg____setitem____SWIG_1(std::vector< int > *self,PySliceObject *slice){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< int,std::allocator< int > >::difference_type id = i; - std::vector< int,std::allocator< int > >::difference_type jd = j; - swig::delslice(self, id, jd, step); - } -SWIGINTERN void std_vector_Sl_int_Sg____delitem____SWIG_1(std::vector< int > *self,PySliceObject *slice){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< int,std::allocator< int > >::difference_type id = i; - std::vector< int,std::allocator< int > >::difference_type jd = j; - swig::delslice(self, id, jd, step); - } -SWIGINTERN std::vector< int >::value_type const &std_vector_Sl_int_Sg____getitem____SWIG_1(std::vector< int > const *self,std::vector< int >::difference_type i){ - return *(swig::cgetpos(self, i)); - } - -namespace swig { - static PyObject* container_owner_attribute() { - static PyObject* attr = SWIG_Python_str_FromChar("__swig_container"); - return attr; - } - - template <typename T> - struct container_owner { - // By default, do not add the back-reference (for value types) - // Specialization below will check the reference for pointer types. - static bool back_reference(PyObject* child, PyObject* owner) { - return false; - } - }; - - template <> - struct container_owner<swig::pointer_category> { - /* - * Call to add a back-reference to the owning object when returning a - * reference from a container. Will only set the reference if child - * is a SWIG wrapper object that does not own the pointer. - * - * returns whether the reference was set or not - */ - static bool back_reference(PyObject* child, PyObject* owner) { - SwigPyObject* swigThis = SWIG_Python_GetSwigThis(child); - if (swigThis && (swigThis->own & SWIG_POINTER_OWN) != SWIG_POINTER_OWN) { - PyObject_SetAttr(child, container_owner_attribute(), owner); - return true; - } - return false; - } - }; -} - -SWIGINTERN void std_vector_Sl_int_Sg____setitem____SWIG_2(std::vector< int > *self,std::vector< int >::difference_type i,std::vector< int >::value_type const &x){ - *(swig::getpos(self,i)) = x; - } -SWIGINTERN std::vector< int >::value_type std_vector_Sl_int_Sg__pop(std::vector< int > *self){ - if (self->size() == 0) - throw std::out_of_range("pop from empty container"); - std::vector< int,std::allocator< int > >::value_type x = self->back(); - self->pop_back(); - return x; - } -SWIGINTERN void std_vector_Sl_int_Sg__append(std::vector< int > *self,std::vector< int >::value_type const &x){ - self->push_back(x); - } -SWIGINTERN std::vector< int >::iterator std_vector_Sl_int_Sg__erase__SWIG_0(std::vector< int > *self,std::vector< int >::iterator pos){ return self->erase(pos); } -SWIGINTERN std::vector< int >::iterator std_vector_Sl_int_Sg__erase__SWIG_1(std::vector< int > *self,std::vector< int >::iterator first,std::vector< int >::iterator last){ return self->erase(first, last); } -SWIGINTERN std::vector< int >::iterator std_vector_Sl_int_Sg__insert__SWIG_0(std::vector< int > *self,std::vector< int >::iterator pos,std::vector< int >::value_type const &x){ return self->insert(pos, x); } -SWIGINTERN void std_vector_Sl_int_Sg__insert__SWIG_1(std::vector< int > *self,std::vector< int >::iterator pos,std::vector< int >::size_type n,std::vector< int >::value_type const &x){ self->insert(pos, n, x); } - - #define SWIG_From_double PyFloat_FromDouble - - -namespace swig { - template <> struct traits< double > { - typedef value_category category; - static const char* type_name() { return"double"; } - }; - template <> struct traits_asval< double > { - typedef double value_type; - static int asval(PyObject *obj, value_type *val) { - return SWIG_AsVal_double (obj, val); - } - }; - template <> struct traits_from< double > { - typedef double value_type; - static PyObject *from(const value_type& val) { - return SWIG_From_double (val); - } - }; -} - - - namespace swig { - template <> struct traits<std::vector< double, std::allocator< double > > > { - typedef pointer_category category; - static const char* type_name() { - return "std::vector<" "double" "," "std::allocator< double >" " >"; - } - }; - } - -SWIGINTERN swig::SwigPyIterator *std_vector_Sl_double_Sg__iterator(std::vector< double > *self,PyObject **PYTHON_SELF){ - return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN bool std_vector_Sl_double_Sg____nonzero__(std::vector< double > const *self){ - return !(self->empty()); - } -SWIGINTERN bool std_vector_Sl_double_Sg____bool__(std::vector< double > const *self){ - return !(self->empty()); - } -SWIGINTERN std::vector< double >::size_type std_vector_Sl_double_Sg____len__(std::vector< double > const *self){ - return self->size(); - } -SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg____getslice__(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j){ - return swig::getslice(self, i, j, 1); - } -SWIGINTERN void std_vector_Sl_double_Sg____setslice____SWIG_0(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j){ - swig::setslice(self, i, j, 1, std::vector< double,std::allocator< double > >()); - } -SWIGINTERN void std_vector_Sl_double_Sg____setslice____SWIG_1(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j,std::vector< double,std::allocator< double > > const &v){ - swig::setslice(self, i, j, 1, v); - } -SWIGINTERN void std_vector_Sl_double_Sg____delslice__(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j){ - swig::delslice(self, i, j, 1); - } -SWIGINTERN void std_vector_Sl_double_Sg____delitem____SWIG_0(std::vector< double > *self,std::vector< double >::difference_type i){ - swig::erase(self, swig::getpos(self, i)); - } -SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg____getitem____SWIG_0(std::vector< double > *self,PySliceObject *slice){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return NULL; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< double,std::allocator< double > >::difference_type id = i; - std::vector< double,std::allocator< double > >::difference_type jd = j; - return swig::getslice(self, id, jd, step); - } -SWIGINTERN void std_vector_Sl_double_Sg____setitem____SWIG_0(std::vector< double > *self,PySliceObject *slice,std::vector< double,std::allocator< double > > const &v){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< double,std::allocator< double > >::difference_type id = i; - std::vector< double,std::allocator< double > >::difference_type jd = j; - swig::setslice(self, id, jd, step, v); - } -SWIGINTERN void std_vector_Sl_double_Sg____setitem____SWIG_1(std::vector< double > *self,PySliceObject *slice){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< double,std::allocator< double > >::difference_type id = i; - std::vector< double,std::allocator< double > >::difference_type jd = j; - swig::delslice(self, id, jd, step); - } -SWIGINTERN void std_vector_Sl_double_Sg____delitem____SWIG_1(std::vector< double > *self,PySliceObject *slice){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< double,std::allocator< double > >::difference_type id = i; - std::vector< double,std::allocator< double > >::difference_type jd = j; - swig::delslice(self, id, jd, step); - } -SWIGINTERN std::vector< double >::value_type const &std_vector_Sl_double_Sg____getitem____SWIG_1(std::vector< double > const *self,std::vector< double >::difference_type i){ - return *(swig::cgetpos(self, i)); - } -SWIGINTERN void std_vector_Sl_double_Sg____setitem____SWIG_2(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::value_type const &x){ - *(swig::getpos(self,i)) = x; - } -SWIGINTERN std::vector< double >::value_type std_vector_Sl_double_Sg__pop(std::vector< double > *self){ - if (self->size() == 0) - throw std::out_of_range("pop from empty container"); - std::vector< double,std::allocator< double > >::value_type x = self->back(); - self->pop_back(); - return x; - } -SWIGINTERN void std_vector_Sl_double_Sg__append(std::vector< double > *self,std::vector< double >::value_type const &x){ - self->push_back(x); - } -SWIGINTERN std::vector< double >::iterator std_vector_Sl_double_Sg__erase__SWIG_0(std::vector< double > *self,std::vector< double >::iterator pos){ return self->erase(pos); } -SWIGINTERN std::vector< double >::iterator std_vector_Sl_double_Sg__erase__SWIG_1(std::vector< double > *self,std::vector< double >::iterator first,std::vector< double >::iterator last){ return self->erase(first, last); } -SWIGINTERN std::vector< double >::iterator std_vector_Sl_double_Sg__insert__SWIG_0(std::vector< double > *self,std::vector< double >::iterator pos,std::vector< double >::value_type const &x){ return self->insert(pos, x); } -SWIGINTERN void std_vector_Sl_double_Sg__insert__SWIG_1(std::vector< double > *self,std::vector< double >::iterator pos,std::vector< double >::size_type n,std::vector< double >::value_type const &x){ self->insert(pos, n, x); } - - namespace swig { - template <> struct traits<std::vector< std::vector< double,std::allocator< double > >, std::allocator< std::vector< double,std::allocator< double > > > > > { - typedef pointer_category category; - static const char* type_name() { - return "std::vector<" "std::vector< double,std::allocator< double > >" "," "std::allocator< std::vector< double,std::allocator< double > > >" " >"; - } - }; - } - -SWIGINTERN swig::SwigPyIterator *std_vector_Sl_std_vector_Sl_double_Sg__Sg__iterator(std::vector< std::vector< double > > *self,PyObject **PYTHON_SELF){ - return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN bool std_vector_Sl_std_vector_Sl_double_Sg__Sg____nonzero__(std::vector< std::vector< double > > const *self){ - return !(self->empty()); - } -SWIGINTERN bool std_vector_Sl_std_vector_Sl_double_Sg__Sg____bool__(std::vector< std::vector< double > > const *self){ - return !(self->empty()); - } -SWIGINTERN std::vector< std::vector< double > >::size_type std_vector_Sl_std_vector_Sl_double_Sg__Sg____len__(std::vector< std::vector< double > > const *self){ - return self->size(); - } -SWIGINTERN std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *std_vector_Sl_std_vector_Sl_double_Sg__Sg____getslice__(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::difference_type j){ - return swig::getslice(self, i, j, 1); - } -SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setslice____SWIG_0(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::difference_type j){ - swig::setslice(self, i, j, 1, std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >()); - } -SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setslice____SWIG_1(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::difference_type j,std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &v){ - swig::setslice(self, i, j, 1, v); - } -SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____delslice__(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::difference_type j){ - swig::delslice(self, i, j, 1); - } -SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____delitem____SWIG_0(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i){ - swig::erase(self, swig::getpos(self, i)); - } -SWIGINTERN std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_0(std::vector< std::vector< double > > *self,PySliceObject *slice){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return NULL; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type id = i; - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type jd = j; - return swig::getslice(self, id, jd, step); - } -SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_0(std::vector< std::vector< double > > *self,PySliceObject *slice,std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &v){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type id = i; - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type jd = j; - swig::setslice(self, id, jd, step, v); - } -SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_1(std::vector< std::vector< double > > *self,PySliceObject *slice){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type id = i; - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type jd = j; - swig::delslice(self, id, jd, step); - } -SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____delitem____SWIG_1(std::vector< std::vector< double > > *self,PySliceObject *slice){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type id = i; - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::difference_type jd = j; - swig::delslice(self, id, jd, step); - } -SWIGINTERN std::vector< std::vector< double > >::value_type const &std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_1(std::vector< std::vector< double > > const *self,std::vector< std::vector< double > >::difference_type i){ - return *(swig::cgetpos(self, i)); - } -SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_2(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::difference_type i,std::vector< std::vector< double > >::value_type const &x){ - *(swig::getpos(self,i)) = x; - } -SWIGINTERN std::vector< std::vector< double > >::value_type std_vector_Sl_std_vector_Sl_double_Sg__Sg__pop(std::vector< std::vector< double > > *self){ - if (self->size() == 0) - throw std::out_of_range("pop from empty container"); - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >::value_type x = self->back(); - self->pop_back(); - return x; - } -SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg__append(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::value_type const &x){ - self->push_back(x); - } -SWIGINTERN std::vector< std::vector< double > >::iterator std_vector_Sl_std_vector_Sl_double_Sg__Sg__erase__SWIG_0(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::iterator pos){ return self->erase(pos); } -SWIGINTERN std::vector< std::vector< double > >::iterator std_vector_Sl_std_vector_Sl_double_Sg__Sg__erase__SWIG_1(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::iterator first,std::vector< std::vector< double > >::iterator last){ return self->erase(first, last); } -SWIGINTERN std::vector< std::vector< double > >::iterator std_vector_Sl_std_vector_Sl_double_Sg__Sg__insert__SWIG_0(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::iterator pos,std::vector< std::vector< double > >::value_type const &x){ return self->insert(pos, x); } -SWIGINTERN void std_vector_Sl_std_vector_Sl_double_Sg__Sg__insert__SWIG_1(std::vector< std::vector< double > > *self,std::vector< std::vector< double > >::iterator pos,std::vector< std::vector< double > >::size_type n,std::vector< std::vector< double > >::value_type const &x){ self->insert(pos, n, x); } - -SWIGINTERN swig_type_info* -SWIG_pchar_descriptor(void) -{ - static int init = 0; - static swig_type_info* info = 0; - if (!init) { - info = SWIG_TypeQuery("_p_char"); - init = 1; - } - return info; -} - - -SWIGINTERN int -SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) -{ -#if PY_VERSION_HEX>=0x03000000 -#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - if (PyBytes_Check(obj)) -#else - if (PyUnicode_Check(obj)) -#endif -#else - if (PyString_Check(obj)) -#endif - { - char *cstr; Py_ssize_t len; - int ret = SWIG_OK; -#if PY_VERSION_HEX>=0x03000000 -#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - if (!alloc && cptr) { - /* We can't allow converting without allocation, since the internal - representation of string in Python 3 is UCS-2/UCS-4 but we require - a UTF-8 representation. - TODO(bhy) More detailed explanation */ - return SWIG_RuntimeError; - } - obj = PyUnicode_AsUTF8String(obj); - if (!obj) - return SWIG_TypeError; - if (alloc) - *alloc = SWIG_NEWOBJ; -#endif - PyBytes_AsStringAndSize(obj, &cstr, &len); -#else - PyString_AsStringAndSize(obj, &cstr, &len); -#endif - if (cptr) { - if (alloc) { - if (*alloc == SWIG_NEWOBJ) { - *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1))); - *alloc = SWIG_NEWOBJ; - } else { - *cptr = cstr; - *alloc = SWIG_OLDOBJ; - } - } else { -#if PY_VERSION_HEX>=0x03000000 -#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - *cptr = PyBytes_AsString(obj); -#else - assert(0); /* Should never reach here with Unicode strings in Python 3 */ -#endif -#else - *cptr = SWIG_Python_str_AsChar(obj); - if (!*cptr) - ret = SWIG_TypeError; -#endif - } - } - if (psize) *psize = len + 1; -#if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - Py_XDECREF(obj); -#endif - return ret; - } else { -#if defined(SWIG_PYTHON_2_UNICODE) -#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) -#error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once" -#endif -#if PY_VERSION_HEX<0x03000000 - if (PyUnicode_Check(obj)) { - char *cstr; Py_ssize_t len; - if (!alloc && cptr) { - return SWIG_RuntimeError; - } - obj = PyUnicode_AsUTF8String(obj); - if (!obj) - return SWIG_TypeError; - if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) { - if (cptr) { - if (alloc) *alloc = SWIG_NEWOBJ; - *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1))); - } - if (psize) *psize = len + 1; - - Py_XDECREF(obj); - return SWIG_OK; - } else { - Py_XDECREF(obj); - } - } -#endif -#endif - - swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - if (pchar_descriptor) { - void* vptr = 0; - if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { - if (cptr) *cptr = (char *) vptr; - if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; - if (alloc) *alloc = SWIG_OLDOBJ; - return SWIG_OK; - } - } - } - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsPtr_std_string (PyObject * obj, std::string **val) -{ - char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ; - if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) { - if (buf) { - if (val) *val = new std::string(buf, size - 1); - if (alloc == SWIG_NEWOBJ) delete[] buf; - return SWIG_NEWOBJ; - } else { - if (val) *val = 0; - return SWIG_OLDOBJ; - } - } else { - static int init = 0; - static swig_type_info* descriptor = 0; - if (!init) { - descriptor = SWIG_TypeQuery("std::string" " *"); - init = 1; - } - if (descriptor) { - std::string *vptr; - int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0); - if (SWIG_IsOK(res) && val) *val = vptr; - return res; - } - } - return SWIG_ERROR; -} - - -SWIGINTERN int -SWIG_AsVal_std_string (PyObject * obj, std::string *val) -{ - std::string* v = (std::string *) 0; - int res = SWIG_AsPtr_std_string (obj, &v); - if (!SWIG_IsOK(res)) return res; - if (v) { - if (val) *val = *v; - if (SWIG_IsNewObj(res)) { - delete v; - res = SWIG_DelNewMask(res); - } - return res; - } - return SWIG_ERROR; -} - - -SWIGINTERNINLINE PyObject * -SWIG_FromCharPtrAndSize(const char* carray, size_t size) -{ - if (carray) { - if (size > INT_MAX) { - swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); - return pchar_descriptor ? - SWIG_InternalNewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void(); - } else { -#if PY_VERSION_HEX >= 0x03000000 -#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) - return PyBytes_FromStringAndSize(carray, static_cast< Py_ssize_t >(size)); -#else - return PyUnicode_DecodeUTF8(carray, static_cast< Py_ssize_t >(size), "surrogateescape"); -#endif -#else - return PyString_FromStringAndSize(carray, static_cast< Py_ssize_t >(size)); -#endif - } - } else { - return SWIG_Py_Void(); - } -} - - -SWIGINTERNINLINE PyObject * -SWIG_From_std_string (const std::string& s) -{ - return SWIG_FromCharPtrAndSize(s.data(), s.size()); -} - - -namespace swig { - template <> struct traits< std::string > { - typedef value_category category; - static const char* type_name() { return"std::string"; } - }; - template <> struct traits_asval< std::string > { - typedef std::string value_type; - static int asval(PyObject *obj, value_type *val) { - return SWIG_AsVal_std_string (obj, val); - } - }; - template <> struct traits_from< std::string > { - typedef std::string value_type; - static PyObject *from(const value_type& val) { - return SWIG_From_std_string (val); - } - }; -} - - - namespace swig { - template <> struct traits<std::vector< std::string, std::allocator< std::string > > > { - typedef pointer_category category; - static const char* type_name() { - return "std::vector<" "std::string" "," "std::allocator< std::string >" " >"; - } - }; - } - -SWIGINTERN swig::SwigPyIterator *std_vector_Sl_std_string_Sg__iterator(std::vector< std::string > *self,PyObject **PYTHON_SELF){ - return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN bool std_vector_Sl_std_string_Sg____nonzero__(std::vector< std::string > const *self){ - return !(self->empty()); - } -SWIGINTERN bool std_vector_Sl_std_string_Sg____bool__(std::vector< std::string > const *self){ - return !(self->empty()); - } -SWIGINTERN std::vector< std::string >::size_type std_vector_Sl_std_string_Sg____len__(std::vector< std::string > const *self){ - return self->size(); - } -SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg____getslice__(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type j){ - return swig::getslice(self, i, j, 1); - } -SWIGINTERN void std_vector_Sl_std_string_Sg____setslice____SWIG_0(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type j){ - swig::setslice(self, i, j, 1, std::vector< std::string,std::allocator< std::string > >()); - } -SWIGINTERN void std_vector_Sl_std_string_Sg____setslice____SWIG_1(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type j,std::vector< std::string,std::allocator< std::string > > const &v){ - swig::setslice(self, i, j, 1, v); - } -SWIGINTERN void std_vector_Sl_std_string_Sg____delslice__(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::difference_type j){ - swig::delslice(self, i, j, 1); - } -SWIGINTERN void std_vector_Sl_std_string_Sg____delitem____SWIG_0(std::vector< std::string > *self,std::vector< std::string >::difference_type i){ - swig::erase(self, swig::getpos(self, i)); - } -SWIGINTERN std::vector< std::string,std::allocator< std::string > > *std_vector_Sl_std_string_Sg____getitem____SWIG_0(std::vector< std::string > *self,PySliceObject *slice){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return NULL; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< std::string,std::allocator< std::string > >::difference_type id = i; - std::vector< std::string,std::allocator< std::string > >::difference_type jd = j; - return swig::getslice(self, id, jd, step); - } -SWIGINTERN void std_vector_Sl_std_string_Sg____setitem____SWIG_0(std::vector< std::string > *self,PySliceObject *slice,std::vector< std::string,std::allocator< std::string > > const &v){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< std::string,std::allocator< std::string > >::difference_type id = i; - std::vector< std::string,std::allocator< std::string > >::difference_type jd = j; - swig::setslice(self, id, jd, step, v); - } -SWIGINTERN void std_vector_Sl_std_string_Sg____setitem____SWIG_1(std::vector< std::string > *self,PySliceObject *slice){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< std::string,std::allocator< std::string > >::difference_type id = i; - std::vector< std::string,std::allocator< std::string > >::difference_type jd = j; - swig::delslice(self, id, jd, step); - } -SWIGINTERN void std_vector_Sl_std_string_Sg____delitem____SWIG_1(std::vector< std::string > *self,PySliceObject *slice){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< std::string,std::allocator< std::string > >::difference_type id = i; - std::vector< std::string,std::allocator< std::string > >::difference_type jd = j; - swig::delslice(self, id, jd, step); - } -SWIGINTERN std::vector< std::string >::value_type const &std_vector_Sl_std_string_Sg____getitem____SWIG_1(std::vector< std::string > const *self,std::vector< std::string >::difference_type i){ - return *(swig::cgetpos(self, i)); - } -SWIGINTERN void std_vector_Sl_std_string_Sg____setitem____SWIG_2(std::vector< std::string > *self,std::vector< std::string >::difference_type i,std::vector< std::string >::value_type const &x){ - *(swig::getpos(self,i)) = x; - } -SWIGINTERN std::vector< std::string >::value_type std_vector_Sl_std_string_Sg__pop(std::vector< std::string > *self){ - if (self->size() == 0) - throw std::out_of_range("pop from empty container"); - std::vector< std::string,std::allocator< std::string > >::value_type x = self->back(); - self->pop_back(); - return x; - } -SWIGINTERN void std_vector_Sl_std_string_Sg__append(std::vector< std::string > *self,std::vector< std::string >::value_type const &x){ - self->push_back(x); - } -SWIGINTERN std::vector< std::string >::iterator std_vector_Sl_std_string_Sg__erase__SWIG_0(std::vector< std::string > *self,std::vector< std::string >::iterator pos){ return self->erase(pos); } -SWIGINTERN std::vector< std::string >::iterator std_vector_Sl_std_string_Sg__erase__SWIG_1(std::vector< std::string > *self,std::vector< std::string >::iterator first,std::vector< std::string >::iterator last){ return self->erase(first, last); } -SWIGINTERN std::vector< std::string >::iterator std_vector_Sl_std_string_Sg__insert__SWIG_0(std::vector< std::string > *self,std::vector< std::string >::iterator pos,std::vector< std::string >::value_type const &x){ return self->insert(pos, x); } -SWIGINTERN void std_vector_Sl_std_string_Sg__insert__SWIG_1(std::vector< std::string > *self,std::vector< std::string >::iterator pos,std::vector< std::string >::size_type n,std::vector< std::string >::value_type const &x){ self->insert(pos, n, x); } - - namespace swig { - template <> struct traits< CdiVariable > { - typedef pointer_category category; - static const char* type_name() { return"CdiVariable"; } - }; - } - - - namespace swig { - template <> struct traits<std::vector< CdiVariable, std::allocator< CdiVariable > > > { - typedef pointer_category category; - static const char* type_name() { - return "std::vector<" "CdiVariable" "," "std::allocator< CdiVariable >" " >"; - } - }; - } - -SWIGINTERN swig::SwigPyIterator *std_vector_Sl_CdiVariable_Sg__iterator(std::vector< CdiVariable > *self,PyObject **PYTHON_SELF){ - return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN bool std_vector_Sl_CdiVariable_Sg____nonzero__(std::vector< CdiVariable > const *self){ - return !(self->empty()); - } -SWIGINTERN bool std_vector_Sl_CdiVariable_Sg____bool__(std::vector< CdiVariable > const *self){ - return !(self->empty()); - } -SWIGINTERN std::vector< CdiVariable >::size_type std_vector_Sl_CdiVariable_Sg____len__(std::vector< CdiVariable > const *self){ - return self->size(); - } -SWIGINTERN std::vector< CdiVariable,std::allocator< CdiVariable > > *std_vector_Sl_CdiVariable_Sg____getslice__(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::difference_type j){ - return swig::getslice(self, i, j, 1); - } -SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setslice____SWIG_0(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::difference_type j){ - swig::setslice(self, i, j, 1, std::vector< CdiVariable,std::allocator< CdiVariable > >()); - } -SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setslice____SWIG_1(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::difference_type j,std::vector< CdiVariable,std::allocator< CdiVariable > > const &v){ - swig::setslice(self, i, j, 1, v); - } -SWIGINTERN void std_vector_Sl_CdiVariable_Sg____delslice__(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::difference_type j){ - swig::delslice(self, i, j, 1); - } -SWIGINTERN void std_vector_Sl_CdiVariable_Sg____delitem____SWIG_0(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i){ - swig::erase(self, swig::getpos(self, i)); - } -SWIGINTERN std::vector< CdiVariable,std::allocator< CdiVariable > > *std_vector_Sl_CdiVariable_Sg____getitem____SWIG_0(std::vector< CdiVariable > *self,PySliceObject *slice){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return NULL; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type id = i; - std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type jd = j; - return swig::getslice(self, id, jd, step); - } -SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setitem____SWIG_0(std::vector< CdiVariable > *self,PySliceObject *slice,std::vector< CdiVariable,std::allocator< CdiVariable > > const &v){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type id = i; - std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type jd = j; - swig::setslice(self, id, jd, step, v); - } -SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setitem____SWIG_1(std::vector< CdiVariable > *self,PySliceObject *slice){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type id = i; - std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type jd = j; - swig::delslice(self, id, jd, step); - } -SWIGINTERN void std_vector_Sl_CdiVariable_Sg____delitem____SWIG_1(std::vector< CdiVariable > *self,PySliceObject *slice){ - Py_ssize_t i, j, step; - if( !PySlice_Check(slice) ) { - SWIG_Error(SWIG_TypeError, "Slice object expected."); - return; - } - PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step); - std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type id = i; - std::vector< CdiVariable,std::allocator< CdiVariable > >::difference_type jd = j; - swig::delslice(self, id, jd, step); - } -SWIGINTERN std::vector< CdiVariable >::value_type const &std_vector_Sl_CdiVariable_Sg____getitem____SWIG_1(std::vector< CdiVariable > const *self,std::vector< CdiVariable >::difference_type i){ - return *(swig::cgetpos(self, i)); - } -SWIGINTERN void std_vector_Sl_CdiVariable_Sg____setitem____SWIG_2(std::vector< CdiVariable > *self,std::vector< CdiVariable >::difference_type i,std::vector< CdiVariable >::value_type const &x){ - *(swig::getpos(self,i)) = x; - } -SWIGINTERN std::vector< CdiVariable >::value_type std_vector_Sl_CdiVariable_Sg__pop(std::vector< CdiVariable > *self){ - if (self->size() == 0) - throw std::out_of_range("pop from empty container"); - std::vector< CdiVariable,std::allocator< CdiVariable > >::value_type x = self->back(); - self->pop_back(); - return x; - } -SWIGINTERN void std_vector_Sl_CdiVariable_Sg__append(std::vector< CdiVariable > *self,std::vector< CdiVariable >::value_type const &x){ - self->push_back(x); - } -SWIGINTERN std::vector< CdiVariable >::iterator std_vector_Sl_CdiVariable_Sg__erase__SWIG_0(std::vector< CdiVariable > *self,std::vector< CdiVariable >::iterator pos){ return self->erase(pos); } -SWIGINTERN std::vector< CdiVariable >::iterator std_vector_Sl_CdiVariable_Sg__erase__SWIG_1(std::vector< CdiVariable > *self,std::vector< CdiVariable >::iterator first,std::vector< CdiVariable >::iterator last){ return self->erase(first, last); } -SWIGINTERN std::vector< CdiVariable >::iterator std_vector_Sl_CdiVariable_Sg__insert__SWIG_0(std::vector< CdiVariable > *self,std::vector< CdiVariable >::iterator pos,std::vector< CdiVariable >::value_type const &x){ return self->insert(pos, x); } -SWIGINTERN void std_vector_Sl_CdiVariable_Sg__insert__SWIG_1(std::vector< CdiVariable > *self,std::vector< CdiVariable >::iterator pos,std::vector< CdiVariable >::size_type n,std::vector< CdiVariable >::value_type const &x){ self->insert(pos, n, x); } - - namespace swig { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - template <class T, class U > - struct traits_asptr<std::pair<T,U> > { - typedef std::pair<T,U> value_type; - - static int get_pair(PyObject* first, PyObject* second, - std::pair<T,U> **val) - { - if (val) { - value_type *vp = (new std::pair<T,U>()); - T *pfirst = &(vp->first); - int res1 = swig::asval((PyObject*)first, pfirst); - if (!SWIG_IsOK(res1)) { - delete vp; - return res1; - } - U *psecond = &(vp->second); - int res2 = swig::asval((PyObject*)second, psecond); - if (!SWIG_IsOK(res2)) { - delete vp; - return res2; - } - *val = vp; - return SWIG_AddNewMask(res1 > res2 ? res1 : res2); - } else { - T *pfirst = 0; - int res1 = swig::asval((PyObject*)first, pfirst); - if (!SWIG_IsOK(res1)) return res1; - U *psecond = 0; - int res2 = swig::asval((PyObject*)second, psecond); - if (!SWIG_IsOK(res2)) return res2; - return res1 > res2 ? res1 : res2; - } - } - - static int asptr(PyObject *obj, std::pair<T,U> **val) { - int res = SWIG_ERROR; - if (PyTuple_Check(obj)) { - if (PyTuple_GET_SIZE(obj) == 2) { - res = get_pair(PyTuple_GET_ITEM(obj,0),PyTuple_GET_ITEM(obj,1), val); - } - } else if (PySequence_Check(obj)) { - if (PySequence_Size(obj) == 2) { - swig::SwigVar_PyObject first = PySequence_GetItem(obj,0); - swig::SwigVar_PyObject second = PySequence_GetItem(obj,1); - res = get_pair(first, second, val); - } - } else { - value_type *p; - swig_type_info *descriptor = swig::type_info<value_type>(); - res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; - if (SWIG_IsOK(res) && val) *val = p; - } - return res; - } - }; - - - template <class T, class U > - struct traits_from<std::pair<T,U> > { - static PyObject *from(const std::pair<T,U>& val) { - PyObject* obj = PyTuple_New(2); - PyTuple_SetItem(obj,0,swig::from(val.first)); - PyTuple_SetItem(obj,1,swig::from(val.second)); - return obj; - } - }; - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - namespace swig { - template <> struct traits<std::pair< std::string, CdiVariable > > { - typedef pointer_category category; - static const char* type_name() { - return "std::pair<" "std::string" "," "CdiVariable" " >"; - } - }; - } - - - namespace swig { - template <class ValueType> - struct from_key_oper - { - typedef const ValueType& argument_type; - typedef PyObject *result_type; - result_type operator()(argument_type v) const - { - return swig::from(v.first); - } - }; - - template <class ValueType> - struct from_value_oper - { - typedef const ValueType& argument_type; - typedef PyObject *result_type; - result_type operator()(argument_type v) const - { - return swig::from(v.second); - } - }; - - template<class OutIterator, class FromOper, class ValueType = typename OutIterator::value_type> - struct SwigPyMapIterator_T : SwigPyIteratorClosed_T<OutIterator, ValueType, FromOper> - { - SwigPyMapIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq) - : SwigPyIteratorClosed_T<OutIterator,ValueType,FromOper>(curr, first, last, seq) - { - } - }; - - - template<class OutIterator, - class FromOper = from_key_oper<typename OutIterator::value_type> > - struct SwigPyMapKeyIterator_T : SwigPyMapIterator_T<OutIterator, FromOper> - { - SwigPyMapKeyIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq) - : SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq) - { - } - }; - - template<typename OutIter> - inline SwigPyIterator* - make_output_key_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0) - { - return new SwigPyMapKeyIterator_T<OutIter>(current, begin, end, seq); - } - - template<class OutIterator, - class FromOper = from_value_oper<typename OutIterator::value_type> > - struct SwigPyMapValueIterator_T : SwigPyMapIterator_T<OutIterator, FromOper> - { - SwigPyMapValueIterator_T(OutIterator curr, OutIterator first, OutIterator last, PyObject *seq) - : SwigPyMapIterator_T<OutIterator, FromOper>(curr, first, last, seq) - { - } - }; - - - template<typename OutIter> - inline SwigPyIterator* - make_output_value_iterator(const OutIter& current, const OutIter& begin, const OutIter& end, PyObject *seq = 0) - { - return new SwigPyMapValueIterator_T<OutIter>(current, begin, end, seq); - } - } - - - namespace swig { - template <class SwigPySeq, class K, class T, class Compare, class Alloc > - inline void - assign(const SwigPySeq& swigpyseq, std::map<K,T,Compare,Alloc > *map) { - typedef typename std::map<K,T,Compare,Alloc >::value_type value_type; - typename SwigPySeq::const_iterator it = swigpyseq.begin(); - for (;it != swigpyseq.end(); ++it) { - map->insert(value_type(it->first, it->second)); - } - } - - template <class K, class T, class Compare, class Alloc> - struct traits_asptr<std::map<K,T,Compare,Alloc > > { - typedef std::map<K,T,Compare,Alloc > map_type; - static int asptr(PyObject *obj, map_type **val) { - int res = SWIG_ERROR; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (PyDict_Check(obj)) { - SwigVar_PyObject items = PyObject_CallMethod(obj,(char *)"items",NULL); -#if PY_VERSION_HEX >= 0x03000000 - /* In Python 3.x the ".items()" method returns a dict_items object */ - items = PySequence_Fast(items, ".items() didn't return a sequence!"); -#endif - res = traits_asptr_stdseq<map_type, std::pair<K, T> >::asptr(items, val); - } else { - map_type *p; - swig_type_info *descriptor = swig::type_info<map_type>(); - res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; - if (SWIG_IsOK(res) && val) *val = p; - } - SWIG_PYTHON_THREAD_END_BLOCK; - return res; - } - }; - - template <class K, class T, class Compare, class Alloc > - struct traits_from<std::map<K,T,Compare,Alloc > > { - typedef std::map<K,T,Compare,Alloc > map_type; - typedef typename map_type::const_iterator const_iterator; - typedef typename map_type::size_type size_type; - - static PyObject *asdict(const map_type& map) { - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - size_type size = map.size(); - Py_ssize_t pysize = (size <= (size_type) INT_MAX) ? (Py_ssize_t) size : -1; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject *obj = PyDict_New(); - for (const_iterator i= map.begin(); i!= map.end(); ++i) { - swig::SwigVar_PyObject key = swig::from(i->first); - swig::SwigVar_PyObject val = swig::from(i->second); - PyDict_SetItem(obj, key, val); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return obj; - } - - static PyObject *from(const map_type& map) { - swig_type_info *desc = swig::type_info<map_type>(); - if (desc && desc->clientdata) { - return SWIG_InternalNewPointerObj(new map_type(map), desc, SWIG_POINTER_OWN); - } else { - return asdict(map); - } - } - }; - } - - - namespace swig { - template <> struct traits<std::map< std::string, CdiVariable, std::less< std::string >, std::allocator< std::pair< std::string const,CdiVariable > > > > { - typedef pointer_category category; - static const char* type_name() { - return "std::map<" "std::string" "," "CdiVariable" "," "std::less< std::string >" "," "std::allocator< std::pair< std::string const,CdiVariable > >" " >"; - } - }; - } - -SWIGINTERN swig::SwigPyIterator *std_map_Sl_std_string_Sc_CdiVariable_Sg__iterator(std::map< std::string,CdiVariable > *self,PyObject **PYTHON_SELF){ - return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg____nonzero__(std::map< std::string,CdiVariable > const *self){ - return !(self->empty()); - } -SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg____bool__(std::map< std::string,CdiVariable > const *self){ - return !(self->empty()); - } -SWIGINTERN std::map< std::string,CdiVariable >::size_type std_map_Sl_std_string_Sc_CdiVariable_Sg____len__(std::map< std::string,CdiVariable > const *self){ - return self->size(); - } -SWIGINTERN std::map< std::string,CdiVariable >::mapped_type const &std_map_Sl_std_string_Sc_CdiVariable_Sg____getitem__(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key){ - std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->find(key); - if (i != self->end()) - return i->second; - else - throw std::out_of_range("key not found"); - } -SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg____delitem__(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key){ - std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::iterator i = self->find(key); - if (i != self->end()) - self->erase(i); - else - throw std::out_of_range("key not found"); - } -SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg__has_key(std::map< std::string,CdiVariable > const *self,std::map< std::string,CdiVariable >::key_type const &key){ - std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->find(key); - return i != self->end(); - } -SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__keys(std::map< std::string,CdiVariable > *self){ - std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type size = self->size(); - Py_ssize_t pysize = (size <= (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject* keyList = PyList_New(pysize); - std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->begin(); - for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { - PyList_SET_ITEM(keyList, j, swig::from(i->first)); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return keyList; - } -SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__values(std::map< std::string,CdiVariable > *self){ - std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type size = self->size(); - Py_ssize_t pysize = (size <= (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject* valList = PyList_New(pysize); - std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->begin(); - for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { - PyList_SET_ITEM(valList, j, swig::from(i->second)); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return valList; - } -SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__items(std::map< std::string,CdiVariable > *self){ - std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type size = self->size(); - Py_ssize_t pysize = (size <= (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject* itemList = PyList_New(pysize); - std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >::const_iterator i = self->begin(); - for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { - PyList_SET_ITEM(itemList, j, swig::from(*i)); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return itemList; - } -SWIGINTERN bool std_map_Sl_std_string_Sc_CdiVariable_Sg____contains__(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key){ - return self->find(key) != self->end(); - } -SWIGINTERN swig::SwigPyIterator *std_map_Sl_std_string_Sc_CdiVariable_Sg__key_iterator(std::map< std::string,CdiVariable > *self,PyObject **PYTHON_SELF){ - return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN swig::SwigPyIterator *std_map_Sl_std_string_Sc_CdiVariable_Sg__value_iterator(std::map< std::string,CdiVariable > *self,PyObject **PYTHON_SELF){ - return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem____SWIG_0(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key){ - self->erase(key); - } -SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem____SWIG_1(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::key_type const &key,std::map< std::string,CdiVariable >::mapped_type const &x){ - (*self)[key] = x; - } -SWIGINTERN PyObject *std_map_Sl_std_string_Sc_CdiVariable_Sg__asdict(std::map< std::string,CdiVariable > *self){ - return swig::traits_from< std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > >::asdict(*self); - } -SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg__erase__SWIG_1(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::iterator position){ self->erase(position); } -SWIGINTERN void std_map_Sl_std_string_Sc_CdiVariable_Sg__erase__SWIG_2(std::map< std::string,CdiVariable > *self,std::map< std::string,CdiVariable >::iterator first,std::map< std::string,CdiVariable >::iterator last){ self->erase(first, last); } - - namespace swig { - template <> struct traits<std::pair< int, CdiVariable > > { - typedef pointer_category category; - static const char* type_name() { - return "std::pair<" "int" "," "CdiVariable" " >"; - } - }; - } - - - namespace swig { - template <> struct traits<std::map< int, CdiVariable, std::less< int >, std::allocator< std::pair< int const,CdiVariable > > > > { - typedef pointer_category category; - static const char* type_name() { - return "std::map<" "int" "," "CdiVariable" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiVariable > >" " >"; - } - }; - } - -SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiVariable_Sg__iterator(std::map< int,CdiVariable > *self,PyObject **PYTHON_SELF){ - return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg____nonzero__(std::map< int,CdiVariable > const *self){ - return !(self->empty()); - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg____bool__(std::map< int,CdiVariable > const *self){ - return !(self->empty()); - } -SWIGINTERN std::map< int,CdiVariable >::size_type std_map_Sl_int_Sc_CdiVariable_Sg____len__(std::map< int,CdiVariable > const *self){ - return self->size(); - } -SWIGINTERN std::map< int,CdiVariable >::mapped_type const &std_map_Sl_int_Sc_CdiVariable_Sg____getitem__(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key){ - std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->find(key); - if (i != self->end()) - return i->second; - else - throw std::out_of_range("key not found"); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg____delitem__(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key){ - std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::iterator i = self->find(key); - if (i != self->end()) - self->erase(i); - else - throw std::out_of_range("key not found"); - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg__has_key(std::map< int,CdiVariable > const *self,std::map< int,CdiVariable >::key_type const &key){ - std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->find(key); - return i != self->end(); - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__keys(std::map< int,CdiVariable > *self){ - std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type size = self->size(); - Py_ssize_t pysize = (size <= (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject* keyList = PyList_New(pysize); - std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->begin(); - for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { - PyList_SET_ITEM(keyList, j, swig::from(i->first)); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return keyList; - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__values(std::map< int,CdiVariable > *self){ - std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type size = self->size(); - Py_ssize_t pysize = (size <= (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject* valList = PyList_New(pysize); - std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->begin(); - for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { - PyList_SET_ITEM(valList, j, swig::from(i->second)); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return valList; - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__items(std::map< int,CdiVariable > *self){ - std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type size = self->size(); - Py_ssize_t pysize = (size <= (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject* itemList = PyList_New(pysize); - std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >::const_iterator i = self->begin(); - for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { - PyList_SET_ITEM(itemList, j, swig::from(*i)); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return itemList; - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiVariable_Sg____contains__(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key){ - return self->find(key) != self->end(); - } -SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiVariable_Sg__key_iterator(std::map< int,CdiVariable > *self,PyObject **PYTHON_SELF){ - return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiVariable_Sg__value_iterator(std::map< int,CdiVariable > *self,PyObject **PYTHON_SELF){ - return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg____setitem____SWIG_0(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key){ - self->erase(key); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg____setitem____SWIG_1(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::key_type const &key,std::map< int,CdiVariable >::mapped_type const &x){ - (*self)[key] = x; - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiVariable_Sg__asdict(std::map< int,CdiVariable > *self){ - return swig::traits_from< std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > >::asdict(*self); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg__erase__SWIG_1(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::iterator position){ self->erase(position); } -SWIGINTERN void std_map_Sl_int_Sc_CdiVariable_Sg__erase__SWIG_2(std::map< int,CdiVariable > *self,std::map< int,CdiVariable >::iterator first,std::map< int,CdiVariable >::iterator last){ self->erase(first, last); } - - namespace swig { - template <> struct traits< CdiTaxis > { - typedef pointer_category category; - static const char* type_name() { return"CdiTaxis"; } - }; - } - - - namespace swig { - template <> struct traits<std::pair< int, CdiTaxis > > { - typedef pointer_category category; - static const char* type_name() { - return "std::pair<" "int" "," "CdiTaxis" " >"; - } - }; - } - - - namespace swig { - template <> struct traits<std::map< int, CdiTaxis, std::less< int >, std::allocator< std::pair< int const,CdiTaxis > > > > { - typedef pointer_category category; - static const char* type_name() { - return "std::map<" "int" "," "CdiTaxis" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiTaxis > >" " >"; - } - }; - } - -SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiTaxis_Sg__iterator(std::map< int,CdiTaxis > *self,PyObject **PYTHON_SELF){ - return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg____nonzero__(std::map< int,CdiTaxis > const *self){ - return !(self->empty()); - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg____bool__(std::map< int,CdiTaxis > const *self){ - return !(self->empty()); - } -SWIGINTERN std::map< int,CdiTaxis >::size_type std_map_Sl_int_Sc_CdiTaxis_Sg____len__(std::map< int,CdiTaxis > const *self){ - return self->size(); - } -SWIGINTERN std::map< int,CdiTaxis >::mapped_type const &std_map_Sl_int_Sc_CdiTaxis_Sg____getitem__(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key){ - std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->find(key); - if (i != self->end()) - return i->second; - else - throw std::out_of_range("key not found"); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg____delitem__(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key){ - std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::iterator i = self->find(key); - if (i != self->end()) - self->erase(i); - else - throw std::out_of_range("key not found"); - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg__has_key(std::map< int,CdiTaxis > const *self,std::map< int,CdiTaxis >::key_type const &key){ - std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->find(key); - return i != self->end(); - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__keys(std::map< int,CdiTaxis > *self){ - std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type size = self->size(); - Py_ssize_t pysize = (size <= (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject* keyList = PyList_New(pysize); - std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->begin(); - for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { - PyList_SET_ITEM(keyList, j, swig::from(i->first)); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return keyList; - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__values(std::map< int,CdiTaxis > *self){ - std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type size = self->size(); - Py_ssize_t pysize = (size <= (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject* valList = PyList_New(pysize); - std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->begin(); - for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { - PyList_SET_ITEM(valList, j, swig::from(i->second)); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return valList; - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__items(std::map< int,CdiTaxis > *self){ - std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type size = self->size(); - Py_ssize_t pysize = (size <= (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject* itemList = PyList_New(pysize); - std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >::const_iterator i = self->begin(); - for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { - PyList_SET_ITEM(itemList, j, swig::from(*i)); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return itemList; - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiTaxis_Sg____contains__(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key){ - return self->find(key) != self->end(); - } -SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiTaxis_Sg__key_iterator(std::map< int,CdiTaxis > *self,PyObject **PYTHON_SELF){ - return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiTaxis_Sg__value_iterator(std::map< int,CdiTaxis > *self,PyObject **PYTHON_SELF){ - return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg____setitem____SWIG_0(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key){ - self->erase(key); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg____setitem____SWIG_1(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::key_type const &key,std::map< int,CdiTaxis >::mapped_type const &x){ - (*self)[key] = x; - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiTaxis_Sg__asdict(std::map< int,CdiTaxis > *self){ - return swig::traits_from< std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > >::asdict(*self); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg__erase__SWIG_1(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::iterator position){ self->erase(position); } -SWIGINTERN void std_map_Sl_int_Sc_CdiTaxis_Sg__erase__SWIG_2(std::map< int,CdiTaxis > *self,std::map< int,CdiTaxis >::iterator first,std::map< int,CdiTaxis >::iterator last){ self->erase(first, last); } - - namespace swig { - template <> struct traits< CdiZaxis > { - typedef pointer_category category; - static const char* type_name() { return"CdiZaxis"; } - }; - } - - - namespace swig { - template <> struct traits<std::pair< int, CdiZaxis > > { - typedef pointer_category category; - static const char* type_name() { - return "std::pair<" "int" "," "CdiZaxis" " >"; - } - }; - } - - - namespace swig { - template <> struct traits<std::map< int, CdiZaxis, std::less< int >, std::allocator< std::pair< int const,CdiZaxis > > > > { - typedef pointer_category category; - static const char* type_name() { - return "std::map<" "int" "," "CdiZaxis" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiZaxis > >" " >"; - } - }; - } - -SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiZaxis_Sg__iterator(std::map< int,CdiZaxis > *self,PyObject **PYTHON_SELF){ - return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg____nonzero__(std::map< int,CdiZaxis > const *self){ - return !(self->empty()); - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg____bool__(std::map< int,CdiZaxis > const *self){ - return !(self->empty()); - } -SWIGINTERN std::map< int,CdiZaxis >::size_type std_map_Sl_int_Sc_CdiZaxis_Sg____len__(std::map< int,CdiZaxis > const *self){ - return self->size(); - } -SWIGINTERN std::map< int,CdiZaxis >::mapped_type const &std_map_Sl_int_Sc_CdiZaxis_Sg____getitem__(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key){ - std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->find(key); - if (i != self->end()) - return i->second; - else - throw std::out_of_range("key not found"); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg____delitem__(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key){ - std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::iterator i = self->find(key); - if (i != self->end()) - self->erase(i); - else - throw std::out_of_range("key not found"); - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg__has_key(std::map< int,CdiZaxis > const *self,std::map< int,CdiZaxis >::key_type const &key){ - std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->find(key); - return i != self->end(); - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__keys(std::map< int,CdiZaxis > *self){ - std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type size = self->size(); - Py_ssize_t pysize = (size <= (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject* keyList = PyList_New(pysize); - std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->begin(); - for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { - PyList_SET_ITEM(keyList, j, swig::from(i->first)); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return keyList; - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__values(std::map< int,CdiZaxis > *self){ - std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type size = self->size(); - Py_ssize_t pysize = (size <= (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject* valList = PyList_New(pysize); - std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->begin(); - for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { - PyList_SET_ITEM(valList, j, swig::from(i->second)); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return valList; - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__items(std::map< int,CdiZaxis > *self){ - std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type size = self->size(); - Py_ssize_t pysize = (size <= (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject* itemList = PyList_New(pysize); - std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >::const_iterator i = self->begin(); - for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { - PyList_SET_ITEM(itemList, j, swig::from(*i)); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return itemList; - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiZaxis_Sg____contains__(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key){ - return self->find(key) != self->end(); - } -SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiZaxis_Sg__key_iterator(std::map< int,CdiZaxis > *self,PyObject **PYTHON_SELF){ - return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiZaxis_Sg__value_iterator(std::map< int,CdiZaxis > *self,PyObject **PYTHON_SELF){ - return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg____setitem____SWIG_0(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key){ - self->erase(key); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg____setitem____SWIG_1(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::key_type const &key,std::map< int,CdiZaxis >::mapped_type const &x){ - (*self)[key] = x; - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiZaxis_Sg__asdict(std::map< int,CdiZaxis > *self){ - return swig::traits_from< std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > >::asdict(*self); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg__erase__SWIG_1(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::iterator position){ self->erase(position); } -SWIGINTERN void std_map_Sl_int_Sc_CdiZaxis_Sg__erase__SWIG_2(std::map< int,CdiZaxis > *self,std::map< int,CdiZaxis >::iterator first,std::map< int,CdiZaxis >::iterator last){ self->erase(first, last); } - - namespace swig { - template <> struct traits< CdiGrid > { - typedef pointer_category category; - static const char* type_name() { return"CdiGrid"; } - }; - } - - - namespace swig { - template <> struct traits<std::pair< int, CdiGrid > > { - typedef pointer_category category; - static const char* type_name() { - return "std::pair<" "int" "," "CdiGrid" " >"; - } - }; - } - - - namespace swig { - template <> struct traits<std::map< int, CdiGrid, std::less< int >, std::allocator< std::pair< int const,CdiGrid > > > > { - typedef pointer_category category; - static const char* type_name() { - return "std::map<" "int" "," "CdiGrid" "," "std::less< int >" "," "std::allocator< std::pair< int const,CdiGrid > >" " >"; - } - }; - } - -SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiGrid_Sg__iterator(std::map< int,CdiGrid > *self,PyObject **PYTHON_SELF){ - return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg____nonzero__(std::map< int,CdiGrid > const *self){ - return !(self->empty()); - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg____bool__(std::map< int,CdiGrid > const *self){ - return !(self->empty()); - } -SWIGINTERN std::map< int,CdiGrid >::size_type std_map_Sl_int_Sc_CdiGrid_Sg____len__(std::map< int,CdiGrid > const *self){ - return self->size(); - } -SWIGINTERN std::map< int,CdiGrid >::mapped_type const &std_map_Sl_int_Sc_CdiGrid_Sg____getitem__(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key){ - std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->find(key); - if (i != self->end()) - return i->second; - else - throw std::out_of_range("key not found"); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg____delitem__(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key){ - std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::iterator i = self->find(key); - if (i != self->end()) - self->erase(i); - else - throw std::out_of_range("key not found"); - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg__has_key(std::map< int,CdiGrid > const *self,std::map< int,CdiGrid >::key_type const &key){ - std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->find(key); - return i != self->end(); - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiGrid_Sg__keys(std::map< int,CdiGrid > *self){ - std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type size = self->size(); - Py_ssize_t pysize = (size <= (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject* keyList = PyList_New(pysize); - std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->begin(); - for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { - PyList_SET_ITEM(keyList, j, swig::from(i->first)); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return keyList; - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiGrid_Sg__values(std::map< int,CdiGrid > *self){ - std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type size = self->size(); - Py_ssize_t pysize = (size <= (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject* valList = PyList_New(pysize); - std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->begin(); - for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { - PyList_SET_ITEM(valList, j, swig::from(i->second)); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return valList; - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiGrid_Sg__items(std::map< int,CdiGrid > *self){ - std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type size = self->size(); - Py_ssize_t pysize = (size <= (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::size_type) INT_MAX) ? (Py_ssize_t) size : -1; - SWIG_PYTHON_THREAD_BEGIN_BLOCK; - if (pysize < 0) { - PyErr_SetString(PyExc_OverflowError, "map size not valid in python"); - SWIG_PYTHON_THREAD_END_BLOCK; - return NULL; - } - PyObject* itemList = PyList_New(pysize); - std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >::const_iterator i = self->begin(); - for (Py_ssize_t j = 0; j < pysize; ++i, ++j) { - PyList_SET_ITEM(itemList, j, swig::from(*i)); - } - SWIG_PYTHON_THREAD_END_BLOCK; - return itemList; - } -SWIGINTERN bool std_map_Sl_int_Sc_CdiGrid_Sg____contains__(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key){ - return self->find(key) != self->end(); - } -SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiGrid_Sg__key_iterator(std::map< int,CdiGrid > *self,PyObject **PYTHON_SELF){ - return swig::make_output_key_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN swig::SwigPyIterator *std_map_Sl_int_Sc_CdiGrid_Sg__value_iterator(std::map< int,CdiGrid > *self,PyObject **PYTHON_SELF){ - return swig::make_output_value_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg____setitem____SWIG_0(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key){ - self->erase(key); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg____setitem____SWIG_1(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::key_type const &key,std::map< int,CdiGrid >::mapped_type const &x){ - (*self)[key] = x; - } -SWIGINTERN PyObject *std_map_Sl_int_Sc_CdiGrid_Sg__asdict(std::map< int,CdiGrid > *self){ - return swig::traits_from< std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > >::asdict(*self); - } -SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg__erase__SWIG_1(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::iterator position){ self->erase(position); } -SWIGINTERN void std_map_Sl_int_Sc_CdiGrid_Sg__erase__SWIG_2(std::map< int,CdiGrid > *self,std::map< int,CdiGrid >::iterator first,std::map< int,CdiGrid >::iterator last){ self->erase(first, last); } - -SWIGINTERN int -SWIG_AsVal_bool (PyObject *obj, bool *val) -{ - int r; - if (!PyBool_Check(obj)) - return SWIG_ERROR; - r = PyObject_IsTrue(obj); - if (r == -1) - return SWIG_ERROR; - if (val) *val = r ? true : false; - return SWIG_OK; -} - - -SWIGINTERN int -SWIG_AsCharArray(PyObject * obj, char *val, size_t size) -{ - char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ; - int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc); - if (SWIG_IsOK(res)) { - /* special case of single char conversion when we don't need space for NUL */ - if (size == 1 && csize == 2 && cptr && !cptr[1]) --csize; - if (csize <= size) { - if (val) { - if (csize) memcpy(val, cptr, csize*sizeof(char)); - if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char)); - } - if (alloc == SWIG_NEWOBJ) { - delete[] cptr; - res = SWIG_DelNewMask(res); - } - return res; - } - if (alloc == SWIG_NEWOBJ) delete[] cptr; - } - return SWIG_TypeError; -} - - -SWIGINTERN size_t -SWIG_strnlen(const char* s, size_t maxlen) -{ - const char *p; - for (p = s; maxlen-- && *p; p++) - ; - return p - s; -} - - - - - -SWIGINTERNINLINE PyObject * -SWIG_FromCharPtr(const char *cptr) -{ - return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); -} - -#ifdef __cplusplus -extern "C" { -#endif -SWIGINTERN PyObject *_wrap_delete_SwigPyIterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SwigPyIterator" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator_value(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_value" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - try { - result = (PyObject *)((swig::SwigPyIterator const *)arg1)->value(); - } catch(swig::stop_iteration &_e) { - { - (void)_e; - SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); - SWIG_fail; - } - } - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator_incr__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - size_t arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - swig::SwigPyIterator *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_incr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator_incr" "', argument " "2"" of type '" "size_t""'"); - } - arg2 = static_cast< size_t >(val2); - try { - result = (swig::SwigPyIterator *)(arg1)->incr(arg2); - } catch(swig::stop_iteration &_e) { - { - (void)_e; - SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); - SWIG_fail; - } - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator_incr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_incr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - try { - result = (swig::SwigPyIterator *)(arg1)->incr(); - } catch(swig::stop_iteration &_e) { - { - (void)_e; - SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); - SWIG_fail; - } - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator_incr(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "SwigPyIterator_incr", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 1) { - int _v; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_SwigPyIterator_incr__SWIG_1(self, argc, argv); - } - } - if (argc == 2) { - int _v; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_SwigPyIterator_incr__SWIG_0(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'SwigPyIterator_incr'.\n" - " Possible C/C++ prototypes are:\n" - " swig::SwigPyIterator::incr(size_t)\n" - " swig::SwigPyIterator::incr()\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator_decr__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - size_t arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - swig::SwigPyIterator *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_decr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator_decr" "', argument " "2"" of type '" "size_t""'"); - } - arg2 = static_cast< size_t >(val2); - try { - result = (swig::SwigPyIterator *)(arg1)->decr(arg2); - } catch(swig::stop_iteration &_e) { - { - (void)_e; - SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); - SWIG_fail; - } - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator_decr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_decr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - try { - result = (swig::SwigPyIterator *)(arg1)->decr(); - } catch(swig::stop_iteration &_e) { - { - (void)_e; - SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); - SWIG_fail; - } - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator_decr(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "SwigPyIterator_decr", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 1) { - int _v; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_SwigPyIterator_decr__SWIG_1(self, argc, argv); - } - } - if (argc == 2) { - int _v; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_SwigPyIterator_decr__SWIG_0(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'SwigPyIterator_decr'.\n" - " Possible C/C++ prototypes are:\n" - " swig::SwigPyIterator::decr(size_t)\n" - " swig::SwigPyIterator::decr()\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator_distance(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - swig::SwigPyIterator *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - ptrdiff_t result; - - if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator_distance", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_distance" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_swig__SwigPyIterator, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator_distance" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator_distance" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); - } - arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2); - try { - result = ((swig::SwigPyIterator const *)arg1)->distance((swig::SwigPyIterator const &)*arg2); - } catch(std::invalid_argument &_e) { - SWIG_Python_Raise(SWIG_NewPointerObj((new std::invalid_argument(static_cast< const std::invalid_argument& >(_e))),SWIGTYPE_p_std__invalid_argument,SWIG_POINTER_OWN), "std::invalid_argument", SWIGTYPE_p_std__invalid_argument); SWIG_fail; - } - resultobj = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator_equal(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - swig::SwigPyIterator *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - bool result; - - if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator_equal", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_equal" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_swig__SwigPyIterator, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator_equal" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator_equal" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); - } - arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2); - try { - result = (bool)((swig::SwigPyIterator const *)arg1)->equal((swig::SwigPyIterator const &)*arg2); - } catch(std::invalid_argument &_e) { - SWIG_Python_Raise(SWIG_NewPointerObj((new std::invalid_argument(static_cast< const std::invalid_argument& >(_e))),SWIGTYPE_p_std__invalid_argument,SWIG_POINTER_OWN), "std::invalid_argument", SWIGTYPE_p_std__invalid_argument); SWIG_fail; - } - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator_copy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_copy" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - result = (swig::SwigPyIterator *)((swig::SwigPyIterator const *)arg1)->copy(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator_next(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_next" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - try { - result = (PyObject *)(arg1)->next(); - } catch(swig::stop_iteration &_e) { - { - (void)_e; - SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); - SWIG_fail; - } - } - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator___next__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___next__" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - try { - result = (PyObject *)(arg1)->__next__(); - } catch(swig::stop_iteration &_e) { - { - (void)_e; - SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); - SWIG_fail; - } - } - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator_previous(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_previous" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - try { - result = (PyObject *)(arg1)->previous(); - } catch(swig::stop_iteration &_e) { - { - (void)_e; - SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); - SWIG_fail; - } - } - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator_advance(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - ptrdiff_t arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - swig::SwigPyIterator *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator_advance", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_advance" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator_advance" "', argument " "2"" of type '" "ptrdiff_t""'"); - } - arg2 = static_cast< ptrdiff_t >(val2); - try { - result = (swig::SwigPyIterator *)(arg1)->advance(arg2); - } catch(swig::stop_iteration &_e) { - { - (void)_e; - SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); - SWIG_fail; - } - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - swig::SwigPyIterator *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - bool result; - - if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator___eq__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___eq__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_swig__SwigPyIterator, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator___eq__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator___eq__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); - } - arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2); - result = (bool)((swig::SwigPyIterator const *)arg1)->operator ==((swig::SwigPyIterator const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - PyErr_Clear(); - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator___ne__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - swig::SwigPyIterator *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - bool result; - - if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator___ne__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___ne__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_swig__SwigPyIterator, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator___ne__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator___ne__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); - } - arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2); - result = (bool)((swig::SwigPyIterator const *)arg1)->operator !=((swig::SwigPyIterator const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - PyErr_Clear(); - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator___iadd__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - ptrdiff_t arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - swig::SwigPyIterator *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator___iadd__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___iadd__" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___iadd__" "', argument " "2"" of type '" "ptrdiff_t""'"); - } - arg2 = static_cast< ptrdiff_t >(val2); - try { - result = (swig::SwigPyIterator *) &(arg1)->operator +=(arg2); - } catch(swig::stop_iteration &_e) { - { - (void)_e; - SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); - SWIG_fail; - } - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator___isub__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - ptrdiff_t arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - swig::SwigPyIterator *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator___isub__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___isub__" "', argument " "1"" of type '" "swig::SwigPyIterator *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___isub__" "', argument " "2"" of type '" "ptrdiff_t""'"); - } - arg2 = static_cast< ptrdiff_t >(val2); - try { - result = (swig::SwigPyIterator *) &(arg1)->operator -=(arg2); - } catch(swig::stop_iteration &_e) { - { - (void)_e; - SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); - SWIG_fail; - } - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator___add__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - ptrdiff_t arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - swig::SwigPyIterator *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "SwigPyIterator___add__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___add__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___add__" "', argument " "2"" of type '" "ptrdiff_t""'"); - } - arg2 = static_cast< ptrdiff_t >(val2); - try { - result = (swig::SwigPyIterator *)((swig::SwigPyIterator const *)arg1)->operator +(arg2); - } catch(swig::stop_iteration &_e) { - { - (void)_e; - SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); - SWIG_fail; - } - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - PyErr_Clear(); - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator___sub____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - ptrdiff_t arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - swig::SwigPyIterator *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___sub__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___sub__" "', argument " "2"" of type '" "ptrdiff_t""'"); - } - arg2 = static_cast< ptrdiff_t >(val2); - try { - result = (swig::SwigPyIterator *)((swig::SwigPyIterator const *)arg1)->operator -(arg2); - } catch(swig::stop_iteration &_e) { - { - (void)_e; - SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); - SWIG_fail; - } - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - PyErr_Clear(); - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator___sub____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ; - swig::SwigPyIterator *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - ptrdiff_t result; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___sub__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'"); - } - arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_swig__SwigPyIterator, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator___sub__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator___sub__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'"); - } - arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2); - result = ((swig::SwigPyIterator const *)arg1)->operator -((swig::SwigPyIterator const &)*arg2); - resultobj = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result)); - return resultobj; -fail: - PyErr_Clear(); - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - - -SWIGINTERN PyObject *_wrap_SwigPyIterator___sub__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "SwigPyIterator___sub__", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0); - _v = SWIG_CheckState(res); - if (_v) { - int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_SwigPyIterator___sub____SWIG_1(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_SwigPyIterator___sub____SWIG_0(self, argc, argv); - } - } - } - -fail: - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - - -SWIGINTERN PyObject *SwigPyIterator_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_swig__SwigPyIterator, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *_wrap_IntVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_iterator" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - result = (swig::SwigPyIterator *)std_vector_Sl_int_Sg__iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___nonzero__" "', argument " "1"" of type '" "std::vector< int > const *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - result = (bool)std_vector_Sl_int_Sg____nonzero__((std::vector< int > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___bool__" "', argument " "1"" of type '" "std::vector< int > const *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - result = (bool)std_vector_Sl_int_Sg____bool__((std::vector< int > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< int >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___len__" "', argument " "1"" of type '" "std::vector< int > const *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - result = std_vector_Sl_int_Sg____len__((std::vector< int > const *)arg1); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::difference_type arg2 ; - std::vector< int >::difference_type arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - std::vector< int,std::allocator< int > > *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "IntVector___getslice__", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___getslice__" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___getslice__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'"); - } - arg2 = static_cast< std::vector< int >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___getslice__" "', argument " "3"" of type '" "std::vector< int >::difference_type""'"); - } - arg3 = static_cast< std::vector< int >::difference_type >(val3); - try { - result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg____getslice__(arg1,arg2,arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::difference_type arg2 ; - std::vector< int >::difference_type arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setslice__" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___setslice__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'"); - } - arg2 = static_cast< std::vector< int >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___setslice__" "', argument " "3"" of type '" "std::vector< int >::difference_type""'"); - } - arg3 = static_cast< std::vector< int >::difference_type >(val3); - try { - std_vector_Sl_int_Sg____setslice____SWIG_0(arg1,arg2,arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::difference_type arg2 ; - std::vector< int >::difference_type arg3 ; - std::vector< int,std::allocator< int > > *arg4 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - int res4 = SWIG_OLDOBJ ; - - if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setslice__" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___setslice__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'"); - } - arg2 = static_cast< std::vector< int >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___setslice__" "', argument " "3"" of type '" "std::vector< int >::difference_type""'"); - } - arg3 = static_cast< std::vector< int >::difference_type >(val3); - { - std::vector< int,std::allocator< int > > *ptr = (std::vector< int,std::allocator< int > > *)0; - res4 = swig::asptr(swig_obj[3], &ptr); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IntVector___setslice__" "', argument " "4"" of type '" "std::vector< int,std::allocator< int > > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "IntVector___setslice__" "', argument " "4"" of type '" "std::vector< int,std::allocator< int > > const &""'"); - } - arg4 = ptr; - } - try { - std_vector_Sl_int_Sg____setslice____SWIG_1(arg1,arg2,arg3,(std::vector< int,std::allocator< int > > const &)*arg4); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res4)) delete arg4; - return resultobj; -fail: - if (SWIG_IsNewObj(res4)) delete arg4; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector___setslice__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[5] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "IntVector___setslice__", 0, 4, argv))) SWIG_fail; - --argc; - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_IntVector___setslice____SWIG_0(self, argc, argv); - } - } - } - } - if (argc == 4) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = swig::asptr(argv[3], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_IntVector___setslice____SWIG_1(self, argc, argv); - } - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'IntVector___setslice__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< int >::__setslice__(std::vector< int >::difference_type,std::vector< int >::difference_type)\n" - " std::vector< int >::__setslice__(std::vector< int >::difference_type,std::vector< int >::difference_type,std::vector< int,std::allocator< int > > const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_IntVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::difference_type arg2 ; - std::vector< int >::difference_type arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "IntVector___delslice__", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___delslice__" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___delslice__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'"); - } - arg2 = static_cast< std::vector< int >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___delslice__" "', argument " "3"" of type '" "std::vector< int >::difference_type""'"); - } - arg3 = static_cast< std::vector< int >::difference_type >(val3); - try { - std_vector_Sl_int_Sg____delslice__(arg1,arg2,arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::difference_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___delitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___delitem__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'"); - } - arg2 = static_cast< std::vector< int >::difference_type >(val2); - try { - std_vector_Sl_int_Sg____delitem____SWIG_0(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::vector< int,std::allocator< int > > *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___getitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - try { - result = (std::vector< int,std::allocator< int > > *)std_vector_Sl_int_Sg____getitem____SWIG_0(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - std::vector< int,std::allocator< int > > *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res3 = SWIG_OLDOBJ ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - { - std::vector< int,std::allocator< int > > *ptr = (std::vector< int,std::allocator< int > > *)0; - res3 = swig::asptr(swig_obj[2], &ptr); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IntVector___setitem__" "', argument " "3"" of type '" "std::vector< int,std::allocator< int > > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "IntVector___setitem__" "', argument " "3"" of type '" "std::vector< int,std::allocator< int > > const &""'"); - } - arg3 = ptr; - } - try { - std_vector_Sl_int_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< int,std::allocator< int > > const &)*arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res3)) delete arg3; - return resultobj; -fail: - if (SWIG_IsNewObj(res3)) delete arg3; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - try { - std_vector_Sl_int_Sg____setitem____SWIG_1(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___delitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - try { - std_vector_Sl_int_Sg____delitem____SWIG_1(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector___delitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "IntVector___delitem__", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - return _wrap_IntVector___delitem____SWIG_1(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_IntVector___delitem____SWIG_0(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'IntVector___delitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< int >::__delitem__(std::vector< int >::difference_type)\n" - " std::vector< int >::__delitem__(PySliceObject *)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_IntVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::difference_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - std::vector< int >::value_type *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___getitem__" "', argument " "1"" of type '" "std::vector< int > const *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___getitem__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'"); - } - arg2 = static_cast< std::vector< int >::difference_type >(val2); - try { - result = (std::vector< int >::value_type *) &std_vector_Sl_int_Sg____getitem____SWIG_1((std::vector< int > const *)arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_From_int(static_cast< int >(*result)); - (void)swig::container_owner<swig::traits<std::vector< int >::value_type>::category>::back_reference(resultobj, swig_obj[0]); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector___getitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "IntVector___getitem__", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - return _wrap_IntVector___getitem____SWIG_0(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_IntVector___getitem____SWIG_1(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'IntVector___getitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< int >::__getitem__(PySliceObject *)\n" - " std::vector< int >::__getitem__(std::vector< int >::difference_type) const\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_IntVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::difference_type arg2 ; - std::vector< int >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - std::vector< int >::value_type temp3 ; - int val3 ; - int ecode3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector___setitem__" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector___setitem__" "', argument " "2"" of type '" "std::vector< int >::difference_type""'"); - } - arg2 = static_cast< std::vector< int >::difference_type >(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector___setitem__" "', argument " "3"" of type '" "std::vector< int >::value_type""'"); - } - temp3 = static_cast< std::vector< int >::value_type >(val3); - arg3 = &temp3; - try { - std_vector_Sl_int_Sg____setitem____SWIG_2(arg1,arg2,(int const &)*arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector___setitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "IntVector___setitem__", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - return _wrap_IntVector___setitem____SWIG_1(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - int res = swig::asptr(argv[2], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_IntVector___setitem____SWIG_0(self, argc, argv); - } - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_IntVector___setitem____SWIG_2(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'IntVector___setitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< int >::__setitem__(PySliceObject *,std::vector< int,std::allocator< int > > const &)\n" - " std::vector< int >::__setitem__(PySliceObject *)\n" - " std::vector< int >::__setitem__(std::vector< int >::difference_type,std::vector< int >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_IntVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< int >::value_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_pop" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - try { - result = (std::vector< int >::value_type)std_vector_Sl_int_Sg__pop(arg1); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::value_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::vector< int >::value_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "IntVector_append", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_append" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_append" "', argument " "2"" of type '" "std::vector< int >::value_type""'"); - } - temp2 = static_cast< std::vector< int >::value_type >(val2); - arg2 = &temp2; - std_vector_Sl_int_Sg__append(arg1,(int const &)*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_IntVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { - PyObject *resultobj = 0; - std::vector< int > *result = 0 ; - - if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; - result = (std::vector< int > *)new std::vector< int >(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_IntVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = 0 ; - int res1 = SWIG_OLDOBJ ; - std::vector< int > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - { - std::vector< int,std::allocator< int > > *ptr = (std::vector< int,std::allocator< int > > *)0; - res1 = swig::asptr(swig_obj[0], &ptr); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector< int > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector< int > const &""'"); - } - arg1 = ptr; - } - result = (std::vector< int > *)new std::vector< int >((std::vector< int > const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_NEW | 0 ); - if (SWIG_IsNewObj(res1)) delete arg1; - return resultobj; -fail: - if (SWIG_IsNewObj(res1)) delete arg1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_empty" "', argument " "1"" of type '" "std::vector< int > const *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - result = (bool)((std::vector< int > const *)arg1)->empty(); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< int >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_size" "', argument " "1"" of type '" "std::vector< int > const *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - result = ((std::vector< int > const *)arg1)->size(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int > *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "IntVector_swap", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_swap" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IntVector_swap" "', argument " "2"" of type '" "std::vector< int > &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "IntVector_swap" "', argument " "2"" of type '" "std::vector< int > &""'"); - } - arg2 = reinterpret_cast< std::vector< int > * >(argp2); - (arg1)->swap(*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< int >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_begin" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - result = (arg1)->begin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< int >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_end" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - result = (arg1)->end(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< int >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_rbegin" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - result = (arg1)->rbegin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< int >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_rend" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - result = (arg1)->rend(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_clear" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - (arg1)->clear(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - SwigValueWrapper< std::allocator< int > > result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_get_allocator" "', argument " "1"" of type '" "std::vector< int > const *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - result = ((std::vector< int > const *)arg1)->get_allocator(); - resultobj = SWIG_NewPointerObj((new std::vector< int >::allocator_type(static_cast< const std::vector< int >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_int_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_IntVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int >::size_type arg1 ; - size_t val1 ; - int ecode1 = 0 ; - std::vector< int > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector< int >::size_type""'"); - } - arg1 = static_cast< std::vector< int >::size_type >(val1); - result = (std::vector< int > *)new std::vector< int >(arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_pop_back" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - (arg1)->pop_back(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::size_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_resize" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_resize" "', argument " "2"" of type '" "std::vector< int >::size_type""'"); - } - arg2 = static_cast< std::vector< int >::size_type >(val2); - (arg1)->resize(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::iterator arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - std::vector< int >::iterator result; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_erase" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); - } - } - result = std_vector_Sl_int_Sg__erase__SWIG_0(arg1,arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::iterator arg2 ; - std::vector< int >::iterator arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - swig::SwigPyIterator *iter3 = 0 ; - int res3 ; - std::vector< int >::iterator result; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_erase" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); - } - } - res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res3) || !iter3) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "3"" of type '" "std::vector< int >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter3); - if (iter_t) { - arg3 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_erase" "', argument " "3"" of type '" "std::vector< int >::iterator""'"); - } - } - result = std_vector_Sl_int_Sg__erase__SWIG_1(arg1,arg2,arg3); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_erase(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "IntVector_erase", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_IntVector_erase__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter) != 0)); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_IntVector_erase__SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'IntVector_erase'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< int >::erase(std::vector< int >::iterator)\n" - " std::vector< int >::erase(std::vector< int >::iterator,std::vector< int >::iterator)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_new_IntVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int >::size_type arg1 ; - std::vector< int >::value_type *arg2 = 0 ; - size_t val1 ; - int ecode1 = 0 ; - std::vector< int >::value_type temp2 ; - int val2 ; - int ecode2 = 0 ; - std::vector< int > *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_IntVector" "', argument " "1"" of type '" "std::vector< int >::size_type""'"); - } - arg1 = static_cast< std::vector< int >::size_type >(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_IntVector" "', argument " "2"" of type '" "std::vector< int >::value_type""'"); - } - temp2 = static_cast< std::vector< int >::value_type >(val2); - arg2 = &temp2; - result = (std::vector< int > *)new std::vector< int >(arg1,(std::vector< int >::value_type const &)*arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_IntVector(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "new_IntVector", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 0) { - return _wrap_new_IntVector__SWIG_0(self, argc, argv); - } - if (argc == 1) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_IntVector__SWIG_2(self, argc, argv); - } - } - if (argc == 1) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_IntVector__SWIG_1(self, argc, argv); - } - } - if (argc == 2) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_IntVector__SWIG_3(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_IntVector'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< int >::vector()\n" - " std::vector< int >::vector(std::vector< int > const &)\n" - " std::vector< int >::vector(std::vector< int >::size_type)\n" - " std::vector< int >::vector(std::vector< int >::size_type,std::vector< int >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_IntVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::value_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::vector< int >::value_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "IntVector_push_back", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_push_back" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_push_back" "', argument " "2"" of type '" "std::vector< int >::value_type""'"); - } - temp2 = static_cast< std::vector< int >::value_type >(val2); - arg2 = &temp2; - (arg1)->push_back((std::vector< int >::value_type const &)*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< int >::value_type *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_front" "', argument " "1"" of type '" "std::vector< int > const *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - result = (std::vector< int >::value_type *) &((std::vector< int > const *)arg1)->front(); - resultobj = SWIG_From_int(static_cast< int >(*result)); - (void)swig::container_owner<swig::traits<std::vector< int >::value_type>::category>::back_reference(resultobj, swig_obj[0]); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< int >::value_type *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_back" "', argument " "1"" of type '" "std::vector< int > const *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - result = (std::vector< int >::value_type *) &((std::vector< int > const *)arg1)->back(); - resultobj = SWIG_From_int(static_cast< int >(*result)); - (void)swig::container_owner<swig::traits<std::vector< int >::value_type>::category>::back_reference(resultobj, swig_obj[0]); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::size_type arg2 ; - std::vector< int >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - std::vector< int >::value_type temp3 ; - int val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "IntVector_assign", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_assign" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_assign" "', argument " "2"" of type '" "std::vector< int >::size_type""'"); - } - arg2 = static_cast< std::vector< int >::size_type >(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_assign" "', argument " "3"" of type '" "std::vector< int >::value_type""'"); - } - temp3 = static_cast< std::vector< int >::value_type >(val3); - arg3 = &temp3; - (arg1)->assign(arg2,(std::vector< int >::value_type const &)*arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::size_type arg2 ; - std::vector< int >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - std::vector< int >::value_type temp3 ; - int val3 ; - int ecode3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_resize" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_resize" "', argument " "2"" of type '" "std::vector< int >::size_type""'"); - } - arg2 = static_cast< std::vector< int >::size_type >(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_resize" "', argument " "3"" of type '" "std::vector< int >::value_type""'"); - } - temp3 = static_cast< std::vector< int >::value_type >(val3); - arg3 = &temp3; - (arg1)->resize(arg2,(std::vector< int >::value_type const &)*arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_resize(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "IntVector_resize", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_IntVector_resize__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_IntVector_resize__SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'IntVector_resize'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< int >::resize(std::vector< int >::size_type)\n" - " std::vector< int >::resize(std::vector< int >::size_type,std::vector< int >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_IntVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::iterator arg2 ; - std::vector< int >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - std::vector< int >::value_type temp3 ; - int val3 ; - int ecode3 = 0 ; - std::vector< int >::iterator result; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_insert" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); - } - } - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_insert" "', argument " "3"" of type '" "std::vector< int >::value_type""'"); - } - temp3 = static_cast< std::vector< int >::value_type >(val3); - arg3 = &temp3; - result = std_vector_Sl_int_Sg__insert__SWIG_0(arg1,arg2,(int const &)*arg3); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< int >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::iterator arg2 ; - std::vector< int >::size_type arg3 ; - std::vector< int >::value_type *arg4 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - size_t val3 ; - int ecode3 = 0 ; - std::vector< int >::value_type temp4 ; - int val4 ; - int ecode4 = 0 ; - - if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_insert" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< int >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "IntVector_insert" "', argument " "2"" of type '" "std::vector< int >::iterator""'"); - } - } - ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "IntVector_insert" "', argument " "3"" of type '" "std::vector< int >::size_type""'"); - } - arg3 = static_cast< std::vector< int >::size_type >(val3); - ecode4 = SWIG_AsVal_int(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "IntVector_insert" "', argument " "4"" of type '" "std::vector< int >::value_type""'"); - } - temp4 = static_cast< std::vector< int >::value_type >(val4); - arg4 = &temp4; - std_vector_Sl_int_Sg__insert__SWIG_1(arg1,arg2,arg3,(int const &)*arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_insert(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[5] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "IntVector_insert", 0, 4, argv))) SWIG_fail; - --argc; - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter) != 0)); - if (_v) { - { - int res = SWIG_AsVal_int(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_IntVector_insert__SWIG_0(self, argc, argv); - } - } - } - } - if (argc == 4) { - int _v; - int res = swig::asptr(argv[0], (std::vector< int,std::allocator< int > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< int >::iterator > *>(iter) != 0)); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[3], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_IntVector_insert__SWIG_1(self, argc, argv); - } - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'IntVector_insert'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< int >::insert(std::vector< int >::iterator,std::vector< int >::value_type const &)\n" - " std::vector< int >::insert(std::vector< int >::iterator,std::vector< int >::size_type,std::vector< int >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_IntVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - std::vector< int >::size_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "IntVector_reserve", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_reserve" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "IntVector_reserve" "', argument " "2"" of type '" "std::vector< int >::size_type""'"); - } - arg2 = static_cast< std::vector< int >::size_type >(val2); - (arg1)->reserve(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_IntVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< int >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IntVector_capacity" "', argument " "1"" of type '" "std::vector< int > const *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - result = ((std::vector< int > const *)arg1)->capacity(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_IntVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< int > *arg1 = (std::vector< int > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IntVector" "', argument " "1"" of type '" "std::vector< int > *""'"); - } - arg1 = reinterpret_cast< std::vector< int > * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *IntVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *IntVector_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_DoubleVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_iterator" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - result = (swig::SwigPyIterator *)std_vector_Sl_double_Sg__iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___nonzero__" "', argument " "1"" of type '" "std::vector< double > const *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - result = (bool)std_vector_Sl_double_Sg____nonzero__((std::vector< double > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___bool__" "', argument " "1"" of type '" "std::vector< double > const *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - result = (bool)std_vector_Sl_double_Sg____bool__((std::vector< double > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___len__" "', argument " "1"" of type '" "std::vector< double > const *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - result = std_vector_Sl_double_Sg____len__((std::vector< double > const *)arg1); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::difference_type arg2 ; - std::vector< double >::difference_type arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - std::vector< double,std::allocator< double > > *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "DoubleVector___getslice__", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___getslice__" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___getslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'"); - } - arg2 = static_cast< std::vector< double >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___getslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'"); - } - arg3 = static_cast< std::vector< double >::difference_type >(val3); - try { - result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg____getslice__(arg1,arg2,arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::difference_type arg2 ; - std::vector< double >::difference_type arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setslice__" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___setslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'"); - } - arg2 = static_cast< std::vector< double >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___setslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'"); - } - arg3 = static_cast< std::vector< double >::difference_type >(val3); - try { - std_vector_Sl_double_Sg____setslice____SWIG_0(arg1,arg2,arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::difference_type arg2 ; - std::vector< double >::difference_type arg3 ; - std::vector< double,std::allocator< double > > *arg4 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - int res4 = SWIG_OLDOBJ ; - - if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setslice__" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___setslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'"); - } - arg2 = static_cast< std::vector< double >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___setslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'"); - } - arg3 = static_cast< std::vector< double >::difference_type >(val3); - { - std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; - res4 = swig::asptr(swig_obj[3], &ptr); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DoubleVector___setslice__" "', argument " "4"" of type '" "std::vector< double,std::allocator< double > > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleVector___setslice__" "', argument " "4"" of type '" "std::vector< double,std::allocator< double > > const &""'"); - } - arg4 = ptr; - } - try { - std_vector_Sl_double_Sg____setslice____SWIG_1(arg1,arg2,arg3,(std::vector< double,std::allocator< double > > const &)*arg4); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res4)) delete arg4; - return resultobj; -fail: - if (SWIG_IsNewObj(res4)) delete arg4; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___setslice__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[5] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleVector___setslice__", 0, 4, argv))) SWIG_fail; - --argc; - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_DoubleVector___setslice____SWIG_0(self, argc, argv); - } - } - } - } - if (argc == 4) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = swig::asptr(argv[3], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_DoubleVector___setslice____SWIG_1(self, argc, argv); - } - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleVector___setslice__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< double >::__setslice__(std::vector< double >::difference_type,std::vector< double >::difference_type)\n" - " std::vector< double >::__setslice__(std::vector< double >::difference_type,std::vector< double >::difference_type,std::vector< double,std::allocator< double > > const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::difference_type arg2 ; - std::vector< double >::difference_type arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "DoubleVector___delslice__", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___delslice__" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___delslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'"); - } - arg2 = static_cast< std::vector< double >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___delslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'"); - } - arg3 = static_cast< std::vector< double >::difference_type >(val3); - try { - std_vector_Sl_double_Sg____delslice__(arg1,arg2,arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::difference_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___delitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___delitem__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'"); - } - arg2 = static_cast< std::vector< double >::difference_type >(val2); - try { - std_vector_Sl_double_Sg____delitem____SWIG_0(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::vector< double,std::allocator< double > > *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___getitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - try { - result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg____getitem____SWIG_0(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - std::vector< double,std::allocator< double > > *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res3 = SWIG_OLDOBJ ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - { - std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; - res3 = swig::asptr(swig_obj[2], &ptr); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< double,std::allocator< double > > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< double,std::allocator< double > > const &""'"); - } - arg3 = ptr; - } - try { - std_vector_Sl_double_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< double,std::allocator< double > > const &)*arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res3)) delete arg3; - return resultobj; -fail: - if (SWIG_IsNewObj(res3)) delete arg3; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - try { - std_vector_Sl_double_Sg____setitem____SWIG_1(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___delitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - try { - std_vector_Sl_double_Sg____delitem____SWIG_1(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___delitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleVector___delitem__", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - return _wrap_DoubleVector___delitem____SWIG_1(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_DoubleVector___delitem____SWIG_0(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleVector___delitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< double >::__delitem__(std::vector< double >::difference_type)\n" - " std::vector< double >::__delitem__(PySliceObject *)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::difference_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - std::vector< double >::value_type *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___getitem__" "', argument " "1"" of type '" "std::vector< double > const *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___getitem__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'"); - } - arg2 = static_cast< std::vector< double >::difference_type >(val2); - try { - result = (std::vector< double >::value_type *) &std_vector_Sl_double_Sg____getitem____SWIG_1((std::vector< double > const *)arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_From_double(static_cast< double >(*result)); - (void)swig::container_owner<swig::traits<std::vector< double >::value_type>::category>::back_reference(resultobj, swig_obj[0]); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___getitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleVector___getitem__", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - return _wrap_DoubleVector___getitem____SWIG_0(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_DoubleVector___getitem____SWIG_1(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleVector___getitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< double >::__getitem__(PySliceObject *)\n" - " std::vector< double >::__getitem__(std::vector< double >::difference_type) const\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::difference_type arg2 ; - std::vector< double >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - std::vector< double >::value_type temp3 ; - double val3 ; - int ecode3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector___setitem__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'"); - } - arg2 = static_cast< std::vector< double >::difference_type >(val2); - ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< double >::value_type""'"); - } - temp3 = static_cast< std::vector< double >::value_type >(val3); - arg3 = &temp3; - try { - std_vector_Sl_double_Sg____setitem____SWIG_2(arg1,arg2,(double const &)*arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector___setitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleVector___setitem__", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - return _wrap_DoubleVector___setitem____SWIG_1(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - int res = swig::asptr(argv[2], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_DoubleVector___setitem____SWIG_0(self, argc, argv); - } - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_double(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_DoubleVector___setitem____SWIG_2(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleVector___setitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< double >::__setitem__(PySliceObject *,std::vector< double,std::allocator< double > > const &)\n" - " std::vector< double >::__setitem__(PySliceObject *)\n" - " std::vector< double >::__setitem__(std::vector< double >::difference_type,std::vector< double >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double >::value_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_pop" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - try { - result = (std::vector< double >::value_type)std_vector_Sl_double_Sg__pop(arg1); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_From_double(static_cast< double >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::value_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::vector< double >::value_type temp2 ; - double val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "DoubleVector_append", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_append" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_append" "', argument " "2"" of type '" "std::vector< double >::value_type""'"); - } - temp2 = static_cast< std::vector< double >::value_type >(val2); - arg2 = &temp2; - std_vector_Sl_double_Sg__append(arg1,(double const &)*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_DoubleVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { - PyObject *resultobj = 0; - std::vector< double > *result = 0 ; - - if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; - result = (std::vector< double > *)new std::vector< double >(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_DoubleVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = 0 ; - int res1 = SWIG_OLDOBJ ; - std::vector< double > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - { - std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; - res1 = swig::asptr(swig_obj[0], &ptr); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector< double > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector< double > const &""'"); - } - arg1 = ptr; - } - result = (std::vector< double > *)new std::vector< double >((std::vector< double > const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW | 0 ); - if (SWIG_IsNewObj(res1)) delete arg1; - return resultobj; -fail: - if (SWIG_IsNewObj(res1)) delete arg1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_empty" "', argument " "1"" of type '" "std::vector< double > const *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - result = (bool)((std::vector< double > const *)arg1)->empty(); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_size" "', argument " "1"" of type '" "std::vector< double > const *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - result = ((std::vector< double > const *)arg1)->size(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double > *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "DoubleVector_swap", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_swap" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleVector_swap" "', argument " "2"" of type '" "std::vector< double > &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleVector_swap" "', argument " "2"" of type '" "std::vector< double > &""'"); - } - arg2 = reinterpret_cast< std::vector< double > * >(argp2); - (arg1)->swap(*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_begin" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - result = (arg1)->begin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_end" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - result = (arg1)->end(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_rbegin" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - result = (arg1)->rbegin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_rend" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - result = (arg1)->rend(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_clear" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - (arg1)->clear(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - SwigValueWrapper< std::allocator< double > > result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_get_allocator" "', argument " "1"" of type '" "std::vector< double > const *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - result = ((std::vector< double > const *)arg1)->get_allocator(); - resultobj = SWIG_NewPointerObj((new std::vector< double >::allocator_type(static_cast< const std::vector< double >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_double_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_DoubleVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double >::size_type arg1 ; - size_t val1 ; - int ecode1 = 0 ; - std::vector< double > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector< double >::size_type""'"); - } - arg1 = static_cast< std::vector< double >::size_type >(val1); - result = (std::vector< double > *)new std::vector< double >(arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_pop_back" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - (arg1)->pop_back(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::size_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_resize" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_resize" "', argument " "2"" of type '" "std::vector< double >::size_type""'"); - } - arg2 = static_cast< std::vector< double >::size_type >(val2); - (arg1)->resize(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::iterator arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - std::vector< double >::iterator result; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_erase" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); - } - } - result = std_vector_Sl_double_Sg__erase__SWIG_0(arg1,arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::iterator arg2 ; - std::vector< double >::iterator arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - swig::SwigPyIterator *iter3 = 0 ; - int res3 ; - std::vector< double >::iterator result; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_erase" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); - } - } - res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res3) || !iter3) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "3"" of type '" "std::vector< double >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter3); - if (iter_t) { - arg3 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_erase" "', argument " "3"" of type '" "std::vector< double >::iterator""'"); - } - } - result = std_vector_Sl_double_Sg__erase__SWIG_1(arg1,arg2,arg3); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_erase(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleVector_erase", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_DoubleVector_erase__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter) != 0)); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_DoubleVector_erase__SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleVector_erase'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< double >::erase(std::vector< double >::iterator)\n" - " std::vector< double >::erase(std::vector< double >::iterator,std::vector< double >::iterator)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_new_DoubleVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double >::size_type arg1 ; - std::vector< double >::value_type *arg2 = 0 ; - size_t val1 ; - int ecode1 = 0 ; - std::vector< double >::value_type temp2 ; - double val2 ; - int ecode2 = 0 ; - std::vector< double > *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleVector" "', argument " "1"" of type '" "std::vector< double >::size_type""'"); - } - arg1 = static_cast< std::vector< double >::size_type >(val1); - ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_DoubleVector" "', argument " "2"" of type '" "std::vector< double >::value_type""'"); - } - temp2 = static_cast< std::vector< double >::value_type >(val2); - arg2 = &temp2; - result = (std::vector< double > *)new std::vector< double >(arg1,(std::vector< double >::value_type const &)*arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_DoubleVector(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "new_DoubleVector", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 0) { - return _wrap_new_DoubleVector__SWIG_0(self, argc, argv); - } - if (argc == 1) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_DoubleVector__SWIG_2(self, argc, argv); - } - } - if (argc == 1) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_DoubleVector__SWIG_1(self, argc, argv); - } - } - if (argc == 2) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_double(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_DoubleVector__SWIG_3(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_DoubleVector'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< double >::vector()\n" - " std::vector< double >::vector(std::vector< double > const &)\n" - " std::vector< double >::vector(std::vector< double >::size_type)\n" - " std::vector< double >::vector(std::vector< double >::size_type,std::vector< double >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::value_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::vector< double >::value_type temp2 ; - double val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "DoubleVector_push_back", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_push_back" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_push_back" "', argument " "2"" of type '" "std::vector< double >::value_type""'"); - } - temp2 = static_cast< std::vector< double >::value_type >(val2); - arg2 = &temp2; - (arg1)->push_back((std::vector< double >::value_type const &)*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double >::value_type *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_front" "', argument " "1"" of type '" "std::vector< double > const *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - result = (std::vector< double >::value_type *) &((std::vector< double > const *)arg1)->front(); - resultobj = SWIG_From_double(static_cast< double >(*result)); - (void)swig::container_owner<swig::traits<std::vector< double >::value_type>::category>::back_reference(resultobj, swig_obj[0]); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double >::value_type *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_back" "', argument " "1"" of type '" "std::vector< double > const *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - result = (std::vector< double >::value_type *) &((std::vector< double > const *)arg1)->back(); - resultobj = SWIG_From_double(static_cast< double >(*result)); - (void)swig::container_owner<swig::traits<std::vector< double >::value_type>::category>::back_reference(resultobj, swig_obj[0]); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::size_type arg2 ; - std::vector< double >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - std::vector< double >::value_type temp3 ; - double val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "DoubleVector_assign", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_assign" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_assign" "', argument " "2"" of type '" "std::vector< double >::size_type""'"); - } - arg2 = static_cast< std::vector< double >::size_type >(val2); - ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_assign" "', argument " "3"" of type '" "std::vector< double >::value_type""'"); - } - temp3 = static_cast< std::vector< double >::value_type >(val3); - arg3 = &temp3; - (arg1)->assign(arg2,(std::vector< double >::value_type const &)*arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::size_type arg2 ; - std::vector< double >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - std::vector< double >::value_type temp3 ; - double val3 ; - int ecode3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_resize" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_resize" "', argument " "2"" of type '" "std::vector< double >::size_type""'"); - } - arg2 = static_cast< std::vector< double >::size_type >(val2); - ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_resize" "', argument " "3"" of type '" "std::vector< double >::value_type""'"); - } - temp3 = static_cast< std::vector< double >::value_type >(val3); - arg3 = &temp3; - (arg1)->resize(arg2,(std::vector< double >::value_type const &)*arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_resize(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleVector_resize", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_DoubleVector_resize__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_double(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_DoubleVector_resize__SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleVector_resize'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< double >::resize(std::vector< double >::size_type)\n" - " std::vector< double >::resize(std::vector< double >::size_type,std::vector< double >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::iterator arg2 ; - std::vector< double >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - std::vector< double >::value_type temp3 ; - double val3 ; - int ecode3 = 0 ; - std::vector< double >::iterator result; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_insert" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); - } - } - ecode3 = SWIG_AsVal_double(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_insert" "', argument " "3"" of type '" "std::vector< double >::value_type""'"); - } - temp3 = static_cast< std::vector< double >::value_type >(val3); - arg3 = &temp3; - result = std_vector_Sl_double_Sg__insert__SWIG_0(arg1,arg2,(double const &)*arg3); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::iterator arg2 ; - std::vector< double >::size_type arg3 ; - std::vector< double >::value_type *arg4 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - size_t val3 ; - int ecode3 = 0 ; - std::vector< double >::value_type temp4 ; - double val4 ; - int ecode4 = 0 ; - - if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_insert" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< double >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleVector_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'"); - } - } - ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleVector_insert" "', argument " "3"" of type '" "std::vector< double >::size_type""'"); - } - arg3 = static_cast< std::vector< double >::size_type >(val3); - ecode4 = SWIG_AsVal_double(swig_obj[3], &val4); - if (!SWIG_IsOK(ecode4)) { - SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "DoubleVector_insert" "', argument " "4"" of type '" "std::vector< double >::value_type""'"); - } - temp4 = static_cast< std::vector< double >::value_type >(val4); - arg4 = &temp4; - std_vector_Sl_double_Sg__insert__SWIG_1(arg1,arg2,arg3,(double const &)*arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_insert(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[5] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleVector_insert", 0, 4, argv))) SWIG_fail; - --argc; - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter) != 0)); - if (_v) { - { - int res = SWIG_AsVal_double(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_DoubleVector_insert__SWIG_0(self, argc, argv); - } - } - } - } - if (argc == 4) { - int _v; - int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< double >::iterator > *>(iter) != 0)); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_double(argv[3], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_DoubleVector_insert__SWIG_1(self, argc, argv); - } - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleVector_insert'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< double >::insert(std::vector< double >::iterator,std::vector< double >::value_type const &)\n" - " std::vector< double >::insert(std::vector< double >::iterator,std::vector< double >::size_type,std::vector< double >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - std::vector< double >::size_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "DoubleVector_reserve", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_reserve" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleVector_reserve" "', argument " "2"" of type '" "std::vector< double >::size_type""'"); - } - arg2 = static_cast< std::vector< double >::size_type >(val2); - (arg1)->reserve(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleVector_capacity" "', argument " "1"" of type '" "std::vector< double > const *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - result = ((std::vector< double > const *)arg1)->capacity(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_DoubleVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< double > *arg1 = (std::vector< double > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DoubleVector" "', argument " "1"" of type '" "std::vector< double > *""'"); - } - arg1 = reinterpret_cast< std::vector< double > * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *DoubleVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *DoubleVector_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_iterator" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - result = (swig::SwigPyIterator *)std_vector_Sl_std_vector_Sl_double_Sg__Sg__iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___nonzero__" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - result = (bool)std_vector_Sl_std_vector_Sl_double_Sg__Sg____nonzero__((std::vector< std::vector< double > > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___bool__" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - result = (bool)std_vector_Sl_std_vector_Sl_double_Sg__Sg____bool__((std::vector< std::vector< double > > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::vector< double > >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___len__" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - result = std_vector_Sl_std_vector_Sl_double_Sg__Sg____len__((std::vector< std::vector< double > > const *)arg1); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::difference_type arg2 ; - std::vector< std::vector< double > >::difference_type arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "DoubleDoubleVector___getslice__", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___getslice__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___getslice__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'"); - } - arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector___getslice__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::difference_type""'"); - } - arg3 = static_cast< std::vector< std::vector< double > >::difference_type >(val3); - try { - result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)std_vector_Sl_std_vector_Sl_double_Sg__Sg____getslice__(arg1,arg2,arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::difference_type arg2 ; - std::vector< std::vector< double > >::difference_type arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setslice__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___setslice__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'"); - } - arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector___setslice__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::difference_type""'"); - } - arg3 = static_cast< std::vector< std::vector< double > >::difference_type >(val3); - try { - std_vector_Sl_std_vector_Sl_double_Sg__Sg____setslice____SWIG_0(arg1,arg2,arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::difference_type arg2 ; - std::vector< std::vector< double > >::difference_type arg3 ; - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *arg4 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - int res4 = SWIG_OLDOBJ ; - - if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setslice__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___setslice__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'"); - } - arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector___setslice__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::difference_type""'"); - } - arg3 = static_cast< std::vector< std::vector< double > >::difference_type >(val3); - { - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *ptr = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)0; - res4 = swig::asptr(swig_obj[3], &ptr); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DoubleDoubleVector___setslice__" "', argument " "4"" of type '" "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector___setslice__" "', argument " "4"" of type '" "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &""'"); - } - arg4 = ptr; - } - try { - std_vector_Sl_std_vector_Sl_double_Sg__Sg____setslice____SWIG_1(arg1,arg2,arg3,(std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &)*arg4); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res4)) delete arg4; - return resultobj; -fail: - if (SWIG_IsNewObj(res4)) delete arg4; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setslice__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[5] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleDoubleVector___setslice__", 0, 4, argv))) SWIG_fail; - --argc; - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_DoubleDoubleVector___setslice____SWIG_0(self, argc, argv); - } - } - } - } - if (argc == 4) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = swig::asptr(argv[3], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_DoubleDoubleVector___setslice____SWIG_1(self, argc, argv); - } - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleDoubleVector___setslice__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::vector< double > >::__setslice__(std::vector< std::vector< double > >::difference_type,std::vector< std::vector< double > >::difference_type)\n" - " std::vector< std::vector< double > >::__setslice__(std::vector< std::vector< double > >::difference_type,std::vector< std::vector< double > >::difference_type,std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::difference_type arg2 ; - std::vector< std::vector< double > >::difference_type arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "DoubleDoubleVector___delslice__", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___delslice__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___delslice__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'"); - } - arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector___delslice__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::difference_type""'"); - } - arg3 = static_cast< std::vector< std::vector< double > >::difference_type >(val3); - try { - std_vector_Sl_std_vector_Sl_double_Sg__Sg____delslice__(arg1,arg2,arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::difference_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___delitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___delitem__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'"); - } - arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); - try { - std_vector_Sl_std_vector_Sl_double_Sg__Sg____delitem____SWIG_0(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___getitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - try { - result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_0(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res3 = SWIG_OLDOBJ ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - { - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *ptr = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)0; - res3 = swig::asptr(swig_obj[2], &ptr); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &""'"); - } - arg3 = ptr; - } - try { - std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_0(arg1,arg2,(std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &)*arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res3)) delete arg3; - return resultobj; -fail: - if (SWIG_IsNewObj(res3)) delete arg3; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - try { - std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_1(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___delitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - try { - std_vector_Sl_std_vector_Sl_double_Sg__Sg____delitem____SWIG_1(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___delitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleDoubleVector___delitem__", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - return _wrap_DoubleDoubleVector___delitem____SWIG_1(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_DoubleDoubleVector___delitem____SWIG_0(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleDoubleVector___delitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::vector< double > >::__delitem__(std::vector< std::vector< double > >::difference_type)\n" - " std::vector< std::vector< double > >::__delitem__(PySliceObject *)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::difference_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - std::vector< std::vector< double > >::value_type *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___getitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___getitem__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'"); - } - arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); - try { - result = (std::vector< std::vector< double > >::value_type *) &std_vector_Sl_std_vector_Sl_double_Sg__Sg____getitem____SWIG_1((std::vector< std::vector< double > > const *)arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = swig::from(static_cast< std::vector< double,std::allocator< double > > >(*result)); - (void)swig::container_owner<swig::traits<std::vector< std::vector< double > >::value_type>::category>::back_reference(resultobj, swig_obj[0]); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___getitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleDoubleVector___getitem__", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - return _wrap_DoubleDoubleVector___getitem____SWIG_0(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_DoubleDoubleVector___getitem____SWIG_1(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleDoubleVector___getitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::vector< double > >::__getitem__(PySliceObject *)\n" - " std::vector< std::vector< double > >::__getitem__(std::vector< std::vector< double > >::difference_type) const\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::difference_type arg2 ; - std::vector< std::vector< double > >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - int res3 = SWIG_OLDOBJ ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector___setitem__" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector___setitem__" "', argument " "2"" of type '" "std::vector< std::vector< double > >::difference_type""'"); - } - arg2 = static_cast< std::vector< std::vector< double > >::difference_type >(val2); - { - std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; - res3 = swig::asptr(swig_obj[2], &ptr); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector___setitem__" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - arg3 = ptr; - } - try { - std_vector_Sl_std_vector_Sl_double_Sg__Sg____setitem____SWIG_2(arg1,arg2,(std::vector< double,std::allocator< double > > const &)*arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res3)) delete arg3; - return resultobj; -fail: - if (SWIG_IsNewObj(res3)) delete arg3; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector___setitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleDoubleVector___setitem__", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - return _wrap_DoubleDoubleVector___setitem____SWIG_1(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - int res = swig::asptr(argv[2], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_DoubleDoubleVector___setitem____SWIG_0(self, argc, argv); - } - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = swig::asptr(argv[2], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_DoubleDoubleVector___setitem____SWIG_2(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleDoubleVector___setitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::vector< double > >::__setitem__(PySliceObject *,std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > const &)\n" - " std::vector< std::vector< double > >::__setitem__(PySliceObject *)\n" - " std::vector< std::vector< double > >::__setitem__(std::vector< std::vector< double > >::difference_type,std::vector< std::vector< double > >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::vector< double > >::value_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_pop" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - try { - result = std_vector_Sl_std_vector_Sl_double_Sg__Sg__pop(arg1); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = swig::from(static_cast< std::vector< double,std::allocator< double > > >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::value_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_append", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_append" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - { - std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; - res2 = swig::asptr(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleDoubleVector_append" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_append" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - arg2 = ptr; - } - std_vector_Sl_std_vector_Sl_double_Sg__Sg__append(arg1,(std::vector< double,std::allocator< double > > const &)*arg2); - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *result = 0 ; - - if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; - result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double,std::allocator< double > > > *arg1 = 0 ; - int res1 = SWIG_OLDOBJ ; - std::vector< std::vector< double > > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - { - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *ptr = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)0; - res1 = swig::asptr(swig_obj[0], &ptr); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector< std::vector< double,std::allocator< double > > > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector< std::vector< double,std::allocator< double > > > const &""'"); - } - arg1 = ptr; - } - result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >((std::vector< std::vector< double,std::allocator< double > > > const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_NEW | 0 ); - if (SWIG_IsNewObj(res1)) delete arg1; - return resultobj; -fail: - if (SWIG_IsNewObj(res1)) delete arg1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_empty" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - result = (bool)((std::vector< std::vector< double > > const *)arg1)->empty(); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::vector< double > >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_size" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - result = ((std::vector< std::vector< double > > const *)arg1)->size(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double,std::allocator< double > > > *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_swap", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_swap" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleDoubleVector_swap" "', argument " "2"" of type '" "std::vector< std::vector< double,std::allocator< double > > > &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_swap" "', argument " "2"" of type '" "std::vector< std::vector< double,std::allocator< double > > > &""'"); - } - arg2 = reinterpret_cast< std::vector< std::vector< double,std::allocator< double > > > * >(argp2); - (arg1)->swap(*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::vector< double > >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_begin" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - result = (arg1)->begin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::vector< double > >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_end" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - result = (arg1)->end(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::vector< double > >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_rbegin" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - result = (arg1)->rbegin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::vector< double > >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_rend" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - result = (arg1)->rend(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_clear" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - (arg1)->clear(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - SwigValueWrapper< std::allocator< std::vector< double,std::allocator< double > > > > result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_get_allocator" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - result = ((std::vector< std::vector< double > > const *)arg1)->get_allocator(); - resultobj = SWIG_NewPointerObj((new std::vector< std::vector< double > >::allocator_type(static_cast< const std::vector< std::vector< double > >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > >::size_type arg1 ; - size_t val1 ; - int ecode1 = 0 ; - std::vector< std::vector< double > > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector< std::vector< double > >::size_type""'"); - } - arg1 = static_cast< std::vector< std::vector< double > >::size_type >(val1); - result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >(arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_pop_back" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - (arg1)->pop_back(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::size_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_resize" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_resize" "', argument " "2"" of type '" "std::vector< std::vector< double > >::size_type""'"); - } - arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2); - (arg1)->resize(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::iterator arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - std::vector< std::vector< double > >::iterator result; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_erase" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); - } - } - result = std_vector_Sl_std_vector_Sl_double_Sg__Sg__erase__SWIG_0(arg1,arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::iterator arg2 ; - std::vector< std::vector< double > >::iterator arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - swig::SwigPyIterator *iter3 = 0 ; - int res3 ; - std::vector< std::vector< double > >::iterator result; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_erase" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); - } - } - res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res3) || !iter3) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "3"" of type '" "std::vector< std::vector< double > >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter3); - if (iter_t) { - arg3 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_erase" "', argument " "3"" of type '" "std::vector< std::vector< double > >::iterator""'"); - } - } - result = std_vector_Sl_std_vector_Sl_double_Sg__Sg__erase__SWIG_1(arg1,arg2,arg3); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_erase(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_erase", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_DoubleDoubleVector_erase__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0)); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_DoubleDoubleVector_erase__SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleDoubleVector_erase'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::vector< double > >::erase(std::vector< std::vector< double > >::iterator)\n" - " std::vector< std::vector< double > >::erase(std::vector< std::vector< double > >::iterator,std::vector< std::vector< double > >::iterator)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > >::size_type arg1 ; - std::vector< std::vector< double > >::value_type *arg2 = 0 ; - size_t val1 ; - int ecode1 = 0 ; - int res2 = SWIG_OLDOBJ ; - std::vector< std::vector< double > > *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector< std::vector< double > >::size_type""'"); - } - arg1 = static_cast< std::vector< std::vector< double > >::size_type >(val1); - { - std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; - res2 = swig::asptr(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_DoubleDoubleVector" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DoubleDoubleVector" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - arg2 = ptr; - } - result = (std::vector< std::vector< double > > *)new std::vector< std::vector< double > >(arg1,(std::vector< std::vector< double > >::value_type const &)*arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_NEW | 0 ); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_DoubleDoubleVector(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "new_DoubleDoubleVector", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 0) { - return _wrap_new_DoubleDoubleVector__SWIG_0(self, argc, argv); - } - if (argc == 1) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_DoubleDoubleVector__SWIG_2(self, argc, argv); - } - } - if (argc == 1) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_DoubleDoubleVector__SWIG_1(self, argc, argv); - } - } - if (argc == 2) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = swig::asptr(argv[1], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_DoubleDoubleVector__SWIG_3(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_DoubleDoubleVector'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::vector< double > >::vector()\n" - " std::vector< std::vector< double > >::vector(std::vector< std::vector< double,std::allocator< double > > > const &)\n" - " std::vector< std::vector< double > >::vector(std::vector< std::vector< double > >::size_type)\n" - " std::vector< std::vector< double > >::vector(std::vector< std::vector< double > >::size_type,std::vector< std::vector< double > >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::value_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_push_back", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_push_back" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - { - std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; - res2 = swig::asptr(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DoubleDoubleVector_push_back" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_push_back" "', argument " "2"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - arg2 = ptr; - } - (arg1)->push_back((std::vector< std::vector< double > >::value_type const &)*arg2); - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::vector< double > >::value_type *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_front" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - result = (std::vector< std::vector< double > >::value_type *) &((std::vector< std::vector< double > > const *)arg1)->front(); - resultobj = swig::from(static_cast< std::vector< double,std::allocator< double > > >(*result)); - (void)swig::container_owner<swig::traits<std::vector< std::vector< double > >::value_type>::category>::back_reference(resultobj, swig_obj[0]); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::vector< double > >::value_type *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_back" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - result = (std::vector< std::vector< double > >::value_type *) &((std::vector< std::vector< double > > const *)arg1)->back(); - resultobj = swig::from(static_cast< std::vector< double,std::allocator< double > > >(*result)); - (void)swig::container_owner<swig::traits<std::vector< std::vector< double > >::value_type>::category>::back_reference(resultobj, swig_obj[0]); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::size_type arg2 ; - std::vector< std::vector< double > >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - int res3 = SWIG_OLDOBJ ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_assign", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_assign" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_assign" "', argument " "2"" of type '" "std::vector< std::vector< double > >::size_type""'"); - } - arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2); - { - std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; - res3 = swig::asptr(swig_obj[2], &ptr); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector_assign" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_assign" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - arg3 = ptr; - } - (arg1)->assign(arg2,(std::vector< std::vector< double > >::value_type const &)*arg3); - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res3)) delete arg3; - return resultobj; -fail: - if (SWIG_IsNewObj(res3)) delete arg3; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::size_type arg2 ; - std::vector< std::vector< double > >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - int res3 = SWIG_OLDOBJ ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_resize" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_resize" "', argument " "2"" of type '" "std::vector< std::vector< double > >::size_type""'"); - } - arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2); - { - std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; - res3 = swig::asptr(swig_obj[2], &ptr); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector_resize" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_resize" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - arg3 = ptr; - } - (arg1)->resize(arg2,(std::vector< std::vector< double > >::value_type const &)*arg3); - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res3)) delete arg3; - return resultobj; -fail: - if (SWIG_IsNewObj(res3)) delete arg3; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_resize(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_resize", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_DoubleDoubleVector_resize__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = swig::asptr(argv[2], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_DoubleDoubleVector_resize__SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleDoubleVector_resize'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::vector< double > >::resize(std::vector< std::vector< double > >::size_type)\n" - " std::vector< std::vector< double > >::resize(std::vector< std::vector< double > >::size_type,std::vector< std::vector< double > >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::iterator arg2 ; - std::vector< std::vector< double > >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - int res3 = SWIG_OLDOBJ ; - std::vector< std::vector< double > >::iterator result; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_insert" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); - } - } - { - std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; - res3 = swig::asptr(swig_obj[2], &ptr); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DoubleDoubleVector_insert" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_insert" "', argument " "3"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - arg3 = ptr; - } - result = std_vector_Sl_std_vector_Sl_double_Sg__Sg__insert__SWIG_0(arg1,arg2,(std::vector< double,std::allocator< double > > const &)*arg3); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::vector< double > >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - if (SWIG_IsNewObj(res3)) delete arg3; - return resultobj; -fail: - if (SWIG_IsNewObj(res3)) delete arg3; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::iterator arg2 ; - std::vector< std::vector< double > >::size_type arg3 ; - std::vector< std::vector< double > >::value_type *arg4 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - size_t val3 ; - int ecode3 = 0 ; - int res4 = SWIG_OLDOBJ ; - - if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_insert" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "DoubleDoubleVector_insert" "', argument " "2"" of type '" "std::vector< std::vector< double > >::iterator""'"); - } - } - ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DoubleDoubleVector_insert" "', argument " "3"" of type '" "std::vector< std::vector< double > >::size_type""'"); - } - arg3 = static_cast< std::vector< std::vector< double > >::size_type >(val3); - { - std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0; - res4 = swig::asptr(swig_obj[3], &ptr); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DoubleDoubleVector_insert" "', argument " "4"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DoubleDoubleVector_insert" "', argument " "4"" of type '" "std::vector< std::vector< double > >::value_type const &""'"); - } - arg4 = ptr; - } - std_vector_Sl_std_vector_Sl_double_Sg__Sg__insert__SWIG_1(arg1,arg2,arg3,(std::vector< double,std::allocator< double > > const &)*arg4); - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res4)) delete arg4; - return resultobj; -fail: - if (SWIG_IsNewObj(res4)) delete arg4; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_insert(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[5] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_insert", 0, 4, argv))) SWIG_fail; - --argc; - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0)); - if (_v) { - int res = swig::asptr(argv[2], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_DoubleDoubleVector_insert__SWIG_0(self, argc, argv); - } - } - } - } - if (argc == 4) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::vector< double > >::iterator > *>(iter) != 0)); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = swig::asptr(argv[3], (std::vector< double,std::allocator< double > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_DoubleDoubleVector_insert__SWIG_1(self, argc, argv); - } - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'DoubleDoubleVector_insert'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::vector< double > >::insert(std::vector< std::vector< double > >::iterator,std::vector< std::vector< double > >::value_type const &)\n" - " std::vector< std::vector< double > >::insert(std::vector< std::vector< double > >::iterator,std::vector< std::vector< double > >::size_type,std::vector< std::vector< double > >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - std::vector< std::vector< double > >::size_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "DoubleDoubleVector_reserve", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_reserve" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DoubleDoubleVector_reserve" "', argument " "2"" of type '" "std::vector< std::vector< double > >::size_type""'"); - } - arg2 = static_cast< std::vector< std::vector< double > >::size_type >(val2); - (arg1)->reserve(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_DoubleDoubleVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::vector< double > >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DoubleDoubleVector_capacity" "', argument " "1"" of type '" "std::vector< std::vector< double > > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - result = ((std::vector< std::vector< double > > const *)arg1)->capacity(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_DoubleDoubleVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::vector< double > > *arg1 = (std::vector< std::vector< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DoubleDoubleVector" "', argument " "1"" of type '" "std::vector< std::vector< double > > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::vector< double > > * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *DoubleDoubleVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *DoubleDoubleVector_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_StringVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_iterator" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - result = (swig::SwigPyIterator *)std_vector_Sl_std_string_Sg__iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___nonzero__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - result = (bool)std_vector_Sl_std_string_Sg____nonzero__((std::vector< std::string > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___bool__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - result = (bool)std_vector_Sl_std_string_Sg____bool__((std::vector< std::string > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::string >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___len__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - result = std_vector_Sl_std_string_Sg____len__((std::vector< std::string > const *)arg1); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::difference_type arg2 ; - std::vector< std::string >::difference_type arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - std::vector< std::string,std::allocator< std::string > > *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "StringVector___getslice__", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___getslice__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___getslice__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'"); - } - arg2 = static_cast< std::vector< std::string >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___getslice__" "', argument " "3"" of type '" "std::vector< std::string >::difference_type""'"); - } - arg3 = static_cast< std::vector< std::string >::difference_type >(val3); - try { - result = (std::vector< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_Sg____getslice__(arg1,arg2,arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::difference_type arg2 ; - std::vector< std::string >::difference_type arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setslice__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___setslice__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'"); - } - arg2 = static_cast< std::vector< std::string >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___setslice__" "', argument " "3"" of type '" "std::vector< std::string >::difference_type""'"); - } - arg3 = static_cast< std::vector< std::string >::difference_type >(val3); - try { - std_vector_Sl_std_string_Sg____setslice____SWIG_0(arg1,arg2,arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::difference_type arg2 ; - std::vector< std::string >::difference_type arg3 ; - std::vector< std::string,std::allocator< std::string > > *arg4 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - int res4 = SWIG_OLDOBJ ; - - if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setslice__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___setslice__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'"); - } - arg2 = static_cast< std::vector< std::string >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___setslice__" "', argument " "3"" of type '" "std::vector< std::string >::difference_type""'"); - } - arg3 = static_cast< std::vector< std::string >::difference_type >(val3); - { - std::vector< std::string,std::allocator< std::string > > *ptr = (std::vector< std::string,std::allocator< std::string > > *)0; - res4 = swig::asptr(swig_obj[3], &ptr); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringVector___setslice__" "', argument " "4"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector___setslice__" "', argument " "4"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); - } - arg4 = ptr; - } - try { - std_vector_Sl_std_string_Sg____setslice____SWIG_1(arg1,arg2,arg3,(std::vector< std::string,std::allocator< std::string > > const &)*arg4); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res4)) delete arg4; - return resultobj; -fail: - if (SWIG_IsNewObj(res4)) delete arg4; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector___setslice__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[5] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "StringVector___setslice__", 0, 4, argv))) SWIG_fail; - --argc; - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_StringVector___setslice____SWIG_0(self, argc, argv); - } - } - } - } - if (argc == 4) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = swig::asptr(argv[3], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_StringVector___setslice____SWIG_1(self, argc, argv); - } - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'StringVector___setslice__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::string >::__setslice__(std::vector< std::string >::difference_type,std::vector< std::string >::difference_type)\n" - " std::vector< std::string >::__setslice__(std::vector< std::string >::difference_type,std::vector< std::string >::difference_type,std::vector< std::string,std::allocator< std::string > > const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_StringVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::difference_type arg2 ; - std::vector< std::string >::difference_type arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "StringVector___delslice__", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___delslice__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___delslice__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'"); - } - arg2 = static_cast< std::vector< std::string >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector___delslice__" "', argument " "3"" of type '" "std::vector< std::string >::difference_type""'"); - } - arg3 = static_cast< std::vector< std::string >::difference_type >(val3); - try { - std_vector_Sl_std_string_Sg____delslice__(arg1,arg2,arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::difference_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___delitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___delitem__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'"); - } - arg2 = static_cast< std::vector< std::string >::difference_type >(val2); - try { - std_vector_Sl_std_string_Sg____delitem____SWIG_0(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::vector< std::string,std::allocator< std::string > > *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___getitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - try { - result = (std::vector< std::string,std::allocator< std::string > > *)std_vector_Sl_std_string_Sg____getitem____SWIG_0(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - std::vector< std::string,std::allocator< std::string > > *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res3 = SWIG_OLDOBJ ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - { - std::vector< std::string,std::allocator< std::string > > *ptr = (std::vector< std::string,std::allocator< std::string > > *)0; - res3 = swig::asptr(swig_obj[2], &ptr); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string,std::allocator< std::string > > const &""'"); - } - arg3 = ptr; - } - try { - std_vector_Sl_std_string_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< std::string,std::allocator< std::string > > const &)*arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res3)) delete arg3; - return resultobj; -fail: - if (SWIG_IsNewObj(res3)) delete arg3; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - try { - std_vector_Sl_std_string_Sg____setitem____SWIG_1(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___delitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - try { - std_vector_Sl_std_string_Sg____delitem____SWIG_1(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector___delitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "StringVector___delitem__", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - return _wrap_StringVector___delitem____SWIG_1(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_StringVector___delitem____SWIG_0(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'StringVector___delitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::string >::__delitem__(std::vector< std::string >::difference_type)\n" - " std::vector< std::string >::__delitem__(PySliceObject *)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_StringVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::difference_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - std::vector< std::string >::value_type *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___getitem__" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___getitem__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'"); - } - arg2 = static_cast< std::vector< std::string >::difference_type >(val2); - try { - result = (std::vector< std::string >::value_type *) &std_vector_Sl_std_string_Sg____getitem____SWIG_1((std::vector< std::string > const *)arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - (void)swig::container_owner<swig::traits<std::vector< std::string >::value_type>::category>::back_reference(resultobj, swig_obj[0]); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector___getitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "StringVector___getitem__", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - return _wrap_StringVector___getitem____SWIG_0(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_StringVector___getitem____SWIG_1(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'StringVector___getitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::string >::__getitem__(PySliceObject *)\n" - " std::vector< std::string >::__getitem__(std::vector< std::string >::difference_type) const\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_StringVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::difference_type arg2 ; - std::vector< std::string >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - int res3 = SWIG_OLDOBJ ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector___setitem__" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector___setitem__" "', argument " "2"" of type '" "std::vector< std::string >::difference_type""'"); - } - arg2 = static_cast< std::vector< std::string >::difference_type >(val2); - { - std::string *ptr = (std::string *)0; - res3 = SWIG_AsPtr_std_string(swig_obj[2], &ptr); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector___setitem__" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); - } - arg3 = ptr; - } - try { - std_vector_Sl_std_string_Sg____setitem____SWIG_2(arg1,arg2,(std::string const &)*arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res3)) delete arg3; - return resultobj; -fail: - if (SWIG_IsNewObj(res3)) delete arg3; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector___setitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "StringVector___setitem__", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - return _wrap_StringVector___setitem____SWIG_1(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - int res = swig::asptr(argv[2], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_StringVector___setitem____SWIG_0(self, argc, argv); - } - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_StringVector___setitem____SWIG_2(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'StringVector___setitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::string >::__setitem__(PySliceObject *,std::vector< std::string,std::allocator< std::string > > const &)\n" - " std::vector< std::string >::__setitem__(PySliceObject *)\n" - " std::vector< std::string >::__setitem__(std::vector< std::string >::difference_type,std::vector< std::string >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_StringVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::string >::value_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_pop" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - try { - result = std_vector_Sl_std_string_Sg__pop(arg1); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_From_std_string(static_cast< std::string >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::value_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "StringVector_append", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_append" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringVector_append" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_append" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); - } - arg2 = ptr; - } - std_vector_Sl_std_string_Sg__append(arg1,(std::string const &)*arg2); - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_StringVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { - PyObject *resultobj = 0; - std::vector< std::string > *result = 0 ; - - if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; - result = (std::vector< std::string > *)new std::vector< std::string >(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_StringVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = 0 ; - int res1 = SWIG_OLDOBJ ; - std::vector< std::string > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - { - std::vector< std::string,std::allocator< std::string > > *ptr = (std::vector< std::string,std::allocator< std::string > > *)0; - res1 = swig::asptr(swig_obj[0], &ptr); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector< std::string > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector< std::string > const &""'"); - } - arg1 = ptr; - } - result = (std::vector< std::string > *)new std::vector< std::string >((std::vector< std::string > const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW | 0 ); - if (SWIG_IsNewObj(res1)) delete arg1; - return resultobj; -fail: - if (SWIG_IsNewObj(res1)) delete arg1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_empty" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - result = (bool)((std::vector< std::string > const *)arg1)->empty(); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::string >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_size" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - result = ((std::vector< std::string > const *)arg1)->size(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string > *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "StringVector_swap", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_swap" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringVector_swap" "', argument " "2"" of type '" "std::vector< std::string > &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_swap" "', argument " "2"" of type '" "std::vector< std::string > &""'"); - } - arg2 = reinterpret_cast< std::vector< std::string > * >(argp2); - (arg1)->swap(*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::string >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_begin" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - result = (arg1)->begin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::string >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_end" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - result = (arg1)->end(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::string >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_rbegin" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - result = (arg1)->rbegin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::string >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_rend" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - result = (arg1)->rend(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_clear" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - (arg1)->clear(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - SwigValueWrapper< std::allocator< std::string > > result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_get_allocator" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - result = ((std::vector< std::string > const *)arg1)->get_allocator(); - resultobj = SWIG_NewPointerObj((new std::vector< std::string >::allocator_type(static_cast< const std::vector< std::string >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__string_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_StringVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string >::size_type arg1 ; - size_t val1 ; - int ecode1 = 0 ; - std::vector< std::string > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector< std::string >::size_type""'"); - } - arg1 = static_cast< std::vector< std::string >::size_type >(val1); - result = (std::vector< std::string > *)new std::vector< std::string >(arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_pop_back" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - (arg1)->pop_back(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::size_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_resize" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_resize" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'"); - } - arg2 = static_cast< std::vector< std::string >::size_type >(val2); - (arg1)->resize(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::iterator arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - std::vector< std::string >::iterator result; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_erase" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); - } - } - result = std_vector_Sl_std_string_Sg__erase__SWIG_0(arg1,arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::iterator arg2 ; - std::vector< std::string >::iterator arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - swig::SwigPyIterator *iter3 = 0 ; - int res3 ; - std::vector< std::string >::iterator result; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_erase" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); - } - } - res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res3) || !iter3) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "3"" of type '" "std::vector< std::string >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter3); - if (iter_t) { - arg3 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_erase" "', argument " "3"" of type '" "std::vector< std::string >::iterator""'"); - } - } - result = std_vector_Sl_std_string_Sg__erase__SWIG_1(arg1,arg2,arg3); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_erase(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "StringVector_erase", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_StringVector_erase__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter) != 0)); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_StringVector_erase__SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'StringVector_erase'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::string >::erase(std::vector< std::string >::iterator)\n" - " std::vector< std::string >::erase(std::vector< std::string >::iterator,std::vector< std::string >::iterator)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_new_StringVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string >::size_type arg1 ; - std::vector< std::string >::value_type *arg2 = 0 ; - size_t val1 ; - int ecode1 = 0 ; - int res2 = SWIG_OLDOBJ ; - std::vector< std::string > *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_StringVector" "', argument " "1"" of type '" "std::vector< std::string >::size_type""'"); - } - arg1 = static_cast< std::vector< std::string >::size_type >(val1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_StringVector" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_StringVector" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); - } - arg2 = ptr; - } - result = (std::vector< std::string > *)new std::vector< std::string >(arg1,(std::vector< std::string >::value_type const &)*arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_NEW | 0 ); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_StringVector(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "new_StringVector", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 0) { - return _wrap_new_StringVector__SWIG_0(self, argc, argv); - } - if (argc == 1) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_StringVector__SWIG_2(self, argc, argv); - } - } - if (argc == 1) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_StringVector__SWIG_1(self, argc, argv); - } - } - if (argc == 2) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_StringVector__SWIG_3(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_StringVector'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::string >::vector()\n" - " std::vector< std::string >::vector(std::vector< std::string > const &)\n" - " std::vector< std::string >::vector(std::vector< std::string >::size_type)\n" - " std::vector< std::string >::vector(std::vector< std::string >::size_type,std::vector< std::string >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_StringVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::value_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "StringVector_push_back", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_push_back" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StringVector_push_back" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_push_back" "', argument " "2"" of type '" "std::vector< std::string >::value_type const &""'"); - } - arg2 = ptr; - } - (arg1)->push_back((std::vector< std::string >::value_type const &)*arg2); - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::string >::value_type *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_front" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - result = (std::vector< std::string >::value_type *) &((std::vector< std::string > const *)arg1)->front(); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - (void)swig::container_owner<swig::traits<std::vector< std::string >::value_type>::category>::back_reference(resultobj, swig_obj[0]); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::string >::value_type *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_back" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - result = (std::vector< std::string >::value_type *) &((std::vector< std::string > const *)arg1)->back(); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - (void)swig::container_owner<swig::traits<std::vector< std::string >::value_type>::category>::back_reference(resultobj, swig_obj[0]); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::size_type arg2 ; - std::vector< std::string >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - int res3 = SWIG_OLDOBJ ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "StringVector_assign", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_assign" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_assign" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'"); - } - arg2 = static_cast< std::vector< std::string >::size_type >(val2); - { - std::string *ptr = (std::string *)0; - res3 = SWIG_AsPtr_std_string(swig_obj[2], &ptr); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector_assign" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_assign" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); - } - arg3 = ptr; - } - (arg1)->assign(arg2,(std::vector< std::string >::value_type const &)*arg3); - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res3)) delete arg3; - return resultobj; -fail: - if (SWIG_IsNewObj(res3)) delete arg3; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::size_type arg2 ; - std::vector< std::string >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - int res3 = SWIG_OLDOBJ ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_resize" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_resize" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'"); - } - arg2 = static_cast< std::vector< std::string >::size_type >(val2); - { - std::string *ptr = (std::string *)0; - res3 = SWIG_AsPtr_std_string(swig_obj[2], &ptr); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector_resize" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_resize" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); - } - arg3 = ptr; - } - (arg1)->resize(arg2,(std::vector< std::string >::value_type const &)*arg3); - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res3)) delete arg3; - return resultobj; -fail: - if (SWIG_IsNewObj(res3)) delete arg3; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_resize(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "StringVector_resize", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_StringVector_resize__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_StringVector_resize__SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'StringVector_resize'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::string >::resize(std::vector< std::string >::size_type)\n" - " std::vector< std::string >::resize(std::vector< std::string >::size_type,std::vector< std::string >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_StringVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::iterator arg2 ; - std::vector< std::string >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - int res3 = SWIG_OLDOBJ ; - std::vector< std::string >::iterator result; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_insert" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); - } - } - { - std::string *ptr = (std::string *)0; - res3 = SWIG_AsPtr_std_string(swig_obj[2], &ptr); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StringVector_insert" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_insert" "', argument " "3"" of type '" "std::vector< std::string >::value_type const &""'"); - } - arg3 = ptr; - } - result = std_vector_Sl_std_string_Sg__insert__SWIG_0(arg1,arg2,(std::string const &)*arg3); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< std::string >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - if (SWIG_IsNewObj(res3)) delete arg3; - return resultobj; -fail: - if (SWIG_IsNewObj(res3)) delete arg3; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::iterator arg2 ; - std::vector< std::string >::size_type arg3 ; - std::vector< std::string >::value_type *arg4 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - size_t val3 ; - int ecode3 = 0 ; - int res4 = SWIG_OLDOBJ ; - - if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_insert" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< std::string >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "StringVector_insert" "', argument " "2"" of type '" "std::vector< std::string >::iterator""'"); - } - } - ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "StringVector_insert" "', argument " "3"" of type '" "std::vector< std::string >::size_type""'"); - } - arg3 = static_cast< std::vector< std::string >::size_type >(val3); - { - std::string *ptr = (std::string *)0; - res4 = SWIG_AsPtr_std_string(swig_obj[3], &ptr); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "StringVector_insert" "', argument " "4"" of type '" "std::vector< std::string >::value_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "StringVector_insert" "', argument " "4"" of type '" "std::vector< std::string >::value_type const &""'"); - } - arg4 = ptr; - } - std_vector_Sl_std_string_Sg__insert__SWIG_1(arg1,arg2,arg3,(std::string const &)*arg4); - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res4)) delete arg4; - return resultobj; -fail: - if (SWIG_IsNewObj(res4)) delete arg4; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_insert(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[5] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "StringVector_insert", 0, 4, argv))) SWIG_fail; - --argc; - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter) != 0)); - if (_v) { - int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_StringVector_insert__SWIG_0(self, argc, argv); - } - } - } - } - if (argc == 4) { - int _v; - int res = swig::asptr(argv[0], (std::vector< std::string,std::allocator< std::string > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< std::string >::iterator > *>(iter) != 0)); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = SWIG_AsPtr_std_string(argv[3], (std::string**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_StringVector_insert__SWIG_1(self, argc, argv); - } - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'StringVector_insert'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< std::string >::insert(std::vector< std::string >::iterator,std::vector< std::string >::value_type const &)\n" - " std::vector< std::string >::insert(std::vector< std::string >::iterator,std::vector< std::string >::size_type,std::vector< std::string >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_StringVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - std::vector< std::string >::size_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "StringVector_reserve", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_reserve" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "StringVector_reserve" "', argument " "2"" of type '" "std::vector< std::string >::size_type""'"); - } - arg2 = static_cast< std::vector< std::string >::size_type >(val2); - (arg1)->reserve(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_StringVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::string >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StringVector_capacity" "', argument " "1"" of type '" "std::vector< std::string > const *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - result = ((std::vector< std::string > const *)arg1)->capacity(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_StringVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< std::string > *arg1 = (std::vector< std::string > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_StringVector" "', argument " "1"" of type '" "std::vector< std::string > *""'"); - } - arg1 = reinterpret_cast< std::vector< std::string > * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *StringVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *StringVector_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_VarsVector_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_iterator" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - result = (swig::SwigPyIterator *)std_vector_Sl_CdiVariable_Sg__iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___nonzero__" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - result = (bool)std_vector_Sl_CdiVariable_Sg____nonzero__((std::vector< CdiVariable > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___bool__" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - result = (bool)std_vector_Sl_CdiVariable_Sg____bool__((std::vector< CdiVariable > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< CdiVariable >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___len__" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - result = std_vector_Sl_CdiVariable_Sg____len__((std::vector< CdiVariable > const *)arg1); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::difference_type arg2 ; - std::vector< CdiVariable >::difference_type arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "VarsVector___getslice__", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___getslice__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___getslice__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'"); - } - arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector___getslice__" "', argument " "3"" of type '" "std::vector< CdiVariable >::difference_type""'"); - } - arg3 = static_cast< std::vector< CdiVariable >::difference_type >(val3); - try { - result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)std_vector_Sl_CdiVariable_Sg____getslice__(arg1,arg2,arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::difference_type arg2 ; - std::vector< CdiVariable >::difference_type arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setslice__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___setslice__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'"); - } - arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector___setslice__" "', argument " "3"" of type '" "std::vector< CdiVariable >::difference_type""'"); - } - arg3 = static_cast< std::vector< CdiVariable >::difference_type >(val3); - try { - std_vector_Sl_CdiVariable_Sg____setslice____SWIG_0(arg1,arg2,arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::difference_type arg2 ; - std::vector< CdiVariable >::difference_type arg3 ; - std::vector< CdiVariable,std::allocator< CdiVariable > > *arg4 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - int res4 = SWIG_OLDOBJ ; - - if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setslice__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___setslice__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'"); - } - arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector___setslice__" "', argument " "3"" of type '" "std::vector< CdiVariable >::difference_type""'"); - } - arg3 = static_cast< std::vector< CdiVariable >::difference_type >(val3); - { - std::vector< CdiVariable,std::allocator< CdiVariable > > *ptr = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)0; - res4 = swig::asptr(swig_obj[3], &ptr); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VarsVector___setslice__" "', argument " "4"" of type '" "std::vector< CdiVariable,std::allocator< CdiVariable > > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector___setslice__" "', argument " "4"" of type '" "std::vector< CdiVariable,std::allocator< CdiVariable > > const &""'"); - } - arg4 = ptr; - } - try { - std_vector_Sl_CdiVariable_Sg____setslice____SWIG_1(arg1,arg2,arg3,(std::vector< CdiVariable,std::allocator< CdiVariable > > const &)*arg4); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res4)) delete arg4; - return resultobj; -fail: - if (SWIG_IsNewObj(res4)) delete arg4; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___setslice__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[5] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "VarsVector___setslice__", 0, 4, argv))) SWIG_fail; - --argc; - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_VarsVector___setslice____SWIG_0(self, argc, argv); - } - } - } - } - if (argc == 4) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = swig::asptr(argv[3], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_VarsVector___setslice____SWIG_1(self, argc, argv); - } - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsVector___setslice__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< CdiVariable >::__setslice__(std::vector< CdiVariable >::difference_type,std::vector< CdiVariable >::difference_type)\n" - " std::vector< CdiVariable >::__setslice__(std::vector< CdiVariable >::difference_type,std::vector< CdiVariable >::difference_type,std::vector< CdiVariable,std::allocator< CdiVariable > > const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::difference_type arg2 ; - std::vector< CdiVariable >::difference_type arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - ptrdiff_t val3 ; - int ecode3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "VarsVector___delslice__", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___delslice__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___delslice__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'"); - } - arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); - ecode3 = SWIG_AsVal_ptrdiff_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector___delslice__" "', argument " "3"" of type '" "std::vector< CdiVariable >::difference_type""'"); - } - arg3 = static_cast< std::vector< CdiVariable >::difference_type >(val3); - try { - std_vector_Sl_CdiVariable_Sg____delslice__(arg1,arg2,arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::difference_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___delitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___delitem__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'"); - } - arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); - try { - std_vector_Sl_CdiVariable_Sg____delitem____SWIG_0(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___getitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector___getitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - try { - result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)std_vector_Sl_CdiVariable_Sg____getitem____SWIG_0(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - std::vector< CdiVariable,std::allocator< CdiVariable > > *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res3 = SWIG_OLDOBJ ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - { - std::vector< CdiVariable,std::allocator< CdiVariable > > *ptr = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)0; - res3 = swig::asptr(swig_obj[2], &ptr); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector___setitem__" "', argument " "3"" of type '" "std::vector< CdiVariable,std::allocator< CdiVariable > > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector___setitem__" "', argument " "3"" of type '" "std::vector< CdiVariable,std::allocator< CdiVariable > > const &""'"); - } - arg3 = ptr; - } - try { - std_vector_Sl_CdiVariable_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< CdiVariable,std::allocator< CdiVariable > > const &)*arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res3)) delete arg3; - return resultobj; -fail: - if (SWIG_IsNewObj(res3)) delete arg3; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector___setitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - try { - std_vector_Sl_CdiVariable_Sg____setitem____SWIG_1(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - PySliceObject *arg2 = (PySliceObject *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___delitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - { - if (!PySlice_Check(swig_obj[1])) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector___delitem__" "', argument " "2"" of type '" "PySliceObject *""'"); - } - arg2 = (PySliceObject *) swig_obj[1]; - } - try { - std_vector_Sl_CdiVariable_Sg____delitem____SWIG_1(arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } catch(std::invalid_argument &_e) { - SWIG_exception_fail(SWIG_ValueError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___delitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "VarsVector___delitem__", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - return _wrap_VarsVector___delitem____SWIG_1(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_VarsVector___delitem____SWIG_0(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsVector___delitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< CdiVariable >::__delitem__(std::vector< CdiVariable >::difference_type)\n" - " std::vector< CdiVariable >::__delitem__(PySliceObject *)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::difference_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - std::vector< CdiVariable >::value_type *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___getitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___getitem__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'"); - } - arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); - try { - result = (std::vector< CdiVariable >::value_type *) &std_vector_Sl_CdiVariable_Sg____getitem____SWIG_1((std::vector< CdiVariable > const *)arg1,arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 | 0 ); - (void)swig::container_owner<swig::traits<std::vector< CdiVariable >::value_type>::category>::back_reference(resultobj, swig_obj[0]); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___getitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "VarsVector___getitem__", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - return _wrap_VarsVector___getitem____SWIG_0(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_VarsVector___getitem____SWIG_1(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsVector___getitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< CdiVariable >::__getitem__(PySliceObject *)\n" - " std::vector< CdiVariable >::__getitem__(std::vector< CdiVariable >::difference_type) const\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::difference_type arg2 ; - std::vector< CdiVariable >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - ptrdiff_t val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector___setitem__" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_ptrdiff_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector___setitem__" "', argument " "2"" of type '" "std::vector< CdiVariable >::difference_type""'"); - } - arg2 = static_cast< std::vector< CdiVariable >::difference_type >(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiVariable, 0 | 0); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector___setitem__" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - if (!argp3) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector___setitem__" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3); - try { - std_vector_Sl_CdiVariable_Sg____setitem____SWIG_2(arg1,arg2,(CdiVariable const &)*arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector___setitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "VarsVector___setitem__", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - return _wrap_VarsVector___setitem____SWIG_1(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - _v = PySlice_Check(argv[1]); - } - if (_v) { - int res = swig::asptr(argv[2], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_VarsVector___setitem____SWIG_0(self, argc, argv); - } - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_VarsVector___setitem____SWIG_2(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsVector___setitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< CdiVariable >::__setitem__(PySliceObject *,std::vector< CdiVariable,std::allocator< CdiVariable > > const &)\n" - " std::vector< CdiVariable >::__setitem__(PySliceObject *)\n" - " std::vector< CdiVariable >::__setitem__(std::vector< CdiVariable >::difference_type,std::vector< CdiVariable >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< CdiVariable >::value_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_pop" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - try { - result = std_vector_Sl_CdiVariable_Sg__pop(arg1); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj((new std::vector< CdiVariable >::value_type(static_cast< const std::vector< CdiVariable >::value_type& >(result))), SWIGTYPE_p_CdiVariable, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::value_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "VarsVector_append", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_append" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_CdiVariable, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsVector_append" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_append" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - arg2 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp2); - std_vector_Sl_CdiVariable_Sg__append(arg1,(CdiVariable const &)*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_VarsVector__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *result = 0 ; - - if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; - result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_VarsVector__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = 0 ; - int res1 = SWIG_OLDOBJ ; - std::vector< CdiVariable > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - { - std::vector< CdiVariable,std::allocator< CdiVariable > > *ptr = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)0; - res1 = swig::asptr(swig_obj[0], &ptr); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector< CdiVariable > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector< CdiVariable > const &""'"); - } - arg1 = ptr; - } - result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >((std::vector< CdiVariable > const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_NEW | 0 ); - if (SWIG_IsNewObj(res1)) delete arg1; - return resultobj; -fail: - if (SWIG_IsNewObj(res1)) delete arg1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_empty" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - result = (bool)((std::vector< CdiVariable > const *)arg1)->empty(); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< CdiVariable >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_size" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - result = ((std::vector< CdiVariable > const *)arg1)->size(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable > *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "VarsVector_swap", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_swap" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsVector_swap" "', argument " "2"" of type '" "std::vector< CdiVariable > &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_swap" "', argument " "2"" of type '" "std::vector< CdiVariable > &""'"); - } - arg2 = reinterpret_cast< std::vector< CdiVariable > * >(argp2); - (arg1)->swap(*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< CdiVariable >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_begin" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - result = (arg1)->begin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< CdiVariable >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_end" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - result = (arg1)->end(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< CdiVariable >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_rbegin" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - result = (arg1)->rbegin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< CdiVariable >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_rend" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - result = (arg1)->rend(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_clear" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - (arg1)->clear(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - SwigValueWrapper< std::allocator< CdiVariable > > result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_get_allocator" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - result = ((std::vector< CdiVariable > const *)arg1)->get_allocator(); - resultobj = SWIG_NewPointerObj((new std::vector< CdiVariable >::allocator_type(static_cast< const std::vector< CdiVariable >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_CdiVariable_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_VarsVector__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable >::size_type arg1 ; - size_t val1 ; - int ecode1 = 0 ; - std::vector< CdiVariable > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector< CdiVariable >::size_type""'"); - } - arg1 = static_cast< std::vector< CdiVariable >::size_type >(val1); - result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >(arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_pop_back" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - (arg1)->pop_back(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::size_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_resize" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_resize" "', argument " "2"" of type '" "std::vector< CdiVariable >::size_type""'"); - } - arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2); - (arg1)->resize(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::iterator arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - std::vector< CdiVariable >::iterator result; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_erase" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); - } - } - result = std_vector_Sl_CdiVariable_Sg__erase__SWIG_0(arg1,arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::iterator arg2 ; - std::vector< CdiVariable >::iterator arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - swig::SwigPyIterator *iter3 = 0 ; - int res3 ; - std::vector< CdiVariable >::iterator result; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_erase" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); - } - } - res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res3) || !iter3) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "3"" of type '" "std::vector< CdiVariable >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter3); - if (iter_t) { - arg3 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_erase" "', argument " "3"" of type '" "std::vector< CdiVariable >::iterator""'"); - } - } - result = std_vector_Sl_CdiVariable_Sg__erase__SWIG_1(arg1,arg2,arg3); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_erase(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "VarsVector_erase", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_VarsVector_erase__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0)); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_VarsVector_erase__SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsVector_erase'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< CdiVariable >::erase(std::vector< CdiVariable >::iterator)\n" - " std::vector< CdiVariable >::erase(std::vector< CdiVariable >::iterator,std::vector< CdiVariable >::iterator)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_new_VarsVector__SWIG_3(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable >::size_type arg1 ; - std::vector< CdiVariable >::value_type *arg2 = 0 ; - size_t val1 ; - int ecode1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - std::vector< CdiVariable > *result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - ecode1 = SWIG_AsVal_size_t(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_VarsVector" "', argument " "1"" of type '" "std::vector< CdiVariable >::size_type""'"); - } - arg1 = static_cast< std::vector< CdiVariable >::size_type >(val1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_CdiVariable, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_VarsVector" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsVector" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - arg2 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp2); - result = (std::vector< CdiVariable > *)new std::vector< CdiVariable >(arg1,(std::vector< CdiVariable >::value_type const &)*arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_VarsVector(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "new_VarsVector", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 0) { - return _wrap_new_VarsVector__SWIG_0(self, argc, argv); - } - if (argc == 1) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_VarsVector__SWIG_2(self, argc, argv); - } - } - if (argc == 1) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_VarsVector__SWIG_1(self, argc, argv); - } - } - if (argc == 2) { - int _v; - { - int res = SWIG_AsVal_size_t(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_VarsVector__SWIG_3(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_VarsVector'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< CdiVariable >::vector()\n" - " std::vector< CdiVariable >::vector(std::vector< CdiVariable > const &)\n" - " std::vector< CdiVariable >::vector(std::vector< CdiVariable >::size_type)\n" - " std::vector< CdiVariable >::vector(std::vector< CdiVariable >::size_type,std::vector< CdiVariable >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::value_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "VarsVector_push_back", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_push_back" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_CdiVariable, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsVector_push_back" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_push_back" "', argument " "2"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - arg2 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp2); - (arg1)->push_back((std::vector< CdiVariable >::value_type const &)*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< CdiVariable >::value_type *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_front" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - result = (std::vector< CdiVariable >::value_type *) &((std::vector< CdiVariable > const *)arg1)->front(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 | 0 ); - (void)swig::container_owner<swig::traits<std::vector< CdiVariable >::value_type>::category>::back_reference(resultobj, swig_obj[0]); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< CdiVariable >::value_type *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_back" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - result = (std::vector< CdiVariable >::value_type *) &((std::vector< CdiVariable > const *)arg1)->back(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 | 0 ); - (void)swig::container_owner<swig::traits<std::vector< CdiVariable >::value_type>::category>::back_reference(resultobj, swig_obj[0]); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::size_type arg2 ; - std::vector< CdiVariable >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "VarsVector_assign", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_assign" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_assign" "', argument " "2"" of type '" "std::vector< CdiVariable >::size_type""'"); - } - arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiVariable, 0 | 0); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector_assign" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - if (!argp3) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_assign" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3); - (arg1)->assign(arg2,(std::vector< CdiVariable >::value_type const &)*arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::size_type arg2 ; - std::vector< CdiVariable >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_resize" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_resize" "', argument " "2"" of type '" "std::vector< CdiVariable >::size_type""'"); - } - arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiVariable, 0 | 0); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector_resize" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - if (!argp3) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_resize" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3); - (arg1)->resize(arg2,(std::vector< CdiVariable >::value_type const &)*arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_resize(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "VarsVector_resize", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_VarsVector_resize__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_VarsVector_resize__SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsVector_resize'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< CdiVariable >::resize(std::vector< CdiVariable >::size_type)\n" - " std::vector< CdiVariable >::resize(std::vector< CdiVariable >::size_type,std::vector< CdiVariable >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::iterator arg2 ; - std::vector< CdiVariable >::value_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - void *argp3 = 0 ; - int res3 = 0 ; - std::vector< CdiVariable >::iterator result; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_insert" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); - } - } - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiVariable, 0 | 0); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsVector_insert" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - if (!argp3) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_insert" "', argument " "3"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - arg3 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp3); - result = std_vector_Sl_CdiVariable_Sg__insert__SWIG_0(arg1,arg2,(CdiVariable const &)*arg3); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< CdiVariable >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_insert__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::iterator arg2 ; - std::vector< CdiVariable >::size_type arg3 ; - std::vector< CdiVariable >::value_type *arg4 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - size_t val3 ; - int ecode3 = 0 ; - void *argp4 = 0 ; - int res4 = 0 ; - - if ((nobjs < 4) || (nobjs > 4)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_insert" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsVector_insert" "', argument " "2"" of type '" "std::vector< CdiVariable >::iterator""'"); - } - } - ecode3 = SWIG_AsVal_size_t(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VarsVector_insert" "', argument " "3"" of type '" "std::vector< CdiVariable >::size_type""'"); - } - arg3 = static_cast< std::vector< CdiVariable >::size_type >(val3); - res4 = SWIG_ConvertPtr(swig_obj[3], &argp4, SWIGTYPE_p_CdiVariable, 0 | 0); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VarsVector_insert" "', argument " "4"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - if (!argp4) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsVector_insert" "', argument " "4"" of type '" "std::vector< CdiVariable >::value_type const &""'"); - } - arg4 = reinterpret_cast< std::vector< CdiVariable >::value_type * >(argp4); - std_vector_Sl_CdiVariable_Sg__insert__SWIG_1(arg1,arg2,arg3,(CdiVariable const &)*arg4); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_insert(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[5] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "VarsVector_insert", 0, 4, argv))) SWIG_fail; - --argc; - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0)); - if (_v) { - int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_VarsVector_insert__SWIG_0(self, argc, argv); - } - } - } - } - if (argc == 4) { - int _v; - int res = swig::asptr(argv[0], (std::vector< CdiVariable,std::allocator< CdiVariable > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::vector< CdiVariable >::iterator > *>(iter) != 0)); - if (_v) { - { - int res = SWIG_AsVal_size_t(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = SWIG_ConvertPtr(argv[3], 0, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_VarsVector_insert__SWIG_1(self, argc, argv); - } - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsVector_insert'.\n" - " Possible C/C++ prototypes are:\n" - " std::vector< CdiVariable >::insert(std::vector< CdiVariable >::iterator,std::vector< CdiVariable >::value_type const &)\n" - " std::vector< CdiVariable >::insert(std::vector< CdiVariable >::iterator,std::vector< CdiVariable >::size_type,std::vector< CdiVariable >::value_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_reserve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - std::vector< CdiVariable >::size_type arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - size_t val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "VarsVector_reserve", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_reserve" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_size_t(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsVector_reserve" "', argument " "2"" of type '" "std::vector< CdiVariable >::size_type""'"); - } - arg2 = static_cast< std::vector< CdiVariable >::size_type >(val2); - (arg1)->reserve(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsVector_capacity(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< CdiVariable >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsVector_capacity" "', argument " "1"" of type '" "std::vector< CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - result = ((std::vector< CdiVariable > const *)arg1)->capacity(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_VarsVector(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::vector< CdiVariable > *arg1 = (std::vector< CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VarsVector" "', argument " "1"" of type '" "std::vector< CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::vector< CdiVariable > * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *VarsVector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *VarsVector_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_new_VarsMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::less< std::string > *arg1 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< std::string,CdiVariable > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__lessT_std__string_t, 0 | 0); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsMap" "', argument " "1"" of type '" "std::less< std::string > const &""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsMap" "', argument " "1"" of type '" "std::less< std::string > const &""'"); - } - arg1 = reinterpret_cast< std::less< std::string > * >(argp1); - result = (std::map< std::string,CdiVariable > *)new std::map< std::string,CdiVariable >((std::less< std::string > const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_iterator" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = (swig::SwigPyIterator *)std_map_Sl_std_string_Sc_CdiVariable_Sg__iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___nonzero__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = (bool)std_map_Sl_std_string_Sc_CdiVariable_Sg____nonzero__((std::map< std::string,CdiVariable > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___bool__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = (bool)std_map_Sl_std_string_Sc_CdiVariable_Sg____bool__((std::map< std::string,CdiVariable > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< std::string,CdiVariable >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___len__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = std_map_Sl_std_string_Sc_CdiVariable_Sg____len__((std::map< std::string,CdiVariable > const *)arg1); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - std::map< std::string,CdiVariable >::mapped_type *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "VarsMap___getitem__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___getitem__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___getitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___getitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - arg2 = ptr; - } - try { - result = (std::map< std::string,CdiVariable >::mapped_type *) &std_map_Sl_std_string_Sc_CdiVariable_Sg____getitem__(arg1,(std::string const &)*arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "VarsMap___delitem__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___delitem__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___delitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___delitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - arg2 = ptr; - } - try { - std_map_Sl_std_string_Sc_CdiVariable_Sg____delitem__(arg1,(std::string const &)*arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - bool result; - - if (!SWIG_Python_UnpackTuple(args, "VarsMap_has_key", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_has_key" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_has_key" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_has_key" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - arg2 = ptr; - } - result = (bool)std_map_Sl_std_string_Sc_CdiVariable_Sg__has_key((std::map< std::string,CdiVariable > const *)arg1,(std::string const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_keys" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = (PyObject *)std_map_Sl_std_string_Sc_CdiVariable_Sg__keys(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_values" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = (PyObject *)std_map_Sl_std_string_Sc_CdiVariable_Sg__values(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_items" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = (PyObject *)std_map_Sl_std_string_Sc_CdiVariable_Sg__items(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - bool result; - - if (!SWIG_Python_UnpackTuple(args, "VarsMap___contains__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___contains__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___contains__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___contains__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - arg2 = ptr; - } - result = (bool)std_map_Sl_std_string_Sc_CdiVariable_Sg____contains__(arg1,(std::string const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_key_iterator" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = (swig::SwigPyIterator *)std_map_Sl_std_string_Sc_CdiVariable_Sg__key_iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_value_iterator" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = (swig::SwigPyIterator *)std_map_Sl_std_string_Sc_CdiVariable_Sg__value_iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___setitem__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - arg2 = ptr; - } - std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem____SWIG_0(arg1,(std::string const &)*arg2); - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; - std::map< std::string,CdiVariable >::mapped_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - void *argp3 = 0 ; - int res3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap___setitem__" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___setitem__" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - arg2 = ptr; - } - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiVariable, 0 | 0); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsMap___setitem__" "', argument " "3"" of type '" "std::map< std::string,CdiVariable >::mapped_type const &""'"); - } - if (!argp3) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap___setitem__" "', argument " "3"" of type '" "std::map< std::string,CdiVariable >::mapped_type const &""'"); - } - arg3 = reinterpret_cast< std::map< std::string,CdiVariable >::mapped_type * >(argp3); - try { - std_map_Sl_std_string_Sc_CdiVariable_Sg____setitem____SWIG_1(arg1,(std::string const &)*arg2,(CdiVariable const &)*arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap___setitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "VarsMap___setitem__", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_VarsMap___setitem____SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_VarsMap___setitem____SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsMap___setitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::map< std::string,CdiVariable >::__setitem__(std::map< std::string,CdiVariable >::key_type const &)\n" - " std::map< std::string,CdiVariable >::__setitem__(std::map< std::string,CdiVariable >::key_type const &,std::map< std::string,CdiVariable >::mapped_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_asdict" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = (PyObject *)std_map_Sl_std_string_Sc_CdiVariable_Sg__asdict(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_VarsMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *result = 0 ; - - if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; - result = (std::map< std::string,CdiVariable > *)new std::map< std::string,CdiVariable >(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_VarsMap__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = 0 ; - int res1 = SWIG_OLDOBJ ; - std::map< std::string,CdiVariable > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - { - std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *ptr = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *)0; - res1 = swig::asptr(swig_obj[0], &ptr); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsMap" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsMap" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const &""'"); - } - arg1 = ptr; - } - result = (std::map< std::string,CdiVariable > *)new std::map< std::string,CdiVariable >((std::map< std::string,CdiVariable > const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_POINTER_NEW | 0 ); - if (SWIG_IsNewObj(res1)) delete arg1; - return resultobj; -fail: - if (SWIG_IsNewObj(res1)) delete arg1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_VarsMap(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[2] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "new_VarsMap", 0, 1, argv))) SWIG_fail; - --argc; - if (argc == 0) { - return _wrap_new_VarsMap__SWIG_1(self, argc, argv); - } - if (argc == 1) { - int _v; - int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_std__string_t, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_VarsMap__SWIG_0(self, argc, argv); - } - } - if (argc == 1) { - int _v; - int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_VarsMap__SWIG_2(self, argc, argv); - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_VarsMap'.\n" - " Possible C/C++ prototypes are:\n" - " std::map< std::string,CdiVariable >::map(std::less< std::string > const &)\n" - " std::map< std::string,CdiVariable >::map()\n" - " std::map< std::string,CdiVariable >::map(std::map< std::string,CdiVariable > const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_empty" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = (bool)((std::map< std::string,CdiVariable > const *)arg1)->empty(); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< std::string,CdiVariable >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_size" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = ((std::map< std::string,CdiVariable > const *)arg1)->size(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - std::map< std::string,CdiVariable > *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "VarsMap_swap", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_swap" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_swap" "', argument " "2"" of type '" "std::map< std::string,CdiVariable > &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_swap" "', argument " "2"" of type '" "std::map< std::string,CdiVariable > &""'"); - } - arg2 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp2); - (arg1)->swap(*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< std::string,CdiVariable >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_begin" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = (arg1)->begin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< std::string,CdiVariable >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_end" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = (arg1)->end(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< std::string,CdiVariable >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_rbegin" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = (arg1)->rbegin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< std::string,CdiVariable >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_rend" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = (arg1)->rend(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_clear" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - (arg1)->clear(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - SwigValueWrapper< std::allocator< std::pair< std::string const,CdiVariable > > > result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_get_allocator" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - result = ((std::map< std::string,CdiVariable > const *)arg1)->get_allocator(); - resultobj = SWIG_NewPointerObj((new std::map< std::string,CdiVariable >::allocator_type(static_cast< const std::map< std::string,CdiVariable >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - std::map< std::string,CdiVariable >::size_type result; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_erase" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - arg2 = ptr; - } - result = (arg1)->erase((std::map< std::string,CdiVariable >::key_type const &)*arg2); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - std::map< std::string,CdiVariable >::size_type result; - - if (!SWIG_Python_UnpackTuple(args, "VarsMap_count", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_count" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_count" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_count" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - arg2 = ptr; - } - result = ((std::map< std::string,CdiVariable > const *)arg1)->count((std::map< std::string,CdiVariable >::key_type const &)*arg2); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - std::map< std::string,CdiVariable >::iterator arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_erase" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::iterator""'"); - } - } - std_map_Sl_std_string_Sc_CdiVariable_Sg__erase__SWIG_1(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - std::map< std::string,CdiVariable >::iterator arg2 ; - std::map< std::string,CdiVariable >::iterator arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - swig::SwigPyIterator *iter3 = 0 ; - int res3 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_erase" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::iterator""'"); - } - } - res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res3) || !iter3) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "3"" of type '" "std::map< std::string,CdiVariable >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter3); - if (iter_t) { - arg3 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsMap_erase" "', argument " "3"" of type '" "std::map< std::string,CdiVariable >::iterator""'"); - } - } - std_map_Sl_std_string_Sc_CdiVariable_Sg__erase__SWIG_2(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_erase(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "VarsMap_erase", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_VarsMap_erase__SWIG_1(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_VarsMap_erase__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter) != 0)); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< std::string,CdiVariable >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_VarsMap_erase__SWIG_2(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsMap_erase'.\n" - " Possible C/C++ prototypes are:\n" - " std::map< std::string,CdiVariable >::erase(std::map< std::string,CdiVariable >::key_type const &)\n" - " std::map< std::string,CdiVariable >::erase(std::map< std::string,CdiVariable >::iterator)\n" - " std::map< std::string,CdiVariable >::erase(std::map< std::string,CdiVariable >::iterator,std::map< std::string,CdiVariable >::iterator)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - std::map< std::string,CdiVariable >::iterator result; - - if (!SWIG_Python_UnpackTuple(args, "VarsMap_find", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_find" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_find" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_find" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - arg2 = ptr; - } - result = (arg1)->find((std::map< std::string,CdiVariable >::key_type const &)*arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - std::map< std::string,CdiVariable >::iterator result; - - if (!SWIG_Python_UnpackTuple(args, "VarsMap_lower_bound", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_lower_bound" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_lower_bound" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_lower_bound" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - arg2 = ptr; - } - result = (arg1)->lower_bound((std::map< std::string,CdiVariable >::key_type const &)*arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsMap_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - std::map< std::string,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - std::map< std::string,CdiVariable >::iterator result; - - if (!SWIG_Python_UnpackTuple(args, "VarsMap_upper_bound", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsMap_upper_bound" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsMap_upper_bound" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsMap_upper_bound" "', argument " "2"" of type '" "std::map< std::string,CdiVariable >::key_type const &""'"); - } - arg2 = ptr; - } - result = (arg1)->upper_bound((std::map< std::string,CdiVariable >::key_type const &)*arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< std::string,CdiVariable >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_VarsMap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< std::string,CdiVariable > *arg1 = (std::map< std::string,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VarsMap" "', argument " "1"" of type '" "std::map< std::string,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< std::string,CdiVariable > * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *VarsMap_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *VarsMap_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_new_VarsByCode__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::less< int > *arg1 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiVariable > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__lessT_int_t, 0 | 0); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsByCode" "', argument " "1"" of type '" "std::less< int > const &""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsByCode" "', argument " "1"" of type '" "std::less< int > const &""'"); - } - arg1 = reinterpret_cast< std::less< int > * >(argp1); - result = (std::map< int,CdiVariable > *)new std::map< int,CdiVariable >((std::less< int > const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_iterator" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiVariable_Sg__iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___nonzero__" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg____nonzero__((std::map< int,CdiVariable > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___bool__" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg____bool__((std::map< int,CdiVariable > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiVariable >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___len__" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = std_map_Sl_int_Sc_CdiVariable_Sg____len__((std::map< int,CdiVariable > const *)arg1); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - std::map< int,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiVariable >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiVariable >::mapped_type *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "VarsByCode___getitem__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___getitem__" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___getitem__" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); - arg2 = &temp2; - try { - result = (std::map< int,CdiVariable >::mapped_type *) &std_map_Sl_int_Sc_CdiVariable_Sg____getitem__(arg1,(int const &)*arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - std::map< int,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiVariable >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "VarsByCode___delitem__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___delitem__" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___delitem__" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); - arg2 = &temp2; - try { - std_map_Sl_int_Sc_CdiVariable_Sg____delitem__(arg1,(int const &)*arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - std::map< int,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiVariable >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - bool result; - - if (!SWIG_Python_UnpackTuple(args, "VarsByCode_has_key", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_has_key" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_has_key" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); - arg2 = &temp2; - result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg__has_key((std::map< int,CdiVariable > const *)arg1,(int const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_keys" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiVariable_Sg__keys(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_values" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiVariable_Sg__values(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_items" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiVariable_Sg__items(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - std::map< int,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiVariable >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - bool result; - - if (!SWIG_Python_UnpackTuple(args, "VarsByCode___contains__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___contains__" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___contains__" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); - arg2 = &temp2; - result = (bool)std_map_Sl_int_Sc_CdiVariable_Sg____contains__(arg1,(int const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_key_iterator" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiVariable_Sg__key_iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_value_iterator" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiVariable_Sg__value_iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - std::map< int,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiVariable >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___setitem__" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___setitem__" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); - arg2 = &temp2; - std_map_Sl_int_Sc_CdiVariable_Sg____setitem____SWIG_0(arg1,(int const &)*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - std::map< int,CdiVariable >::key_type *arg2 = 0 ; - std::map< int,CdiVariable >::mapped_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiVariable >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode___setitem__" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode___setitem__" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); - arg2 = &temp2; - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiVariable, 0 | 0); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VarsByCode___setitem__" "', argument " "3"" of type '" "std::map< int,CdiVariable >::mapped_type const &""'"); - } - if (!argp3) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsByCode___setitem__" "', argument " "3"" of type '" "std::map< int,CdiVariable >::mapped_type const &""'"); - } - arg3 = reinterpret_cast< std::map< int,CdiVariable >::mapped_type * >(argp3); - try { - std_map_Sl_int_Sc_CdiVariable_Sg____setitem____SWIG_1(arg1,(int const &)*arg2,(CdiVariable const &)*arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode___setitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "VarsByCode___setitem__", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_VarsByCode___setitem____SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiVariable, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_VarsByCode___setitem____SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsByCode___setitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::map< int,CdiVariable >::__setitem__(std::map< int,CdiVariable >::key_type const &)\n" - " std::map< int,CdiVariable >::__setitem__(std::map< int,CdiVariable >::key_type const &,std::map< int,CdiVariable >::mapped_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_asdict" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiVariable_Sg__asdict(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_VarsByCode__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *result = 0 ; - - if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; - result = (std::map< int,CdiVariable > *)new std::map< int,CdiVariable >(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_VarsByCode__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = 0 ; - int res1 = SWIG_OLDOBJ ; - std::map< int,CdiVariable > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - { - std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *ptr = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *)0; - res1 = swig::asptr(swig_obj[0], &ptr); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VarsByCode" "', argument " "1"" of type '" "std::map< int,CdiVariable > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VarsByCode" "', argument " "1"" of type '" "std::map< int,CdiVariable > const &""'"); - } - arg1 = ptr; - } - result = (std::map< int,CdiVariable > *)new std::map< int,CdiVariable >((std::map< int,CdiVariable > const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_POINTER_NEW | 0 ); - if (SWIG_IsNewObj(res1)) delete arg1; - return resultobj; -fail: - if (SWIG_IsNewObj(res1)) delete arg1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_VarsByCode(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[2] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "new_VarsByCode", 0, 1, argv))) SWIG_fail; - --argc; - if (argc == 0) { - return _wrap_new_VarsByCode__SWIG_1(self, argc, argv); - } - if (argc == 1) { - int _v; - int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_int_t, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_VarsByCode__SWIG_0(self, argc, argv); - } - } - if (argc == 1) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_VarsByCode__SWIG_2(self, argc, argv); - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_VarsByCode'.\n" - " Possible C/C++ prototypes are:\n" - " std::map< int,CdiVariable >::map(std::less< int > const &)\n" - " std::map< int,CdiVariable >::map()\n" - " std::map< int,CdiVariable >::map(std::map< int,CdiVariable > const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_empty" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = (bool)((std::map< int,CdiVariable > const *)arg1)->empty(); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiVariable >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_size" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = ((std::map< int,CdiVariable > const *)arg1)->size(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - std::map< int,CdiVariable > *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "VarsByCode_swap", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_swap" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VarsByCode_swap" "', argument " "2"" of type '" "std::map< int,CdiVariable > &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VarsByCode_swap" "', argument " "2"" of type '" "std::map< int,CdiVariable > &""'"); - } - arg2 = reinterpret_cast< std::map< int,CdiVariable > * >(argp2); - (arg1)->swap(*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiVariable >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_begin" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = (arg1)->begin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiVariable >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_end" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = (arg1)->end(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiVariable >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_rbegin" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = (arg1)->rbegin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiVariable >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_rend" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = (arg1)->rend(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_clear" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - (arg1)->clear(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - SwigValueWrapper< std::allocator< std::pair< int const,CdiVariable > > > result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_get_allocator" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - result = ((std::map< int,CdiVariable > const *)arg1)->get_allocator(); - resultobj = SWIG_NewPointerObj((new std::map< int,CdiVariable >::allocator_type(static_cast< const std::map< int,CdiVariable >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - std::map< int,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiVariable >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - std::map< int,CdiVariable >::size_type result; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_erase" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->erase((std::map< int,CdiVariable >::key_type const &)*arg2); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - std::map< int,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiVariable >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiVariable >::size_type result; - - if (!SWIG_Python_UnpackTuple(args, "VarsByCode_count", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_count" "', argument " "1"" of type '" "std::map< int,CdiVariable > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_count" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); - arg2 = &temp2; - result = ((std::map< int,CdiVariable > const *)arg1)->count((std::map< int,CdiVariable >::key_type const &)*arg2); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - std::map< int,CdiVariable >::iterator arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_erase" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map< int,CdiVariable >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map< int,CdiVariable >::iterator""'"); - } - } - std_map_Sl_int_Sc_CdiVariable_Sg__erase__SWIG_1(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - std::map< int,CdiVariable >::iterator arg2 ; - std::map< int,CdiVariable >::iterator arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - swig::SwigPyIterator *iter3 = 0 ; - int res3 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_erase" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map< int,CdiVariable >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "2"" of type '" "std::map< int,CdiVariable >::iterator""'"); - } - } - res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res3) || !iter3) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "3"" of type '" "std::map< int,CdiVariable >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter3); - if (iter_t) { - arg3 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VarsByCode_erase" "', argument " "3"" of type '" "std::map< int,CdiVariable >::iterator""'"); - } - } - std_map_Sl_int_Sc_CdiVariable_Sg__erase__SWIG_2(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_erase(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "VarsByCode_erase", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_VarsByCode_erase__SWIG_1(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_VarsByCode_erase__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter) != 0)); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiVariable >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_VarsByCode_erase__SWIG_2(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'VarsByCode_erase'.\n" - " Possible C/C++ prototypes are:\n" - " std::map< int,CdiVariable >::erase(std::map< int,CdiVariable >::key_type const &)\n" - " std::map< int,CdiVariable >::erase(std::map< int,CdiVariable >::iterator)\n" - " std::map< int,CdiVariable >::erase(std::map< int,CdiVariable >::iterator,std::map< int,CdiVariable >::iterator)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - std::map< int,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiVariable >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiVariable >::iterator result; - - if (!SWIG_Python_UnpackTuple(args, "VarsByCode_find", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_find" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_find" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->find((std::map< int,CdiVariable >::key_type const &)*arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - std::map< int,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiVariable >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiVariable >::iterator result; - - if (!SWIG_Python_UnpackTuple(args, "VarsByCode_lower_bound", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_lower_bound" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_lower_bound" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->lower_bound((std::map< int,CdiVariable >::key_type const &)*arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_VarsByCode_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - std::map< int,CdiVariable >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiVariable >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiVariable >::iterator result; - - if (!SWIG_Python_UnpackTuple(args, "VarsByCode_upper_bound", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VarsByCode_upper_bound" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VarsByCode_upper_bound" "', argument " "2"" of type '" "std::map< int,CdiVariable >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiVariable >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->upper_bound((std::map< int,CdiVariable >::key_type const &)*arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiVariable >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_VarsByCode(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiVariable > *arg1 = (std::map< int,CdiVariable > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_VarsByCode" "', argument " "1"" of type '" "std::map< int,CdiVariable > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiVariable > * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *VarsByCode_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *VarsByCode_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_new_TaxesMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::less< int > *arg1 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiTaxis > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__lessT_int_t, 0 | 0); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_TaxesMap" "', argument " "1"" of type '" "std::less< int > const &""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_TaxesMap" "', argument " "1"" of type '" "std::less< int > const &""'"); - } - arg1 = reinterpret_cast< std::less< int > * >(argp1); - result = (std::map< int,CdiTaxis > *)new std::map< int,CdiTaxis >((std::less< int > const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_iterator" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiTaxis_Sg__iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___nonzero__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg____nonzero__((std::map< int,CdiTaxis > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___bool__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg____bool__((std::map< int,CdiTaxis > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiTaxis >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___len__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = std_map_Sl_int_Sc_CdiTaxis_Sg____len__((std::map< int,CdiTaxis > const *)arg1); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - std::map< int,CdiTaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiTaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiTaxis >::mapped_type *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "TaxesMap___getitem__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___getitem__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___getitem__" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); - arg2 = &temp2; - try { - result = (std::map< int,CdiTaxis >::mapped_type *) &std_map_Sl_int_Sc_CdiTaxis_Sg____getitem__(arg1,(int const &)*arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiTaxis, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - std::map< int,CdiTaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiTaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "TaxesMap___delitem__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___delitem__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___delitem__" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); - arg2 = &temp2; - try { - std_map_Sl_int_Sc_CdiTaxis_Sg____delitem__(arg1,(int const &)*arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - std::map< int,CdiTaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiTaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - bool result; - - if (!SWIG_Python_UnpackTuple(args, "TaxesMap_has_key", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_has_key" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_has_key" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); - arg2 = &temp2; - result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg__has_key((std::map< int,CdiTaxis > const *)arg1,(int const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_keys" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiTaxis_Sg__keys(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_values" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiTaxis_Sg__values(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_items" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiTaxis_Sg__items(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - std::map< int,CdiTaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiTaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - bool result; - - if (!SWIG_Python_UnpackTuple(args, "TaxesMap___contains__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___contains__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___contains__" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); - arg2 = &temp2; - result = (bool)std_map_Sl_int_Sc_CdiTaxis_Sg____contains__(arg1,(int const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_key_iterator" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiTaxis_Sg__key_iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_value_iterator" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiTaxis_Sg__value_iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - std::map< int,CdiTaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiTaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); - arg2 = &temp2; - std_map_Sl_int_Sc_CdiTaxis_Sg____setitem____SWIG_0(arg1,(int const &)*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - std::map< int,CdiTaxis >::key_type *arg2 = 0 ; - std::map< int,CdiTaxis >::mapped_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiTaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); - arg2 = &temp2; - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiTaxis, 0 | 0); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "TaxesMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiTaxis >::mapped_type const &""'"); - } - if (!argp3) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "TaxesMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiTaxis >::mapped_type const &""'"); - } - arg3 = reinterpret_cast< std::map< int,CdiTaxis >::mapped_type * >(argp3); - try { - std_map_Sl_int_Sc_CdiTaxis_Sg____setitem____SWIG_1(arg1,(int const &)*arg2,(CdiTaxis const &)*arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap___setitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "TaxesMap___setitem__", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_TaxesMap___setitem____SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiTaxis, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_TaxesMap___setitem____SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'TaxesMap___setitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::map< int,CdiTaxis >::__setitem__(std::map< int,CdiTaxis >::key_type const &)\n" - " std::map< int,CdiTaxis >::__setitem__(std::map< int,CdiTaxis >::key_type const &,std::map< int,CdiTaxis >::mapped_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_asdict" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiTaxis_Sg__asdict(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_TaxesMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *result = 0 ; - - if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; - result = (std::map< int,CdiTaxis > *)new std::map< int,CdiTaxis >(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_TaxesMap__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = 0 ; - int res1 = SWIG_OLDOBJ ; - std::map< int,CdiTaxis > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - { - std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *ptr = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *)0; - res1 = swig::asptr(swig_obj[0], &ptr); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_TaxesMap" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_TaxesMap" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const &""'"); - } - arg1 = ptr; - } - result = (std::map< int,CdiTaxis > *)new std::map< int,CdiTaxis >((std::map< int,CdiTaxis > const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_POINTER_NEW | 0 ); - if (SWIG_IsNewObj(res1)) delete arg1; - return resultobj; -fail: - if (SWIG_IsNewObj(res1)) delete arg1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_TaxesMap(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[2] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "new_TaxesMap", 0, 1, argv))) SWIG_fail; - --argc; - if (argc == 0) { - return _wrap_new_TaxesMap__SWIG_1(self, argc, argv); - } - if (argc == 1) { - int _v; - int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_int_t, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_TaxesMap__SWIG_0(self, argc, argv); - } - } - if (argc == 1) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_TaxesMap__SWIG_2(self, argc, argv); - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_TaxesMap'.\n" - " Possible C/C++ prototypes are:\n" - " std::map< int,CdiTaxis >::map(std::less< int > const &)\n" - " std::map< int,CdiTaxis >::map()\n" - " std::map< int,CdiTaxis >::map(std::map< int,CdiTaxis > const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_empty" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = (bool)((std::map< int,CdiTaxis > const *)arg1)->empty(); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiTaxis >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_size" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = ((std::map< int,CdiTaxis > const *)arg1)->size(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - std::map< int,CdiTaxis > *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "TaxesMap_swap", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_swap" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "TaxesMap_swap" "', argument " "2"" of type '" "std::map< int,CdiTaxis > &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "TaxesMap_swap" "', argument " "2"" of type '" "std::map< int,CdiTaxis > &""'"); - } - arg2 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp2); - (arg1)->swap(*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiTaxis >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_begin" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = (arg1)->begin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiTaxis >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_end" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = (arg1)->end(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiTaxis >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_rbegin" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = (arg1)->rbegin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiTaxis >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_rend" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = (arg1)->rend(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_clear" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - (arg1)->clear(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - SwigValueWrapper< std::allocator< std::pair< int const,CdiTaxis > > > result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_get_allocator" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - result = ((std::map< int,CdiTaxis > const *)arg1)->get_allocator(); - resultobj = SWIG_NewPointerObj((new std::map< int,CdiTaxis >::allocator_type(static_cast< const std::map< int,CdiTaxis >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - std::map< int,CdiTaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiTaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - std::map< int,CdiTaxis >::size_type result; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->erase((std::map< int,CdiTaxis >::key_type const &)*arg2); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - std::map< int,CdiTaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiTaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiTaxis >::size_type result; - - if (!SWIG_Python_UnpackTuple(args, "TaxesMap_count", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_count" "', argument " "1"" of type '" "std::map< int,CdiTaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_count" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); - arg2 = &temp2; - result = ((std::map< int,CdiTaxis > const *)arg1)->count((std::map< int,CdiTaxis >::key_type const &)*arg2); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - std::map< int,CdiTaxis >::iterator arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::iterator""'"); - } - } - std_map_Sl_int_Sc_CdiTaxis_Sg__erase__SWIG_1(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - std::map< int,CdiTaxis >::iterator arg2 ; - std::map< int,CdiTaxis >::iterator arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - swig::SwigPyIterator *iter3 = 0 ; - int res3 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::iterator""'"); - } - } - res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res3) || !iter3) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "3"" of type '" "std::map< int,CdiTaxis >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter3); - if (iter_t) { - arg3 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "TaxesMap_erase" "', argument " "3"" of type '" "std::map< int,CdiTaxis >::iterator""'"); - } - } - std_map_Sl_int_Sc_CdiTaxis_Sg__erase__SWIG_2(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_erase(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "TaxesMap_erase", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_TaxesMap_erase__SWIG_1(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_TaxesMap_erase__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter) != 0)); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiTaxis >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_TaxesMap_erase__SWIG_2(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'TaxesMap_erase'.\n" - " Possible C/C++ prototypes are:\n" - " std::map< int,CdiTaxis >::erase(std::map< int,CdiTaxis >::key_type const &)\n" - " std::map< int,CdiTaxis >::erase(std::map< int,CdiTaxis >::iterator)\n" - " std::map< int,CdiTaxis >::erase(std::map< int,CdiTaxis >::iterator,std::map< int,CdiTaxis >::iterator)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - std::map< int,CdiTaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiTaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiTaxis >::iterator result; - - if (!SWIG_Python_UnpackTuple(args, "TaxesMap_find", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_find" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_find" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->find((std::map< int,CdiTaxis >::key_type const &)*arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - std::map< int,CdiTaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiTaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiTaxis >::iterator result; - - if (!SWIG_Python_UnpackTuple(args, "TaxesMap_lower_bound", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_lower_bound" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_lower_bound" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->lower_bound((std::map< int,CdiTaxis >::key_type const &)*arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_TaxesMap_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - std::map< int,CdiTaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiTaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiTaxis >::iterator result; - - if (!SWIG_Python_UnpackTuple(args, "TaxesMap_upper_bound", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "TaxesMap_upper_bound" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "TaxesMap_upper_bound" "', argument " "2"" of type '" "std::map< int,CdiTaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiTaxis >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->upper_bound((std::map< int,CdiTaxis >::key_type const &)*arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiTaxis >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_TaxesMap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiTaxis > *arg1 = (std::map< int,CdiTaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_TaxesMap" "', argument " "1"" of type '" "std::map< int,CdiTaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiTaxis > * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *TaxesMap_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *TaxesMap_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_new_ZaxesMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::less< int > *arg1 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiZaxis > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__lessT_int_t, 0 | 0); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ZaxesMap" "', argument " "1"" of type '" "std::less< int > const &""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ZaxesMap" "', argument " "1"" of type '" "std::less< int > const &""'"); - } - arg1 = reinterpret_cast< std::less< int > * >(argp1); - result = (std::map< int,CdiZaxis > *)new std::map< int,CdiZaxis >((std::less< int > const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_iterator" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiZaxis_Sg__iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___nonzero__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg____nonzero__((std::map< int,CdiZaxis > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___bool__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg____bool__((std::map< int,CdiZaxis > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiZaxis >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___len__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = std_map_Sl_int_Sc_CdiZaxis_Sg____len__((std::map< int,CdiZaxis > const *)arg1); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - std::map< int,CdiZaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiZaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiZaxis >::mapped_type *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "ZaxesMap___getitem__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___getitem__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___getitem__" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); - arg2 = &temp2; - try { - result = (std::map< int,CdiZaxis >::mapped_type *) &std_map_Sl_int_Sc_CdiZaxis_Sg____getitem__(arg1,(int const &)*arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiZaxis, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - std::map< int,CdiZaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiZaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "ZaxesMap___delitem__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___delitem__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___delitem__" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); - arg2 = &temp2; - try { - std_map_Sl_int_Sc_CdiZaxis_Sg____delitem__(arg1,(int const &)*arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - std::map< int,CdiZaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiZaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - bool result; - - if (!SWIG_Python_UnpackTuple(args, "ZaxesMap_has_key", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_has_key" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_has_key" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); - arg2 = &temp2; - result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg__has_key((std::map< int,CdiZaxis > const *)arg1,(int const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_keys" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiZaxis_Sg__keys(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_values" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiZaxis_Sg__values(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_items" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiZaxis_Sg__items(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - std::map< int,CdiZaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiZaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - bool result; - - if (!SWIG_Python_UnpackTuple(args, "ZaxesMap___contains__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___contains__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___contains__" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); - arg2 = &temp2; - result = (bool)std_map_Sl_int_Sc_CdiZaxis_Sg____contains__(arg1,(int const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_key_iterator" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiZaxis_Sg__key_iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_value_iterator" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiZaxis_Sg__value_iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - std::map< int,CdiZaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiZaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); - arg2 = &temp2; - std_map_Sl_int_Sc_CdiZaxis_Sg____setitem____SWIG_0(arg1,(int const &)*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - std::map< int,CdiZaxis >::key_type *arg2 = 0 ; - std::map< int,CdiZaxis >::mapped_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiZaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); - arg2 = &temp2; - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiZaxis, 0 | 0); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ZaxesMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiZaxis >::mapped_type const &""'"); - } - if (!argp3) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ZaxesMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiZaxis >::mapped_type const &""'"); - } - arg3 = reinterpret_cast< std::map< int,CdiZaxis >::mapped_type * >(argp3); - try { - std_map_Sl_int_Sc_CdiZaxis_Sg____setitem____SWIG_1(arg1,(int const &)*arg2,(CdiZaxis const &)*arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap___setitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "ZaxesMap___setitem__", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_ZaxesMap___setitem____SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiZaxis, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_ZaxesMap___setitem____SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'ZaxesMap___setitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::map< int,CdiZaxis >::__setitem__(std::map< int,CdiZaxis >::key_type const &)\n" - " std::map< int,CdiZaxis >::__setitem__(std::map< int,CdiZaxis >::key_type const &,std::map< int,CdiZaxis >::mapped_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_asdict" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiZaxis_Sg__asdict(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_ZaxesMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *result = 0 ; - - if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; - result = (std::map< int,CdiZaxis > *)new std::map< int,CdiZaxis >(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_ZaxesMap__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = 0 ; - int res1 = SWIG_OLDOBJ ; - std::map< int,CdiZaxis > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - { - std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *ptr = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *)0; - res1 = swig::asptr(swig_obj[0], &ptr); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ZaxesMap" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ZaxesMap" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const &""'"); - } - arg1 = ptr; - } - result = (std::map< int,CdiZaxis > *)new std::map< int,CdiZaxis >((std::map< int,CdiZaxis > const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_POINTER_NEW | 0 ); - if (SWIG_IsNewObj(res1)) delete arg1; - return resultobj; -fail: - if (SWIG_IsNewObj(res1)) delete arg1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_ZaxesMap(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[2] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "new_ZaxesMap", 0, 1, argv))) SWIG_fail; - --argc; - if (argc == 0) { - return _wrap_new_ZaxesMap__SWIG_1(self, argc, argv); - } - if (argc == 1) { - int _v; - int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_int_t, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_ZaxesMap__SWIG_0(self, argc, argv); - } - } - if (argc == 1) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_ZaxesMap__SWIG_2(self, argc, argv); - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_ZaxesMap'.\n" - " Possible C/C++ prototypes are:\n" - " std::map< int,CdiZaxis >::map(std::less< int > const &)\n" - " std::map< int,CdiZaxis >::map()\n" - " std::map< int,CdiZaxis >::map(std::map< int,CdiZaxis > const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_empty" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = (bool)((std::map< int,CdiZaxis > const *)arg1)->empty(); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiZaxis >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_size" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = ((std::map< int,CdiZaxis > const *)arg1)->size(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - std::map< int,CdiZaxis > *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "ZaxesMap_swap", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_swap" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ZaxesMap_swap" "', argument " "2"" of type '" "std::map< int,CdiZaxis > &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ZaxesMap_swap" "', argument " "2"" of type '" "std::map< int,CdiZaxis > &""'"); - } - arg2 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp2); - (arg1)->swap(*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiZaxis >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_begin" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = (arg1)->begin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiZaxis >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_end" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = (arg1)->end(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiZaxis >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_rbegin" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = (arg1)->rbegin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiZaxis >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_rend" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = (arg1)->rend(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_clear" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - (arg1)->clear(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - SwigValueWrapper< std::allocator< std::pair< int const,CdiZaxis > > > result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_get_allocator" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - result = ((std::map< int,CdiZaxis > const *)arg1)->get_allocator(); - resultobj = SWIG_NewPointerObj((new std::map< int,CdiZaxis >::allocator_type(static_cast< const std::map< int,CdiZaxis >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - std::map< int,CdiZaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiZaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - std::map< int,CdiZaxis >::size_type result; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->erase((std::map< int,CdiZaxis >::key_type const &)*arg2); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - std::map< int,CdiZaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiZaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiZaxis >::size_type result; - - if (!SWIG_Python_UnpackTuple(args, "ZaxesMap_count", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_count" "', argument " "1"" of type '" "std::map< int,CdiZaxis > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_count" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); - arg2 = &temp2; - result = ((std::map< int,CdiZaxis > const *)arg1)->count((std::map< int,CdiZaxis >::key_type const &)*arg2); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - std::map< int,CdiZaxis >::iterator arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::iterator""'"); - } - } - std_map_Sl_int_Sc_CdiZaxis_Sg__erase__SWIG_1(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - std::map< int,CdiZaxis >::iterator arg2 ; - std::map< int,CdiZaxis >::iterator arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - swig::SwigPyIterator *iter3 = 0 ; - int res3 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_erase" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::iterator""'"); - } - } - res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res3) || !iter3) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "3"" of type '" "std::map< int,CdiZaxis >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter3); - if (iter_t) { - arg3 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "ZaxesMap_erase" "', argument " "3"" of type '" "std::map< int,CdiZaxis >::iterator""'"); - } - } - std_map_Sl_int_Sc_CdiZaxis_Sg__erase__SWIG_2(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_erase(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "ZaxesMap_erase", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_ZaxesMap_erase__SWIG_1(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_ZaxesMap_erase__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter) != 0)); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiZaxis >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_ZaxesMap_erase__SWIG_2(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'ZaxesMap_erase'.\n" - " Possible C/C++ prototypes are:\n" - " std::map< int,CdiZaxis >::erase(std::map< int,CdiZaxis >::key_type const &)\n" - " std::map< int,CdiZaxis >::erase(std::map< int,CdiZaxis >::iterator)\n" - " std::map< int,CdiZaxis >::erase(std::map< int,CdiZaxis >::iterator,std::map< int,CdiZaxis >::iterator)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - std::map< int,CdiZaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiZaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiZaxis >::iterator result; - - if (!SWIG_Python_UnpackTuple(args, "ZaxesMap_find", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_find" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_find" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->find((std::map< int,CdiZaxis >::key_type const &)*arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - std::map< int,CdiZaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiZaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiZaxis >::iterator result; - - if (!SWIG_Python_UnpackTuple(args, "ZaxesMap_lower_bound", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_lower_bound" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_lower_bound" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->lower_bound((std::map< int,CdiZaxis >::key_type const &)*arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_ZaxesMap_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - std::map< int,CdiZaxis >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiZaxis >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiZaxis >::iterator result; - - if (!SWIG_Python_UnpackTuple(args, "ZaxesMap_upper_bound", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ZaxesMap_upper_bound" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ZaxesMap_upper_bound" "', argument " "2"" of type '" "std::map< int,CdiZaxis >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiZaxis >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->upper_bound((std::map< int,CdiZaxis >::key_type const &)*arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiZaxis >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_ZaxesMap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiZaxis > *arg1 = (std::map< int,CdiZaxis > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ZaxesMap" "', argument " "1"" of type '" "std::map< int,CdiZaxis > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiZaxis > * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *ZaxesMap_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *ZaxesMap_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_new_GridsMap__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::less< int > *arg1 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiGrid > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__lessT_int_t, 0 | 0); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_GridsMap" "', argument " "1"" of type '" "std::less< int > const &""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_GridsMap" "', argument " "1"" of type '" "std::less< int > const &""'"); - } - arg1 = reinterpret_cast< std::less< int > * >(argp1); - result = (std::map< int,CdiGrid > *)new std::map< int,CdiGrid >((std::less< int > const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_iterator" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiGrid_Sg__iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___nonzero__" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg____nonzero__((std::map< int,CdiGrid > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___bool__" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg____bool__((std::map< int,CdiGrid > const *)arg1); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiGrid >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___len__" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = std_map_Sl_int_Sc_CdiGrid_Sg____len__((std::map< int,CdiGrid > const *)arg1); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap___getitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - std::map< int,CdiGrid >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiGrid >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiGrid >::mapped_type *result = 0 ; - - if (!SWIG_Python_UnpackTuple(args, "GridsMap___getitem__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___getitem__" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___getitem__" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); - arg2 = &temp2; - try { - result = (std::map< int,CdiGrid >::mapped_type *) &std_map_Sl_int_Sc_CdiGrid_Sg____getitem__(arg1,(int const &)*arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiGrid, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap___delitem__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - std::map< int,CdiGrid >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiGrid >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "GridsMap___delitem__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___delitem__" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___delitem__" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); - arg2 = &temp2; - try { - std_map_Sl_int_Sc_CdiGrid_Sg____delitem__(arg1,(int const &)*arg2); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_has_key(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - std::map< int,CdiGrid >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiGrid >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - bool result; - - if (!SWIG_Python_UnpackTuple(args, "GridsMap_has_key", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_has_key" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_has_key" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); - arg2 = &temp2; - result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg__has_key((std::map< int,CdiGrid > const *)arg1,(int const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_keys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_keys" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiGrid_Sg__keys(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_values(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_values" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiGrid_Sg__values(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_items(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_items" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiGrid_Sg__items(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap___contains__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - std::map< int,CdiGrid >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiGrid >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - bool result; - - if (!SWIG_Python_UnpackTuple(args, "GridsMap___contains__", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___contains__" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___contains__" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); - arg2 = &temp2; - result = (bool)std_map_Sl_int_Sc_CdiGrid_Sg____contains__(arg1,(int const &)*arg2); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_key_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_key_iterator" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiGrid_Sg__key_iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_value_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - PyObject **arg2 = (PyObject **) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - swig::SwigPyIterator *result = 0 ; - - arg2 = &swig_obj[0]; - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_value_iterator" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = (swig::SwigPyIterator *)std_map_Sl_int_Sc_CdiGrid_Sg__value_iterator(arg1,arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - std::map< int,CdiGrid >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiGrid >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); - arg2 = &temp2; - std_map_Sl_int_Sc_CdiGrid_Sg____setitem____SWIG_0(arg1,(int const &)*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - std::map< int,CdiGrid >::key_type *arg2 = 0 ; - std::map< int,CdiGrid >::mapped_type *arg3 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiGrid >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap___setitem__" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap___setitem__" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); - arg2 = &temp2; - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_CdiGrid, 0 | 0); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "GridsMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiGrid >::mapped_type const &""'"); - } - if (!argp3) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "GridsMap___setitem__" "', argument " "3"" of type '" "std::map< int,CdiGrid >::mapped_type const &""'"); - } - arg3 = reinterpret_cast< std::map< int,CdiGrid >::mapped_type * >(argp3); - try { - std_map_Sl_int_Sc_CdiGrid_Sg____setitem____SWIG_1(arg1,(int const &)*arg2,(CdiGrid const &)*arg3); - } catch(std::out_of_range &_e) { - SWIG_exception_fail(SWIG_IndexError, (&_e)->what()); - } - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap___setitem__(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "GridsMap___setitem__", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_GridsMap___setitem____SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_CdiGrid, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_GridsMap___setitem____SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'GridsMap___setitem__'.\n" - " Possible C/C++ prototypes are:\n" - " std::map< int,CdiGrid >::__setitem__(std::map< int,CdiGrid >::key_type const &)\n" - " std::map< int,CdiGrid >::__setitem__(std::map< int,CdiGrid >::key_type const &,std::map< int,CdiGrid >::mapped_type const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_asdict(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - PyObject *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_asdict" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = (PyObject *)std_map_Sl_int_Sc_CdiGrid_Sg__asdict(arg1); - resultobj = result; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_GridsMap__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *result = 0 ; - - if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; - result = (std::map< int,CdiGrid > *)new std::map< int,CdiGrid >(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_GridsMap__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = 0 ; - int res1 = SWIG_OLDOBJ ; - std::map< int,CdiGrid > *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - { - std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *ptr = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *)0; - res1 = swig::asptr(swig_obj[0], &ptr); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_GridsMap" "', argument " "1"" of type '" "std::map< int,CdiGrid > const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_GridsMap" "', argument " "1"" of type '" "std::map< int,CdiGrid > const &""'"); - } - arg1 = ptr; - } - result = (std::map< int,CdiGrid > *)new std::map< int,CdiGrid >((std::map< int,CdiGrid > const &)*arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_POINTER_NEW | 0 ); - if (SWIG_IsNewObj(res1)) delete arg1; - return resultobj; -fail: - if (SWIG_IsNewObj(res1)) delete arg1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_GridsMap(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[2] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "new_GridsMap", 0, 1, argv))) SWIG_fail; - --argc; - if (argc == 0) { - return _wrap_new_GridsMap__SWIG_1(self, argc, argv); - } - if (argc == 1) { - int _v; - int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__lessT_int_t, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_GridsMap__SWIG_0(self, argc, argv); - } - } - if (argc == 1) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_GridsMap__SWIG_2(self, argc, argv); - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_GridsMap'.\n" - " Possible C/C++ prototypes are:\n" - " std::map< int,CdiGrid >::map(std::less< int > const &)\n" - " std::map< int,CdiGrid >::map()\n" - " std::map< int,CdiGrid >::map(std::map< int,CdiGrid > const &)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_empty" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = (bool)((std::map< int,CdiGrid > const *)arg1)->empty(); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiGrid >::size_type result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_size" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = ((std::map< int,CdiGrid > const *)arg1)->size(); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - std::map< int,CdiGrid > *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "GridsMap_swap", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_swap" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GridsMap_swap" "', argument " "2"" of type '" "std::map< int,CdiGrid > &""'"); - } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "GridsMap_swap" "', argument " "2"" of type '" "std::map< int,CdiGrid > &""'"); - } - arg2 = reinterpret_cast< std::map< int,CdiGrid > * >(argp2); - (arg1)->swap(*arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiGrid >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_begin" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = (arg1)->begin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiGrid >::iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_end" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = (arg1)->end(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiGrid >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_rbegin" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = (arg1)->rbegin(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiGrid >::reverse_iterator result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_rend" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = (arg1)->rend(); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::reverse_iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_clear" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - (arg1)->clear(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - SwigValueWrapper< std::allocator< std::pair< int const,CdiGrid > > > result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_get_allocator" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - result = ((std::map< int,CdiGrid > const *)arg1)->get_allocator(); - resultobj = SWIG_NewPointerObj((new std::map< int,CdiGrid >::allocator_type(static_cast< const std::map< int,CdiGrid >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - std::map< int,CdiGrid >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiGrid >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - std::map< int,CdiGrid >::size_type result; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_erase" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->erase((std::map< int,CdiGrid >::key_type const &)*arg2); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_count(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - std::map< int,CdiGrid >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiGrid >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiGrid >::size_type result; - - if (!SWIG_Python_UnpackTuple(args, "GridsMap_count", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_count" "', argument " "1"" of type '" "std::map< int,CdiGrid > const *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_count" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); - arg2 = &temp2; - result = ((std::map< int,CdiGrid > const *)arg1)->count((std::map< int,CdiGrid >::key_type const &)*arg2); - resultobj = SWIG_From_size_t(static_cast< size_t >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - std::map< int,CdiGrid >::iterator arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_erase" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map< int,CdiGrid >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map< int,CdiGrid >::iterator""'"); - } - } - std_map_Sl_int_Sc_CdiGrid_Sg__erase__SWIG_1(arg1,arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_erase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - std::map< int,CdiGrid >::iterator arg2 ; - std::map< int,CdiGrid >::iterator arg3 ; - void *argp1 = 0 ; - int res1 = 0 ; - swig::SwigPyIterator *iter2 = 0 ; - int res2 ; - swig::SwigPyIterator *iter3 = 0 ; - int res3 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_erase" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res2) || !iter2) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map< int,CdiGrid >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter2); - if (iter_t) { - arg2 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "2"" of type '" "std::map< int,CdiGrid >::iterator""'"); - } - } - res3 = SWIG_ConvertPtr(swig_obj[2], SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0); - if (!SWIG_IsOK(res3) || !iter3) { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "3"" of type '" "std::map< int,CdiGrid >::iterator""'"); - } else { - swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *iter_t = dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter3); - if (iter_t) { - arg3 = iter_t->get_current(); - } else { - SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "GridsMap_erase" "', argument " "3"" of type '" "std::map< int,CdiGrid >::iterator""'"); - } - } - std_map_Sl_int_Sc_CdiGrid_Sg__erase__SWIG_2(arg1,arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_erase(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "GridsMap_erase", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_GridsMap_erase__SWIG_1(self, argc, argv); - } - } - } - if (argc == 2) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_GridsMap_erase__SWIG_0(self, argc, argv); - } - } - } - if (argc == 3) { - int _v; - int res = swig::asptr(argv[0], (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > >**)(0)); - _v = SWIG_CheckState(res); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter) != 0)); - if (_v) { - swig::SwigPyIterator *iter = 0; - int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0); - _v = (SWIG_IsOK(res) && iter && (dynamic_cast<swig::SwigPyIterator_T<std::map< int,CdiGrid >::iterator > *>(iter) != 0)); - if (_v) { - return _wrap_GridsMap_erase__SWIG_2(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'GridsMap_erase'.\n" - " Possible C/C++ prototypes are:\n" - " std::map< int,CdiGrid >::erase(std::map< int,CdiGrid >::key_type const &)\n" - " std::map< int,CdiGrid >::erase(std::map< int,CdiGrid >::iterator)\n" - " std::map< int,CdiGrid >::erase(std::map< int,CdiGrid >::iterator,std::map< int,CdiGrid >::iterator)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_find(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - std::map< int,CdiGrid >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiGrid >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiGrid >::iterator result; - - if (!SWIG_Python_UnpackTuple(args, "GridsMap_find", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_find" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_find" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->find((std::map< int,CdiGrid >::key_type const &)*arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_lower_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - std::map< int,CdiGrid >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiGrid >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiGrid >::iterator result; - - if (!SWIG_Python_UnpackTuple(args, "GridsMap_lower_bound", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_lower_bound" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_lower_bound" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->lower_bound((std::map< int,CdiGrid >::key_type const &)*arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_GridsMap_upper_bound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - std::map< int,CdiGrid >::key_type *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - std::map< int,CdiGrid >::key_type temp2 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - std::map< int,CdiGrid >::iterator result; - - if (!SWIG_Python_UnpackTuple(args, "GridsMap_upper_bound", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GridsMap_upper_bound" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GridsMap_upper_bound" "', argument " "2"" of type '" "std::map< int,CdiGrid >::key_type""'"); - } - temp2 = static_cast< std::map< int,CdiGrid >::key_type >(val2); - arg2 = &temp2; - result = (arg1)->upper_bound((std::map< int,CdiGrid >::key_type const &)*arg2); - resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::map< int,CdiGrid >::iterator & >(result)), - swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_GridsMap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - std::map< int,CdiGrid > *arg1 = (std::map< int,CdiGrid > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GridsMap" "', argument " "1"" of type '" "std::map< int,CdiGrid > *""'"); - } - arg1 = reinterpret_cast< std::map< int,CdiGrid > * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *GridsMap_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *GridsMap_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_new_CdiGrid__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { - PyObject *resultobj = 0; - CdiGrid *result = 0 ; - - if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; - result = (CdiGrid *)new CdiGrid(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiGrid, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_CdiGrid__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - CdiGrid *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_CdiGrid" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - result = (CdiGrid *)new CdiGrid(arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiGrid, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_CdiGrid(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[2] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "new_CdiGrid", 0, 1, argv))) SWIG_fail; - --argc; - if (argc == 0) { - return _wrap_new_CdiGrid__SWIG_0(self, argc, argv); - } - if (argc == 1) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_CdiGrid__SWIG_1(self, argc, argv); - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_CdiGrid'.\n" - " Possible C/C++ prototypes are:\n" - " CdiGrid::CdiGrid()\n" - " CdiGrid::CdiGrid(int)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_delete_CdiGrid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CdiGrid" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_gridID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_gridID_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_gridID_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_gridID_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->gridID = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_gridID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_gridID_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (int) ((arg1)->gridID); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_type_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_type_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_type_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_type_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->type = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_type_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_type_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (int) ((arg1)->type); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_size_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_size_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_size_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_size_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->size = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_size_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_size_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (int) ((arg1)->size); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_xsize_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_xsize_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xsize_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_xsize_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->xsize = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_xsize_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xsize_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (int) ((arg1)->xsize); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_ysize_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_ysize_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ysize_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_ysize_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->ysize = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_ysize_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ysize_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (int) ((arg1)->ysize); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_prec_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_prec_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_prec_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_prec_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->prec = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_prec_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_prec_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (int) ((arg1)->prec); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_ncorner_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_ncorner_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ncorner_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_ncorner_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->ncorner = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_ncorner_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ncorner_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (int) ((arg1)->ncorner); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_hasXValues_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - bool arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - bool val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_hasXValues_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_hasXValues_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_hasXValues_set" "', argument " "2"" of type '" "bool""'"); - } - arg2 = static_cast< bool >(val2); - if (arg1) (arg1)->hasXValues = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_hasXValues_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_hasXValues_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (bool) ((arg1)->hasXValues); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_hasYValues_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - bool arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - bool val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_hasYValues_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_hasYValues_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_hasYValues_set" "', argument " "2"" of type '" "bool""'"); - } - arg2 = static_cast< bool >(val2); - if (arg1) (arg1)->hasYValues = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_hasYValues_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_hasYValues_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (bool) ((arg1)->hasYValues); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_hasBounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - bool arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - bool val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_hasBounds_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_hasBounds_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiGrid_hasBounds_set" "', argument " "2"" of type '" "bool""'"); - } - arg2 = static_cast< bool >(val2); - if (arg1) (arg1)->hasBounds = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_hasBounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - bool result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_hasBounds_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (bool) ((arg1)->hasBounds); - resultobj = SWIG_From_bool(static_cast< bool >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_xvalues_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_xvalues_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xvalues_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xvalues_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); - } - arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); - if (arg1) (arg1)->xvalues = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_xvalues_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double,std::allocator< double > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xvalues_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (std::vector< double,std::allocator< double > > *)& ((arg1)->xvalues); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_yvalues_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_yvalues_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yvalues_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_yvalues_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); - } - arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); - if (arg1) (arg1)->yvalues = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_yvalues_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double,std::allocator< double > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yvalues_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (std::vector< double,std::allocator< double > > *)& ((arg1)->yvalues); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_xbounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_xbounds_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xbounds_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xbounds_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); - } - arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); - if (arg1) (arg1)->xbounds = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_xbounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double,std::allocator< double > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xbounds_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (std::vector< double,std::allocator< double > > *)& ((arg1)->xbounds); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_ybounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_ybounds_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ybounds_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_ybounds_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); - } - arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); - if (arg1) (arg1)->ybounds = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_ybounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double,std::allocator< double > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ybounds_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (std::vector< double,std::allocator< double > > *)& ((arg1)->ybounds); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_xname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_xname_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xname_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_xname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->xname = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_xname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xname_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (std::string *) & ((arg1)->xname); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_xlongname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_xlongname_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xlongname_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xlongname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_xlongname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->xlongname = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_xlongname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xlongname_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (std::string *) & ((arg1)->xlongname); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_xstdname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_xstdname_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xstdname_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xstdname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_xstdname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->xstdname = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_xstdname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xstdname_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (std::string *) & ((arg1)->xstdname); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_xunits_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_xunits_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xunits_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_xunits_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_xunits_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->xunits = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_xunits_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_xunits_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (std::string *) & ((arg1)->xunits); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_yname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_yname_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yname_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_yname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_yname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->yname = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_yname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yname_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (std::string *) & ((arg1)->yname); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_ylongname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_ylongname_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ylongname_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_ylongname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_ylongname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->ylongname = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_ylongname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ylongname_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (std::string *) & ((arg1)->ylongname); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_ystdname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_ystdname_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ystdname_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_ystdname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_ystdname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->ystdname = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_ystdname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_ystdname_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (std::string *) & ((arg1)->ystdname); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_yunits_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_yunits_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yunits_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_yunits_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_yunits_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->yunits = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_yunits_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_yunits_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (std::string *) & ((arg1)->yunits); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_name_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_name_set" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_name_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiGrid_name_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->name = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_name_get" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - result = (std::string *) & ((arg1)->name); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_getValues(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_getValues" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - (arg1)->getValues(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_getBounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_getBounds" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - (arg1)->getBounds(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_getValuesAsPointer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - double *arg2 = (double *) 0 ; - double *arg3 = (double *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_getValuesAsPointer", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_getValuesAsPointer" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_getValuesAsPointer" "', argument " "2"" of type '" "double *""'"); - } - arg2 = reinterpret_cast< double * >(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CdiGrid_getValuesAsPointer" "', argument " "3"" of type '" "double *""'"); - } - arg3 = reinterpret_cast< double * >(argp3); - (arg1)->getValuesAsPointer(arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_getBoundsAsPointer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - double *arg2 = (double *) 0 ; - double *arg3 = (double *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_getBoundsAsPointer", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_getBoundsAsPointer" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_getBoundsAsPointer" "', argument " "2"" of type '" "double *""'"); - } - arg2 = reinterpret_cast< double * >(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_double, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CdiGrid_getBoundsAsPointer" "', argument " "3"" of type '" "double *""'"); - } - arg3 = reinterpret_cast< double * >(argp3); - (arg1)->getBoundsAsPointer(arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_getFloatVals(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - float *arg2 = (float *) 0 ; - float *arg3 = (float *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_getFloatVals", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_getFloatVals" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_getFloatVals" "', argument " "2"" of type '" "float *""'"); - } - arg2 = reinterpret_cast< float * >(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CdiGrid_getFloatVals" "', argument " "3"" of type '" "float *""'"); - } - arg3 = reinterpret_cast< float * >(argp3); - (arg1)->getFloatVals(arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiGrid_getFloatBounds(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiGrid *arg1 = (CdiGrid *) 0 ; - float *arg2 = (float *) 0 ; - float *arg3 = (float *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; - PyObject *swig_obj[3] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiGrid_getFloatBounds", 3, 3, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiGrid_getFloatBounds" "', argument " "1"" of type '" "CdiGrid *""'"); - } - arg1 = reinterpret_cast< CdiGrid * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_float, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiGrid_getFloatBounds" "', argument " "2"" of type '" "float *""'"); - } - arg2 = reinterpret_cast< float * >(argp2); - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_float, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CdiGrid_getFloatBounds" "', argument " "3"" of type '" "float *""'"); - } - arg3 = reinterpret_cast< float * >(argp3); - (arg1)->getFloatBounds(arg2,arg3); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *CdiGrid_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_CdiGrid, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *CdiGrid_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_new_CdiTaxis__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { - PyObject *resultobj = 0; - CdiTaxis *result = 0 ; - - if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; - result = (CdiTaxis *)new CdiTaxis(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiTaxis, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_CdiTaxis__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - CdiTaxis *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_CdiTaxis" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - result = (CdiTaxis *)new CdiTaxis(arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiTaxis, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_CdiTaxis(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[2] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "new_CdiTaxis", 0, 1, argv))) SWIG_fail; - --argc; - if (argc == 0) { - return _wrap_new_CdiTaxis__SWIG_0(self, argc, argv); - } - if (argc == 1) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_CdiTaxis__SWIG_1(self, argc, argv); - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_CdiTaxis'.\n" - " Possible C/C++ prototypes are:\n" - " CdiTaxis::CdiTaxis()\n" - " CdiTaxis::CdiTaxis(int)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_delete_CdiTaxis(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CdiTaxis" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_taxisID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_taxisID_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_taxisID_set" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_taxisID_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->taxisID = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_taxisID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_taxisID_get" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - result = (int) ((arg1)->taxisID); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_ntsteps_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_ntsteps_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_ntsteps_set" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_ntsteps_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->ntsteps = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_ntsteps_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_ntsteps_get" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - result = (int) ((arg1)->ntsteps); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_unit_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_unit_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_unit_set" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_unit_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->unit = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_unit_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_unit_get" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - result = (int) ((arg1)->unit); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_rdate_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_rdate_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_rdate_set" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_rdate_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->rdate = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_rdate_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_rdate_get" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - result = (int) ((arg1)->rdate); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_rtime_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_rtime_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_rtime_set" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_rtime_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->rtime = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_rtime_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_rtime_get" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - result = (int) ((arg1)->rtime); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_vdate_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_vdate_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_vdate_set" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_vdate_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->vdate = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_vdate_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_vdate_get" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - result = (int) ((arg1)->vdate); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_vtime_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_vtime_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_vtime_set" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_vtime_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->vtime = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_vtime_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_vtime_get" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - result = (int) ((arg1)->vtime); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_type_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_type_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_type_set" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_type_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->type = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_type_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_type_get" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - result = (int) ((arg1)->type); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_calendar_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_calendar_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_calendar_set" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_calendar_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->calendar = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_calendar_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_calendar_get" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - result = (int) ((arg1)->calendar); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_hasBounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_hasBounds_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_hasBounds_set" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiTaxis_hasBounds_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->hasBounds = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_hasBounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_hasBounds_get" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - result = (int) ((arg1)->hasBounds); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - char *arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - char temp2[CDI_MAX_NAME] ; - int res2 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_name_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_name_set" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - res2 = SWIG_AsCharArray(swig_obj[1], temp2, CDI_MAX_NAME); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiTaxis_name_set" "', argument " "2"" of type '" "char [CDI_MAX_NAME]""'"); - } - arg2 = reinterpret_cast< char * >(temp2); - if (arg2) memcpy(arg1->name,arg2,CDI_MAX_NAME*sizeof(char)); - else memset(arg1->name,0,CDI_MAX_NAME*sizeof(char)); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_name_get" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - result = (char *)(char *) ((arg1)->name); - { - size_t size = SWIG_strnlen(result, CDI_MAX_NAME); - - - - resultobj = SWIG_FromCharPtrAndSize(result, size); - } - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_unitname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - char *arg2 = (char *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 ; - char *buf2 = 0 ; - int alloc2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiTaxis_unitname_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_unitname_set" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiTaxis_unitname_set" "', argument " "2"" of type '" "char const *""'"); - } - arg2 = reinterpret_cast< char * >(buf2); - if (arg2) { - size_t size = strlen(reinterpret_cast< const char * >(reinterpret_cast< const char * >(arg2))) + 1; - arg1->unitname = (char const *)reinterpret_cast< char* >(memcpy(new char[size], arg2, sizeof(char)*(size))); - } else { - arg1->unitname = 0; - } - resultobj = SWIG_Py_Void(); - if (alloc2 == SWIG_NEWOBJ) delete[] buf2; - return resultobj; -fail: - if (alloc2 == SWIG_NEWOBJ) delete[] buf2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiTaxis_unitname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiTaxis *arg1 = (CdiTaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - char *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiTaxis_unitname_get" "', argument " "1"" of type '" "CdiTaxis *""'"); - } - arg1 = reinterpret_cast< CdiTaxis * >(argp1); - result = (char *) ((arg1)->unitname); - resultobj = SWIG_FromCharPtr((const char *)result); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *CdiTaxis_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_CdiTaxis, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *CdiTaxis_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_new_CdiZaxis__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { - PyObject *resultobj = 0; - CdiZaxis *result = 0 ; - - if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; - result = (CdiZaxis *)new CdiZaxis(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiZaxis, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_CdiZaxis__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - int arg1 ; - int val1 ; - int ecode1 = 0 ; - CdiZaxis *result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_CdiZaxis" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - result = (CdiZaxis *)new CdiZaxis(arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiZaxis, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_CdiZaxis(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[2] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "new_CdiZaxis", 0, 1, argv))) SWIG_fail; - --argc; - if (argc == 0) { - return _wrap_new_CdiZaxis__SWIG_0(self, argc, argv); - } - if (argc == 1) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_CdiZaxis__SWIG_1(self, argc, argv); - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_CdiZaxis'.\n" - " Possible C/C++ prototypes are:\n" - " CdiZaxis::CdiZaxis()\n" - " CdiZaxis::CdiZaxis(int)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_delete_CdiZaxis(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CdiZaxis" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_zaxisID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_zaxisID_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_zaxisID_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiZaxis_zaxisID_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->zaxisID = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_zaxisID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_zaxisID_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (int) ((arg1)->zaxisID); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_type_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_type_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_type_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiZaxis_type_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->type = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_type_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_type_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (int) ((arg1)->type); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_ltype_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_ltype_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_ltype_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiZaxis_ltype_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->ltype = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_ltype_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_ltype_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (int) ((arg1)->ltype); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_size_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_size_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_size_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiZaxis_size_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->size = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_size_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_size_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (int) ((arg1)->size); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_prec_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_prec_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_prec_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiZaxis_prec_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->prec = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_prec_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_prec_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (int) ((arg1)->prec); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_plevels_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - double *arg2 = (double *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_plevels_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_plevels_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_plevels_set" "', argument " "2"" of type '" "double *""'"); - } - arg2 = reinterpret_cast< double * >(argp2); - if (arg1) (arg1)->plevels = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_plevels_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - double *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_plevels_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (double *) ((arg1)->plevels); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_plbounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - double *arg2 = (double *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_plbounds_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_plbounds_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_plbounds_set" "', argument " "2"" of type '" "double *""'"); - } - arg2 = reinterpret_cast< double * >(argp2); - if (arg1) (arg1)->plbounds = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_plbounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - double *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_plbounds_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (double *) ((arg1)->plbounds); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_pubounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - double *arg2 = (double *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_pubounds_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_pubounds_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_pubounds_set" "', argument " "2"" of type '" "double *""'"); - } - arg2 = reinterpret_cast< double * >(argp2); - if (arg1) (arg1)->pubounds = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_pubounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - double *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_pubounds_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (double *) ((arg1)->pubounds); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_pweights_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - double *arg2 = (double *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_pweights_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_pweights_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_double, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_pweights_set" "', argument " "2"" of type '" "double *""'"); - } - arg2 = reinterpret_cast< double * >(argp2); - if (arg1) (arg1)->pweights = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_pweights_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - double *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_pweights_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (double *) ((arg1)->pweights); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_levels_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_levels_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_levels_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_levels_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); - } - arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); - if (arg1) (arg1)->levels = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_levels_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double,std::allocator< double > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_levels_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (std::vector< double,std::allocator< double > > *)& ((arg1)->levels); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_lbounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_lbounds_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_lbounds_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_lbounds_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); - } - arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); - if (arg1) (arg1)->lbounds = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_lbounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double,std::allocator< double > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_lbounds_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (std::vector< double,std::allocator< double > > *)& ((arg1)->lbounds); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_ubounds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_ubounds_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_ubounds_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_ubounds_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); - } - arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); - if (arg1) (arg1)->ubounds = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_ubounds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double,std::allocator< double > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_ubounds_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (std::vector< double,std::allocator< double > > *)& ((arg1)->ubounds); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_weights_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_weights_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_weights_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_weights_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); - } - arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); - if (arg1) (arg1)->weights = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_weights_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double,std::allocator< double > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_weights_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (std::vector< double,std::allocator< double > > *)& ((arg1)->weights); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_name_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_name_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_name_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiZaxis_name_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->name = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_name_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (std::string *) & ((arg1)->name); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_longname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_longname_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_longname_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_longname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiZaxis_longname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->longname = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_longname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_longname_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (std::string *) & ((arg1)->longname); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_units_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiZaxis_units_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_units_set" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiZaxis_units_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiZaxis_units_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->units = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiZaxis_units_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiZaxis *arg1 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiZaxis_units_get" "', argument " "1"" of type '" "CdiZaxis *""'"); - } - arg1 = reinterpret_cast< CdiZaxis * >(argp1); - result = (std::string *) & ((arg1)->units); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *CdiZaxis_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_CdiZaxis, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *CdiZaxis_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_new_CdiVariable__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) { - PyObject *resultobj = 0; - CdiVariable *result = 0 ; - - if ((nobjs < 0) || (nobjs > 0)) SWIG_fail; - result = (CdiVariable *)new CdiVariable(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_CdiVariable__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - int arg1 ; - int arg2 ; - int arg3 ; - int val1 ; - int ecode1 = 0 ; - int val2 ; - int ecode2 = 0 ; - int val3 ; - int ecode3 = 0 ; - CdiVariable *result = 0 ; - - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - ecode1 = SWIG_AsVal_int(swig_obj[0], &val1); - if (!SWIG_IsOK(ecode1)) { - SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_CdiVariable" "', argument " "1"" of type '" "int""'"); - } - arg1 = static_cast< int >(val1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_CdiVariable" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - ecode3 = SWIG_AsVal_int(swig_obj[2], &val3); - if (!SWIG_IsOK(ecode3)) { - SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_CdiVariable" "', argument " "3"" of type '" "int""'"); - } - arg3 = static_cast< int >(val3); - result = (CdiVariable *)new CdiVariable(arg1,arg2,arg3); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiVariable, SWIG_POINTER_NEW | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_new_CdiVariable(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[4] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "new_CdiVariable", 0, 3, argv))) SWIG_fail; - --argc; - if (argc == 0) { - return _wrap_new_CdiVariable__SWIG_0(self, argc, argv); - } - if (argc == 3) { - int _v; - { - int res = SWIG_AsVal_int(argv[0], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - { - int res = SWIG_AsVal_int(argv[2], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_new_CdiVariable__SWIG_1(self, argc, argv); - } - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_CdiVariable'.\n" - " Possible C/C++ prototypes are:\n" - " CdiVariable::CdiVariable()\n" - " CdiVariable::CdiVariable(int,int,int)\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_delete_CdiVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CdiVariable" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_varID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_varID_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_varID_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_varID_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->varID = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_varID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_varID_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (int) ((arg1)->varID); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_zaxisID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_zaxisID_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_zaxisID_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_zaxisID_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->zaxisID = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_zaxisID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_zaxisID_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (int) ((arg1)->zaxisID); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_gridID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_gridID_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_gridID_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_gridID_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->gridID = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_gridID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_gridID_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (int) ((arg1)->gridID); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_taxisID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_taxisID_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_taxisID_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_taxisID_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->taxisID = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_taxisID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_taxisID_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (int) ((arg1)->taxisID); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_timeID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_timeID_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_timeID_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_timeID_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->timeID = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_timeID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_timeID_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (int) ((arg1)->timeID); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_vlistID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_vlistID_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_vlistID_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_vlistID_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->vlistID = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_vlistID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_vlistID_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (int) ((arg1)->vlistID); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_size_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_size_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_size_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_size_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->size = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_size_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_size_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (int) ((arg1)->size); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_code_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_code_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_code_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_code_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->code = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_code_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_code_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (int) ((arg1)->code); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_datatype_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_datatype_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_datatype_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_datatype_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->datatype = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_datatype_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_datatype_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (int) ((arg1)->datatype); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_streamID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_streamID_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_streamID_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_streamID_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->streamID = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_streamID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_streamID_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (int) ((arg1)->streamID); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_name_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_name_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_name_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiVariable_name_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->name = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_name_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (std::string *) & ((arg1)->name); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_longname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_longname_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_longname_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_longname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiVariable_longname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->longname = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_longname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_longname_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (std::string *) & ((arg1)->longname); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_units_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_units_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_units_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_units_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiVariable_units_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->units = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_units_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_units_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (std::string *) & ((arg1)->units); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_stdname_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - std::string *arg2 = 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - int res2 = SWIG_OLDOBJ ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_stdname_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_stdname_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - { - std::string *ptr = (std::string *)0; - res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_stdname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - if (!ptr) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CdiVariable_stdname_set" "', argument " "2"" of type '" "std::string const &""'"); - } - arg2 = ptr; - } - if (arg1) (arg1)->stdname = *arg2; - resultobj = SWIG_Py_Void(); - if (SWIG_IsNewObj(res2)) delete arg2; - return resultobj; -fail: - if (SWIG_IsNewObj(res2)) delete arg2; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_stdname_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::string *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_stdname_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (std::string *) & ((arg1)->stdname); - resultobj = SWIG_From_std_string(static_cast< std::string >(*result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_missval_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - double arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - double val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_missval_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_missval_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - ecode2 = SWIG_AsVal_double(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_missval_set" "', argument " "2"" of type '" "double""'"); - } - arg2 = static_cast< double >(val2); - if (arg1) (arg1)->missval = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_missval_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - double result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_missval_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (double) ((arg1)->missval); - resultobj = SWIG_From_double(static_cast< double >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_values_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - std::vector< double,std::allocator< double > > *arg2 = (std::vector< double,std::allocator< double > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_values_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_values_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_values_set" "', argument " "2"" of type '" "std::vector< double,std::allocator< double > > *""'"); - } - arg2 = reinterpret_cast< std::vector< double,std::allocator< double > > * >(argp2); - if (arg1) (arg1)->values = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_values_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< double,std::allocator< double > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_values_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (std::vector< double,std::allocator< double > > *)& ((arg1)->values); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_valuesWithLevel_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *arg2 = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_valuesWithLevel_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_valuesWithLevel_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_valuesWithLevel_set" "', argument " "2"" of type '" "std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *""'"); - } - arg2 = reinterpret_cast< std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > * >(argp2); - if (arg1) (arg1)->valuesWithLevel = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_valuesWithLevel_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_valuesWithLevel_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *)& ((arg1)->valuesWithLevel); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_grid_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - CdiGrid *arg2 = (CdiGrid *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_grid_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_grid_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_CdiGrid, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_grid_set" "', argument " "2"" of type '" "CdiGrid *""'"); - } - arg2 = reinterpret_cast< CdiGrid * >(argp2); - if (arg1) (arg1)->grid = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_grid_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - CdiGrid *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_grid_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (CdiGrid *)& ((arg1)->grid); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiGrid, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_zaxis_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - CdiZaxis *arg2 = (CdiZaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_zaxis_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_zaxis_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_CdiZaxis, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_zaxis_set" "', argument " "2"" of type '" "CdiZaxis *""'"); - } - arg2 = reinterpret_cast< CdiZaxis * >(argp2); - if (arg1) (arg1)->zaxis = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_zaxis_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - CdiZaxis *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_zaxis_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (CdiZaxis *)& ((arg1)->zaxis); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiZaxis, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_taxis_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - CdiTaxis *arg2 = (CdiTaxis *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "CdiVariable_taxis_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_taxis_set" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_CdiTaxis, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CdiVariable_taxis_set" "', argument " "2"" of type '" "CdiTaxis *""'"); - } - arg2 = reinterpret_cast< CdiTaxis * >(argp2); - if (arg1) (arg1)->taxis = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_taxis_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - CdiTaxis *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_taxis_get" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (CdiTaxis *)& ((arg1)->taxis); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CdiTaxis, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_sinfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_sinfo" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - (arg1)->sinfo(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_getValues(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getValues" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - (arg1)->getValues(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevel__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getValuesWithLevel" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_getValuesWithLevel" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - (arg1)->getValuesWithLevel(arg2); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevel__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getValuesWithLevel" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - (arg1)->getValuesWithLevel(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevel(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "CdiVariable_getValuesWithLevel", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 1) { - int _v; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_CdiVariable_getValuesWithLevel__SWIG_1(self, argc, argv); - } - } - if (argc == 2) { - int _v; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_CdiVariable_getValuesWithLevel__SWIG_0(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'CdiVariable_getValuesWithLevel'.\n" - " Possible C/C++ prototypes are:\n" - " CdiVariable::getValuesWithLevel(int)\n" - " CdiVariable::getValuesWithLevel()\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_getFValues(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - SwigValueWrapper< std::vector< float,std::allocator< float > > > result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getFValues" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (arg1)->getFValues(); - resultobj = SWIG_NewPointerObj((new std::vector< float,std::allocator< float > >(static_cast< const std::vector< float,std::allocator< float > >& >(result))), SWIGTYPE_p_std__vectorT_float_std__allocatorT_float_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_getFValuesWithLevel__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - SwigValueWrapper< std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > > > result; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getFValuesWithLevel" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_getFValuesWithLevel" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - result = (arg1)->getFValuesWithLevel(arg2); - resultobj = SWIG_NewPointerObj((new std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >(static_cast< const std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >& >(result))), SWIGTYPE_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_getFValuesWithLevel__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - SwigValueWrapper< std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > > > result; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getFValuesWithLevel" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (arg1)->getFValuesWithLevel(); - resultobj = SWIG_NewPointerObj((new std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >(static_cast< const std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > >& >(result))), SWIGTYPE_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, SWIG_POINTER_OWN | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_getFValuesWithLevel(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "CdiVariable_getFValuesWithLevel", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 1) { - int _v; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_CdiVariable_getFValuesWithLevel__SWIG_1(self, argc, argv); - } - } - if (argc == 2) { - int _v; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_CdiVariable_getFValuesWithLevel__SWIG_0(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'CdiVariable_getFValuesWithLevel'.\n" - " Possible C/C++ prototypes are:\n" - " CdiVariable::getFValuesWithLevel(int)\n" - " CdiVariable::getFValuesWithLevel()\n"); - return 0; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_getValuesAsPointer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - double *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getValuesAsPointer" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (double *)(arg1)->getValuesAsPointer(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_double, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevelAsPointer__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - double **result = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getValuesWithLevelAsPointer" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CdiVariable_getValuesWithLevelAsPointer" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - result = (double **)(arg1)->getValuesWithLevelAsPointer(arg2); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_double, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevelAsPointer__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - CdiVariable *arg1 = (CdiVariable *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - double **result = 0 ; - - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_CdiVariable, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CdiVariable_getValuesWithLevelAsPointer" "', argument " "1"" of type '" "CdiVariable *""'"); - } - arg1 = reinterpret_cast< CdiVariable * >(argp1); - result = (double **)(arg1)->getValuesWithLevelAsPointer(); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_double, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_CdiVariable_getValuesWithLevelAsPointer(PyObject *self, PyObject *args) { - Py_ssize_t argc; - PyObject *argv[3] = { - 0 - }; - - if (!(argc = SWIG_Python_UnpackTuple(args, "CdiVariable_getValuesWithLevelAsPointer", 0, 2, argv))) SWIG_fail; - --argc; - if (argc == 1) { - int _v; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_CdiVariable_getValuesWithLevelAsPointer__SWIG_1(self, argc, argv); - } - } - if (argc == 2) { - int _v; - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CdiVariable, 0); - _v = SWIG_CheckState(res); - if (_v) { - { - int res = SWIG_AsVal_int(argv[1], NULL); - _v = SWIG_CheckState(res); - } - if (_v) { - return _wrap_CdiVariable_getValuesWithLevelAsPointer__SWIG_0(self, argc, argv); - } - } - } - -fail: - SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'CdiVariable_getValuesWithLevelAsPointer'.\n" - " Possible C/C++ prototypes are:\n" - " CdiVariable::getValuesWithLevelAsPointer(int)\n" - " CdiVariable::getValuesWithLevelAsPointer()\n"); - return 0; -} - - -SWIGINTERN PyObject *CdiVariable_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_CdiVariable, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *CdiVariable_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -SWIGINTERN PyObject *_wrap_new_Cdi(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - char *arg1 = (char *) 0 ; - int res1 ; - char *buf1 = 0 ; - int alloc1 = 0 ; - PyObject *swig_obj[1] ; - Cdi *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Cdi" "', argument " "1"" of type '" "char const *""'"); - } - arg1 = reinterpret_cast< char * >(buf1); - result = (Cdi *)new Cdi((char const *)arg1); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Cdi, SWIG_POINTER_NEW | 0 ); - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return resultobj; -fail: - if (alloc1 == SWIG_NEWOBJ) delete[] buf1; - return NULL; -} - - -SWIGINTERN PyObject *_wrap_delete_Cdi(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, SWIG_POINTER_DISOWN | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Cdi" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - delete arg1; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_streamID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "Cdi_streamID_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_streamID_set" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cdi_streamID_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->streamID = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_streamID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_streamID_get" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - result = (int) ((arg1)->streamID); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_vlistID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "Cdi_vlistID_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_vlistID_set" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cdi_vlistID_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->vlistID = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_vlistID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_vlistID_get" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - result = (int) ((arg1)->vlistID); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_nvars_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "Cdi_nvars_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_nvars_set" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cdi_nvars_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->nvars = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_nvars_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_nvars_get" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - result = (int) ((arg1)->nvars); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_nzaxes_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "Cdi_nzaxes_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_nzaxes_set" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cdi_nzaxes_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->nzaxes = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_nzaxes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_nzaxes_get" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - result = (int) ((arg1)->nzaxes); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_ngrids_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "Cdi_ngrids_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_ngrids_set" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cdi_ngrids_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->ngrids = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_ngrids_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_ngrids_get" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - result = (int) ((arg1)->ngrids); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_ntaxes_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "Cdi_ntaxes_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_ntaxes_set" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cdi_ntaxes_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->ntaxes = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_ntaxes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_ntaxes_get" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - result = (int) ((arg1)->ntaxes); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_taxisID_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - int arg2 ; - void *argp1 = 0 ; - int res1 = 0 ; - int val2 ; - int ecode2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "Cdi_taxisID_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_taxisID_set" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Cdi_taxisID_set" "', argument " "2"" of type '" "int""'"); - } - arg2 = static_cast< int >(val2); - if (arg1) (arg1)->taxisID = arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_taxisID_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - int result; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_taxisID_get" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - result = (int) ((arg1)->taxisID); - resultobj = SWIG_From_int(static_cast< int >(result)); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_varnames_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - std::vector< std::string,std::allocator< std::string > > *arg2 = (std::vector< std::string,std::allocator< std::string > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "Cdi_varnames_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_varnames_set" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_varnames_set" "', argument " "2"" of type '" "std::vector< std::string,std::allocator< std::string > > *""'"); - } - arg2 = reinterpret_cast< std::vector< std::string,std::allocator< std::string > > * >(argp2); - if (arg1) (arg1)->varnames = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_varnames_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< std::string,std::allocator< std::string > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_varnames_get" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - result = (std::vector< std::string,std::allocator< std::string > > *)& ((arg1)->varnames); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_codes_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - std::vector< int,std::allocator< int > > *arg2 = (std::vector< int,std::allocator< int > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "Cdi_codes_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_codes_set" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_codes_set" "', argument " "2"" of type '" "std::vector< int,std::allocator< int > > *""'"); - } - arg2 = reinterpret_cast< std::vector< int,std::allocator< int > > * >(argp2); - if (arg1) (arg1)->codes = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_codes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< int,std::allocator< int > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_codes_get" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - result = (std::vector< int,std::allocator< int > > *)& ((arg1)->codes); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_variables_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - std::vector< CdiVariable,std::allocator< CdiVariable > > *arg2 = (std::vector< CdiVariable,std::allocator< CdiVariable > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "Cdi_variables_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_variables_set" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_variables_set" "', argument " "2"" of type '" "std::vector< CdiVariable,std::allocator< CdiVariable > > *""'"); - } - arg2 = reinterpret_cast< std::vector< CdiVariable,std::allocator< CdiVariable > > * >(argp2); - if (arg1) (arg1)->variables = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_variables_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::vector< CdiVariable,std::allocator< CdiVariable > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_variables_get" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - result = (std::vector< CdiVariable,std::allocator< CdiVariable > > *)& ((arg1)->variables); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_var_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *arg2 = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "Cdi_var_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_var_set" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_var_set" "', argument " "2"" of type '" "std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *""'"); - } - arg2 = reinterpret_cast< std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > * >(argp2); - if (arg1) (arg1)->var = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_var_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_var_get" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - result = (std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *)& ((arg1)->var); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_varByCode_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *arg2 = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "Cdi_varByCode_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_varByCode_set" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_varByCode_set" "', argument " "2"" of type '" "std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *""'"); - } - arg2 = reinterpret_cast< std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > * >(argp2); - if (arg1) (arg1)->varByCode = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_varByCode_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_varByCode_get" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - result = (std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *)& ((arg1)->varByCode); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_taxes_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *arg2 = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "Cdi_taxes_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_taxes_set" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_taxes_set" "', argument " "2"" of type '" "std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *""'"); - } - arg2 = reinterpret_cast< std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > * >(argp2); - if (arg1) (arg1)->taxes = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_taxes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_taxes_get" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - result = (std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *)& ((arg1)->taxes); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_zaxes_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *arg2 = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "Cdi_zaxes_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_zaxes_set" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_zaxes_set" "', argument " "2"" of type '" "std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *""'"); - } - arg2 = reinterpret_cast< std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > * >(argp2); - if (arg1) (arg1)->zaxes = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_zaxes_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_zaxes_get" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - result = (std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *)& ((arg1)->zaxes); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_grids_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *arg2 = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; - PyObject *swig_obj[2] ; - - if (!SWIG_Python_UnpackTuple(args, "Cdi_grids_set", 2, 2, swig_obj)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_grids_set" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Cdi_grids_set" "', argument " "2"" of type '" "std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *""'"); - } - arg2 = reinterpret_cast< std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > * >(argp2); - if (arg1) (arg1)->grids = *arg2; - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_grids_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *result = 0 ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_grids_get" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - result = (std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *)& ((arg1)->grids); - resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0 | 0 ); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Cdi_griddes(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *resultobj = 0; - Cdi *arg1 = (Cdi *) 0 ; - void *argp1 = 0 ; - int res1 = 0 ; - PyObject *swig_obj[1] ; - - if (!args) SWIG_fail; - swig_obj[0] = args; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Cdi, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Cdi_griddes" "', argument " "1"" of type '" "Cdi *""'"); - } - arg1 = reinterpret_cast< Cdi * >(argp1); - (arg1)->griddes(); - resultobj = SWIG_Py_Void(); - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *Cdi_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - PyObject *obj; - if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL; - SWIG_TypeNewClientData(SWIGTYPE_p_Cdi, SWIG_NewClientData(obj)); - return SWIG_Py_Void(); -} - -SWIGINTERN PyObject *Cdi_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { - return SWIG_Python_InitShadowInstance(args); -} - -static PyMethodDef SwigMethods[] = { - { "SWIG_PyInstanceMethod_New", SWIG_PyInstanceMethod_New, METH_O, NULL}, - { "delete_SwigPyIterator", _wrap_delete_SwigPyIterator, METH_O, NULL}, - { "SwigPyIterator_value", _wrap_SwigPyIterator_value, METH_O, NULL}, - { "SwigPyIterator_incr", _wrap_SwigPyIterator_incr, METH_VARARGS, NULL}, - { "SwigPyIterator_decr", _wrap_SwigPyIterator_decr, METH_VARARGS, NULL}, - { "SwigPyIterator_distance", _wrap_SwigPyIterator_distance, METH_VARARGS, NULL}, - { "SwigPyIterator_equal", _wrap_SwigPyIterator_equal, METH_VARARGS, NULL}, - { "SwigPyIterator_copy", _wrap_SwigPyIterator_copy, METH_O, NULL}, - { "SwigPyIterator_next", _wrap_SwigPyIterator_next, METH_O, NULL}, - { "SwigPyIterator___next__", _wrap_SwigPyIterator___next__, METH_O, NULL}, - { "SwigPyIterator_previous", _wrap_SwigPyIterator_previous, METH_O, NULL}, - { "SwigPyIterator_advance", _wrap_SwigPyIterator_advance, METH_VARARGS, NULL}, - { "SwigPyIterator___eq__", _wrap_SwigPyIterator___eq__, METH_VARARGS, NULL}, - { "SwigPyIterator___ne__", _wrap_SwigPyIterator___ne__, METH_VARARGS, NULL}, - { "SwigPyIterator___iadd__", _wrap_SwigPyIterator___iadd__, METH_VARARGS, NULL}, - { "SwigPyIterator___isub__", _wrap_SwigPyIterator___isub__, METH_VARARGS, NULL}, - { "SwigPyIterator___add__", _wrap_SwigPyIterator___add__, METH_VARARGS, NULL}, - { "SwigPyIterator___sub__", _wrap_SwigPyIterator___sub__, METH_VARARGS, NULL}, - { "SwigPyIterator_swigregister", SwigPyIterator_swigregister, METH_O, NULL}, - { "IntVector_iterator", _wrap_IntVector_iterator, METH_O, NULL}, - { "IntVector___nonzero__", _wrap_IntVector___nonzero__, METH_O, NULL}, - { "IntVector___bool__", _wrap_IntVector___bool__, METH_O, NULL}, - { "IntVector___len__", _wrap_IntVector___len__, METH_O, NULL}, - { "IntVector___getslice__", _wrap_IntVector___getslice__, METH_VARARGS, NULL}, - { "IntVector___setslice__", _wrap_IntVector___setslice__, METH_VARARGS, NULL}, - { "IntVector___delslice__", _wrap_IntVector___delslice__, METH_VARARGS, NULL}, - { "IntVector___delitem__", _wrap_IntVector___delitem__, METH_VARARGS, NULL}, - { "IntVector___getitem__", _wrap_IntVector___getitem__, METH_VARARGS, NULL}, - { "IntVector___setitem__", _wrap_IntVector___setitem__, METH_VARARGS, NULL}, - { "IntVector_pop", _wrap_IntVector_pop, METH_O, NULL}, - { "IntVector_append", _wrap_IntVector_append, METH_VARARGS, NULL}, - { "IntVector_empty", _wrap_IntVector_empty, METH_O, NULL}, - { "IntVector_size", _wrap_IntVector_size, METH_O, NULL}, - { "IntVector_swap", _wrap_IntVector_swap, METH_VARARGS, NULL}, - { "IntVector_begin", _wrap_IntVector_begin, METH_O, NULL}, - { "IntVector_end", _wrap_IntVector_end, METH_O, NULL}, - { "IntVector_rbegin", _wrap_IntVector_rbegin, METH_O, NULL}, - { "IntVector_rend", _wrap_IntVector_rend, METH_O, NULL}, - { "IntVector_clear", _wrap_IntVector_clear, METH_O, NULL}, - { "IntVector_get_allocator", _wrap_IntVector_get_allocator, METH_O, NULL}, - { "IntVector_pop_back", _wrap_IntVector_pop_back, METH_O, NULL}, - { "IntVector_erase", _wrap_IntVector_erase, METH_VARARGS, NULL}, - { "new_IntVector", _wrap_new_IntVector, METH_VARARGS, NULL}, - { "IntVector_push_back", _wrap_IntVector_push_back, METH_VARARGS, NULL}, - { "IntVector_front", _wrap_IntVector_front, METH_O, NULL}, - { "IntVector_back", _wrap_IntVector_back, METH_O, NULL}, - { "IntVector_assign", _wrap_IntVector_assign, METH_VARARGS, NULL}, - { "IntVector_resize", _wrap_IntVector_resize, METH_VARARGS, NULL}, - { "IntVector_insert", _wrap_IntVector_insert, METH_VARARGS, NULL}, - { "IntVector_reserve", _wrap_IntVector_reserve, METH_VARARGS, NULL}, - { "IntVector_capacity", _wrap_IntVector_capacity, METH_O, NULL}, - { "delete_IntVector", _wrap_delete_IntVector, METH_O, NULL}, - { "IntVector_swigregister", IntVector_swigregister, METH_O, NULL}, - { "IntVector_swiginit", IntVector_swiginit, METH_VARARGS, NULL}, - { "DoubleVector_iterator", _wrap_DoubleVector_iterator, METH_O, NULL}, - { "DoubleVector___nonzero__", _wrap_DoubleVector___nonzero__, METH_O, NULL}, - { "DoubleVector___bool__", _wrap_DoubleVector___bool__, METH_O, NULL}, - { "DoubleVector___len__", _wrap_DoubleVector___len__, METH_O, NULL}, - { "DoubleVector___getslice__", _wrap_DoubleVector___getslice__, METH_VARARGS, NULL}, - { "DoubleVector___setslice__", _wrap_DoubleVector___setslice__, METH_VARARGS, NULL}, - { "DoubleVector___delslice__", _wrap_DoubleVector___delslice__, METH_VARARGS, NULL}, - { "DoubleVector___delitem__", _wrap_DoubleVector___delitem__, METH_VARARGS, NULL}, - { "DoubleVector___getitem__", _wrap_DoubleVector___getitem__, METH_VARARGS, NULL}, - { "DoubleVector___setitem__", _wrap_DoubleVector___setitem__, METH_VARARGS, NULL}, - { "DoubleVector_pop", _wrap_DoubleVector_pop, METH_O, NULL}, - { "DoubleVector_append", _wrap_DoubleVector_append, METH_VARARGS, NULL}, - { "DoubleVector_empty", _wrap_DoubleVector_empty, METH_O, NULL}, - { "DoubleVector_size", _wrap_DoubleVector_size, METH_O, NULL}, - { "DoubleVector_swap", _wrap_DoubleVector_swap, METH_VARARGS, NULL}, - { "DoubleVector_begin", _wrap_DoubleVector_begin, METH_O, NULL}, - { "DoubleVector_end", _wrap_DoubleVector_end, METH_O, NULL}, - { "DoubleVector_rbegin", _wrap_DoubleVector_rbegin, METH_O, NULL}, - { "DoubleVector_rend", _wrap_DoubleVector_rend, METH_O, NULL}, - { "DoubleVector_clear", _wrap_DoubleVector_clear, METH_O, NULL}, - { "DoubleVector_get_allocator", _wrap_DoubleVector_get_allocator, METH_O, NULL}, - { "DoubleVector_pop_back", _wrap_DoubleVector_pop_back, METH_O, NULL}, - { "DoubleVector_erase", _wrap_DoubleVector_erase, METH_VARARGS, NULL}, - { "new_DoubleVector", _wrap_new_DoubleVector, METH_VARARGS, NULL}, - { "DoubleVector_push_back", _wrap_DoubleVector_push_back, METH_VARARGS, NULL}, - { "DoubleVector_front", _wrap_DoubleVector_front, METH_O, NULL}, - { "DoubleVector_back", _wrap_DoubleVector_back, METH_O, NULL}, - { "DoubleVector_assign", _wrap_DoubleVector_assign, METH_VARARGS, NULL}, - { "DoubleVector_resize", _wrap_DoubleVector_resize, METH_VARARGS, NULL}, - { "DoubleVector_insert", _wrap_DoubleVector_insert, METH_VARARGS, NULL}, - { "DoubleVector_reserve", _wrap_DoubleVector_reserve, METH_VARARGS, NULL}, - { "DoubleVector_capacity", _wrap_DoubleVector_capacity, METH_O, NULL}, - { "delete_DoubleVector", _wrap_delete_DoubleVector, METH_O, NULL}, - { "DoubleVector_swigregister", DoubleVector_swigregister, METH_O, NULL}, - { "DoubleVector_swiginit", DoubleVector_swiginit, METH_VARARGS, NULL}, - { "DoubleDoubleVector_iterator", _wrap_DoubleDoubleVector_iterator, METH_O, NULL}, - { "DoubleDoubleVector___nonzero__", _wrap_DoubleDoubleVector___nonzero__, METH_O, NULL}, - { "DoubleDoubleVector___bool__", _wrap_DoubleDoubleVector___bool__, METH_O, NULL}, - { "DoubleDoubleVector___len__", _wrap_DoubleDoubleVector___len__, METH_O, NULL}, - { "DoubleDoubleVector___getslice__", _wrap_DoubleDoubleVector___getslice__, METH_VARARGS, NULL}, - { "DoubleDoubleVector___setslice__", _wrap_DoubleDoubleVector___setslice__, METH_VARARGS, NULL}, - { "DoubleDoubleVector___delslice__", _wrap_DoubleDoubleVector___delslice__, METH_VARARGS, NULL}, - { "DoubleDoubleVector___delitem__", _wrap_DoubleDoubleVector___delitem__, METH_VARARGS, NULL}, - { "DoubleDoubleVector___getitem__", _wrap_DoubleDoubleVector___getitem__, METH_VARARGS, NULL}, - { "DoubleDoubleVector___setitem__", _wrap_DoubleDoubleVector___setitem__, METH_VARARGS, NULL}, - { "DoubleDoubleVector_pop", _wrap_DoubleDoubleVector_pop, METH_O, NULL}, - { "DoubleDoubleVector_append", _wrap_DoubleDoubleVector_append, METH_VARARGS, NULL}, - { "DoubleDoubleVector_empty", _wrap_DoubleDoubleVector_empty, METH_O, NULL}, - { "DoubleDoubleVector_size", _wrap_DoubleDoubleVector_size, METH_O, NULL}, - { "DoubleDoubleVector_swap", _wrap_DoubleDoubleVector_swap, METH_VARARGS, NULL}, - { "DoubleDoubleVector_begin", _wrap_DoubleDoubleVector_begin, METH_O, NULL}, - { "DoubleDoubleVector_end", _wrap_DoubleDoubleVector_end, METH_O, NULL}, - { "DoubleDoubleVector_rbegin", _wrap_DoubleDoubleVector_rbegin, METH_O, NULL}, - { "DoubleDoubleVector_rend", _wrap_DoubleDoubleVector_rend, METH_O, NULL}, - { "DoubleDoubleVector_clear", _wrap_DoubleDoubleVector_clear, METH_O, NULL}, - { "DoubleDoubleVector_get_allocator", _wrap_DoubleDoubleVector_get_allocator, METH_O, NULL}, - { "DoubleDoubleVector_pop_back", _wrap_DoubleDoubleVector_pop_back, METH_O, NULL}, - { "DoubleDoubleVector_erase", _wrap_DoubleDoubleVector_erase, METH_VARARGS, NULL}, - { "new_DoubleDoubleVector", _wrap_new_DoubleDoubleVector, METH_VARARGS, NULL}, - { "DoubleDoubleVector_push_back", _wrap_DoubleDoubleVector_push_back, METH_VARARGS, NULL}, - { "DoubleDoubleVector_front", _wrap_DoubleDoubleVector_front, METH_O, NULL}, - { "DoubleDoubleVector_back", _wrap_DoubleDoubleVector_back, METH_O, NULL}, - { "DoubleDoubleVector_assign", _wrap_DoubleDoubleVector_assign, METH_VARARGS, NULL}, - { "DoubleDoubleVector_resize", _wrap_DoubleDoubleVector_resize, METH_VARARGS, NULL}, - { "DoubleDoubleVector_insert", _wrap_DoubleDoubleVector_insert, METH_VARARGS, NULL}, - { "DoubleDoubleVector_reserve", _wrap_DoubleDoubleVector_reserve, METH_VARARGS, NULL}, - { "DoubleDoubleVector_capacity", _wrap_DoubleDoubleVector_capacity, METH_O, NULL}, - { "delete_DoubleDoubleVector", _wrap_delete_DoubleDoubleVector, METH_O, NULL}, - { "DoubleDoubleVector_swigregister", DoubleDoubleVector_swigregister, METH_O, NULL}, - { "DoubleDoubleVector_swiginit", DoubleDoubleVector_swiginit, METH_VARARGS, NULL}, - { "StringVector_iterator", _wrap_StringVector_iterator, METH_O, NULL}, - { "StringVector___nonzero__", _wrap_StringVector___nonzero__, METH_O, NULL}, - { "StringVector___bool__", _wrap_StringVector___bool__, METH_O, NULL}, - { "StringVector___len__", _wrap_StringVector___len__, METH_O, NULL}, - { "StringVector___getslice__", _wrap_StringVector___getslice__, METH_VARARGS, NULL}, - { "StringVector___setslice__", _wrap_StringVector___setslice__, METH_VARARGS, NULL}, - { "StringVector___delslice__", _wrap_StringVector___delslice__, METH_VARARGS, NULL}, - { "StringVector___delitem__", _wrap_StringVector___delitem__, METH_VARARGS, NULL}, - { "StringVector___getitem__", _wrap_StringVector___getitem__, METH_VARARGS, NULL}, - { "StringVector___setitem__", _wrap_StringVector___setitem__, METH_VARARGS, NULL}, - { "StringVector_pop", _wrap_StringVector_pop, METH_O, NULL}, - { "StringVector_append", _wrap_StringVector_append, METH_VARARGS, NULL}, - { "StringVector_empty", _wrap_StringVector_empty, METH_O, NULL}, - { "StringVector_size", _wrap_StringVector_size, METH_O, NULL}, - { "StringVector_swap", _wrap_StringVector_swap, METH_VARARGS, NULL}, - { "StringVector_begin", _wrap_StringVector_begin, METH_O, NULL}, - { "StringVector_end", _wrap_StringVector_end, METH_O, NULL}, - { "StringVector_rbegin", _wrap_StringVector_rbegin, METH_O, NULL}, - { "StringVector_rend", _wrap_StringVector_rend, METH_O, NULL}, - { "StringVector_clear", _wrap_StringVector_clear, METH_O, NULL}, - { "StringVector_get_allocator", _wrap_StringVector_get_allocator, METH_O, NULL}, - { "StringVector_pop_back", _wrap_StringVector_pop_back, METH_O, NULL}, - { "StringVector_erase", _wrap_StringVector_erase, METH_VARARGS, NULL}, - { "new_StringVector", _wrap_new_StringVector, METH_VARARGS, NULL}, - { "StringVector_push_back", _wrap_StringVector_push_back, METH_VARARGS, NULL}, - { "StringVector_front", _wrap_StringVector_front, METH_O, NULL}, - { "StringVector_back", _wrap_StringVector_back, METH_O, NULL}, - { "StringVector_assign", _wrap_StringVector_assign, METH_VARARGS, NULL}, - { "StringVector_resize", _wrap_StringVector_resize, METH_VARARGS, NULL}, - { "StringVector_insert", _wrap_StringVector_insert, METH_VARARGS, NULL}, - { "StringVector_reserve", _wrap_StringVector_reserve, METH_VARARGS, NULL}, - { "StringVector_capacity", _wrap_StringVector_capacity, METH_O, NULL}, - { "delete_StringVector", _wrap_delete_StringVector, METH_O, NULL}, - { "StringVector_swigregister", StringVector_swigregister, METH_O, NULL}, - { "StringVector_swiginit", StringVector_swiginit, METH_VARARGS, NULL}, - { "VarsVector_iterator", _wrap_VarsVector_iterator, METH_O, NULL}, - { "VarsVector___nonzero__", _wrap_VarsVector___nonzero__, METH_O, NULL}, - { "VarsVector___bool__", _wrap_VarsVector___bool__, METH_O, NULL}, - { "VarsVector___len__", _wrap_VarsVector___len__, METH_O, NULL}, - { "VarsVector___getslice__", _wrap_VarsVector___getslice__, METH_VARARGS, NULL}, - { "VarsVector___setslice__", _wrap_VarsVector___setslice__, METH_VARARGS, NULL}, - { "VarsVector___delslice__", _wrap_VarsVector___delslice__, METH_VARARGS, NULL}, - { "VarsVector___delitem__", _wrap_VarsVector___delitem__, METH_VARARGS, NULL}, - { "VarsVector___getitem__", _wrap_VarsVector___getitem__, METH_VARARGS, NULL}, - { "VarsVector___setitem__", _wrap_VarsVector___setitem__, METH_VARARGS, NULL}, - { "VarsVector_pop", _wrap_VarsVector_pop, METH_O, NULL}, - { "VarsVector_append", _wrap_VarsVector_append, METH_VARARGS, NULL}, - { "VarsVector_empty", _wrap_VarsVector_empty, METH_O, NULL}, - { "VarsVector_size", _wrap_VarsVector_size, METH_O, NULL}, - { "VarsVector_swap", _wrap_VarsVector_swap, METH_VARARGS, NULL}, - { "VarsVector_begin", _wrap_VarsVector_begin, METH_O, NULL}, - { "VarsVector_end", _wrap_VarsVector_end, METH_O, NULL}, - { "VarsVector_rbegin", _wrap_VarsVector_rbegin, METH_O, NULL}, - { "VarsVector_rend", _wrap_VarsVector_rend, METH_O, NULL}, - { "VarsVector_clear", _wrap_VarsVector_clear, METH_O, NULL}, - { "VarsVector_get_allocator", _wrap_VarsVector_get_allocator, METH_O, NULL}, - { "VarsVector_pop_back", _wrap_VarsVector_pop_back, METH_O, NULL}, - { "VarsVector_erase", _wrap_VarsVector_erase, METH_VARARGS, NULL}, - { "new_VarsVector", _wrap_new_VarsVector, METH_VARARGS, NULL}, - { "VarsVector_push_back", _wrap_VarsVector_push_back, METH_VARARGS, NULL}, - { "VarsVector_front", _wrap_VarsVector_front, METH_O, NULL}, - { "VarsVector_back", _wrap_VarsVector_back, METH_O, NULL}, - { "VarsVector_assign", _wrap_VarsVector_assign, METH_VARARGS, NULL}, - { "VarsVector_resize", _wrap_VarsVector_resize, METH_VARARGS, NULL}, - { "VarsVector_insert", _wrap_VarsVector_insert, METH_VARARGS, NULL}, - { "VarsVector_reserve", _wrap_VarsVector_reserve, METH_VARARGS, NULL}, - { "VarsVector_capacity", _wrap_VarsVector_capacity, METH_O, NULL}, - { "delete_VarsVector", _wrap_delete_VarsVector, METH_O, NULL}, - { "VarsVector_swigregister", VarsVector_swigregister, METH_O, NULL}, - { "VarsVector_swiginit", VarsVector_swiginit, METH_VARARGS, NULL}, - { "VarsMap_iterator", _wrap_VarsMap_iterator, METH_O, NULL}, - { "VarsMap___nonzero__", _wrap_VarsMap___nonzero__, METH_O, NULL}, - { "VarsMap___bool__", _wrap_VarsMap___bool__, METH_O, NULL}, - { "VarsMap___len__", _wrap_VarsMap___len__, METH_O, NULL}, - { "VarsMap___getitem__", _wrap_VarsMap___getitem__, METH_VARARGS, NULL}, - { "VarsMap___delitem__", _wrap_VarsMap___delitem__, METH_VARARGS, NULL}, - { "VarsMap_has_key", _wrap_VarsMap_has_key, METH_VARARGS, NULL}, - { "VarsMap_keys", _wrap_VarsMap_keys, METH_O, NULL}, - { "VarsMap_values", _wrap_VarsMap_values, METH_O, NULL}, - { "VarsMap_items", _wrap_VarsMap_items, METH_O, NULL}, - { "VarsMap___contains__", _wrap_VarsMap___contains__, METH_VARARGS, NULL}, - { "VarsMap_key_iterator", _wrap_VarsMap_key_iterator, METH_O, NULL}, - { "VarsMap_value_iterator", _wrap_VarsMap_value_iterator, METH_O, NULL}, - { "VarsMap___setitem__", _wrap_VarsMap___setitem__, METH_VARARGS, NULL}, - { "VarsMap_asdict", _wrap_VarsMap_asdict, METH_O, NULL}, - { "new_VarsMap", _wrap_new_VarsMap, METH_VARARGS, NULL}, - { "VarsMap_empty", _wrap_VarsMap_empty, METH_O, NULL}, - { "VarsMap_size", _wrap_VarsMap_size, METH_O, NULL}, - { "VarsMap_swap", _wrap_VarsMap_swap, METH_VARARGS, NULL}, - { "VarsMap_begin", _wrap_VarsMap_begin, METH_O, NULL}, - { "VarsMap_end", _wrap_VarsMap_end, METH_O, NULL}, - { "VarsMap_rbegin", _wrap_VarsMap_rbegin, METH_O, NULL}, - { "VarsMap_rend", _wrap_VarsMap_rend, METH_O, NULL}, - { "VarsMap_clear", _wrap_VarsMap_clear, METH_O, NULL}, - { "VarsMap_get_allocator", _wrap_VarsMap_get_allocator, METH_O, NULL}, - { "VarsMap_count", _wrap_VarsMap_count, METH_VARARGS, NULL}, - { "VarsMap_erase", _wrap_VarsMap_erase, METH_VARARGS, NULL}, - { "VarsMap_find", _wrap_VarsMap_find, METH_VARARGS, NULL}, - { "VarsMap_lower_bound", _wrap_VarsMap_lower_bound, METH_VARARGS, NULL}, - { "VarsMap_upper_bound", _wrap_VarsMap_upper_bound, METH_VARARGS, NULL}, - { "delete_VarsMap", _wrap_delete_VarsMap, METH_O, NULL}, - { "VarsMap_swigregister", VarsMap_swigregister, METH_O, NULL}, - { "VarsMap_swiginit", VarsMap_swiginit, METH_VARARGS, NULL}, - { "VarsByCode_iterator", _wrap_VarsByCode_iterator, METH_O, NULL}, - { "VarsByCode___nonzero__", _wrap_VarsByCode___nonzero__, METH_O, NULL}, - { "VarsByCode___bool__", _wrap_VarsByCode___bool__, METH_O, NULL}, - { "VarsByCode___len__", _wrap_VarsByCode___len__, METH_O, NULL}, - { "VarsByCode___getitem__", _wrap_VarsByCode___getitem__, METH_VARARGS, NULL}, - { "VarsByCode___delitem__", _wrap_VarsByCode___delitem__, METH_VARARGS, NULL}, - { "VarsByCode_has_key", _wrap_VarsByCode_has_key, METH_VARARGS, NULL}, - { "VarsByCode_keys", _wrap_VarsByCode_keys, METH_O, NULL}, - { "VarsByCode_values", _wrap_VarsByCode_values, METH_O, NULL}, - { "VarsByCode_items", _wrap_VarsByCode_items, METH_O, NULL}, - { "VarsByCode___contains__", _wrap_VarsByCode___contains__, METH_VARARGS, NULL}, - { "VarsByCode_key_iterator", _wrap_VarsByCode_key_iterator, METH_O, NULL}, - { "VarsByCode_value_iterator", _wrap_VarsByCode_value_iterator, METH_O, NULL}, - { "VarsByCode___setitem__", _wrap_VarsByCode___setitem__, METH_VARARGS, NULL}, - { "VarsByCode_asdict", _wrap_VarsByCode_asdict, METH_O, NULL}, - { "new_VarsByCode", _wrap_new_VarsByCode, METH_VARARGS, NULL}, - { "VarsByCode_empty", _wrap_VarsByCode_empty, METH_O, NULL}, - { "VarsByCode_size", _wrap_VarsByCode_size, METH_O, NULL}, - { "VarsByCode_swap", _wrap_VarsByCode_swap, METH_VARARGS, NULL}, - { "VarsByCode_begin", _wrap_VarsByCode_begin, METH_O, NULL}, - { "VarsByCode_end", _wrap_VarsByCode_end, METH_O, NULL}, - { "VarsByCode_rbegin", _wrap_VarsByCode_rbegin, METH_O, NULL}, - { "VarsByCode_rend", _wrap_VarsByCode_rend, METH_O, NULL}, - { "VarsByCode_clear", _wrap_VarsByCode_clear, METH_O, NULL}, - { "VarsByCode_get_allocator", _wrap_VarsByCode_get_allocator, METH_O, NULL}, - { "VarsByCode_count", _wrap_VarsByCode_count, METH_VARARGS, NULL}, - { "VarsByCode_erase", _wrap_VarsByCode_erase, METH_VARARGS, NULL}, - { "VarsByCode_find", _wrap_VarsByCode_find, METH_VARARGS, NULL}, - { "VarsByCode_lower_bound", _wrap_VarsByCode_lower_bound, METH_VARARGS, NULL}, - { "VarsByCode_upper_bound", _wrap_VarsByCode_upper_bound, METH_VARARGS, NULL}, - { "delete_VarsByCode", _wrap_delete_VarsByCode, METH_O, NULL}, - { "VarsByCode_swigregister", VarsByCode_swigregister, METH_O, NULL}, - { "VarsByCode_swiginit", VarsByCode_swiginit, METH_VARARGS, NULL}, - { "TaxesMap_iterator", _wrap_TaxesMap_iterator, METH_O, NULL}, - { "TaxesMap___nonzero__", _wrap_TaxesMap___nonzero__, METH_O, NULL}, - { "TaxesMap___bool__", _wrap_TaxesMap___bool__, METH_O, NULL}, - { "TaxesMap___len__", _wrap_TaxesMap___len__, METH_O, NULL}, - { "TaxesMap___getitem__", _wrap_TaxesMap___getitem__, METH_VARARGS, NULL}, - { "TaxesMap___delitem__", _wrap_TaxesMap___delitem__, METH_VARARGS, NULL}, - { "TaxesMap_has_key", _wrap_TaxesMap_has_key, METH_VARARGS, NULL}, - { "TaxesMap_keys", _wrap_TaxesMap_keys, METH_O, NULL}, - { "TaxesMap_values", _wrap_TaxesMap_values, METH_O, NULL}, - { "TaxesMap_items", _wrap_TaxesMap_items, METH_O, NULL}, - { "TaxesMap___contains__", _wrap_TaxesMap___contains__, METH_VARARGS, NULL}, - { "TaxesMap_key_iterator", _wrap_TaxesMap_key_iterator, METH_O, NULL}, - { "TaxesMap_value_iterator", _wrap_TaxesMap_value_iterator, METH_O, NULL}, - { "TaxesMap___setitem__", _wrap_TaxesMap___setitem__, METH_VARARGS, NULL}, - { "TaxesMap_asdict", _wrap_TaxesMap_asdict, METH_O, NULL}, - { "new_TaxesMap", _wrap_new_TaxesMap, METH_VARARGS, NULL}, - { "TaxesMap_empty", _wrap_TaxesMap_empty, METH_O, NULL}, - { "TaxesMap_size", _wrap_TaxesMap_size, METH_O, NULL}, - { "TaxesMap_swap", _wrap_TaxesMap_swap, METH_VARARGS, NULL}, - { "TaxesMap_begin", _wrap_TaxesMap_begin, METH_O, NULL}, - { "TaxesMap_end", _wrap_TaxesMap_end, METH_O, NULL}, - { "TaxesMap_rbegin", _wrap_TaxesMap_rbegin, METH_O, NULL}, - { "TaxesMap_rend", _wrap_TaxesMap_rend, METH_O, NULL}, - { "TaxesMap_clear", _wrap_TaxesMap_clear, METH_O, NULL}, - { "TaxesMap_get_allocator", _wrap_TaxesMap_get_allocator, METH_O, NULL}, - { "TaxesMap_count", _wrap_TaxesMap_count, METH_VARARGS, NULL}, - { "TaxesMap_erase", _wrap_TaxesMap_erase, METH_VARARGS, NULL}, - { "TaxesMap_find", _wrap_TaxesMap_find, METH_VARARGS, NULL}, - { "TaxesMap_lower_bound", _wrap_TaxesMap_lower_bound, METH_VARARGS, NULL}, - { "TaxesMap_upper_bound", _wrap_TaxesMap_upper_bound, METH_VARARGS, NULL}, - { "delete_TaxesMap", _wrap_delete_TaxesMap, METH_O, NULL}, - { "TaxesMap_swigregister", TaxesMap_swigregister, METH_O, NULL}, - { "TaxesMap_swiginit", TaxesMap_swiginit, METH_VARARGS, NULL}, - { "ZaxesMap_iterator", _wrap_ZaxesMap_iterator, METH_O, NULL}, - { "ZaxesMap___nonzero__", _wrap_ZaxesMap___nonzero__, METH_O, NULL}, - { "ZaxesMap___bool__", _wrap_ZaxesMap___bool__, METH_O, NULL}, - { "ZaxesMap___len__", _wrap_ZaxesMap___len__, METH_O, NULL}, - { "ZaxesMap___getitem__", _wrap_ZaxesMap___getitem__, METH_VARARGS, NULL}, - { "ZaxesMap___delitem__", _wrap_ZaxesMap___delitem__, METH_VARARGS, NULL}, - { "ZaxesMap_has_key", _wrap_ZaxesMap_has_key, METH_VARARGS, NULL}, - { "ZaxesMap_keys", _wrap_ZaxesMap_keys, METH_O, NULL}, - { "ZaxesMap_values", _wrap_ZaxesMap_values, METH_O, NULL}, - { "ZaxesMap_items", _wrap_ZaxesMap_items, METH_O, NULL}, - { "ZaxesMap___contains__", _wrap_ZaxesMap___contains__, METH_VARARGS, NULL}, - { "ZaxesMap_key_iterator", _wrap_ZaxesMap_key_iterator, METH_O, NULL}, - { "ZaxesMap_value_iterator", _wrap_ZaxesMap_value_iterator, METH_O, NULL}, - { "ZaxesMap___setitem__", _wrap_ZaxesMap___setitem__, METH_VARARGS, NULL}, - { "ZaxesMap_asdict", _wrap_ZaxesMap_asdict, METH_O, NULL}, - { "new_ZaxesMap", _wrap_new_ZaxesMap, METH_VARARGS, NULL}, - { "ZaxesMap_empty", _wrap_ZaxesMap_empty, METH_O, NULL}, - { "ZaxesMap_size", _wrap_ZaxesMap_size, METH_O, NULL}, - { "ZaxesMap_swap", _wrap_ZaxesMap_swap, METH_VARARGS, NULL}, - { "ZaxesMap_begin", _wrap_ZaxesMap_begin, METH_O, NULL}, - { "ZaxesMap_end", _wrap_ZaxesMap_end, METH_O, NULL}, - { "ZaxesMap_rbegin", _wrap_ZaxesMap_rbegin, METH_O, NULL}, - { "ZaxesMap_rend", _wrap_ZaxesMap_rend, METH_O, NULL}, - { "ZaxesMap_clear", _wrap_ZaxesMap_clear, METH_O, NULL}, - { "ZaxesMap_get_allocator", _wrap_ZaxesMap_get_allocator, METH_O, NULL}, - { "ZaxesMap_count", _wrap_ZaxesMap_count, METH_VARARGS, NULL}, - { "ZaxesMap_erase", _wrap_ZaxesMap_erase, METH_VARARGS, NULL}, - { "ZaxesMap_find", _wrap_ZaxesMap_find, METH_VARARGS, NULL}, - { "ZaxesMap_lower_bound", _wrap_ZaxesMap_lower_bound, METH_VARARGS, NULL}, - { "ZaxesMap_upper_bound", _wrap_ZaxesMap_upper_bound, METH_VARARGS, NULL}, - { "delete_ZaxesMap", _wrap_delete_ZaxesMap, METH_O, NULL}, - { "ZaxesMap_swigregister", ZaxesMap_swigregister, METH_O, NULL}, - { "ZaxesMap_swiginit", ZaxesMap_swiginit, METH_VARARGS, NULL}, - { "GridsMap_iterator", _wrap_GridsMap_iterator, METH_O, NULL}, - { "GridsMap___nonzero__", _wrap_GridsMap___nonzero__, METH_O, NULL}, - { "GridsMap___bool__", _wrap_GridsMap___bool__, METH_O, NULL}, - { "GridsMap___len__", _wrap_GridsMap___len__, METH_O, NULL}, - { "GridsMap___getitem__", _wrap_GridsMap___getitem__, METH_VARARGS, NULL}, - { "GridsMap___delitem__", _wrap_GridsMap___delitem__, METH_VARARGS, NULL}, - { "GridsMap_has_key", _wrap_GridsMap_has_key, METH_VARARGS, NULL}, - { "GridsMap_keys", _wrap_GridsMap_keys, METH_O, NULL}, - { "GridsMap_values", _wrap_GridsMap_values, METH_O, NULL}, - { "GridsMap_items", _wrap_GridsMap_items, METH_O, NULL}, - { "GridsMap___contains__", _wrap_GridsMap___contains__, METH_VARARGS, NULL}, - { "GridsMap_key_iterator", _wrap_GridsMap_key_iterator, METH_O, NULL}, - { "GridsMap_value_iterator", _wrap_GridsMap_value_iterator, METH_O, NULL}, - { "GridsMap___setitem__", _wrap_GridsMap___setitem__, METH_VARARGS, NULL}, - { "GridsMap_asdict", _wrap_GridsMap_asdict, METH_O, NULL}, - { "new_GridsMap", _wrap_new_GridsMap, METH_VARARGS, NULL}, - { "GridsMap_empty", _wrap_GridsMap_empty, METH_O, NULL}, - { "GridsMap_size", _wrap_GridsMap_size, METH_O, NULL}, - { "GridsMap_swap", _wrap_GridsMap_swap, METH_VARARGS, NULL}, - { "GridsMap_begin", _wrap_GridsMap_begin, METH_O, NULL}, - { "GridsMap_end", _wrap_GridsMap_end, METH_O, NULL}, - { "GridsMap_rbegin", _wrap_GridsMap_rbegin, METH_O, NULL}, - { "GridsMap_rend", _wrap_GridsMap_rend, METH_O, NULL}, - { "GridsMap_clear", _wrap_GridsMap_clear, METH_O, NULL}, - { "GridsMap_get_allocator", _wrap_GridsMap_get_allocator, METH_O, NULL}, - { "GridsMap_count", _wrap_GridsMap_count, METH_VARARGS, NULL}, - { "GridsMap_erase", _wrap_GridsMap_erase, METH_VARARGS, NULL}, - { "GridsMap_find", _wrap_GridsMap_find, METH_VARARGS, NULL}, - { "GridsMap_lower_bound", _wrap_GridsMap_lower_bound, METH_VARARGS, NULL}, - { "GridsMap_upper_bound", _wrap_GridsMap_upper_bound, METH_VARARGS, NULL}, - { "delete_GridsMap", _wrap_delete_GridsMap, METH_O, NULL}, - { "GridsMap_swigregister", GridsMap_swigregister, METH_O, NULL}, - { "GridsMap_swiginit", GridsMap_swiginit, METH_VARARGS, NULL}, - { "new_CdiGrid", _wrap_new_CdiGrid, METH_VARARGS, NULL}, - { "delete_CdiGrid", _wrap_delete_CdiGrid, METH_O, NULL}, - { "CdiGrid_gridID_set", _wrap_CdiGrid_gridID_set, METH_VARARGS, NULL}, - { "CdiGrid_gridID_get", _wrap_CdiGrid_gridID_get, METH_O, NULL}, - { "CdiGrid_type_set", _wrap_CdiGrid_type_set, METH_VARARGS, NULL}, - { "CdiGrid_type_get", _wrap_CdiGrid_type_get, METH_O, NULL}, - { "CdiGrid_size_set", _wrap_CdiGrid_size_set, METH_VARARGS, NULL}, - { "CdiGrid_size_get", _wrap_CdiGrid_size_get, METH_O, NULL}, - { "CdiGrid_xsize_set", _wrap_CdiGrid_xsize_set, METH_VARARGS, NULL}, - { "CdiGrid_xsize_get", _wrap_CdiGrid_xsize_get, METH_O, NULL}, - { "CdiGrid_ysize_set", _wrap_CdiGrid_ysize_set, METH_VARARGS, NULL}, - { "CdiGrid_ysize_get", _wrap_CdiGrid_ysize_get, METH_O, NULL}, - { "CdiGrid_prec_set", _wrap_CdiGrid_prec_set, METH_VARARGS, NULL}, - { "CdiGrid_prec_get", _wrap_CdiGrid_prec_get, METH_O, NULL}, - { "CdiGrid_ncorner_set", _wrap_CdiGrid_ncorner_set, METH_VARARGS, NULL}, - { "CdiGrid_ncorner_get", _wrap_CdiGrid_ncorner_get, METH_O, NULL}, - { "CdiGrid_hasXValues_set", _wrap_CdiGrid_hasXValues_set, METH_VARARGS, NULL}, - { "CdiGrid_hasXValues_get", _wrap_CdiGrid_hasXValues_get, METH_O, NULL}, - { "CdiGrid_hasYValues_set", _wrap_CdiGrid_hasYValues_set, METH_VARARGS, NULL}, - { "CdiGrid_hasYValues_get", _wrap_CdiGrid_hasYValues_get, METH_O, NULL}, - { "CdiGrid_hasBounds_set", _wrap_CdiGrid_hasBounds_set, METH_VARARGS, NULL}, - { "CdiGrid_hasBounds_get", _wrap_CdiGrid_hasBounds_get, METH_O, NULL}, - { "CdiGrid_xvalues_set", _wrap_CdiGrid_xvalues_set, METH_VARARGS, NULL}, - { "CdiGrid_xvalues_get", _wrap_CdiGrid_xvalues_get, METH_O, NULL}, - { "CdiGrid_yvalues_set", _wrap_CdiGrid_yvalues_set, METH_VARARGS, NULL}, - { "CdiGrid_yvalues_get", _wrap_CdiGrid_yvalues_get, METH_O, NULL}, - { "CdiGrid_xbounds_set", _wrap_CdiGrid_xbounds_set, METH_VARARGS, NULL}, - { "CdiGrid_xbounds_get", _wrap_CdiGrid_xbounds_get, METH_O, NULL}, - { "CdiGrid_ybounds_set", _wrap_CdiGrid_ybounds_set, METH_VARARGS, NULL}, - { "CdiGrid_ybounds_get", _wrap_CdiGrid_ybounds_get, METH_O, NULL}, - { "CdiGrid_xname_set", _wrap_CdiGrid_xname_set, METH_VARARGS, NULL}, - { "CdiGrid_xname_get", _wrap_CdiGrid_xname_get, METH_O, NULL}, - { "CdiGrid_xlongname_set", _wrap_CdiGrid_xlongname_set, METH_VARARGS, NULL}, - { "CdiGrid_xlongname_get", _wrap_CdiGrid_xlongname_get, METH_O, NULL}, - { "CdiGrid_xstdname_set", _wrap_CdiGrid_xstdname_set, METH_VARARGS, NULL}, - { "CdiGrid_xstdname_get", _wrap_CdiGrid_xstdname_get, METH_O, NULL}, - { "CdiGrid_xunits_set", _wrap_CdiGrid_xunits_set, METH_VARARGS, NULL}, - { "CdiGrid_xunits_get", _wrap_CdiGrid_xunits_get, METH_O, NULL}, - { "CdiGrid_yname_set", _wrap_CdiGrid_yname_set, METH_VARARGS, NULL}, - { "CdiGrid_yname_get", _wrap_CdiGrid_yname_get, METH_O, NULL}, - { "CdiGrid_ylongname_set", _wrap_CdiGrid_ylongname_set, METH_VARARGS, NULL}, - { "CdiGrid_ylongname_get", _wrap_CdiGrid_ylongname_get, METH_O, NULL}, - { "CdiGrid_ystdname_set", _wrap_CdiGrid_ystdname_set, METH_VARARGS, NULL}, - { "CdiGrid_ystdname_get", _wrap_CdiGrid_ystdname_get, METH_O, NULL}, - { "CdiGrid_yunits_set", _wrap_CdiGrid_yunits_set, METH_VARARGS, NULL}, - { "CdiGrid_yunits_get", _wrap_CdiGrid_yunits_get, METH_O, NULL}, - { "CdiGrid_name_set", _wrap_CdiGrid_name_set, METH_VARARGS, NULL}, - { "CdiGrid_name_get", _wrap_CdiGrid_name_get, METH_O, NULL}, - { "CdiGrid_getValues", _wrap_CdiGrid_getValues, METH_O, NULL}, - { "CdiGrid_getBounds", _wrap_CdiGrid_getBounds, METH_O, NULL}, - { "CdiGrid_getValuesAsPointer", _wrap_CdiGrid_getValuesAsPointer, METH_VARARGS, NULL}, - { "CdiGrid_getBoundsAsPointer", _wrap_CdiGrid_getBoundsAsPointer, METH_VARARGS, NULL}, - { "CdiGrid_getFloatVals", _wrap_CdiGrid_getFloatVals, METH_VARARGS, NULL}, - { "CdiGrid_getFloatBounds", _wrap_CdiGrid_getFloatBounds, METH_VARARGS, NULL}, - { "CdiGrid_swigregister", CdiGrid_swigregister, METH_O, NULL}, - { "CdiGrid_swiginit", CdiGrid_swiginit, METH_VARARGS, NULL}, - { "new_CdiTaxis", _wrap_new_CdiTaxis, METH_VARARGS, NULL}, - { "delete_CdiTaxis", _wrap_delete_CdiTaxis, METH_O, NULL}, - { "CdiTaxis_taxisID_set", _wrap_CdiTaxis_taxisID_set, METH_VARARGS, NULL}, - { "CdiTaxis_taxisID_get", _wrap_CdiTaxis_taxisID_get, METH_O, NULL}, - { "CdiTaxis_ntsteps_set", _wrap_CdiTaxis_ntsteps_set, METH_VARARGS, NULL}, - { "CdiTaxis_ntsteps_get", _wrap_CdiTaxis_ntsteps_get, METH_O, NULL}, - { "CdiTaxis_unit_set", _wrap_CdiTaxis_unit_set, METH_VARARGS, NULL}, - { "CdiTaxis_unit_get", _wrap_CdiTaxis_unit_get, METH_O, NULL}, - { "CdiTaxis_rdate_set", _wrap_CdiTaxis_rdate_set, METH_VARARGS, NULL}, - { "CdiTaxis_rdate_get", _wrap_CdiTaxis_rdate_get, METH_O, NULL}, - { "CdiTaxis_rtime_set", _wrap_CdiTaxis_rtime_set, METH_VARARGS, NULL}, - { "CdiTaxis_rtime_get", _wrap_CdiTaxis_rtime_get, METH_O, NULL}, - { "CdiTaxis_vdate_set", _wrap_CdiTaxis_vdate_set, METH_VARARGS, NULL}, - { "CdiTaxis_vdate_get", _wrap_CdiTaxis_vdate_get, METH_O, NULL}, - { "CdiTaxis_vtime_set", _wrap_CdiTaxis_vtime_set, METH_VARARGS, NULL}, - { "CdiTaxis_vtime_get", _wrap_CdiTaxis_vtime_get, METH_O, NULL}, - { "CdiTaxis_type_set", _wrap_CdiTaxis_type_set, METH_VARARGS, NULL}, - { "CdiTaxis_type_get", _wrap_CdiTaxis_type_get, METH_O, NULL}, - { "CdiTaxis_calendar_set", _wrap_CdiTaxis_calendar_set, METH_VARARGS, NULL}, - { "CdiTaxis_calendar_get", _wrap_CdiTaxis_calendar_get, METH_O, NULL}, - { "CdiTaxis_hasBounds_set", _wrap_CdiTaxis_hasBounds_set, METH_VARARGS, NULL}, - { "CdiTaxis_hasBounds_get", _wrap_CdiTaxis_hasBounds_get, METH_O, NULL}, - { "CdiTaxis_name_set", _wrap_CdiTaxis_name_set, METH_VARARGS, NULL}, - { "CdiTaxis_name_get", _wrap_CdiTaxis_name_get, METH_O, NULL}, - { "CdiTaxis_unitname_set", _wrap_CdiTaxis_unitname_set, METH_VARARGS, NULL}, - { "CdiTaxis_unitname_get", _wrap_CdiTaxis_unitname_get, METH_O, NULL}, - { "CdiTaxis_swigregister", CdiTaxis_swigregister, METH_O, NULL}, - { "CdiTaxis_swiginit", CdiTaxis_swiginit, METH_VARARGS, NULL}, - { "new_CdiZaxis", _wrap_new_CdiZaxis, METH_VARARGS, NULL}, - { "delete_CdiZaxis", _wrap_delete_CdiZaxis, METH_O, NULL}, - { "CdiZaxis_zaxisID_set", _wrap_CdiZaxis_zaxisID_set, METH_VARARGS, NULL}, - { "CdiZaxis_zaxisID_get", _wrap_CdiZaxis_zaxisID_get, METH_O, NULL}, - { "CdiZaxis_type_set", _wrap_CdiZaxis_type_set, METH_VARARGS, NULL}, - { "CdiZaxis_type_get", _wrap_CdiZaxis_type_get, METH_O, NULL}, - { "CdiZaxis_ltype_set", _wrap_CdiZaxis_ltype_set, METH_VARARGS, NULL}, - { "CdiZaxis_ltype_get", _wrap_CdiZaxis_ltype_get, METH_O, NULL}, - { "CdiZaxis_size_set", _wrap_CdiZaxis_size_set, METH_VARARGS, NULL}, - { "CdiZaxis_size_get", _wrap_CdiZaxis_size_get, METH_O, NULL}, - { "CdiZaxis_prec_set", _wrap_CdiZaxis_prec_set, METH_VARARGS, NULL}, - { "CdiZaxis_prec_get", _wrap_CdiZaxis_prec_get, METH_O, NULL}, - { "CdiZaxis_plevels_set", _wrap_CdiZaxis_plevels_set, METH_VARARGS, NULL}, - { "CdiZaxis_plevels_get", _wrap_CdiZaxis_plevels_get, METH_O, NULL}, - { "CdiZaxis_plbounds_set", _wrap_CdiZaxis_plbounds_set, METH_VARARGS, NULL}, - { "CdiZaxis_plbounds_get", _wrap_CdiZaxis_plbounds_get, METH_O, NULL}, - { "CdiZaxis_pubounds_set", _wrap_CdiZaxis_pubounds_set, METH_VARARGS, NULL}, - { "CdiZaxis_pubounds_get", _wrap_CdiZaxis_pubounds_get, METH_O, NULL}, - { "CdiZaxis_pweights_set", _wrap_CdiZaxis_pweights_set, METH_VARARGS, NULL}, - { "CdiZaxis_pweights_get", _wrap_CdiZaxis_pweights_get, METH_O, NULL}, - { "CdiZaxis_levels_set", _wrap_CdiZaxis_levels_set, METH_VARARGS, NULL}, - { "CdiZaxis_levels_get", _wrap_CdiZaxis_levels_get, METH_O, NULL}, - { "CdiZaxis_lbounds_set", _wrap_CdiZaxis_lbounds_set, METH_VARARGS, NULL}, - { "CdiZaxis_lbounds_get", _wrap_CdiZaxis_lbounds_get, METH_O, NULL}, - { "CdiZaxis_ubounds_set", _wrap_CdiZaxis_ubounds_set, METH_VARARGS, NULL}, - { "CdiZaxis_ubounds_get", _wrap_CdiZaxis_ubounds_get, METH_O, NULL}, - { "CdiZaxis_weights_set", _wrap_CdiZaxis_weights_set, METH_VARARGS, NULL}, - { "CdiZaxis_weights_get", _wrap_CdiZaxis_weights_get, METH_O, NULL}, - { "CdiZaxis_name_set", _wrap_CdiZaxis_name_set, METH_VARARGS, NULL}, - { "CdiZaxis_name_get", _wrap_CdiZaxis_name_get, METH_O, NULL}, - { "CdiZaxis_longname_set", _wrap_CdiZaxis_longname_set, METH_VARARGS, NULL}, - { "CdiZaxis_longname_get", _wrap_CdiZaxis_longname_get, METH_O, NULL}, - { "CdiZaxis_units_set", _wrap_CdiZaxis_units_set, METH_VARARGS, NULL}, - { "CdiZaxis_units_get", _wrap_CdiZaxis_units_get, METH_O, NULL}, - { "CdiZaxis_swigregister", CdiZaxis_swigregister, METH_O, NULL}, - { "CdiZaxis_swiginit", CdiZaxis_swiginit, METH_VARARGS, NULL}, - { "new_CdiVariable", _wrap_new_CdiVariable, METH_VARARGS, NULL}, - { "delete_CdiVariable", _wrap_delete_CdiVariable, METH_O, NULL}, - { "CdiVariable_varID_set", _wrap_CdiVariable_varID_set, METH_VARARGS, NULL}, - { "CdiVariable_varID_get", _wrap_CdiVariable_varID_get, METH_O, NULL}, - { "CdiVariable_zaxisID_set", _wrap_CdiVariable_zaxisID_set, METH_VARARGS, NULL}, - { "CdiVariable_zaxisID_get", _wrap_CdiVariable_zaxisID_get, METH_O, NULL}, - { "CdiVariable_gridID_set", _wrap_CdiVariable_gridID_set, METH_VARARGS, NULL}, - { "CdiVariable_gridID_get", _wrap_CdiVariable_gridID_get, METH_O, NULL}, - { "CdiVariable_taxisID_set", _wrap_CdiVariable_taxisID_set, METH_VARARGS, NULL}, - { "CdiVariable_taxisID_get", _wrap_CdiVariable_taxisID_get, METH_O, NULL}, - { "CdiVariable_timeID_set", _wrap_CdiVariable_timeID_set, METH_VARARGS, NULL}, - { "CdiVariable_timeID_get", _wrap_CdiVariable_timeID_get, METH_O, NULL}, - { "CdiVariable_vlistID_set", _wrap_CdiVariable_vlistID_set, METH_VARARGS, NULL}, - { "CdiVariable_vlistID_get", _wrap_CdiVariable_vlistID_get, METH_O, NULL}, - { "CdiVariable_size_set", _wrap_CdiVariable_size_set, METH_VARARGS, NULL}, - { "CdiVariable_size_get", _wrap_CdiVariable_size_get, METH_O, NULL}, - { "CdiVariable_code_set", _wrap_CdiVariable_code_set, METH_VARARGS, NULL}, - { "CdiVariable_code_get", _wrap_CdiVariable_code_get, METH_O, NULL}, - { "CdiVariable_datatype_set", _wrap_CdiVariable_datatype_set, METH_VARARGS, NULL}, - { "CdiVariable_datatype_get", _wrap_CdiVariable_datatype_get, METH_O, NULL}, - { "CdiVariable_streamID_set", _wrap_CdiVariable_streamID_set, METH_VARARGS, NULL}, - { "CdiVariable_streamID_get", _wrap_CdiVariable_streamID_get, METH_O, NULL}, - { "CdiVariable_name_set", _wrap_CdiVariable_name_set, METH_VARARGS, NULL}, - { "CdiVariable_name_get", _wrap_CdiVariable_name_get, METH_O, NULL}, - { "CdiVariable_longname_set", _wrap_CdiVariable_longname_set, METH_VARARGS, NULL}, - { "CdiVariable_longname_get", _wrap_CdiVariable_longname_get, METH_O, NULL}, - { "CdiVariable_units_set", _wrap_CdiVariable_units_set, METH_VARARGS, NULL}, - { "CdiVariable_units_get", _wrap_CdiVariable_units_get, METH_O, NULL}, - { "CdiVariable_stdname_set", _wrap_CdiVariable_stdname_set, METH_VARARGS, NULL}, - { "CdiVariable_stdname_get", _wrap_CdiVariable_stdname_get, METH_O, NULL}, - { "CdiVariable_missval_set", _wrap_CdiVariable_missval_set, METH_VARARGS, NULL}, - { "CdiVariable_missval_get", _wrap_CdiVariable_missval_get, METH_O, NULL}, - { "CdiVariable_values_set", _wrap_CdiVariable_values_set, METH_VARARGS, NULL}, - { "CdiVariable_values_get", _wrap_CdiVariable_values_get, METH_O, NULL}, - { "CdiVariable_valuesWithLevel_set", _wrap_CdiVariable_valuesWithLevel_set, METH_VARARGS, NULL}, - { "CdiVariable_valuesWithLevel_get", _wrap_CdiVariable_valuesWithLevel_get, METH_O, NULL}, - { "CdiVariable_grid_set", _wrap_CdiVariable_grid_set, METH_VARARGS, NULL}, - { "CdiVariable_grid_get", _wrap_CdiVariable_grid_get, METH_O, NULL}, - { "CdiVariable_zaxis_set", _wrap_CdiVariable_zaxis_set, METH_VARARGS, NULL}, - { "CdiVariable_zaxis_get", _wrap_CdiVariable_zaxis_get, METH_O, NULL}, - { "CdiVariable_taxis_set", _wrap_CdiVariable_taxis_set, METH_VARARGS, NULL}, - { "CdiVariable_taxis_get", _wrap_CdiVariable_taxis_get, METH_O, NULL}, - { "CdiVariable_sinfo", _wrap_CdiVariable_sinfo, METH_O, NULL}, - { "CdiVariable_getValues", _wrap_CdiVariable_getValues, METH_O, NULL}, - { "CdiVariable_getValuesWithLevel", _wrap_CdiVariable_getValuesWithLevel, METH_VARARGS, NULL}, - { "CdiVariable_getFValues", _wrap_CdiVariable_getFValues, METH_O, NULL}, - { "CdiVariable_getFValuesWithLevel", _wrap_CdiVariable_getFValuesWithLevel, METH_VARARGS, NULL}, - { "CdiVariable_getValuesAsPointer", _wrap_CdiVariable_getValuesAsPointer, METH_O, NULL}, - { "CdiVariable_getValuesWithLevelAsPointer", _wrap_CdiVariable_getValuesWithLevelAsPointer, METH_VARARGS, NULL}, - { "CdiVariable_swigregister", CdiVariable_swigregister, METH_O, NULL}, - { "CdiVariable_swiginit", CdiVariable_swiginit, METH_VARARGS, NULL}, - { "new_Cdi", _wrap_new_Cdi, METH_O, NULL}, - { "delete_Cdi", _wrap_delete_Cdi, METH_O, NULL}, - { "Cdi_streamID_set", _wrap_Cdi_streamID_set, METH_VARARGS, NULL}, - { "Cdi_streamID_get", _wrap_Cdi_streamID_get, METH_O, NULL}, - { "Cdi_vlistID_set", _wrap_Cdi_vlistID_set, METH_VARARGS, NULL}, - { "Cdi_vlistID_get", _wrap_Cdi_vlistID_get, METH_O, NULL}, - { "Cdi_nvars_set", _wrap_Cdi_nvars_set, METH_VARARGS, NULL}, - { "Cdi_nvars_get", _wrap_Cdi_nvars_get, METH_O, NULL}, - { "Cdi_nzaxes_set", _wrap_Cdi_nzaxes_set, METH_VARARGS, NULL}, - { "Cdi_nzaxes_get", _wrap_Cdi_nzaxes_get, METH_O, NULL}, - { "Cdi_ngrids_set", _wrap_Cdi_ngrids_set, METH_VARARGS, NULL}, - { "Cdi_ngrids_get", _wrap_Cdi_ngrids_get, METH_O, NULL}, - { "Cdi_ntaxes_set", _wrap_Cdi_ntaxes_set, METH_VARARGS, NULL}, - { "Cdi_ntaxes_get", _wrap_Cdi_ntaxes_get, METH_O, NULL}, - { "Cdi_taxisID_set", _wrap_Cdi_taxisID_set, METH_VARARGS, NULL}, - { "Cdi_taxisID_get", _wrap_Cdi_taxisID_get, METH_O, NULL}, - { "Cdi_varnames_set", _wrap_Cdi_varnames_set, METH_VARARGS, NULL}, - { "Cdi_varnames_get", _wrap_Cdi_varnames_get, METH_O, NULL}, - { "Cdi_codes_set", _wrap_Cdi_codes_set, METH_VARARGS, NULL}, - { "Cdi_codes_get", _wrap_Cdi_codes_get, METH_O, NULL}, - { "Cdi_variables_set", _wrap_Cdi_variables_set, METH_VARARGS, NULL}, - { "Cdi_variables_get", _wrap_Cdi_variables_get, METH_O, NULL}, - { "Cdi_var_set", _wrap_Cdi_var_set, METH_VARARGS, NULL}, - { "Cdi_var_get", _wrap_Cdi_var_get, METH_O, NULL}, - { "Cdi_varByCode_set", _wrap_Cdi_varByCode_set, METH_VARARGS, NULL}, - { "Cdi_varByCode_get", _wrap_Cdi_varByCode_get, METH_O, NULL}, - { "Cdi_taxes_set", _wrap_Cdi_taxes_set, METH_VARARGS, NULL}, - { "Cdi_taxes_get", _wrap_Cdi_taxes_get, METH_O, NULL}, - { "Cdi_zaxes_set", _wrap_Cdi_zaxes_set, METH_VARARGS, NULL}, - { "Cdi_zaxes_get", _wrap_Cdi_zaxes_get, METH_O, NULL}, - { "Cdi_grids_set", _wrap_Cdi_grids_set, METH_VARARGS, NULL}, - { "Cdi_grids_get", _wrap_Cdi_grids_get, METH_O, NULL}, - { "Cdi_griddes", _wrap_Cdi_griddes, METH_O, NULL}, - { "Cdi_swigregister", Cdi_swigregister, METH_O, NULL}, - { "Cdi_swiginit", Cdi_swiginit, METH_VARARGS, NULL}, - { NULL, NULL, 0, NULL } -}; - -static PyMethodDef SwigMethods_proxydocs[] = { - { NULL, NULL, 0, NULL } -}; - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ - -static swig_type_info _swigt__p_Cdi = {"_p_Cdi", "Cdi *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_CdiGrid = {"_p_CdiGrid", "std::map< int,CdiGrid >::mapped_type *|CdiGrid *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_CdiTaxis = {"_p_CdiTaxis", "std::map< int,CdiTaxis >::mapped_type *|CdiTaxis *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_CdiVariable = {"_p_CdiVariable", "std::map< std::string,CdiVariable >::mapped_type *|std::vector< CdiVariable >::value_type *|std::map< int,CdiVariable >::mapped_type *|CdiVariable *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_CdiZaxis = {"_p_CdiZaxis", "std::map< int,CdiZaxis >::mapped_type *|CdiZaxis *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_allocator_type = {"_p_allocator_type", "allocator_type *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_difference_type = {"_p_difference_type", "difference_type *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_float = {"_p_float", "float *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_key_type = {"_p_key_type", "key_type *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_mapped_type = {"_p_mapped_type", "mapped_type *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_p_PyObject = {"_p_p_PyObject", "PyObject **", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_p_double = {"_p_p_double", "double **", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_size_type = {"_p_size_type", "size_type *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__allocatorT_CdiVariable_t = {"_p_std__allocatorT_CdiVariable_t", "std::vector< CdiVariable >::allocator_type *|std::allocator< CdiVariable > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__allocatorT_double_t = {"_p_std__allocatorT_double_t", "std::vector< double >::allocator_type *|std::allocator< double > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__allocatorT_int_t = {"_p_std__allocatorT_int_t", "std::vector< int >::allocator_type *|std::allocator< int > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t", "std::map< int,CdiGrid >::allocator_type *|std::allocator< std::pair< int const,CdiGrid > > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t", "std::map< int,CdiTaxis >::allocator_type *|std::allocator< std::pair< int const,CdiTaxis > > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t", "std::map< int,CdiVariable >::allocator_type *|std::allocator< std::pair< int const,CdiVariable > > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t = {"_p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t", "std::map< int,CdiZaxis >::allocator_type *|std::allocator< std::pair< int const,CdiZaxis > > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t = {"_p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t", "std::allocator< std::pair< std::string const,CdiVariable > > *|std::map< std::string,CdiVariable >::allocator_type *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__allocatorT_std__string_t = {"_p_std__allocatorT_std__string_t", "std::vector< std::string >::allocator_type *|std::allocator< std::string > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t = {"_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t", "std::vector< std::vector< double > >::allocator_type *|std::allocator< std::vector< double,std::allocator< double > > > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__invalid_argument = {"_p_std__invalid_argument", "std::invalid_argument *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__lessT_int_t = {"_p_std__lessT_int_t", "std::less< int > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__lessT_std__string_t = {"_p_std__lessT_std__string_t", "std::less< std::string > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t = {"_p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t", "std::map< int,CdiGrid > *|std::map< int,CdiGrid,std::less< int >,std::allocator< std::pair< int const,CdiGrid > > > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t = {"_p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t", "std::map< int,CdiTaxis > *|std::map< int,CdiTaxis,std::less< int >,std::allocator< std::pair< int const,CdiTaxis > > > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t = {"_p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t", "std::map< int,CdiVariable,std::less< int >,std::allocator< std::pair< int const,CdiVariable > > > *|std::map< int,CdiVariable > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t = {"_p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t", "std::map< int,CdiZaxis > *|std::map< int,CdiZaxis,std::less< int >,std::allocator< std::pair< int const,CdiZaxis > > > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t = {"_p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t", "std::map< std::string,CdiVariable,std::less< std::string >,std::allocator< std::pair< std::string const,CdiVariable > > > *|std::map< std::string,CdiVariable > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t = {"_p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t", "std::vector< CdiVariable,std::allocator< CdiVariable > > *|std::vector< CdiVariable > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__vectorT_double_std__allocatorT_double_t_t = {"_p_std__vectorT_double_std__allocatorT_double_t_t", "std::vector< double,std::allocator< double > > *|std::vector< double > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__vectorT_float_std__allocatorT_float_t_t = {"_p_std__vectorT_float_std__allocatorT_float_t_t", "std::vector< float,std::allocator< float > > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__vectorT_int_std__allocatorT_int_t_t = {"_p_std__vectorT_int_std__allocatorT_int_t_t", "std::vector< int,std::allocator< int > > *|std::vector< int > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t = {"_p_std__vectorT_std__string_std__allocatorT_std__string_t_t", "std::vector< std::string,std::allocator< std::string > > *|std::vector< std::string > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t = {"_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t", "std::vector< std::vector< double > > *|std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *|std::vector< std::vector< double,std::allocator< double > > > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t = {"_p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t", "std::vector< std::vector< float,std::allocator< float > >,std::allocator< std::vector< float,std::allocator< float > > > > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_swig__SwigPyIterator = {"_p_swig__SwigPyIterator", "swig::SwigPyIterator *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_value_type = {"_p_value_type", "value_type *", 0, 0, (void*)0, 0}; - -static swig_type_info *swig_type_initial[] = { - &_swigt__p_Cdi, - &_swigt__p_CdiGrid, - &_swigt__p_CdiTaxis, - &_swigt__p_CdiVariable, - &_swigt__p_CdiZaxis, - &_swigt__p_allocator_type, - &_swigt__p_char, - &_swigt__p_difference_type, - &_swigt__p_double, - &_swigt__p_float, - &_swigt__p_key_type, - &_swigt__p_mapped_type, - &_swigt__p_p_PyObject, - &_swigt__p_p_double, - &_swigt__p_size_type, - &_swigt__p_std__allocatorT_CdiVariable_t, - &_swigt__p_std__allocatorT_double_t, - &_swigt__p_std__allocatorT_int_t, - &_swigt__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t, - &_swigt__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t, - &_swigt__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t, - &_swigt__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t, - &_swigt__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t, - &_swigt__p_std__allocatorT_std__string_t, - &_swigt__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t, - &_swigt__p_std__invalid_argument, - &_swigt__p_std__lessT_int_t, - &_swigt__p_std__lessT_std__string_t, - &_swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, - &_swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, - &_swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, - &_swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, - &_swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, - &_swigt__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, - &_swigt__p_std__vectorT_double_std__allocatorT_double_t_t, - &_swigt__p_std__vectorT_float_std__allocatorT_float_t_t, - &_swigt__p_std__vectorT_int_std__allocatorT_int_t_t, - &_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, - &_swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, - &_swigt__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, - &_swigt__p_swig__SwigPyIterator, - &_swigt__p_value_type, -}; - -static swig_cast_info _swigc__p_Cdi[] = { {&_swigt__p_Cdi, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_CdiGrid[] = { {&_swigt__p_CdiGrid, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_CdiTaxis[] = { {&_swigt__p_CdiTaxis, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_CdiVariable[] = { {&_swigt__p_CdiVariable, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_CdiZaxis[] = { {&_swigt__p_CdiZaxis, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_allocator_type[] = { {&_swigt__p_allocator_type, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_difference_type[] = { {&_swigt__p_difference_type, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_double[] = { {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_float[] = { {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_key_type[] = { {&_swigt__p_key_type, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_mapped_type[] = { {&_swigt__p_mapped_type, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_p_PyObject[] = { {&_swigt__p_p_PyObject, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_p_double[] = { {&_swigt__p_p_double, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_size_type[] = { {&_swigt__p_size_type, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__allocatorT_CdiVariable_t[] = { {&_swigt__p_std__allocatorT_CdiVariable_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__allocatorT_double_t[] = { {&_swigt__p_std__allocatorT_double_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__allocatorT_int_t[] = { {&_swigt__p_std__allocatorT_int_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t[] = { {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t[] = { {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t[] = { {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t[] = { {&_swigt__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t[] = { {&_swigt__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__allocatorT_std__string_t[] = { {&_swigt__p_std__allocatorT_std__string_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t[] = { {&_swigt__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__invalid_argument[] = { {&_swigt__p_std__invalid_argument, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__lessT_int_t[] = { {&_swigt__p_std__lessT_int_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__lessT_std__string_t[] = { {&_swigt__p_std__lessT_std__string_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t[] = { {&_swigt__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t[] = { {&_swigt__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t[] = { {&_swigt__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t[] = { {&_swigt__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t[] = { {&_swigt__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t[] = { {&_swigt__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__vectorT_double_std__allocatorT_double_t_t[] = { {&_swigt__p_std__vectorT_double_std__allocatorT_double_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__vectorT_float_std__allocatorT_float_t_t[] = { {&_swigt__p_std__vectorT_float_std__allocatorT_float_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__vectorT_int_std__allocatorT_int_t_t[] = { {&_swigt__p_std__vectorT_int_std__allocatorT_int_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t[] = { {&_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t[] = { {&_swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t[] = { {&_swigt__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_swig__SwigPyIterator[] = { {&_swigt__p_swig__SwigPyIterator, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_value_type[] = { {&_swigt__p_value_type, 0, 0, 0},{0, 0, 0, 0}}; - -static swig_cast_info *swig_cast_initial[] = { - _swigc__p_Cdi, - _swigc__p_CdiGrid, - _swigc__p_CdiTaxis, - _swigc__p_CdiVariable, - _swigc__p_CdiZaxis, - _swigc__p_allocator_type, - _swigc__p_char, - _swigc__p_difference_type, - _swigc__p_double, - _swigc__p_float, - _swigc__p_key_type, - _swigc__p_mapped_type, - _swigc__p_p_PyObject, - _swigc__p_p_double, - _swigc__p_size_type, - _swigc__p_std__allocatorT_CdiVariable_t, - _swigc__p_std__allocatorT_double_t, - _swigc__p_std__allocatorT_int_t, - _swigc__p_std__allocatorT_std__pairT_int_const_CdiGrid_t_t, - _swigc__p_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t, - _swigc__p_std__allocatorT_std__pairT_int_const_CdiVariable_t_t, - _swigc__p_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t, - _swigc__p_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t, - _swigc__p_std__allocatorT_std__string_t, - _swigc__p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t, - _swigc__p_std__invalid_argument, - _swigc__p_std__lessT_int_t, - _swigc__p_std__lessT_std__string_t, - _swigc__p_std__mapT_int_CdiGrid_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiGrid_t_t_t, - _swigc__p_std__mapT_int_CdiTaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiTaxis_t_t_t, - _swigc__p_std__mapT_int_CdiVariable_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiVariable_t_t_t, - _swigc__p_std__mapT_int_CdiZaxis_std__lessT_int_t_std__allocatorT_std__pairT_int_const_CdiZaxis_t_t_t, - _swigc__p_std__mapT_std__string_CdiVariable_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_CdiVariable_t_t_t, - _swigc__p_std__vectorT_CdiVariable_std__allocatorT_CdiVariable_t_t, - _swigc__p_std__vectorT_double_std__allocatorT_double_t_t, - _swigc__p_std__vectorT_float_std__allocatorT_float_t_t, - _swigc__p_std__vectorT_int_std__allocatorT_int_t_t, - _swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, - _swigc__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, - _swigc__p_std__vectorT_std__vectorT_float_std__allocatorT_float_t_t_std__allocatorT_std__vectorT_float_std__allocatorT_float_t_t_t_t, - _swigc__p_swig__SwigPyIterator, - _swigc__p_value_type, -}; - - -/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ - -static swig_const_info swig_const_table[] = { -{0, 0, 0, 0.0, 0, 0}}; - -#ifdef __cplusplus -} -#endif -/* ----------------------------------------------------------------------------- - * Type initialization: - * This problem is tough by the requirement that no dynamic - * memory is used. Also, since swig_type_info structures store pointers to - * swig_cast_info structures and swig_cast_info structures store pointers back - * to swig_type_info structures, we need some lookup code at initialization. - * The idea is that swig generates all the structures that are needed. - * The runtime then collects these partially filled structures. - * The SWIG_InitializeModule function takes these initial arrays out of - * swig_module, and does all the lookup, filling in the swig_module.types - * array with the correct data and linking the correct swig_cast_info - * structures together. - * - * The generated swig_type_info structures are assigned statically to an initial - * array. We just loop through that array, and handle each type individually. - * First we lookup if this type has been already loaded, and if so, use the - * loaded structure instead of the generated one. Then we have to fill in the - * cast linked list. The cast data is initially stored in something like a - * two-dimensional array. Each row corresponds to a type (there are the same - * number of rows as there are in the swig_type_initial array). Each entry in - * a column is one of the swig_cast_info structures for that type. - * The cast_initial array is actually an array of arrays, because each row has - * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it - * adding the casts to the list. The one last trick we need to do is making - * sure the type pointer in the swig_cast_info struct is correct. - * - * First off, we lookup the cast->type name to see if it is already loaded. - * There are three cases to handle: - * 1) If the cast->type has already been loaded AND the type we are adding - * casting info to has not been loaded (it is in this module), THEN we - * replace the cast->type pointer with the type pointer that has already - * been loaded. - * 2) If BOTH types (the one we are adding casting info to, and the - * cast->type) are loaded, THEN the cast info has already been loaded by - * the previous module so we just ignore it. - * 3) Finally, if cast->type has not already been loaded, then we add that - * swig_cast_info to the linked list (because the cast->type) pointer will - * be correct. - * ----------------------------------------------------------------------------- */ - -#ifdef __cplusplus -extern "C" { -#if 0 -} /* c-mode */ -#endif -#endif - -#if 0 -#define SWIGRUNTIME_DEBUG -#endif - - -SWIGRUNTIME void -SWIG_InitializeModule(void *clientdata) { - size_t i; - swig_module_info *module_head, *iter; - int init; - - /* check to see if the circular list has been setup, if not, set it up */ - if (swig_module.next==0) { - /* Initialize the swig_module */ - swig_module.type_initial = swig_type_initial; - swig_module.cast_initial = swig_cast_initial; - swig_module.next = &swig_module; - init = 1; - } else { - init = 0; - } - - /* Try and load any already created modules */ - module_head = SWIG_GetModule(clientdata); - if (!module_head) { - /* This is the first module loaded for this interpreter */ - /* so set the swig module into the interpreter */ - SWIG_SetModule(clientdata, &swig_module); - } else { - /* the interpreter has loaded a SWIG module, but has it loaded this one? */ - iter=module_head; - do { - if (iter==&swig_module) { - /* Our module is already in the list, so there's nothing more to do. */ - return; - } - iter=iter->next; - } while (iter!= module_head); - - /* otherwise we must add our module into the list */ - swig_module.next = module_head->next; - module_head->next = &swig_module; - } - - /* When multiple interpreters are used, a module could have already been initialized in - a different interpreter, but not yet have a pointer in this interpreter. - In this case, we do not want to continue adding types... everything should be - set up already */ - if (init == 0) return; - - /* Now work on filling in swig_module.types */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size); -#endif - for (i = 0; i < swig_module.size; ++i) { - swig_type_info *type = 0; - swig_type_info *ret; - swig_cast_info *cast; - -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); -#endif - - /* if there is another module already loaded */ - if (swig_module.next != &swig_module) { - type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); - } - if (type) { - /* Overwrite clientdata field */ -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found type %s\n", type->name); -#endif - if (swig_module.type_initial[i]->clientdata) { - type->clientdata = swig_module.type_initial[i]->clientdata; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); -#endif - } - } else { - type = swig_module.type_initial[i]; - } - - /* Insert casting types */ - cast = swig_module.cast_initial[i]; - while (cast->type) { - /* Don't need to add information already in the list */ - ret = 0; -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); -#endif - if (swig_module.next != &swig_module) { - ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); -#ifdef SWIGRUNTIME_DEBUG - if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); -#endif - } - if (ret) { - if (type == swig_module.type_initial[i]) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: skip old type %s\n", ret->name); -#endif - cast->type = ret; - ret = 0; - } else { - /* Check for casting already in the list */ - swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); -#ifdef SWIGRUNTIME_DEBUG - if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); -#endif - if (!ocast) ret = 0; - } - } - - if (!ret) { -#ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); -#endif - if (type->cast) { - type->cast->prev = cast; - cast->next = type->cast; - } - type->cast = cast; - } - cast++; - } - /* Set entry in modules->types array equal to the type */ - swig_module.types[i] = type; - } - swig_module.types[i] = 0; - -#ifdef SWIGRUNTIME_DEBUG - printf("**** SWIG_InitializeModule: Cast List ******\n"); - for (i = 0; i < swig_module.size; ++i) { - int j = 0; - swig_cast_info *cast = swig_module.cast_initial[i]; - printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); - while (cast->type) { - printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); - cast++; - ++j; - } - printf("---- Total casts: %d\n",j); - } - printf("**** SWIG_InitializeModule: Cast List ******\n"); -#endif -} - -/* This function will propagate the clientdata field of type to -* any new swig_type_info structures that have been added into the list -* of equivalent types. It is like calling -* SWIG_TypeClientData(type, clientdata) a second time. -*/ -SWIGRUNTIME void -SWIG_PropagateClientData(void) { - size_t i; - swig_cast_info *equiv; - static int init_run = 0; - - if (init_run) return; - init_run = 1; - - for (i = 0; i < swig_module.size; i++) { - if (swig_module.types[i]->clientdata) { - equiv = swig_module.types[i]->cast; - while (equiv) { - if (!equiv->converter) { - if (equiv->type && !equiv->type->clientdata) - SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); - } - equiv = equiv->next; - } - } - } -} - -#ifdef __cplusplus -#if 0 -{ - /* c-mode */ -#endif -} -#endif - - - -#ifdef __cplusplus -extern "C" { -#endif - - /* Python-specific SWIG API */ -#define SWIG_newvarlink() SWIG_Python_newvarlink() -#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) -#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) - - /* ----------------------------------------------------------------------------- - * global variable support code. - * ----------------------------------------------------------------------------- */ - - typedef struct swig_globalvar { - char *name; /* Name of global variable */ - PyObject *(*get_attr)(void); /* Return the current value */ - int (*set_attr)(PyObject *); /* Set the value */ - struct swig_globalvar *next; - } swig_globalvar; - - typedef struct swig_varlinkobject { - PyObject_HEAD - swig_globalvar *vars; - } swig_varlinkobject; - - SWIGINTERN PyObject * - swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { -#if PY_VERSION_HEX >= 0x03000000 - return PyUnicode_InternFromString("<Swig global variables>"); -#else - return PyString_FromString("<Swig global variables>"); -#endif - } - - SWIGINTERN PyObject * - swig_varlink_str(swig_varlinkobject *v) { -#if PY_VERSION_HEX >= 0x03000000 - PyObject *str = PyUnicode_InternFromString("("); - PyObject *tail; - PyObject *joined; - swig_globalvar *var; - for (var = v->vars; var; var=var->next) { - tail = PyUnicode_FromString(var->name); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; - if (var->next) { - tail = PyUnicode_InternFromString(", "); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; - } - } - tail = PyUnicode_InternFromString(")"); - joined = PyUnicode_Concat(str, tail); - Py_DecRef(str); - Py_DecRef(tail); - str = joined; -#else - PyObject *str = PyString_FromString("("); - swig_globalvar *var; - for (var = v->vars; var; var=var->next) { - PyString_ConcatAndDel(&str,PyString_FromString(var->name)); - if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); - } - PyString_ConcatAndDel(&str,PyString_FromString(")")); -#endif - return str; - } - - SWIGINTERN void - swig_varlink_dealloc(swig_varlinkobject *v) { - swig_globalvar *var = v->vars; - while (var) { - swig_globalvar *n = var->next; - free(var->name); - free(var); - var = n; - } - } - - SWIGINTERN PyObject * - swig_varlink_getattr(swig_varlinkobject *v, char *n) { - PyObject *res = NULL; - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - res = (*var->get_attr)(); - break; - } - var = var->next; - } - if (res == NULL && !PyErr_Occurred()) { - PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); - } - return res; - } - - SWIGINTERN int - swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { - int res = 1; - swig_globalvar *var = v->vars; - while (var) { - if (strcmp(var->name,n) == 0) { - res = (*var->set_attr)(p); - break; - } - var = var->next; - } - if (res == 1 && !PyErr_Occurred()) { - PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n); - } - return res; - } - - SWIGINTERN PyTypeObject* - swig_varlink_type(void) { - static char varlink__doc__[] = "Swig var link object"; - static PyTypeObject varlink_type; - static int type_init = 0; - if (!type_init) { - const PyTypeObject tmp = { -#if PY_VERSION_HEX >= 0x03000000 - PyVarObject_HEAD_INIT(NULL, 0) -#else - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ -#endif - "swigvarlink", /* tp_name */ - sizeof(swig_varlinkobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor) swig_varlink_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - (getattrfunc) swig_varlink_getattr, /* tp_getattr */ - (setattrfunc) swig_varlink_setattr, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc) swig_varlink_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - (reprfunc) swig_varlink_str, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - 0, /* tp_flags */ - varlink__doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ - 0, /* tp_del */ - 0, /* tp_version_tag */ -#if PY_VERSION_HEX >= 0x03040000 - 0, /* tp_finalize */ -#endif -#ifdef COUNT_ALLOCS - 0, /* tp_allocs */ - 0, /* tp_frees */ - 0, /* tp_maxalloc */ - 0, /* tp_prev */ - 0 /* tp_next */ -#endif - }; - varlink_type = tmp; - type_init = 1; - if (PyType_Ready(&varlink_type) < 0) - return NULL; - } - return &varlink_type; - } - - /* Create a variable linking object for use later */ - SWIGINTERN PyObject * - SWIG_Python_newvarlink(void) { - swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); - if (result) { - result->vars = 0; - } - return ((PyObject*) result); - } - - SWIGINTERN void - SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { - swig_varlinkobject *v = (swig_varlinkobject *) p; - swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); - if (gv) { - size_t size = strlen(name)+1; - gv->name = (char *)malloc(size); - if (gv->name) { - memcpy(gv->name, name, size); - gv->get_attr = get_attr; - gv->set_attr = set_attr; - gv->next = v->vars; - } - } - v->vars = gv; - } - - SWIGINTERN PyObject * - SWIG_globals(void) { - static PyObject *globals = 0; - if (!globals) { - globals = SWIG_newvarlink(); - } - return globals; - } - - /* ----------------------------------------------------------------------------- - * constants/methods manipulation - * ----------------------------------------------------------------------------- */ - - /* Install Constants */ - SWIGINTERN void - SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { - PyObject *obj = 0; - size_t i; - for (i = 0; constants[i].type; ++i) { - switch(constants[i].type) { - case SWIG_PY_POINTER: - obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); - break; - case SWIG_PY_BINARY: - obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); - break; - default: - obj = 0; - break; - } - if (obj) { - PyDict_SetItemString(d, constants[i].name, obj); - Py_DECREF(obj); - } - } - } - - /* -----------------------------------------------------------------------------*/ - /* Fix SwigMethods to carry the callback ptrs when needed */ - /* -----------------------------------------------------------------------------*/ - - SWIGINTERN void - SWIG_Python_FixMethods(PyMethodDef *methods, - swig_const_info *const_table, - swig_type_info **types, - swig_type_info **types_initial) { - size_t i; - for (i = 0; methods[i].ml_name; ++i) { - const char *c = methods[i].ml_doc; - if (!c) continue; - c = strstr(c, "swig_ptr: "); - if (c) { - int j; - swig_const_info *ci = 0; - const char *name = c + 10; - for (j = 0; const_table[j].type; ++j) { - if (strncmp(const_table[j].name, name, - strlen(const_table[j].name)) == 0) { - ci = &(const_table[j]); - break; - } - } - if (ci) { - void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; - if (ptr) { - size_t shift = (ci->ptype) - types; - swig_type_info *ty = types_initial[shift]; - size_t ldoc = (c - methods[i].ml_doc); - size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; - char *ndoc = (char*)malloc(ldoc + lptr + 10); - if (ndoc) { - char *buff = ndoc; - memcpy(buff, methods[i].ml_doc, ldoc); - buff += ldoc; - memcpy(buff, "swig_ptr: ", 10); - buff += 10; - SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); - methods[i].ml_doc = ndoc; - } - } - } - } - } - } - - /* ----------------------------------------------------------------------------- - * Method creation and docstring support functions - * ----------------------------------------------------------------------------- */ - - /* ----------------------------------------------------------------------------- - * Function to find the method definition with the correct docstring for the - * proxy module as opposed to the low-level API - * ----------------------------------------------------------------------------- */ - - SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name) { - /* Find the function in the modified method table */ - size_t offset = 0; - int found = 0; - while (SwigMethods_proxydocs[offset].ml_meth != NULL) { - if (strcmp(SwigMethods_proxydocs[offset].ml_name, name) == 0) { - found = 1; - break; - } - offset++; - } - /* Use the copy with the modified docstring if available */ - return found ? &SwigMethods_proxydocs[offset] : NULL; - } - - /* ----------------------------------------------------------------------------- - * Wrapper of PyInstanceMethod_New() used in Python 3 - * It is exported to the generated module, used for -fastproxy - * ----------------------------------------------------------------------------- */ - - SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) { - if (PyCFunction_Check(func)) { - PyCFunctionObject *funcobj = (PyCFunctionObject *)func; - PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name); - if (ml) - func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module); - } -#if PY_VERSION_HEX >= 0x03000000 - return PyInstanceMethod_New(func); -#else - return PyMethod_New(func, NULL, NULL); -#endif - } - - /* ----------------------------------------------------------------------------- - * Wrapper of PyStaticMethod_New() - * It is exported to the generated module, used for -fastproxy - * ----------------------------------------------------------------------------- */ - - SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) { - if (PyCFunction_Check(func)) { - PyCFunctionObject *funcobj = (PyCFunctionObject *)func; - PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name); - if (ml) - func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module); - } - return PyStaticMethod_New(func); - } - -#ifdef __cplusplus -} -#endif - -/* -----------------------------------------------------------------------------* - * Partial Init method - * -----------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" -#endif - -SWIGEXPORT -#if PY_VERSION_HEX >= 0x03000000 -PyObject* -#else -void -#endif -SWIG_init(void) { - PyObject *m, *d, *md, *globals; - -#if PY_VERSION_HEX >= 0x03000000 - static struct PyModuleDef SWIG_module = { - PyModuleDef_HEAD_INIT, - SWIG_name, - NULL, - -1, - SwigMethods, - NULL, - NULL, - NULL, - NULL - }; -#endif - -#if defined(SWIGPYTHON_BUILTIN) - static SwigPyClientData SwigPyObject_clientdata = { - 0, 0, 0, 0, 0, 0, 0 - }; - static PyGetSetDef this_getset_def = { - (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL - }; - static SwigPyGetSet thisown_getset_closure = { - SwigPyObject_own, - SwigPyObject_own - }; - static PyGetSetDef thisown_getset_def = { - (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure - }; - PyTypeObject *builtin_pytype; - int builtin_base_count; - swig_type_info *builtin_basetype; - PyObject *tuple; - PyGetSetDescrObject *static_getset; - PyTypeObject *metatype; - PyTypeObject *swigpyobject; - SwigPyClientData *cd; - PyObject *public_interface, *public_symbol; - PyObject *this_descr; - PyObject *thisown_descr; - PyObject *self = 0; - int i; - - (void)builtin_pytype; - (void)builtin_base_count; - (void)builtin_basetype; - (void)tuple; - (void)static_getset; - (void)self; - - /* Metaclass is used to implement static member variables */ - metatype = SwigPyObjectType(); - assert(metatype); -#endif - - (void)globals; - - /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */ - SWIG_This(); - SWIG_Python_TypeCache(); - SwigPyPacked_type(); -#ifndef SWIGPYTHON_BUILTIN - SwigPyObject_type(); -#endif - - /* Fix SwigMethods to carry the callback ptrs when needed */ - SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); - -#if PY_VERSION_HEX >= 0x03000000 - m = PyModule_Create(&SWIG_module); -#else - m = Py_InitModule(SWIG_name, SwigMethods); -#endif - - md = d = PyModule_GetDict(m); - (void)md; - - SWIG_InitializeModule(0); - -#ifdef SWIGPYTHON_BUILTIN - swigpyobject = SwigPyObject_TypeOnce(); - - SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject"); - assert(SwigPyObject_stype); - cd = (SwigPyClientData*) SwigPyObject_stype->clientdata; - if (!cd) { - SwigPyObject_stype->clientdata = &SwigPyObject_clientdata; - SwigPyObject_clientdata.pytype = swigpyobject; - } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) { - PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules."); -# if PY_VERSION_HEX >= 0x03000000 - return NULL; -# else - return; -# endif - } - - /* All objects have a 'this' attribute */ - this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def); - (void)this_descr; - - /* All objects have a 'thisown' attribute */ - thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def); - (void)thisown_descr; - - public_interface = PyList_New(0); - public_symbol = 0; - (void)public_symbol; - - PyDict_SetItemString(md, "__all__", public_interface); - Py_DECREF(public_interface); - for (i = 0; SwigMethods[i].ml_name != NULL; ++i) - SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name); - for (i = 0; swig_const_table[i].name != 0; ++i) - SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name); -#endif - - SWIG_InstallConstants(d,swig_const_table); - - - // thread safe initialization - swig::container_owner_attribute(); - -#if PY_VERSION_HEX >= 0x03000000 - return m; -#else - return; -#endif -} - diff --git a/interfaces/python/setup.py b/interfaces/python/setup.py deleted file mode 100644 index 7f1fffc6bf05a0eaa07c20d07a51afe81cd491c6..0000000000000000000000000000000000000000 --- a/interfaces/python/setup.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -import os, string - -INCFLAGS = [] -CFLAGS = [] -LDFLAGS = [] -LIBS = [] -if 'INCFLAGS' in os.environ: - INCFLAGS = os.environ['INCFLAGS'].split() - -if 'CFLAGS' in os.environ: - CFLAGS = os.environ['CFLAGS'].split() - -if 'LDFLAGS' in os.environ: - LDFLAGS = os.environ['LDFLAGS'].split('-L') - -if 'LIBS' in os.environ: - LIBS = os.environ['LIBS'].split() - - -from distutils.core import setup, Extension -from setup import * - -cdiobj_module = Extension('_Cdi', - sources=['cdi_wrapper.cpp'], - extra_compile_args = INCFLAGS, - library_dirs = LDFLAGS, - extra_objects = ['../cdi.o'], - runtime_library_dirs = [os.environ['BUILDLIBDIR'],os.environ['LIBDIR']], - extra_link_args = LIBS, - libraries = ['cdi','stdc++'], - language = 'c++', - ) - -setup (name = 'Cdi', - version = '0.1', - author = "Ralf Mueller", - description = """pyhton bindings to CDI class library""", - ext_modules = [cdiobj_module], - py_modules = ["Cdi"], - ) diff --git a/interfaces/python/table.py b/interfaces/python/table.py deleted file mode 100644 index d02b387bfc9c31ad7802cb9f26d1502d3c75092e..0000000000000000000000000000000000000000 --- a/interfaces/python/table.py +++ /dev/null @@ -1,128 +0,0 @@ -import os, numpy, getopt, sys -import CdiObj - - -def usage(): - print("usage: " + sys.argv[0] + " [-o outputFile] [-e experiementTag] [-v] inputFile") - -def htmlSkel(experiment): - return ['<html> <head> <title>ECHAM Experiment: '+ experiment +'</title></head>' + - """<body> -<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script> -<script type="text/javascript" src="https://code.mpimet.mpg.de/files/cdo/html/tableFold.js"></script>""", - '''</body> - </html> - '''] - -def tableSkel(): - return ["<table id=\"detail_table\" class=\"detail\"> <!-- <col style=\"width: 40px;\"> <col style=\"width: 80px;\"> <col style=\"width: 80px;\"> <col style=\"width: 80px;\">-->" + - "<thead align=\"left\"><tr align=\"right\"><th>Code</th><th>North</th><th>South</th><th colspan=\"1000\">Global</th></tr></thead>", - '</table>'] - -def tableRow(code,northVal,southVal,globalVal): - return ["<tr align=\"right\" title=\"Click to expand/collapse\" style=\"cursor: pointer;\" class=\"parent\" id=\"row%d\" >" % code + - "<td valign=\"top\">%d</td><td>%3.3f</td><td>%3.3f</td><td>%3.3f</td>" % (code,northVal, southVal, globalVal) + - '</tr>' + - "<tr style=\"display: none;\" class=\"child-row%d\">" % code + - '<td></td><td colspan="3">', - '</td></tr></table>'] - -def generateSubTable(headers, rows): - html = [] - - if len(headers) > 0: - html.append("<tr>") - for header in headers: - html.append("<th>" + header + "</th>") - html.append("</tr>") - - if len(rows) > 0: - for row in rows: - html.append("<tr>") - for cell in row: - html.append("<td>%3.3f</td>" % cell) - html.append("</tr>") - - if html: - html = ["<table>"] + html + ["</table>"] - - return "".join(html) - -if __name__ == '__main__': - try: - opts, args = getopt.getopt(sys.argv[1:], "ho:v", ["help", "output="]) - except getopt.GetoptError, err: - #print help information and exit: - print str(err) # will print something like "option -a not recognized" - usage() - sys.exit(2) - - output = 'table.html' - expName = '187' - verbose = False - for o, a in opts: - if o == "-v": - verbose = True - elif o in ("-h", "--help"): - usage() - sys.exit() - elif o in ("-o", "--output"): - output = a - elif o in ("-e", "--experiment"): - expName = a - else: - assert False, "unhandled option" - - sourcefile = args[0] - #TODO test if input file exists? - if verbose == True: - print 'Input: ' + sourcefile - print 'Output: ' + output - - cdoOperator = "zonavg" - zonalfile = cdoOperator + "-" + sourcefile - cmd = ' '.join(['cdo',cdoOperator, sourcefile, zonalfile]) - - print cmd - - os.popen(cmd).read() - - cdi = CdiObj.Cdi(zonalfile) - - html = [] - htmlStart, htmlEnd = htmlSkel(expName) - tableStart, tableEnd = tableSkel() - - html.append(htmlStart) - html.append(tableStart) - - for code in cdi.codes: - - var = cdi.varByCode[code] - var.getValues() - vals = numpy.array(var.values) - lats = numpy.array(var.grid.yvalues) - northInd = numpy.where(lats >= 0) - southInd = numpy.where(lats < 0) - if verbose == True: - print 'Global Mean: ',vals.mean() - print 'Global Max|Min: ',vals.max(),'|',vals.min() - print 'North Mean: ',vals[northInd].mean() - print 'South Mean: ',vals[southInd].mean() - - codeTableStart, codeTableEnd = tableRow(code,vals[northInd].mean(), vals[southInd].mean(), vals.mean()) - - html.append(codeTableStart) - - tdata = numpy.array([lats[northInd],vals[northInd],lats[southInd],vals[southInd]]).transpose().tolist() - vtable = generateSubTable(["latitude","values","latidute","values"],tdata) - - html.append(vtable) - - - html.append(tableEnd) - html.append(htmlEnd) - - f = open(output, 'w') - f.write("".join(html)) - f.close diff --git a/interfaces/python/test.py b/interfaces/python/test.py index 45f2a0c9121955d4a62ce2b9ea7a38b85f643acd..236f197b9e3e021f622afe5699999d9c7fa9b49d 100644 --- a/interfaces/python/test.py +++ b/interfaces/python/test.py @@ -1,14 +1,13 @@ -import sys,os -sys.path.insert(0,os.getcwd()) +#! /usr/bin/env python +from __future__ import print_function +import sys, os + import Cdi print("# BEGIN PYTHON TEST ==================================#") -if ( 1 == len(sys.argv) ): - ifile = "../mulval.nc" -else: - ifile = sys.argv[1] +ifile_name = sys.argv[1] if len(sys.argv) > 1 else "../testdata/mulval.grb" -cdi = Cdi.Cdi(ifile) +cdi = Cdi.Cdi(ifile_name) print('Stream: ',cdi.streamID,' vlistID:',cdi.vlistID,' nvars:{d}', cdi.nvars) @@ -34,12 +33,8 @@ print("#========== VAR by index ======================================#") var = cdi.variables[1] var.getValues() val = var.values -i=0; print('val[',i,'] = ',val[i]) -i=1; print('val[',i,'] = ',val[i]) -i=2; print('val[',i,'] = ',val[i]) -i=3; print('val[',i,'] = ',val[i]) -i=4; print('val[',i,'] = ',val[i]) -i=5; print('val[',i,'] = ',val[i]) +for i in range(6): + print('val[',i,'] = ',val[i]) print("#========= Var by name ===============================#") name ="tsurf" newvar = cdi.var[name] diff --git a/interfaces/ruby/setup.rb b/interfaces/ruby/setup.rb index 3ab72ac1933d08002c9b5283cbc281cbcc959f6c..00284d324f850dd349f3362a99d78a4691fb45b9 100644 --- a/interfaces/ruby/setup.rb +++ b/interfaces/ruby/setup.rb @@ -1,12 +1,12 @@ require 'mkmf' -$INCFLAGS = "#{ENV['INCFLAGS']} #{$INCFLAGS}" -$CFLAGS = "#{ENV['CFLAGS']} #{$CFLAGS}" -$LDFLAGS = "#{ENV['LDFLAGS']} #{$LDFLAGS}" -$LIBS = "#{ENV['LIBS']} #{$LIBS}" +$INCFLAGS = "$(CDI_INCFLAGS) #{$INCFLAGS}" +$CPPFLAGS = "$(CDI_CPPFLAGS) #{$CPPFLAGS}" +$CXXFLAGS = "$(CDI_CXXFLAGS) #{$CXXFLAGS}" +$LDFLAGS = "$(CDI_LDFLAGS) #{$LDFLAGS}" +$LIBS = "#{$LIBS} $(CDI_LIBS)" -$libs = append_library($libs, "stdc++") -$LDFLAGS += " ../.libs/libcdipp.a ../../src/.libs/libcdi.a" +$libs = "../libcdipp.la #{$libs}" $srcs = %w[cdi_wrapper.cpp] -$objs = %w[cdi_wrapper.o] +$objs = %w[cdi_wrapper.lo] create_makefile('Cdi') diff --git a/interfaces/ruby/test.rb b/interfaces/ruby/test.rb index aeb0f11de93e1f14556a8dc3a37e94ddf0c5d99b..50739485840774aa875166a217df8e74b0e50ae6 100644 --- a/interfaces/ruby/test.rb +++ b/interfaces/ruby/test.rb @@ -1,4 +1,4 @@ -require './Cdi' +require 'Cdi' require "pp" puts "# BEGIN RUBY TEST ====================================#" @@ -31,13 +31,8 @@ cdi.zaxes.each {|k,v| } puts "#========== VARIABLES ================================#" -cdi.variables.each_with_index {|k,i| - print k.name[0,5] + " " + k.size.to_s + " " - puts if i%16==0 -} -cdi.variables.each_with_index {|k,i| - print k.missval - puts if i%16==0 +cdi.variables.each_with_index {|k,i| + print(k.name[0,5], ' ', k.size.to_s, ' ', k.missval, "\n") } puts "#========== VARNAMES =================================#" @@ -52,7 +47,7 @@ puts "#========== VAR by index ======================================#" var = cdi.variables[1] var.getValues() val = var.values -pp val[-5..-1] +pp val[0..5] puts "#========= Var by name ===============================#" name ="tsurf" newvar = cdi.var[name] diff --git a/interfaces/test_cpp_nc.run.in b/interfaces/test_cpp_nc.run.in new file mode 100644 index 0000000000000000000000000000000000000000..8a0c93ee0991535765e8e9fadd19013e42cea15f --- /dev/null +++ b/interfaces/test_cpp_nc.run.in @@ -0,0 +1,8 @@ +#!@SHELL@ + +set -e + +@ENABLE_RUBY_INTERFACE_FALSE@@ENABLE_PYTHON_INTERFACE_FALSE@exit 77 +@ENABLE_NETCDF_FALSE@exit 77 + +@top_builddir@/libtool --mode=execute ${tool_wrap} ./CdiInfo '@srcdir@/testdata/mulval.nc' diff --git a/interfaces/test_python_grb.run.in b/interfaces/test_python_grb.run.in new file mode 100644 index 0000000000000000000000000000000000000000..e79dd36956247d74be44a867a185e3747e71ec73 --- /dev/null +++ b/interfaces/test_python_grb.run.in @@ -0,0 +1,10 @@ +#!@SHELL@ + +set -e + +@ENABLE_PYTHON_INTERFACE_FALSE@exit 77 +test 'x@ENABLE_GRIB@' = xyes || exit 77 + +PYTHONDONTWRITEBYTECODE=1; export PYTHONDONTWRITEBYTECODE +PYTHONPATH="@abs_builddir@/python:@abs_builddir@/python/.libs:${PYTHONPATH}"; export PYTHONPATH +@PYTHON@ '@srcdir@/python/test.py' '@srcdir@/testdata/mulval.grb' diff --git a/interfaces/test_python_nc.run.in b/interfaces/test_python_nc.run.in new file mode 100644 index 0000000000000000000000000000000000000000..dc1ffd0e55c6cba1790abdfd92f7004937dc3fe2 --- /dev/null +++ b/interfaces/test_python_nc.run.in @@ -0,0 +1,10 @@ +#!@SHELL@ + +set -e + +@ENABLE_PYTHON_INTERFACE_FALSE@exit 77 +@ENABLE_NETCDF_FALSE@exit 77 + +PYTHONDONTWRITEBYTECODE=1; export PYTHONDONTWRITEBYTECODE +PYTHONPATH="@abs_builddir@/python:@abs_builddir@/python/.libs:${PYTHONPATH}"; export PYTHONPATH +@PYTHON@ '@srcdir@/python/test.py' '@srcdir@/testdata/mulval.nc' diff --git a/interfaces/test_ruby_grb.run.in b/interfaces/test_ruby_grb.run.in new file mode 100644 index 0000000000000000000000000000000000000000..7c92d620cce7bf00b2e33bf0b056bac7b0a65f32 --- /dev/null +++ b/interfaces/test_ruby_grb.run.in @@ -0,0 +1,9 @@ +#!@SHELL@ + +set -e + +@ENABLE_RUBY_INTERFACE_FALSE@exit 77 +test 'x@ENABLE_GRIB@' = xyes || exit 77 + +RUBYLIB="@abs_builddir@/ruby/.libs:${RUBYLIB}"; export RUBYLIB +@RUBY@ '@srcdir@/ruby/test.rb' '@srcdir@/testdata/mulval.grb' diff --git a/interfaces/test_ruby_nc.run.in b/interfaces/test_ruby_nc.run.in new file mode 100644 index 0000000000000000000000000000000000000000..71cb171e814c47a8531630fd209b300abd8783ab --- /dev/null +++ b/interfaces/test_ruby_nc.run.in @@ -0,0 +1,9 @@ +#!@SHELL@ + +set -e + +@ENABLE_RUBY_INTERFACE_FALSE@exit 77 +@ENABLE_NETCDF_FALSE@exit 77 + +RUBYLIB="@abs_builddir@/ruby/.libs:${RUBYLIB}"; export RUBYLIB +@RUBY@ '@srcdir@/ruby/test.rb' '@srcdir@/testdata/mulval.nc' diff --git a/interfaces/testdata/mulval.grb b/interfaces/testdata/mulval.grb new file mode 100644 index 0000000000000000000000000000000000000000..e816f4332a0caf1260889842cf264596969c743c Binary files /dev/null and b/interfaces/testdata/mulval.grb differ diff --git a/interfaces/testdata/mulval.nc b/interfaces/testdata/mulval.nc new file mode 100644 index 0000000000000000000000000000000000000000..13ab0cb3d2abb3ea9ea08bfa08e7a02c314a9a37 Binary files /dev/null and b/interfaces/testdata/mulval.nc differ diff --git a/m4/acx_assert_lang_is_fortran_variant.m4 b/m4/acx_assert_lang_is_fortran_variant.m4 index fb995560491e0bc9cf2bc79d3998c71f428c300c..1d857263b105440a5efb4d5d8458bfc3d52e59aa 100644 --- a/m4/acx_assert_lang_is_fortran_variant.m4 +++ b/m4/acx_assert_lang_is_fortran_variant.m4 @@ -6,7 +6,7 @@ dnl Version: 1.0 dnl Keywords: fortran language version assertion dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -51,6 +51,6 @@ dnl dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/acx_c_package.m4 b/m4/acx_c_package.m4 index e749653458f47b9ec66c6567b06da6333e5796e9..c9ec79d07a2225c0d7720ef8e8cecd15a825432f 100644 --- a/m4/acx_c_package.m4 +++ b/m4/acx_c_package.m4 @@ -5,7 +5,7 @@ dnl Version: 1.0 dnl Keywords: configure configure.ac autotools dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -48,7 +48,7 @@ dnl [FUNCTION], [LIB-CANDIDATES], [EXTRA-LIBS], [EXTRA-LIBFLAGS], dnl [ACTION-IF-LIB-NOT-FOUND], dnl [DEFAULT-ROOT], [EXTRA-INCLUDE-PATHS-TO-TRY]) dnl ------------------------------------------------------------------- -dnl Check wether INCLUDE can be compiled and FUNCTION is found in +dnl Check whether INCLUDE can be compiled and FUNCTION is found in dnl LIB-CANDIDATES. Sets PACKAGE_C_LIB and PACKAGE_C_INCLUDE variables to dnl necessary C compiler switches and arguments such that dnl inclusion/compilation succeed for program using INCLUDE or diff --git a/m4/acx_cfortran_flags.m4 b/m4/acx_cfortran_flags.m4 index 35fe2cdba5c1a9eb8978053bbd123e6780cd5b6b..8f09ba15748cdebcf8b258eaeec2c8e83310adfc 100644 --- a/m4/acx_cfortran_flags.m4 +++ b/m4/acx_cfortran_flags.m4 @@ -7,7 +7,7 @@ dnl Version: 1.0 dnl Keywords: dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -36,15 +36,15 @@ dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. dnl -dnl ACX_FC_XLF_QEXTNAME_ADD_APPENDUS +dnl ACX_FC_XLF_QEXTNAME_ADD_APPENDUS([ACTION-IF-FAILURE = FAILURE]) dnl Test if compiler is xlf and if -qextname is in use. dnl Add -Dappendus to CPPFLAGS if the above applies. dnl AC_DEFUN([ACX_XLF_QEXTNAME_ADD_APPENDUS], [AS_CASE([$host], - [*-ibm-aix*], + [*-ibm-aix*|powerpc64-*-linux-*|powerpc-*-linux-*], [AC_MSG_CHECKING([if -Dappendus needs to be added to CPPFLAGS for cfortran.h]) - AS_IF([$CC -qversion 2>&1 | grep '^IBM XL C' >/dev/null], + AS_IF([$CC -qversion 2>&1 | sed -n 1,5p | grep '^IBM XL C' >/dev/null], [acx_temp_qextname_f77flags=`echo "$FFLAGS" | sed -n '/-qextname/{ s/^\(.* \)*-qextname\( .*\)*$/-qextname/;p;}'` acx_temp_qextname_fcflags=`echo "$FCFLAGS" | sed -n '/-qextname/{ s/^\(.* \)*-qextname\( .*\)*$/-qextname/;p;}'` dnl pretend the same option as for FC was used if F77 isn't used at all @@ -61,7 +61,11 @@ AC_DEFUN([ACX_XLF_QEXTNAME_ADD_APPENDUS], [acx_temp_qextname_fcflags=$acx_temp_qextname_f77flags])]) AS_CASE([x"$acx_temp_qextname_fcflags$acx_temp_qextname_f77flags"], [x-qextname], - [AC_MSG_ERROR([Option -qextname must be provided consistently to F77 and FC])], + [AC_MSG_RESULT([error]) + acx_failure_msg="option -qextname must be provided consistently to F77 and FC" + m4_default( + [$1], + [AC_MSG_ERROR([$acx_failure_msg])])], [x-qextname-qextname], [AC_MSG_RESULT([yes]) CPPFLAGS="${CPPFLAGS+$CPPFLAGS }-Dappendus"], @@ -72,11 +76,11 @@ dnl automate flag elicitation for cfortran.h AC_DEFUN([_ACX_FIND_CFORTRAN_DEF], [AC_REQUIRE([AC_CANONICAL_HOST]) _AC_FORTRAN_ASSERT - AC_LANG_CASE([Fortran],[save_FC=$FC ; acx_FC=$FC], - [Fortran 77],[save_F77=$F77 ; acx_FC=$F77]) + AS_VAR_PUSHDEF([acx_FC],[AC_LANG_CASE([Fortran],[FC],[Fortran 77],[F77])])dnl + AS_VAR_PUSHDEF([acx_FCFLAGS],[AC_LANG_CASE([Fortran],[FCFLAGS],[Fortran 77],[FFLAGS])])dnl AS_CASE([$host], [x86_64-*-linux-*|i*86-*-linux-*|*-apple-darwin*|ia64-*-linux-*|x86_64-*-freebsd*|i*86-*-freebsd*], - [acx_temp=`$acx_FC -V 2>&1` + [acx_temp=`$acx_FC -V 2>&1 | sed -n 1,5p` AS_IF([echo "$acx_temp" | grep '^Copyright.*\(The Portland Group\|NVIDIA CORPORATION\)' >/dev/null], [AS_VAR_SET([acx_cf_flag],[-DgFortran])], [echo "$acx_temp" | grep '^NAG Fortran Compiler Release' >/dev/null], @@ -85,19 +89,22 @@ AC_DEFUN([_ACX_FIND_CFORTRAN_DEF], [AS_VAR_SET([acx_cf_flag],[-DgFortran])], [echo "$acx_temp" | grep '^Cray Fortran' >/dev/null], [AS_VAR_SET([acx_cf_flag],[-DgFortran])], - [acx_temp=`$acx_FC --version 2>&1` \ + [acx_temp=`$acx_FC --version 2>&1 | sed -n 1,5p` \ && echo $acx_temp | grep '^GNU Fortran' >/dev/null], [AS_IF([echo $acx_temp | grep g77 >/dev/null], [AS_VAR_SET([acx_cf_flag],[-Dg77Fortran])], [dnl assume gfortran dnl check if compiling with f2c bindings or with default bindings - AS_IF([echo "]AC_LANG_CASE([Fortran],[$FCFLAGS], - [Fortran 77],[$FFLAGS])[" | grep '^\(.* \)*-ff2c\( .*\)*$' >/dev/null], + AS_IF([echo "$acx_FCFLAGS" | grep '^\(.* \)*-ff2c\( .*\)*$' >/dev/null], [AS_VAR_SET([acx_cf_flag],[-Df2cFortran])], [AS_VAR_SET([acx_cf_flag],[-DgFortran])])])], - [acx_temp=`$acx_FC -v 2>&1` \ - && echo $acx_temp | grep '^f2c'], + [echo $acx_temp | grep '^G95' >/dev/null], + [AS_VAR_SET([acx_cf_flag],[-DNAGf90Fortran])], + [$acx_FC -v 2>&1 | sed -n 1,5p | grep '^f2c' >/dev/null], [AS_VAR_SET([acx_cf_flag],[-Df2cFortran])])], + [powerpc64-*-linux-*|powerpc-*-linux-*], + [AS_IF([$acx_FC -qversion 2>&1 | sed -n 1,5p | grep '^IBM XL Fortran' >/dev/null], + [AS_VAR_SET([acx_cf_flag],[-DIBMR2Fortran])])], [*-ibm-aix*], [dnl xlc set _IBMR2 so nothing needs to be done AS_IF([$CC -qversion 2>&1 | grep '^IBM XL C' >/dev/null],, @@ -109,7 +116,8 @@ dnl check if compiling with f2c bindings or with default bindings [sx*-*-*|es*-*-*], [dnl fixme: make sure user is actually using sxf90 dnl but currently there is no alternative I know of - AS_VAR_SET([acx_cf_flag],[-DSXFortran])])]) + AS_VAR_SET([acx_cf_flag],[-DSXFortran])]) + AS_VAR_POPDEF([acx_FC])]) AC_DEFUN([ACX_FIND_CFORTRAN_DEF], [AC_CACHE_CHECK([C preprocessor flags for Fortran calling convention cfortran.h], @@ -124,8 +132,9 @@ p'` AS_IF([test x"$acx_temp" != x], [AS_IF([test x"$acx_cv_cf_flag" = x], [acx_cv_cf_flag="$acx_temp (user-specified)"], - [echo ; echo '"'"$acx_cv_cf_flag $acx_temp"'"' - AC_MSG_ERROR([Multiple specification of cfortran.h flags])])])]) + [acx_failure_msg="multiple specification of cfortran.h flags: "`echo "$acx_cv_cf_flag" | sed 's/ (user-specified)$//'`" $acx_temp" + acx_cv_cf_flag='error' + break])])]) dnl find automatically from machine/compiler AS_IF([test x"$acx_cv_cf_flag" = x], [AC_PROVIDE_IFELSE([AC_PROG_FC], @@ -146,26 +155,26 @@ dnl check f77 flag matches fc flag AC_PROVIDE_IFELSE([AC_PROG_F77], [AC_PROVIDE_IFELSE([AC_PROG_FC], [dnl both FC and F77 are configured - AS_IF([test -z "$F77" -o X"$F77" = Xno], + AS_IF([test -z "$FC" -o X"$FC" != Xno], [acx_cv_cf_flag="$acx_cv_fc_cf_flag (probed)"], - [test -z "$FC" -o X"$FC" = Xno], + [test -z "$F77" -o X"$F77" != Xno], [acx_cv_cf_flag="$acx_cv_f77_cf_flag (probed)"], [AS_IF([test x"$acx_cv_f77_cf_flag" = x"$acx_cv_fc_cf_flag"], [acx_cv_cf_flag="$acx_cv_f77_cf_flag (probed)"], - [AC_MSG_ERROR([cfortran.h flag for $F77 does not match the flag for $FC. -Have you configured compatible compilers?])])]) - ], - [acx_cv_cf_flag="$acx_cv_f77_cf_flag (probed)"])], - [acx_cv_cf_flag="$acx_cv_fc_cf_flag (probed)"]) - ]) - ]) + [acx_failure_msg="cfortran.h flag for $F77 does not match the flag for $FC. +Did you configure compatible compilers?" + acx_cv_cf_flag='error'])])])], + [acx_cv_cf_flag="$acx_cv_fc_cf_flag (probed)"])])]) + AS_IF([test x"$acx_cv_cf_flag" = xerror], + [m4_default([$1], + [AC_MSG_ERROR([$acx_failure_msg])])]) dnl now that flag is established, add (probed) defines to CPPFLAGS AS_IF([echo "$acx_cv_cf_flag" | grep ' (probed)$' >/dev/null], - [CPPFLAGS="${CPPFLAGS+$CPPFLAGS }`echo "$acx_cv_cf_flag" | sed 's/ (probed)$//'`"]) + [CPPFLAGS="${CPPFLAGS+$CPPFLAGS }"`echo "$acx_cv_cf_flag" | sed 's/ (probed)$//'`]) ]) dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/acx_check_cfortran.m4 b/m4/acx_check_cfortran.m4 index c69ebd0cd6594ef69036b1b1232557687808edf0..a8dc4468b80d00eb05603f109ad2351aa95c7689 100644 --- a/m4/acx_check_cfortran.m4 +++ b/m4/acx_check_cfortran.m4 @@ -8,7 +8,7 @@ dnl Version: 1.0 dnl Keywords: dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -55,10 +55,11 @@ AC_DEFUN([_ACX_CHECK_CFORTRAN_FC], r = v * 100.0 ri = 1.0 / v END FUNCTION cftstf])], - [_AC_RUN_LOG([mv "conftest.$ac_objext" "conftest_f.$ac_objext"], - [_AS_ECHO_LOG([Renaming Fortran object file.])]) + [ACX_MV_OBJ([conftest],[conftest_f]) save_LIBS=$LIBS LIBS="conftest_c.$ac_objext conftest_f.$ac_objext $LIBS" + AS_CASE([$FC_FPP_FLAG],[-x\ f??-cpp-input], + [LIBS="-x none $LIBS"]) AC_RUN_IFELSE([AC_LANG_PROGRAM(, [ USE conftest_data, ONLY: ri IMPLICIT NONE @@ -117,8 +118,13 @@ AC_DEFUN([_ACX_CHECK_CFORTRAN_FC], [acx_cv_cfortran_works=yes], [acx_cv_cfortran_works="error"], [AC_MSG_NOTICE([Skipping run test for cfortran.h in cross-compilation mode,]) - AC_MSG_NOTICE([link test succeeded.]) + AC_MSG_NOTICE([cfortran.h link test succeeded for $FC.]) acx_cv_cfortran_works=yes]) + rm -f "conftest_f.$ac_objext" "conftest_f.$OBJEXT" +dnl Some Fortran compilers create module files not in the current +dnl working directory but in the directory with the object file, +dnl therefore we try to delete everything: + rm -f conftest_data* CONFTEST_DATA* 2>/dev/null LIBS=$save_LIBS], [acx_cv_cfortran_works="error compiling Fortran subroutine"]) AC_LANG_POP([Fortran])]) @@ -135,10 +141,11 @@ AC_DEFUN([_ACX_CHECK_CFORTRAN_F77], CFTSTF = V * 100.0 RI = 1.0 / V END FUNCTION CFTSTF])], - [_AC_RUN_LOG([mv "conftest.$ac_objext" "conftest_f.$ac_objext"], - [_AS_ECHO_LOG([Renaming Fortran object file.])]) + [ACX_MV_OBJ([conftest],[conftest_f]) save_LIBS=$LIBS LIBS="conftest_c.$ac_objext conftest_f.$ac_objext $LIBS" + AS_CASE([$FC_FPP_FLAG],[-x\ f??-cpp-input], + [LIBS="-x none $LIBS"]) AC_RUN_IFELSE([AC_LANG_PROGRAM(, [ REAL RI COMMON /CFTSTD/ RI @@ -184,8 +191,9 @@ AC_DEFUN([_ACX_CHECK_CFORTRAN_F77], [acx_cv_cfortran_works=yes], [acx_cv_cfortran_works="error"], [AC_MSG_NOTICE([Skipping run test for cfortran.h in cross-compilation mode,]) - AC_MSG_NOTICE([link test succeeded.]) + AC_MSG_NOTICE([cfortran.h link test succeeded for $F77.]) acx_cv_cfortran_works=yes]) + rm -f "conftest_f.$ac_objext" "conftest_f.$OBJEXT" LIBS=$save_LIBS], [acx_cv_cfortran_works="error compiling Fortran subroutine"]) AC_LANG_POP([Fortran 77])]) @@ -246,10 +254,14 @@ errExit(void) FCALLSCSUB0(errExit,ERR_EXIT,err_exit) ])], - [_AC_RUN_LOG([mv "conftest.$ac_objext" "conftest_c.$ac_objext"], - [_AS_ECHO_LOG([Renaming C object file.])]) - AC_PROVIDE_IFELSE([AC_PROG_FC],[_ACX_CHECK_CFORTRAN_FC]) - AC_PROVIDE_IFELSE([AC_PROG_F77],[_ACX_CHECK_CFORTRAN_F77]) + [ACX_MV_OBJ([conftest],[conftest_c]) + AC_PROVIDE_IFELSE([AC_PROG_FC], + [AS_IF([test -n "$FC" -a X"$FC" != Xno], + [_ACX_CHECK_CFORTRAN_FC], + [acx_cv_cfortran_works=${acx_cv_cfortran_works-yes}])]) + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AS_IF([test -n "$F77" -a X"$F77" != Xno AC_PROVIDE_IFELSE([AC_PROG_FC],[-a \( x"$acx_cv_cfortran_works" = xyes -o -z "$FC" -o X"$FC" = Xno \)])],[_ACX_CHECK_CFORTRAN_F77])]) + rm -f "conftest_c.$ac_objext" "conftest_c.$OBJEXT" ], [acx_cv_cfortran_works="compiling with cfortran.h failed"]) AC_LANG_POP([C]) @@ -270,6 +282,6 @@ FCALLSCSUB0(errExit,ERR_EXIT,err_exit) dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/acx_check_strptr_convert.m4 b/m4/acx_check_strptr_convert.m4 index 6c78deea5d58ebc3df191004b54f60c02dfdbc88..de409d92e910d984fdbd2bf07ffecfd1284ec73a 100644 --- a/m4/acx_check_strptr_convert.m4 +++ b/m4/acx_check_strptr_convert.m4 @@ -91,6 +91,7 @@ end program conftest])], m4_ifval([$1],[$1])], [AC_MSG_RESULT([no]) m4_ifval([$2],[$2])]) + rm -f conftest_mod* CONFTEST_MOD* AC_LANG_POP([Fortran])]) dnl diff --git a/m4/acx_fortran_check_include.m4 b/m4/acx_fortran_check_include.m4 index c902ed0667822b162e17e8a28d63fd5d931d08ed..df5a5b0bf06b16a2d607320a6698153ea417eae3 100644 --- a/m4/acx_fortran_check_include.m4 +++ b/m4/acx_fortran_check_include.m4 @@ -6,7 +6,7 @@ dnl Version: 1.0 dnl Keywords: dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -61,32 +61,32 @@ AC_DEFUN([ACX_FORTRAN_CHECK_MOD_PATHS_IFELSE], AC_REQUIRE([ACX_SL_FC_CHECK_MOD_PATH_FLAG]) AS_VAR_PUSHDEF([acx_Mod], [acx_cv_fortran_mod_$1])dnl AC_MSG_CHECKING([for $1 m4_default([$7],[extra]) module path]) - AC_CACHE_VAL([acx_Mod],dnl - [ac_mod_search_FCFLAGS_SAVE="$FCFLAGS" - for ac_moddir in '' $2; do - AS_IF([test -z "$ac_moddir"], + AC_CACHE_VAL([acx_Mod], + [ac_mod_search_FCFLAGS_SAVE=$FCFLAGS + AS_FOR([Ac_moddir],[ac_moddir],['' $2], + [AS_IF([test -z "Ac_moddir"], [ac_res="none required" FCFLAGS="m4_ifval([$6],[$6 ])$ac_mod_search_FCFLAGS_SAVE"], - [ac_res="$FC_MOD_FLAG$ac_moddir" + [ac_res="$FC_MOD_FLAG]Ac_moddir[" FCFLAGS="m4_ifval([$6],[$6 ])$ac_res $ac_mod_search_FCFLAGS_SAVE"]) - _ACX_FORTRAN_CHECK_MOD_IFELSE([$1],dnl - [AS_IF([test -z "$ac_moddir"],dnl - [AS_VAR_SET([acx_Mod],["$6"])],dnl - [AS_VAR_SET([acx_Mod],["]m4_ifval([$6],[$6 ])[$FC_MOD_FLAG$ac_moddir"])])],,[$5]) - AS_VAR_SET_IF([acx_Mod], [break])dnl - done - FCFLAGS="$ac_mod_search_FCFLAGS_SAVE"]) - AS_VAR_SET_IF([acx_Mod],dnl - [AS_IF([test x"AS_VAR_GET([acx_Mod])" = x],dnl - [AC_MSG_RESULT([(none required)])],dnl - [AC_MSG_RESULT([AS_VAR_GET([acx_Mod])])])], - [AC_MSG_RESULT([not found])]) - AS_VAR_SET_IF([acx_Mod], [$3], [$4])[]dnl + _ACX_FORTRAN_CHECK_MOD_IFELSE([$1], + [AS_IF([test -z "Ac_moddir"], + [AS_VAR_SET([acx_Mod],["$6"])], + [AS_VAR_SET([acx_Mod],["]m4_ifval([$6],[$6 ])[$FC_MOD_FLAG]Ac_moddir["])]) + break],,[$5])]) + FCFLAGS=$ac_mod_search_FCFLAGS_SAVE]) + AS_VAR_SET_IF([acx_Mod], + [AS_IF([test x"AS_VAR_GET([acx_Mod])" = x], + [AC_MSG_RESULT([(none required)])], + [AC_MSG_RESULT([AS_VAR_GET([acx_Mod])])])m4_ifval([$3],[ + $3])], + [AC_MSG_RESULT([not found])m4_ifval([$4],[ + $4])]) AS_VAR_POPDEF([acx_Mod])dnl ])# ACX_FORTRAN_CHECK_MOD_PATHS_IFELSE dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/acx_fortran_include_flag.m4 b/m4/acx_fortran_include_flag.m4 new file mode 100644 index 0000000000000000000000000000000000000000..1aa06fd6111f3ae41fbaee5d82e43586bc48e698 --- /dev/null +++ b/m4/acx_fortran_include_flag.m4 @@ -0,0 +1,35 @@ +# ACX_FORTRAN_INCLUDE_FLAG([ACTION-IF-SUCCESS], +# [ACTION-IF-FAILURE = FAILURE]) +# ----------------------------------------------------------------------------- +# Finds the compiler flag needed to specify search paths for the Fortran +# "INCLUDE" statement. The result is either "unknown" or the actual compiler +# flag, which may contain a significant trailing whitespace. +# +# If successful, runs ACTION-IF-SUCCESS, otherwise runs ACTION-IF-FAILURE +# (defaults to failing with an error message). +# +# The result is cached in the acx_cv_[]_AC_LANG_ABBREV[]_ftn_include_flag variable. +# +AC_DEFUN([ACX_FORTRAN_INCLUDE_FLAG], + [_AC_FORTRAN_ASSERT()dnl + m4_pushdef([acx_cache_var], [acx_cv_[]_AC_LANG_ABBREV[]_ftn_include_flag])dnl + AC_CACHE_CHECK([for _AC_LANG compiler flag needed to specify search paths dnl +for the "INCLUDE" statement], [acx_cache_var], + [acx_cache_var=unknown + AS_MKDIR_P([conftest.dir]) + AC_LANG_CONFTEST([AC_LANG_PROGRAM]) + mv conftest.$ac_ext conftest.dir/conftest.inc + AC_LANG_CONFTEST([AC_LANG_SOURCE( + [[ include "conftest.inc"]])]) + acx_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS + for acx_flag in -I '-I '; do + _AC_LANG_PREFIX[]FLAGS="$acx_save_[]_AC_LANG_PREFIX[]FLAGS ${acx_flag}conftest.dir" + AC_LINK_IFELSE([], [acx_cache_var=$acx_flag]) + test "x$acx_cache_var" != xunknown && break + done + []_AC_LANG_PREFIX[]FLAGS=$acx_save_[]_AC_LANG_PREFIX[]FLAGS + rm -rf conftest.$ac_ext conftest.dir]) + AS_VAR_IF([acx_cache_var], [unknown], [m4_default([$2], + [AC_MSG_FAILURE([unable to detect _AC_LANG compiler flag needed to dnl +specify search paths for the "INCLUDE" statement])])], [$1]) + m4_popdef([acx_cache_var])]) diff --git a/m4/acx_fortran_package.m4 b/m4/acx_fortran_package.m4 index aa5b316e6279a3e92c578c7d08fc7a9c1d9682ab..42ff00151cd6df1c99c4b5f62162c50bcee83f41 100644 --- a/m4/acx_fortran_package.m4 +++ b/m4/acx_fortran_package.m4 @@ -8,7 +8,7 @@ dnl Version: 1.0 dnl Keywords: fortran package availability check dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -51,7 +51,7 @@ dnl [FUNCTION], [LIB-CANDIDATES], [EXTRA-LIBS], [EXTRA-LIBFLAGS], dnl [ACTION-IF-LIB-NOT-FOUND], dnl [DEFAULT-ROOT]) dnl ------------------------------------------------------------------- -dnl Check wether INCLUDE can be compiled and FUNCTION is found in +dnl Check whether INCLUDE can be compiled and FUNCTION is found in dnl LIB-CANDIDATES. Sets PACKAGE_LIB and PACKAGE_INCLUDE variables to dnl necessary Fortran compiler switches and arguments such that dnl inclusion/compilation succeed for program using INCLUDE or @@ -74,71 +74,90 @@ dnl MODULE, [EXTRA-INCLUDES], [EXTRA-INCLUDEFLAGS], dnl [ACTION-IF-MODULE-NOT-FOUND], dnl SUBROUTINE, [LIB-CANDIDATES], [EXTRA-LIBS], [EXTRA-LIBFLAGS], dnl [ACTION-IF-LIB-NOT-FOUND], -dnl [DEFAULT-ROOT],[EXTRA-DECLARATION],[SUBROUTINE-ARGUMENTS]) +dnl [DEFAULT-ROOT],[EXTRA-DECLARATION],[SUBROUTINE-ARGUMENTS], +dnl [ALTERNATIVE-TEST-CODE]) dnl ------------------------------------------------------------------- -dnl Check wether USE MODULE can be compiled and FUNCTION is found in +dnl Check whether USE MODULE can be compiled and FUNCTION is found in dnl LIB-CANDIDATES. Sets PACKAGE_LIB and PACKAGE_MOD variables to dnl necessary Fortran compiler switches and arguments such that dnl compilation and linking succeed for programs using MODULE and dnl calling SUBROUTINE respectively. Extra declaration will be -dnl inserted between use MODULE and the subroutine call. +dnl inserted between use MODULE and the subroutine call. The subroutine +dnl call can be overridden with arbitrary code by specifying +dnl ALTERNATIVE-TEST-CODE. dnl dnl Also defines configure --with arguments for PACKAGEROOT, dnl PACKAGE_FC_LIB and PACKAGE_FC_MOD. AC_DEFUN([ACX_F90_PACKAGE], - [AC_LANG_PUSH([Fortran]) - AC_REQUIRE([AC_PROG_FC]) - AC_REQUIRE([ACX_SL_FC_CHECK_MOD_PATH_FLAG]) - AC_REQUIRE([_ASX_TR_ARG_PREPARE]) - AC_SUBST(AS_TR_CPP([$1][root])) + [AC_REQUIRE([_ASX_TR_ARG_PREPARE])dnl + AC_LANG_PUSH([Fortran])dnl + AS_VAR_PUSHDEF([acx_pkg_root],[AS_TR_CPP([$1][root])])dnl + AS_VAR_PUSHDEF([acx_pkg_lib],[AS_TR_CPP([$1_]_AC_LANG_ABBREV[_LIB])])dnl + AS_VAR_PUSHDEF([acx_pkg_mod],[AS_TR_CPP([$1_]_AC_LANG_ABBREV[_MOD])])dnl + AS_VAR_PUSHDEF([acx_pkg_bindings], + [AS_TR_SH([have_][$1_]_AC_LANG_ABBREV[_bindings])])dnl + AC_REQUIRE([AC_PROG_FC])dnl + AC_REQUIRE([ACX_SL_FC_CHECK_MOD_PATH_FLAG])dnl + AC_REQUIRE([_ASX_TR_ARG_PREPARE])dnl + AC_SUBST(acx_pkg_root)dnl + AS_VAR_SET([acx_pkg_bindings],[yes]) AC_ARG_WITH(ASX_TR_ARG([$1-root]), [AS_HELP_STRING([--with-]ASX_TR_ARG([$1])[-root], - [set directory to search for $1 headers and library, @<:@default=$11@:>@])], - [AS_TR_CPP([$1][root])="$AS_TR_SH([with_]ASX_TR_ARG([$1])[_root])"], - m4_ifval([$11], [AS_TR_CPP([$1][root])=$11])) - AS_VAR_SET_IF(AS_TR_CPP([$1][root]), - [AS_VAR_SET_IF([AS_TR_CPP([$1_]_AC_LANG_ABBREV[_LIB])],, - [AS_TR_CPP([$1_]_AC_LANG_ABBREV[_LIB])="-L$[]AS_TR_CPP([$1][root])/lib"]) - AS_VAR_SET_IF([AS_TR_CPP([$1_]_AC_LANG_ABBREV[_MOD])],, - [AS_TR_CPP([$1_]_AC_LANG_ABBREV[_MOD])="$FC_MOD_FLAG$[]AS_TR_CPP([$1][root])/include"])]) - m4_ifval([$2],dnl + [set directory to search for $1 headers and library]m4_ifval([$11],[, @<:@default=$11@:>@]))], + [AS_VAR_COPY([acx_pkg_root],[withval])], + m4_ifval([$11], [AS_VAR_SET([acx_pkg_root],[$11])])) + AS_VAR_SET_IF([acx_pkg_root], + [AS_VAR_SET_IF([acx_pkg_lib],, + [AS_VAR_SET([acx_pkg_lib],["-L]AS_VAR_GET([acx_pkg_root])[/lib"])]) + AS_VAR_SET_IF([acx_pkg_mod],, + [AS_VAR_SET([acx_pkg_mod], ["$FC_MOD_FLAG]AS_VAR_GET([acx_pkg_root])[/include"])])]) + m4_ifval([$2], [AC_ARG_WITH(ASX_TR_ARG([$1-]_AC_LANG_ABBREV[-mod]), [AS_HELP_STRING([--with-]ASX_TR_ARG([$1-]_AC_LANG_ABBREV)[-mod], [specifically set directory to search for $1 module, ]dnl [@<:@default=$]AS_TR_SH(ASX_TR_ARG([with_$1_root]))[/include@:>@])], - AS_TR_CPP([$1_]_AC_LANG_ABBREV[_MOD])[="$FC_MOD_FLAG$AS_TR_SH(ASX_TR_ARG([with_$1_]_AC_LANG_ABBREV[_mod]))"], - []) - AC_ARG_VAR(AS_TR_CPP([$1_]_AC_LANG_ABBREV[_MOD]), + [AS_VAR_SET([acx_pkg_mod],["$FC_MOD_FLAG$withval"])]) + AC_ARG_VAR(acx_pkg_mod, [flags to enable 'USE $1' in Fortran program.]) - ACX_FORTRAN_CHECK_MOD_PATHS_IFELSE([$2],["$[]AS_TR_CPP([$1][root])/include" "$[]AS_TR_CPP([$1][root])/lib"], - AS_TR_CPP([$1_]_AC_LANG_ABBREV[_MOD])[=]AS_VAR_GET([acx_Mod]), - [$5], - [$3],m4_ifval([$4],[$4 ])[$[]AS_TR_CPP([$1_]_AC_LANG_ABBREV[_MOD])])]) + ACX_FORTRAN_CHECK_MOD_PATHS_IFELSE([$2],["]AS_VAR_GET([acx_pkg_root])[/include" "]AS_VAR_GET([acx_pkg_root])[/lib"], + [AS_VAR_COPY([acx_pkg_mod],[acx_Mod])], + [AS_VAR_SET([acx_pkg_bindings],[no]); $5], + [$3],m4_ifval([$4],[$4 ])[AS_VAR_GET([acx_pkg_mod])])]) m4_ifval([$6], - [AC_ARG_WITH(ASX_TR_ARG([$1]_AC_LANG_ABBREV[-lib]), + [AC_ARG_WITH(ASX_TR_ARG([$1-]_AC_LANG_ABBREV[-lib]), [AS_HELP_STRING([--with-]ASX_TR_ARG([$1-]_AC_LANG_ABBREV)[-lib], [specifically set directory to search for $1 library, ]dnl [@<:@default=$]AS_TR_SH(ASX_TR_ARG([with_$1_root]))[/lib@:>@])], - AS_TR_CPP([$1_]_AC_LANG_ABBREV[_LIB])[="-L$AS_TR_SH(ASX_TR_ARG([with_$1_]_AC_LANG_ABBREV[_lib]))"], - []) - AS_IF([test x$]AS_TR_SH([have_][$1_]_AC_LANG_ABBREV[_bindings])[ = xyes], + [AS_VAR_SET([acx_pkg_lib], ["-L$withval"])]) + AC_ARG_VAR(acx_pkg_lib, + [specifically set flags to use when linking $1.])dnl + AC_SUBST(acx_pkg_lib)dnl + AS_VAR_IF([acx_pkg_bindings], [yes], [AS_VAR_PUSHDEF([ac_Search], [acx_cv_option_search_$6_]_AC_LANG_ABBREV)dnl - AC_SUBST(AS_TR_CPP([$1_]_AC_LANG_ABBREV[_LIB])) - acx_save_FCFLAGS="$FCFLAGS" - FCFLAGS="$[]AS_TR_CPP([$1_]_AC_LANG_ABBREV[_MOD]) $FCFLAGS" - ACX_OPTION_SEARCH_LIBS_MULTI([$6],[$7],,dnl - [$10],[$8],m4_ifval([$9],[$9 ])$[]AS_TR_CPP([$1_]_AC_LANG_ABBREV[_LIB]), + acx_save_FCFLAGS=$FCFLAGS + FCFLAGS="AS_VAR_GET([acx_pkg_mod]) $FCFLAGS" + ACX_OPTION_SEARCH_LIBS_MULTI([$6],[$7],, + [AS_VAR_SET([acx_pkg_bindings],[no]) ; $10],[$8],m4_ifval([$9],[$9 ])[AS_VAR_GET([acx_pkg_lib])], [ use $2]m4_ifval([$12],[[ - $12]]),[ call $6$13]) - FCFLAGS="$acx_save_FCFLAGS" - AS_TR_CPP([$1_]_AC_LANG_ABBREV[_LIB])="AS_VAR_GET([ac_Search])" + $12]]),m4_ifval([$14],[[$14]],[[ call $6$13]])) + FCFLAGS=$acx_save_FCFLAGS + AS_LITERAL_IF([ac_Search], + [AS_VAR_SET([acx_pkg_lib], + [`echo "$]ac_Search[" | sed -e 's/^ *//;s/ *$//'`])], + [AS_VAR_COPY([acx_temp],[ac_Search]) + acx_temp=`echo "$acx_temp" | sed -e 's/^ *//;s/ *$//'` + AS_VAR_COPY([acx_pkg_lib],[acx_temp])]) AS_VAR_POPDEF([ac_Search])])]) + AS_VAR_POPDEF([acx_pkg_bindings])dnl + AS_VAR_POPDEF([acx_pkg_mod])dnl + AS_VAR_POPDEF([acx_pkg_lib])dnl + AS_VAR_POPDEF([acx_pkg_root])dnl AC_LANG_POP([Fortran])dnl ]) dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/acx_lang_c_check_include.m4 b/m4/acx_lang_c_check_include.m4 index 8c04bfcd43a3c85ec60ce8a383c68e72ca23aa0f..f3578992906d42f2a483f0184b3bd4305baa74fa 100644 --- a/m4/acx_lang_c_check_include.m4 +++ b/m4/acx_lang_c_check_include.m4 @@ -1,4 +1,4 @@ -dnl acx_lang_c_check_include.m4 --- Check wether an include succeeds +dnl acx_lang_c_check_include.m4 --- Check whether an include succeeds dnl given one from a collection of dnl include paths. dnl @@ -8,7 +8,7 @@ dnl Version: 1.0 dnl Keywords: c header check -I path dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -48,7 +48,7 @@ dnl # [INCLUDES], [INCLUDE-FLAGS], [EXTRA-INCLUDE-FLAG-SETS]) # ------------------------------------------------------------------ # Check the compiler accepts HEADER-FILE. The INCLUDES might be defaulted. -AC_DEFUN([ACX_LANG_CHECK_INCLUDE_PATHS_IFELSE(C)],dnl +AC_DEFUN([ACX_LANG_CHECK_INCLUDE_PATHS_IFELSE(C)], [ACX_GENERIC_CHECK_INCLUDE_PATHS_IFELSE(CPPFLAGS,-I,$@)]) # m4_define([ACX_LANG_INCLUDE_PROGRAM(C)], @@ -57,6 +57,6 @@ m4_define([ACX_LANG_INCLUDE_PROGRAM(C)], dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/acx_lang_check_include.m4 b/m4/acx_lang_check_include.m4 index 9d4832fd5ecf8904718af1ae2087e033dd72672a..0228bdd2a89a6079a1afea61cbc1de38147935f5 100644 --- a/m4/acx_lang_check_include.m4 +++ b/m4/acx_lang_check_include.m4 @@ -6,7 +6,7 @@ dnl Version: 1.0 dnl Keywords: package include check dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -45,7 +45,7 @@ dnl # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], # [INCLUDES], [INCLUDE-FLAGS]) # ------------------------------------------------------------------ -# Check wether the compiler accepts HEADER-FILE. +# Check whether the compiler accepts HEADER-FILE. # The INCLUDES might be defaulted. AC_DEFUN([ACX_LANG_CHECK_INCLUDE_PATHS_IFELSE],dnl [_AC_LANG_DISPATCH([$0],_AC_LANG,$@)]) @@ -80,7 +80,7 @@ AC_DEFUN([ACX_LANG_CHECK_INCLUDE_IFELSE], # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], # [INCLUDES], [INCLUDE-FLAGS], [EXTRA-INCLUDE-FLAG-SETS]) # ------------------------------------------------------------------ -# Check wether the the current language compiler accepts HEADER-FILE. +# Check whether the the current language compiler accepts HEADER-FILE. # The INCLUDES might be defaulted. AC_DEFUN([ACX_GENERIC_CHECK_INCLUDE_PATHS_IFELSE], [AS_VAR_PUSHDEF([acx_Include], [acx_cv_]_AC_LANG_ABBREV[_include_$3])dnl @@ -88,36 +88,43 @@ AC_DEFUN([ACX_GENERIC_CHECK_INCLUDE_PATHS_IFELSE], AC_MSG_CHECKING([for $3 extra include path]) AC_CACHE_VAL([acx_Include],dnl [AS_VAR_SET([save_flags],["@S|@$1"]) + AS_LITERAL_IF([save_flags],, + [AS_VAR_COPY([acx_temp],[save_flags +])])dnl while :; do - m4_foreach([ACX_IncSet],[$9], - [for ac_incdir in ''m4_ifval([$4],[ $4]); do - AS_IF([test -z "$ac_incdir"], - [ac_res="none required" - $1="m4_ifval(ACX_IncSet,ACX_IncSet )$8 AS_VAR_GET([save_flags])"], - [ac_res="$2$ac_incdir" - $1="m4_ifval(ACX_IncSet,ACX_IncSet )$8 $ac_res AS_VAR_GET([save_flags])"]) - _ACX_LANG_CHECK_INCLUDE_IFELSE([$3],dnl - [AS_IF([test -z "$ac_incdir"],dnl - [AS_VAR_SET([acx_Include],["]m4_ifval(ACX_IncSet,ACX_IncSet )$8["])],dnl - [AS_VAR_SET([acx_Include],["]m4_ifval(ACX_IncSet,ACX_IncSet )[$8 $2$ac_incdir"])])],,[$7]) - AS_VAR_SET_IF([acx_Include], [break]) - done - AS_VAR_SET_IF([acx_Include], [break]) - ]) - break + m4_foreach([ACX_IncSet],[$9], + [AS_FOR([AC_INCDIR],[ac_incdir],['']m4_ifval([$4],[ $4]), + [AS_IF([test -z "$ac_incdir"], + [ac_res="none required" + $1="m4_ifval(ACX_IncSet,ACX_IncSet )m4_ifval([$8],[$8 ])AS_LITERAL_IF([save_flags],[$save_flags],[$acx_temp])"], + [ac_res="$2$ac_incdir" + $1="m4_ifval(ACX_IncSet,ACX_IncSet )m4_ifval([$8],[$8 ])$ac_res AS_LITERAL_IF([save_flags],[$save_flags],[$acx_temp])"]) + _ACX_LANG_CHECK_INCLUDE_IFELSE([$3],dnl + [AS_IF([test -z "$ac_incdir"],dnl + [AS_VAR_SET([acx_Include],["]m4_ifval(ACX_IncSet,ACX_IncSet )$8["])],dnl + [AS_VAR_SET([acx_Include],["]m4_ifval(ACX_IncSet,ACX_IncSet )[$8 $2$ac_incdir"])])],,[$7]) + AS_VAR_SET_IF([acx_Include], [break])]) + AS_VAR_SET_IF([acx_Include], [break]) + ]) + break done AS_VAR_COPY([$1],[save_flags])]) AS_VAR_SET_IF([acx_Include], - [acx_temp=]AS_VAR_GET([acx_Include])[ + [AS_LITERAL_IF([acx_Include], + [AS_VAR_PUSHDEF([acx_temp],[acx_Include])], + [AS_VAR_COPY([acx_temp],[acx_Include +])])dnl AS_IF([test x"$acx_temp" = x], - [AC_MSG_RESULT([(none required)])], - [AC_MSG_RESULT([$acx_temp])])], + [AC_MSG_RESULT([(none required)])], + [AC_MSG_RESULT([$acx_temp])]) + AS_LITERAL_IF([acx_Include], + [AS_VAR_POPDEF([acx_temp],[acx_Include])])], [AC_MSG_RESULT([not found])]) AS_VAR_SET_IF([acx_Include], [$5], [$6]) AS_VAR_POPDEF([acx_Include])])dnl dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/acx_lang_fortran_check_include.m4 b/m4/acx_lang_fortran_check_include.m4 index f522555ef06c58d5f8fd829affdf9df4d50fd649..5ed73283b8654fcff9ef6f99dd1e9706b003afbe 100644 --- a/m4/acx_lang_fortran_check_include.m4 +++ b/m4/acx_lang_fortran_check_include.m4 @@ -7,7 +7,7 @@ dnl Version: 1.0 dnl Keywords: dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -61,6 +61,6 @@ AC_DEFUN([ACX_LANG_INCLUDE_PROGRAM(Fortran)], dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/acx_lang_package.m4 b/m4/acx_lang_package.m4 index 8cf5bc3758670fe39b7fa1e3847cc2d7077d33b7..e18889f8e116c16de93f2c970cfe3af02d6c4030 100644 --- a/m4/acx_lang_package.m4 +++ b/m4/acx_lang_package.m4 @@ -10,7 +10,7 @@ dnl Version: 1.0 dnl Keywords: dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -51,7 +51,7 @@ dnl [EXTRA-INCLUDEFLAGS], [ACTION-IF_HEADER-NOT-FOUND], [FUNCTION], dnl LIBFLAG, [LIB-CANDIDATES], [EXTRA-LIBS], [EXTRA-LIBFLAGS], dnl [ACTION-IF-LIB-NOT-FOUND], [DEFAULT-ROOT], [EXTRA-INCLUDE-DIRS-TO-TRY]) dnl ------------------------------------------------------------------- -dnl Check wether INCLUDE can be compiled and FUNCTION is found in +dnl Check whether INCLUDE can be compiled and FUNCTION is found in dnl LIB-CANDIDATES with current language compiler. Sets PACKAGE_LANG_LIB dnl and PACKAGE_LANG_INCLUDE variables to necessary compiler dnl switches and arguments such that inclusion/compilation succeed for @@ -75,60 +75,65 @@ AC_DEFUN([ACX_GENERIC_PACKAGE], AC_ARG_WITH(ASX_TR_ARG([$1-root]), [AS_HELP_STRING([--with-]ASX_TR_ARG([$1])[-root], [set directory to search for $1 headers and library]m4_ifval([$13],[, @<:@default=$13@:>@]))], - [AS_VAR_SET([acx_pkg_root],"$AS_TR_SH([with_]ASX_TR_ARG([$1])[_root])")], + [AS_VAR_COPY([acx_pkg_root],[withval])], m4_ifval([$13], AS_VAR_SET([acx_pkg_root],[$13]))) AS_VAR_SET_IF([acx_pkg_root], [AS_VAR_SET_IF([acx_pkg_lib],, - [AS_VAR_COPY([acx_temp],acx_pkg_root) - AS_VAR_SET([acx_pkg_lib],["$8$acx_temp/lib"])]) + [AS_LITERAL_IF([acx_pkg_root], + [AS_VAR_SET([acx_pkg_lib],["$8$]acx_pkg_root[/lib"])], + [AS_VAR_COPY([acx_temp],acx_pkg_root) + AS_VAR_SET([acx_pkg_lib],["$8$acx_temp/lib"])])]) AS_VAR_SET_IF([acx_pkg_inc],, - [AS_VAR_COPY([acx_temp],acx_pkg_root) - AS_VAR_SET([acx_pkg_inc],["$3$acx_temp/include"])])]) + [AS_LITERAL_IF([acx_pkg_root], + [AS_VAR_SET([acx_pkg_inc],["$3$]acx_pkg_root[/include"])], + [AS_VAR_COPY([acx_temp],acx_pkg_root) + AS_VAR_SET([acx_pkg_inc],["$3$acx_temp/include"])])])]) m4_ifval([$2], [AC_ARG_WITH(ASX_TR_ARG([$1-include]), [AS_HELP_STRING([--with-[]ASX_TR_ARG([$1])[]-include], [specifically set directory to search for $1 headers, ]dnl [@<:@default=$]AS_TR_SH(ASX_TR_ARG([with_$1_root]))[/include@:>@])], - [AS_VAR_SET([acx_pkg_inc],["]$3[$]AS_TR_SH(ASX_TR_ARG([with_$1_include]))["])]) - AC_ARG_VAR(acx_pkg_inc,dnl -[specifically set flags to use when compiling sources -using $1 includes.]) + [AS_VAR_SET([acx_pkg_inc],["$3$withval"])]) + AC_ARG_VAR(acx_pkg_inc, + [specifically set flags to use when compiling sources using $1 includes.]) ACX_LANG_CHECK_INCLUDE_PATHS_IFELSE([$2],[$14], - [AS_VAR_COPY([acx_temp],[acx_cv_pkg_inc]) - acx_temp=`echo "$acx_temp" | sed -e 's/^ *//;s/ *$//'` - AS_VAR_COPY([acx_pkg_inc],[acx_temp])], - [AS_VAR_SET([acx_pkg_bindings],[no]) - $6], + [AS_LITERAL_IF([acx_cv_pkg_inc], + [AS_VAR_SET([acx_pkg_inc],[`echo "$]acx_cv_pkg_inc[" | sed -e 's/^ *//;s/ *$//'`])], + [AS_VAR_COPY([acx_temp],[acx_cv_pkg_inc]) + acx_temp=`echo "$acx_temp" | sed -e 's/^ *//;s/ *$//'` + AS_VAR_COPY([acx_pkg_inc],[acx_temp])])], + [AS_VAR_SET([acx_pkg_bindings],[no]); $6], [$4],[$]acx_pkg_inc,m4_ifval([$5],[[$5]],[[[]]]))]) m4_ifval([$7], [AC_ARG_WITH(ASX_TR_ARG([$1-lib]), [AS_HELP_STRING([--with-]ASX_TR_ARG([$1])[-lib], [specifically set directory to search for $1 library, ]dnl [@<:@default=$]AS_TR_SH(ASX_TR_ARG([with_$1_root]))[/lib@:>@])], - [AS_VAR_SET([acx_pkg_lib],["$8$AS_TR_SH(ASX_TR_ARG([with_$1_lib]))"])]) + [AS_VAR_SET([acx_pkg_lib],["$8$withval"])]) AC_ARG_VAR(acx_pkg_lib, - [specifically set flags to use when linking $1.]) - AC_SUBST(acx_pkg_lib) - AS_VAR_IF([acx_pkg_bindings],[yes], + [specifically set flags to use when linking $1.])dnl + AC_SUBST(acx_pkg_lib)dnl + AS_VAR_IF([acx_pkg_bindings], [yes], [AS_VAR_PUSHDEF([ac_Search],[acx_cv_option_search_$7_]_AC_LANG_ABBREV)dnl - ACX_OPTION_SEARCH_LIBS_MULTI([$7],[$9],,dnl + ACX_OPTION_SEARCH_LIBS_MULTI([$7],[$9],, [AS_VAR_SET([acx_pkg_bindings],[no]) - $12],[$10],m4_ifval([$11],[$11 ])$[acx_pkg_lib]) - AS_VAR_COPY([acx_temp],[ac_Search]) - acx_temp=`echo "$acx_temp" | sed -e 's/^ *//;s/ *$//'` - AS_VAR_COPY([acx_pkg_lib],[acx_temp]) - AS_VAR_POPDEF([ac_Search])dnl - ]) - ])dnl - AS_VAR_POPDEF([acx_pkg_bindings]) - AS_VAR_POPDEF([acx_cv_pkg_inc]) - AS_VAR_POPDEF([acx_pkg_inc]) - AS_VAR_POPDEF([acx_pkg_lib]) - AS_VAR_POPDEF([acx_pkg_root]) - ]) + $12],[$10],m4_ifval([$11],[$11 ])$acx_pkg_lib) + AS_LITERAL_IF([ac_Search], + [AS_VAR_SET([acx_pkg_lib], + [`echo "$]ac_Search[" | sed -e 's/^ *//;s/ *$//'`])], + [AS_VAR_COPY([acx_temp],[ac_Search]) + acx_temp=`echo "$acx_temp" | sed -e 's/^ *//;s/ *$//'` + AS_VAR_COPY([acx_pkg_lib],[acx_temp])]) + AS_VAR_POPDEF([ac_Search])])]) + AS_VAR_POPDEF([acx_pkg_bindings])dnl + AS_VAR_POPDEF([acx_cv_pkg_inc])dnl + AS_VAR_POPDEF([acx_pkg_inc])dnl + AS_VAR_POPDEF([acx_pkg_lib])dnl + AS_VAR_POPDEF([acx_pkg_root])dnl + ]) dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/acx_lt_problems.m4 b/m4/acx_lt_problems.m4 index f2e1e58d2ab788b67d3de67182b30375607b5fd2..99da19b3aaa8d256f77cb617a266f262fdf863bc 100644 --- a/m4/acx_lt_problems.m4 +++ b/m4/acx_lt_problems.m4 @@ -6,7 +6,7 @@ dnl Version: 1.0 dnl Keywords: dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -54,10 +54,10 @@ dnl causes a duplicate exit handler that fails and clobbers the dnl programs exit status (set to 128). dnl AC_DEFUN([_ACX_LT_PROBLEMS], - [AC_REQUIRE([AC_CANONICAL_HOST]) - AC_LANG_CASE([Fortran],[acx_Comp=$FC], - [Fortran 77],[acx_Comp=$F77], - [C],[acx_Comp=$CC]) + [AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_LANG_CASE([Fortran],[m4_pushdef([acx_Comp],[FC])m4_pushdef([acx_flags_var],[FCFLAGS])], + [Fortran 77],[m4_pushdef([acx_Comp],[F77])m4_pushdef([acx_flags_var],[FFLAGS])], + [C],[m4_pushdef([acx_Comp],[CC])m4_pushdef([acx_flags_var],[CFLAGS])])dnl _AS_ECHO_LOG([testing if $acx_Comp cannot build working shared objects]) AS_CASE([$host], [*-ibm-aix*], @@ -65,8 +65,11 @@ AC_DEFUN([_ACX_LT_PROBLEMS], [acx_cv_disable_shared=yes])], [x86_64-*-linux-*|i*86-*-linux-*|*-apple-darwin*|ia64-*-linux-*|x86_64-*-freebsd*|i*86-*-freebsd*], [AS_IF([$acx_Comp -V 2>&1 | grep '^Intel(R).*Fortran.*Compiler.*Version 15.0.@<:@123@:>@' >/dev/null], - [acx_cv_disable_shared=yes])]) - _AS_ECHO_LOG([result: $acx_cv_disable_shared])]) + [AS_CASE([" $acx_flags_var $LDFLAGS "], + [*\ -Qlocation,ld,*\ *], + [acx_cv_disable_shared=yes], + [acx_flags_var="$acx_flags_var -Qlocation,ld,$ac_abs_confdir/util/icomp15"])])]) + _AS_ECHO_LOG([result: $acx_cv_disable_shared])m4_popdef([acx_Comp])m4_popdef([acx_flags_var])]) dnl dnl run test for C and Fortran compilers AC_DEFUN([ACX_LT_PROBLEMS], @@ -91,6 +94,6 @@ AC_DEFUN([ACX_LT_PROBLEMS], dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/acx_lang_other_suffix_conftest.m4 b/m4/acx_m4_list_to_quoted_strings.m4 similarity index 65% rename from m4/acx_lang_other_suffix_conftest.m4 rename to m4/acx_m4_list_to_quoted_strings.m4 index b2cb75781852fb153f450d2e1deafbc58955193e..a3a87fa8ceb54e51ef6efaeafb2c0243677b8973 100644 --- a/m4/acx_lang_other_suffix_conftest.m4 +++ b/m4/acx_m4_list_to_quoted_strings.m4 @@ -1,15 +1,13 @@ -dnl acx_lang_other_suffix_conftest.m4 --- create a language test with a suffix -dnl different from the default, i.e. -dnl .inc instead of .f90 for Fortran -dnl headers +dnl acx_m4_list_to_quoted_strings.m4 --- expand m4 quoted list to +dnl shell list of quoted strings dnl -dnl Copyright (C) 2010 Thomas Jahns <jahns@dkrz.de> +dnl Copyright (C) 2019 Thomas Jahns <jahns@dkrz.de> dnl dnl Version: 1.0 -dnl Keywords: dnl Author: Thomas Jahns <jahns@dkrz.de> +dnl Keywords: dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -38,27 +36,18 @@ dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. dnl -dnl Commentary: -dnl -dnl -dnl -dnl Code: -dnl -dnl ACX_LANG_OTHER_SUFFIX_CONFTEST(SUFFIX, SOURCE) -dnl produce source in same language environment as AC_LANG_CONFTEST uses -dnl but change ac_ext to SUFFIX, so that a file conftest.SUFFIX will be -dnl written instead (useful e.g. to produce a header file). -AC_DEFUN([ACX_LANG_OTHER_SUFFIX_CONFTEST], - [m4_define([_ACX_LANG_OLD],_AC_LANG) - AC_LANG_PUSH(_AC_LANG) - ac_ext="$1" - AC_LANG_CONFTEST([$2]) - AC_LANG_POP(_ACX_LANG_OLD) - m4_undefine([_ACX_LANG_OLD]) - ]) +dnl ACX_M4_LIST_TO_QUOTED_STRINGS +dnl expand m4 quoted list to shell list of quoted strings +dnl e.g. converts +dnl [[a],[b]] to "a" "b" +m4_define([_ACX_M4_LIST_TO_QUOTED_STRINGS], + [m4_cond([$#],[0],,[$#],[1],["$1"], + ["$1" _ACX_M4_LIST_TO_QUOTED_STRINGS(m4_shift($@))])])dnl +AC_DEFUN([ACX_M4_LIST_TO_QUOTED_STRINGS], + [_ACX_M4_LIST_TO_QUOTED_STRINGS(m4_unquote([$1]))]) dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/acx_mpirun.m4 b/m4/acx_mpirun.m4 new file mode 100644 index 0000000000000000000000000000000000000000..5d2b7c1adc3d68fca4d40a889fe6c1a5e338b73f --- /dev/null +++ b/m4/acx_mpirun.m4 @@ -0,0 +1,104 @@ +dnl acx_mpirun.m4 --- check whether launching MPI programs works +dnl +dnl Copyright (C) 2014 Thomas Jahns <jahns@dkrz.de> +dnl +dnl Keywords: configure configure.ac autoconf MPI mpirun mpiexec +dnl Author: Thomas Jahns <jahns@dkrz.de> +dnl Maintainer: Thomas Jahns <jahns@dkrz.de> +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm +dnl +dnl Redistribution and use in source and binary forms, with or without +dnl modification, are permitted provided that the following conditions are +dnl met: +dnl +dnl Redistributions of source code must retain the above copyright notice, +dnl this list of conditions and the following disclaimer. +dnl +dnl Redistributions in binary form must reproduce the above copyright +dnl notice, this list of conditions and the following disclaimer in the +dnl documentation and/or other materials provided with the distribution. +dnl +dnl Neither the name of the DKRZ GmbH nor the names of its contributors +dnl may be used to endorse or promote products derived from this software +dnl without specific prior written permission. +dnl +dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +dnl IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +dnl TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +dnl OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +dnl +dnl +dnl ACX_MPIRUN([NUM_TASKS=4],[ACTION-IF-WORKING], +dnl [ACTION-IF-FAILED=AC_MSG_FAILURE]) +dnl +dnl First determines mpi launcher program (and sets MPI_LAUNCH to its path), +dnl then builds and runs simple program with 4 tasks +dnl (or NUM_TASKS if specified). +dnl MPI_LAUNCH is either set to a valid MPI launcher program path (unless +dnl cross-compiling, because it can't be tested then) or true (when it +dnl doesn't work). +dnl +dnl TODO: instead of setting C language, perform test for active AC_LANG +AC_DEFUN([ACX_MPIRUN], + [AC_PATH_PROGS([MPI_LAUNCH],[mpirun mpiexec],[true]) + AC_ARG_VAR([MPI_LAUNCH],[absolute path to launcher for MPI programs, must be working unless configuring in cross-compilation mode]) + AS_IF([test x"$MPI_LAUNCH" = xtrue], + [MPI_LAUNCH_failMsg="Failed to find MPI launcher"], + [AS_IF([test x"$cross_compiling" = xno], + [AC_MSG_CHECKING([if $MPI_LAUNCH works]) + AS_IF([test -x `echo "$MPI_LAUNCH" | sed -e 's/@<:@ @:>@.*//'`], + [AC_LANG_PUSH([C]) + AC_LINK_IFELSE([AC_LANG_SOURCE([ +@%:@include <stdio.h> +@%:@include <stdlib.h> + +@%:@include <mpi.h> + +@%:@define xmpi(ret) \\ + do { \\ + if (ret != MPI_SUCCESS) \\ + exit(EXIT_FAILURE); \\ + } while (0) + +int +main(int argc, char **argv) +{ + xmpi(MPI_Init(&argc, &argv)); + char *numarg = argv@<:@1@:>@; + int cmdnum = atoi(numarg); + int procnum = 1; + xmpi(MPI_Allreduce(MPI_IN_PLACE, &procnum, 1, MPI_INT, MPI_SUM, + MPI_COMM_WORLD)); + xmpi(MPI_Finalize()); + return (procnum == cmdnum)?EXIT_SUCCESS:EXIT_FAILURE; +} +])], + [acx_mpirun_test="$MPI_LAUNCH -n m4_ifval([$1],[$1],[4]) ./conftest$EXEEXT m4_ifval([$1],[$1],[4])" + AS_IF([expr "$ac_link" : '.*/libtool --mode=link' >/dev/null], + [acx_mpirun_test=`echo "$ac_link" | sed -e 's@\(.*/libtool --mode=\)link.*@\1@'`"execute $acx_mpirun_test"]) + _AC_RUN_LOG([LIBC_FATAL_STDERR_=1 $acx_mpirun_test >&2],[echo "running $acx_mpirun_test"]) + AS_IF([test $ac_status -eq 0],, + [MPI_LAUNCH=true ; MPI_LAUNCH_failMsg="Failed to run MPI programs"])], + [MPI_LAUNCH=true ; MPI_LAUNCH_failMsg="Cannot compile or link simple MPI program"]) + AC_LANG_POP([C])], + [MPI_LAUNCH_failMsg="Cannot execute $MPI_LAUNCH" ; MPI_LAUNCH=true]) + AS_IF([test x"$MPI_LAUNCH" = xtrue], + [AC_MSG_RESULT([no])], + [AC_MSG_RESULT([yes])])])]) + AS_IF([test x"$MPI_LAUNCH" = xtrue], + [m4_ifval([$3],[$3],[AC_MSG_FAILURE([$MPI_LAUNCH_failMsg])])], + [m4_ifval([$2],[$2],[:])]) +]) +dnl +dnl Local Variables: +dnl mode: autoconf +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" +dnl license-default: "bsd" +dnl End: diff --git a/m4/acx_mv_obj.m4 b/m4/acx_mv_obj.m4 new file mode 100644 index 0000000000000000000000000000000000000000..369db2836db867b16e3572ffc1bca085b3abd0e9 --- /dev/null +++ b/m4/acx_mv_obj.m4 @@ -0,0 +1,70 @@ +dnl acx_mv_lo.m4 --- shell function to rename a libtool .lo file +dnl +dnl Copyright (C) 2019 Thomas Jahns <jahns@dkrz.de> +dnl +dnl Version: 1.0 +dnl Keywords: +dnl Author: Thomas Jahns <jahns@dkrz.de> +dnl Maintainer: Thomas Jahns <jahns@dkrz.de> +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm +dnl +dnl Redistribution and use in source and binary forms, with or without +dnl modification, are permitted provided that the following conditions are +dnl met: +dnl +dnl Redistributions of source code must retain the above copyright notice, +dnl this list of conditions and the following disclaimer. +dnl +dnl Redistributions in binary form must reproduce the above copyright +dnl notice, this list of conditions and the following disclaimer in the +dnl documentation and/or other materials provided with the distribution. +dnl +dnl Neither the name of the DKRZ GmbH nor the names of its contributors +dnl may be used to endorse or promote products derived from this software +dnl without specific prior written permission. +dnl +dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +dnl IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +dnl TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +dnl OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +dnl +dnl ACX_MV_OBJ([FROM],[TO],[ACTION-IF-SUCCEEDED],[ACTION-IF-FAILED]) +dnl rename object file FROM.$ac_objext to TO.$ac_objext, +dnl in case libtool is used, adjusts .lo and moves +dnl .libs/FROM.$OBJEXT accordingly if necessary +dnl +AC_DEFUN([ACX_MV_OBJ], + [AC_REQUIRE_SHELL_FN([acx_fn_mv_obj], + [AS_FUNCTION_DESCRIBE([ac_fn_mv_obj], [LINENO FROM TO], + [Rename FROM.$ac_ext to TO.$ac_ext, and return whether this succeeded.])], + [AS_LINENO_PUSH([$[]1]) + acx_path_from=`echo "$[]2" | sed -e 's!/\{0,1\}@<:@^/@:>@*$[]!!'` + test -z "$acx_path_from" && ASX_VAR_UNSET([acx_path_from]) + acx_fn_from=`echo "$[]2" | sed -e 's@^.*/@@'` + acx_path_to=`echo "$[]3" | sed -e 's!/\{0,1\}@<:@^/@:>@*$[]!!'` + test -z "$acx_path_to" && ASX_VAR_UNSET([acx_path_to]) + acx_fn_to=`echo "$[]3" | sed -e 's@^.*/@@'` + AS_IF([expr "$ac_compile" : '.*/libtool --mode=compile' >/dev/null], + [_AC_RUN_LOG([sed 's@\(pic_object='"'\)"'\(\(.libs/\)\{0,1\}\)'"$acx_fn_from"'\.o'"'"'@\1\2'"$acx_fn_to"'.o'"'"'@' "$][2.$ac_objext" >"$][3.$ac_objext" && rm "$][2.$ac_objext" && if test -f "$][2.$OBJEXT" ; then mv "$][2.$OBJEXT" "$][3.$OBJEXT" ; fi && if test -f "${acx_path_from+$acx_path_from/}.libs/$acx_fn_from.$OBJEXT" ; then as_dir="${acx_path_to-.}/.libs" as_fn_mkdir_p ; mv "${acx_path_from+$acx_path_from/}.libs/$acx_fn_from.$OBJEXT" "${acx_path_to+$acx_path_to/}.libs/$acx_fn_to.$OBJEXT" ; fi], + [_AS_ECHO_LOG([Renaming object file $][2.$ac_objext to $][3.$ac_objext.])])], + [_AC_RUN_LOG([mv "$][2.$ac_objext" "$][3.$ac_objext"], + [_AS_ECHO_LOG([Renaming object file $][2.$ac_objext to $][3.$ac_objext.])])]) + AS_LINENO_POP + AS_SET_STATUS([$ac_status])])dnl + m4_ifval([$3$4],[AS_IF([acx_fn_mv_obj "$LINENO" $1 $2], [$3], [$4])], + [acx_fn_mv_obj "$LINENO" $1 $2])]) +dnl +dnl +dnl Local Variables: +dnl mode: autoconf +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" +dnl license-default: "bsd" +dnl End: +dnl diff --git a/m4/acx_option_search_libs.m4 b/m4/acx_option_search_libs.m4 index a00edfb3a8151850ddf520ffc13b67c90c0a879d..0e55de126fb37576347aa220dc8ca1bcacba27f2 100644 --- a/m4/acx_option_search_libs.m4 +++ b/m4/acx_option_search_libs.m4 @@ -9,7 +9,7 @@ dnl Version: 1.0 dnl Keywords: dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -49,24 +49,21 @@ dnl [OTHER-LIBRARIES], [EXTRA-FLAGS], [PREAMBLE], [CALL-CODE]) dnl same as ACX_OPTION_SEARCH_LIBS but does not cache result dnl dnl Uses either AC_LANG_PROGRAM([PREAMBLE],CALL-CODE) or -dnl AC_LANG_CALL([PREAMBLE],FUNCTION), depending on wether CALL-CODE +dnl AC_LANG_CALL([PREAMBLE],FUNCTION), depending on whether CALL-CODE dnl is given or not. AC_DEFUN([_ACX_OPTION_SEARCH_LIBS], - [acx_option_func_search_save_LIBS="$LIBS" - AC_LANG_CONFTEST([m4_ifval([$6],[AC_LANG_PROGRAM([$5],[$6])],[AC_LANG_CALL([$5], [$1])])]) - for ac_lib in '' $2; do - AS_IF([test -z "$ac_lib"], - [ac_res="none required" - LIBS="m4_ifval([$4],[$4 ])m4_ifnblank($3,[$3 ])$acx_option_func_search_save_LIBS"], - [ac_res="-l$ac_lib" - LIBS="m4_ifval([$4],[$4 ])$ac_res m4_ifnblank($3,[$3 ])$acx_option_func_search_save_LIBS"]) - AC_LINK_IFELSE([], [AS_IF([test x"$ac_res" = x"none required"],dnl - [AS_VAR_SET([ac_Search],["]m4_ifval([$4],[$4 ])[$3"])],dnl - [AS_VAR_SET([ac_Search],["]m4_ifval([$4],[$4 ])[-l$ac_lib $3"])])]) - AS_VAR_SET_IF([ac_Search], [break]) - done - rm conftest.$ac_ext - LIBS="$acx_option_func_search_save_LIBS"]) + [AC_LANG_CONFTEST([m4_ifval([$6],[AC_LANG_PROGRAM([$5],[$6])],[AC_LANG_CALL([$5], [$1])])]) + AS_FOR([AC_LIB],[ac_lib],['' $2], + [AS_IF([test -z "]AC_LIB["], + [ac_res="none required" + LIBS="m4_ifval([$4],[$4 ])m4_ifnblank($3,[$3 ])$acx_option_func_search_save_LIBS"], + [ac_res="-l]AC_LIB[" + LIBS="m4_ifval([$4],[$4 ])$ac_res m4_ifnblank($3,[$3 ])$acx_option_func_search_save_LIBS"]) + AC_LINK_IFELSE([], [AS_IF([test x"$ac_res" = x"none required"], + [AS_VAR_SET([ac_Search],["]m4_ifval([$4],m4_ifnblank([$3],[$4 $3],[$4]),[$3])["])], + [AS_VAR_SET([ac_Search],["]m4_ifval([$4],[$4 ])[-l]AC_LIB[]m4_ifval([$3],[ $3])["])])]) + AS_VAR_SET_IF([ac_Search], [break])]) + rm conftest.$ac_ext]) dnl ACX_OPTION_SEARCH_LIBS(FUNCTION, SEARCH-LIBS, dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES], dnl [EXTRA-FLAGS], [PREAMBLE]) @@ -78,7 +75,9 @@ dnl unconditionally, which might provoke linker errors. AC_DEFUN([ACX_OPTION_SEARCH_LIBS], [AS_VAR_PUSHDEF([ac_Search], [acx_cv_option_search_$1_]_AC_LANG_ABBREV)dnl AC_CACHE_CHECK([for library containing $1], [ac_Search], - [_ACX_OPTION_SEARCH_LIBS([$1],[$2],[$5],[$6],[$7])]) + [acx_option_func_search_save_LIBS=$LIBS + _ACX_OPTION_SEARCH_LIBS([$1],[$2],[$5],[$6],[$7]) + LIBS=$acx_option_func_search_save_LIBS]) ac_res=AS_VAR_GET([ac_Search]) AS_VAR_SET_IF([ac_Search], [$3], @@ -102,27 +101,30 @@ dnl tries each library in the list. AC_DEFUN([ACX_OPTION_SEARCH_LIBS_MULTI], [AS_VAR_PUSHDEF([ac_Search], [acx_cv_option_search_$1_]_AC_LANG_ABBREV)dnl AC_MSG_CHECKING([for library containing $1]) - AC_CACHE_VAL([ac_Search],dnl - [while :; do + AC_CACHE_VAL([ac_Search], + [acx_option_func_search_save_LIBS=$LIBS + while :; do m4_if(m4_car($5),[[]],,[_ACX_OPTION_SEARCH_LIBS([$1],[$2],,[$6],[$7],[$8]) AS_VAR_SET_IF([ac_Search], [break])]) - m4_foreach([ACX_LibSet], [$5],dnl - [_ACX_OPTION_SEARCH_LIBS([$1],[$2],[ACX_LibSet],[$6],[$7],[$8]) + AS_FOR([ACX_LibSet],[acx_libset],ACX_M4_LIST_TO_QUOTED_STRINGS([$5]), + [_ACX_OPTION_SEARCH_LIBS([$1],[$2],ACX_LibSet,[$6],[$7],[$8]) AS_VAR_SET_IF([ac_Search],[break]) ]) break - done]) - AS_VAR_SET_IF([ac_Search],dnl - [AS_IF([test x"AS_VAR_GET([ac_Search])" = x],dnl - [AC_MSG_RESULT([(none required)])],dnl - [AC_MSG_RESULT([AS_VAR_GET([ac_Search])])])],dnl - [AC_MSG_RESULT([not found])]) - AS_VAR_SET_IF([ac_Search],[$3],[$4]) + done + LIBS=$acx_option_func_search_save_LIBS]) + AS_VAR_SET_IF([ac_Search], + [AS_IF([test x"AS_VAR_GET([ac_Search])" = x], + [AC_MSG_RESULT([(none required)])], + [AC_MSG_RESULT([AS_VAR_GET([ac_Search])])])m4_ifval([$3],[ + $3])], + [AC_MSG_RESULT([not found])m4_ifval([$4],[ + $4])]) AS_VAR_POPDEF([ac_Search])dnl ]) dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/acx_options.m4 b/m4/acx_options.m4 index a24b4587d3a2ede6a5ef7cafd73f4285efe20f69..bd189fce0c864aa76e4c319efef637286e9b2115 100644 --- a/m4/acx_options.m4 +++ b/m4/acx_options.m4 @@ -16,7 +16,7 @@ AS_CASE([$with_threads], LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC" - AS_ECHO(["CC:$CC CFLAGS:$CFLAGS LIBS:$LIBS"])], + AS_ECHO(["CC:$CC CFLAGS:$CFLAGS LIBS:$LIBS"]) >&AS_MESSAGE_FD], [*],[THREADS_ROOT=$with_threads LDFLAGS="-L$THREADS_ROOT/lib $LDFLAGS" CPPFLAGS="-I$THREADS_ROOT/include $CPPFLAGS " @@ -204,15 +204,15 @@ AS_VAR_IF([ENABLE_NETCDF], [yes], AS_IF([test "x$ENABLE_NC4SZLIB" = "xyes"], [AC_SEARCH_LIBS([nc_def_var_szip], [netcdf], - [AC_DEFINE([HAVE_NC_DEF_VAR_SZIP],[1],[Define to 1 for NetCDF4 nc_def_var_szip support])],,[-lhdf5])]) + [AC_DEFINE([HAVE_NC_DEF_VAR_SZIP],[1],[Define to 1 for NetCDF4 nc_def_var_szip support])],,)]) AS_IF([test "x$ENABLE_NC4HDF5" = "xyes"], [AC_SEARCH_LIBS([H5TS_mutex_lock], [netcdf], [AC_DEFINE([HAVE_NC4HDF5_THREADSAFE],[1],[Define to 1 for NetCDF4/HDF5 threadsafe support])],,[-lhdf5])]) AS_IF([test "x$ENABLE_NC4HDF5" = "xyes"], - [AC_SEARCH_LIBS([H5get_libversion], [netcdf hdf5], - [AC_DEFINE([HAVE_H5GET_LIBVERSION],[1],[Define to 1 for H5get_libversion support])],,)]) + [AC_SEARCH_LIBS([H5get_libversion], [netcdf], + [AC_DEFINE([HAVE_H5GET_LIBVERSION],[1],[Define to 1 for H5get_libversion support])],,[-lhdf5])]) AC_SUBST([ENABLE_NETCDF]) AC_SUBST([ENABLE_NC2]) @@ -228,7 +228,7 @@ ECCODES_INCLUDE='' ECCODES_LIBS='' AC_ARG_WITH([eccodes], [AS_HELP_STRING([--with-eccodes=<yes|no|directory>], - [library for grib2 encoding/decoding; if a directory is given, it will be used as a value for --with-eccodes-root])], + [location of ECCODES library for grib2 encoding/decoding (lib and include subdirs)])], [AS_CASE(["$with_eccodes"], [no],[AC_MSG_CHECKING([for ECCODES library]) AC_MSG_RESULT([suppressed])], @@ -244,8 +244,8 @@ AC_ARG_WITH([eccodes], [LDFLAGS="-L$ECCODES_ROOT/lib $LDFLAGS" CPPFLAGS="-I$ECCODES_ROOT/include $CPPFLAGS" AC_CHECK_HEADERS([grib_api.h],, - [AC_MSG_ERROR([Could not find grib_api.h])], - [AC_INCLUDES_DEFAULT]) + [AC_MSG_ERROR([Could not find grib_api.h])], + [AC_INCLUDES_DEFAULT]) AC_SEARCH_LIBS([grib_get_message], [eccodes], [AC_DEFINE([HAVE_LIBGRIB_API],[1],[ECCODES library is present if defined to 1])], @@ -264,7 +264,7 @@ GRIB_API_INCLUDE='' GRIB_API_LIBS='' AC_ARG_WITH([grib_api], [AS_HELP_STRING([--with-grib_api=<yes|no|directory>], - [library for grib2 encoding/decoding; if a directory is given, it will be used as a value for --with-grib_api-root])], + [location of GRIB_API library for grib2 encoding/decoding (lib and include subdirs)])], [AS_CASE(["$with_grib_api"], [no],[AC_MSG_CHECKING([for GRIB_API library]) AC_MSG_RESULT([suppressed])], diff --git a/m4/acx_sl_fc_mod_path_flag.m4 b/m4/acx_sl_fc_mod_path_flag.m4 index 8a413e77b19e94310957c6c25aa1cce36c2966b7..ad384f2e05ae6ce1bd6e2588fbaeaa88166e09ae 100644 --- a/m4/acx_sl_fc_mod_path_flag.m4 +++ b/m4/acx_sl_fc_mod_path_flag.m4 @@ -6,7 +6,7 @@ dnl Version: 1.0 dnl Keywords: dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -64,7 +64,7 @@ AC_DEFUN([ACX_SL_FC_CHECK_MOD_PATH_FLAG],dnl AC_COMPILE_IFELSE([AC_LANG_SOURCE( [ module cnftst implicit none - integer,public :: i + integer, public :: i end module cnftst])],, [AC_MSG_ERROR([Cannot compile fortran modules])]) cd .. @@ -91,6 +91,6 @@ AC_DEFUN([ACX_SL_FC_CHECK_MOD_PATH_FLAG],dnl dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/acx_sl_mod_suffix.m4 b/m4/acx_sl_mod_suffix.m4 index 6e47be00bab7bee62cd28fa8b8f7f2b20749520b..d3cd596ab86941c24a0c5d95a45173ea42c94581 100644 --- a/m4/acx_sl_mod_suffix.m4 +++ b/m4/acx_sl_mod_suffix.m4 @@ -6,7 +6,7 @@ dnl Version: 1.0 dnl Keywords: dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -57,40 +57,45 @@ dnl # Currently we warn and continue. We should maybe error out. # AC_DEFUN([ACX_SL_FC_MOD_SUFFIX], - [AC_MSG_CHECKING([for suffix of module files]) - AC_ARG_VAR([FCMODEXT], [file extension of compiled Fortran module files]) - ac_fc_mod_uppercase=no - AC_LANG_PUSH([Fortran]) - AC_COMPILE_IFELSE( -[ module conftest + [AC_ARG_VAR([FCMODEXT], [file extension of compiled Fortran module files]) + AC_CACHE_CHECK([for conftest_module module file name],[acx_cv_fc_mod_name], + [AC_LANG_PUSH([Fortran]) + AC_COMPILE_IFELSE( +[ module conftest_module implicit none integer :: i - end module conftest]) + end module conftest_module]) while :; do - acx_fc_mod_name= - m4_foreach([acx_fc_mod_name],dnl - [[conftest.$FCMODEXT], [conftest.mod], [conftest.MOD], [conftest.M], - [CONFTEST.MOD], [CONFTEST.mod]],dnl - [AS_IF([test -n "acx_fc_mod_name" -a -f "acx_fc_mod_name"],dnl - [[acx_fc_mod_name]="acx_fc_mod_name" ; break]) + acx_cv_fc_mod_name= + m4_foreach([acx_cv_fc_mod_name], + [[conftest_module.$FCMODEXT], [conftest_module.mod], + [conftest_module.MOD], [conftest_module.M], + [CONFTEST_MODULE.MOD], [CONFTEST_MODULE.mod]], + [AS_IF([test -n "acx_cv_fc_mod_name" -a -f "acx_cv_fc_mod_name"], + [[acx_cv_fc_mod_name]="acx_cv_fc_mod_name" ; break]) ]) break done - rm -f conftest* CONFTEST* - AC_LANG_POP([Fortran]) + rm -f conftest_module* CONFTEST_MODULE* +dnl Some Fortran compilers create module files not in the current working directory but +dnl in the directory with the object file, therefore we try to delete everything: + AS_IF([expr "$ac_compile" : '.*/libtool --mode=compile' >/dev/null], + [AS_IF([test -n "$objdir"], + [rm -f "$objdir"/conftest_module* "$objdir"/CONFTEST_MODULE*])]) + AC_LANG_POP([Fortran])]) dnl - AS_CASE(["$acx_fc_mod_name"],dnl - [conftest.$FCMODEXT], [:], - [CONFTEST.$FCMODEXT], [ac_fc_mod_uppercase=yes], - [conftest.mod], [FCMODEXT=mod], - [conftest.MOD], [FCMODEXT=MOD], - [conftest.M], [FCMODEXT=M], - [CONFTEST.MOD], [FCMODEXT=MOD - ac_fc_mod_uppercase=yes], - [CONFTEST.mod], [FCMODEXT=mod - ac_fc_mod_uppercase=yes]) + AC_MSG_CHECKING([for suffix of module files]) + ac_fc_mod_uppercase=no + AS_CASE([$acx_cv_fc_mod_name], + [conftest_module.$FCMODEXT], [:], + [CONFTEST_MODULE.$FCMODEXT], [ac_fc_mod_uppercase=yes], + [conftest_module.mod], [FCMODEXT=mod], + [conftest_module.MOD], [FCMODEXT=MOD], + [conftest_module.M], [FCMODEXT=M], + [CONFTEST_MODULE.MOD], [FCMODEXT=MOD ; ac_fc_mod_uppercase=yes], + [CONFTEST_MODULE.mod], [FCMODEXT=mod ; ac_fc_mod_uppercase=yes]) AC_MSG_RESULT([${FCMODEXT-not found}]) - AS_VAR_TEST_SET([FCMODEXT], [$1], [m4_ifval([$2],[$2],dnl + AS_VAR_TEST_SET([FCMODEXT], [$1], [m4_ifval([$2],[$2], [AC_MSG_WARN([Could not find Fortran module file extension.])])]) dnl AS_IF([test $ac_fc_mod_uppercase = yes], @@ -103,6 +108,6 @@ dnl dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/acx_tls_xlc_retry.m4 b/m4/acx_tls_xlc_retry.m4 new file mode 100644 index 0000000000000000000000000000000000000000..28e6c76b9e68a435a24ea837a0407dddd7af693e --- /dev/null +++ b/m4/acx_tls_xlc_retry.m4 @@ -0,0 +1,93 @@ +dnl acx_tls_xlc_retry.m4 --- check for TLS storage declarator and retry for +dnl IBM XL which might need an extra compiler option +dnl +dnl Copyright (C) 2016 Thomas Jahns <jahns@dkrz.de> +dnl +dnl Keywords: configure configure.ac autoconf MPI mpirun mpiexec +dnl Author: Thomas Jahns <jahns@dkrz.de> +dnl Maintainer: Thomas Jahns <jahns@dkrz.de> +dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl +dnl Redistribution and use in source and binary forms, with or without +dnl modification, are permitted provided that the following conditions are +dnl met: +dnl +dnl Redistributions of source code must retain the above copyright notice, +dnl this list of conditions and the following disclaimer. +dnl +dnl Redistributions in binary form must reproduce the above copyright +dnl notice, this list of conditions and the following disclaimer in the +dnl documentation and/or other materials provided with the distribution. +dnl +dnl Neither the name of the DKRZ GmbH nor the names of its contributors +dnl may be used to endorse or promote products derived from this software +dnl without specific prior written permission. +dnl +dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +dnl IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +dnl TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +dnl OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +dnl +dnl _ACX_TLS_NEWFLAG run AX_TLS with compiler option +m4_define([_ACX_TLS_RETRY], + [saved_CFLAGS=$CFLAGS + $2 + AS_IF([test x"$CFLAGS" = x"$saved_CFLAGS"], + [ac_cv_tls=none], + [AC_MSG_NOTICE([retrying with $1 added to CFLAGS]) + AS_UNSET([ac_cv_tls]) + AX_TLS(,[CFLAGS=$saved_CFLAGS])])]) +dnl +dnl ACX_TLS_XLC_RETRY([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl +dnl First runs AX_TLS and retries with xlc option if this doesn't work +dnl +dnl TODO: instead of assuming C language, perform test for active AC_LANG +AC_DEFUN([ACX_TLS_XLC_RETRY], + [AX_TLS(,[ac_cv_tls=`$CC -qversion 2>&1 | sed -n '/^IBM XL C/{ +n +s/^Version: \(@<:@0-9@:>@*\).*/\1/ +t print +b +: print +p +}'` + AS_IF([test x"$ac_cv_tls" = x], + [ac_cv_tls=`$CC -V | sed -n '/^pgcc /{ +s/^pgcc \([0-9][0-9.]*\).*/\1/ +p +}'` +# pgcc 18.1 and newer support TLS if switched to C11 mode + AS_VERSION_COMPARE([$ac_cv_tls],[18.9], + [ac_cv_tls=none],[ac_cv_tls=none], + [_ACX_TLS_RETRY([-c11], + [AS_CASE([" $CFLAGS "],[ -c11 ],,[CFLAGS="$CFLAGS -c11"])])])], + [test "$ac_cv_tls" -gt 7], + [# unless the user already set the -qtls option, add it and retry test + _ACX_TLS_RETRY([-qtls=initial-exec],[CFLAGS=`echo "$CFLAGS" | sed -n '/.*-qtls\(=@<:@^ @:>@*\)\{0,1\}/{ +p +q +} +s/$/ -qtls=initial-exec/ +p +q +'`]) +],[ac_cv_tls=none])]) + m4_ifnblank([$1$2], + [AS_IF([test "$ac_cv_tls" != "none"], + [m4_ifnblank([$1],[$1])], + [m4_ifnblank([$2],[$2])])]) +]) +dnl +dnl Local Variables: +dnl mode: autoconf +dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-default: "bsd" +dnl End: diff --git a/m4/acx_use_libtool_configuration.m4 b/m4/acx_use_libtool_configuration.m4 new file mode 100644 index 0000000000000000000000000000000000000000..687acd1cc3f93a0055a2398afe5897831c93ba6f --- /dev/null +++ b/m4/acx_use_libtool_configuration.m4 @@ -0,0 +1,179 @@ +dnl acx_use_libtool_configuration.m4 --- prevent problematic libtool build configurations +dnl +dnl Copyright (C) 2016 Thomas Jahns <jahns@dkrz.de> +dnl +dnl Version: 1.0 +dnl Keywords: +dnl Author: Thomas Jahns <jahns@dkrz.de> +dnl Maintainer: Thomas Jahns <jahns@dkrz.de> +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm +dnl +dnl Redistribution and use in source and binary forms, with or without +dnl modification, are permitted provided that the following conditions are +dnl met: +dnl +dnl Redistributions of source code must retain the above copyright notice, +dnl this list of conditions and the following disclaimer. +dnl +dnl Redistributions in binary form must reproduce the above copyright +dnl notice, this list of conditions and the following disclaimer in the +dnl documentation and/or other materials provided with the distribution. +dnl +dnl Neither the name of the DKRZ GmbH nor the names of its contributors +dnl may be used to endorse or promote products derived from this software +dnl without specific prior written permission. +dnl +dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +dnl IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +dnl TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +dnl OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +dnl _ACX_LT_FLAGS_MANGLE +m4_define([nag_filter_flag_var], + [AS_IF([test x${$1+set} = xset], + [$1=`echo "$][$1" | tr ' ' '\n' | sed -e '/^-W@<:@lc@:>@/{' \ +-e 's/^\(-Wl\)/-XCClinker \1/;s/^\(-Wc,\)/-Xcompiler \1/' \ +-e 's/^\(-Wc=.*\)/-Xcompiler \1 -XCClinker \1/' -e '}' \ + | tr '\n' ' ' | sed -e 's/ $//'`])]) +AC_DEFUN([_ACX_LT_FORT_FLAGS_MANGLE], + [_AC_FORTRAN_ASSERT + AC_LANG_CASE([Fortran], + [AS_VAR_PUSHDEF([acx_FC],[FC])dnl + AS_VAR_PUSHDEF([acx_FCFLAGS],[FCFLAGS])dnl + AS_VAR_PUSHDEF([acx_LDFLAGS],[FCLDFLAGS])], + [Fortran 77], + [AS_VAR_PUSHDEF([acx_FC],[F77])dnl + AS_VAR_PUSHDEF([acx_FCFLAGS],[FFLAGS])dnl + AS_VAR_PUSHDEF([acx_LDFLAGS],[F77LDFLAGS])]) + acx_temp=`$acx_FC -V 2>&1 | sed -n 1,5p` +dnl fix problems from NAG compiler + AS_CASE(["$acx_temp"], + [*NAG\ Fortran\ Compiler\ Release*], + [nag_filter_flag_var([acx_FCFLAGS]) + nag_filter_flag_var([acx_LDFLAGS])]) +dnl fix conflicting use of -module by libtool and ifort + AC_LANG_CASE([Fortran], + [AS_CASE(["x${FC_MODOUT}x"], + [x'-module 'x|x'-mod 'x], + [FC_MODOUT="-Xcompiler ${FC_MODOUT}-Xcompiler "])])dnl + AS_VAR_POPDEF([acx_FC])dnl + AS_VAR_POPDEF([acx_FCFLAGS])dnl + AS_VAR_POPDEF([acx_LDFLAGS])]) +dnl +dnl ACX_USE_LIBTOOL_CONFIGURATION([ARGS-TO-LT_INIT]) +dnl Switch compiler to libtool wrapper and prevent occurrence of +dnl problematic setups +AC_DEFUN([ACX_USE_LIBTOOL_CONFIGURATION], + [dnl before switching on libtool, identify compilers that prevent us from + dnl certain build configurations + ACX_LT_PROBLEMS +dnl add some monkey patching for older libtool versions that don't handle +dnl newer PGI or NAG configurations particularly well + m4_if(m4_cmp(m4_version_compare(LT_PACKAGE_VERSION,[2.4.6]),1),-1, + [m4_pushdef([_LT_COMPILER_PIC], + m4_bpatsubst(m4_dquote( + m4_bpatsubst(m4_dquote( + m4_bpatsubst(m4_dquote(m4_defn([_LT_COMPILER_PIC])),[;; + \*Portland\\ ],[;; @%:@( + *NAG\\ Fortran\\ Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $][1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $][1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $][1)='-Bstatic' + ;; + *PGI\\ Compilers\\ and\\ Tools*|*NVIDIA\\ Compilers\\ and\\ Tools*|*Port][land\\ ])),[sed 5q`],[sed -n 1,5p`])),[pgcpp\*],[pgcpp* | pgc++* ]))dnl + m4_pushdef([_LT_LANG_CXX_CONFIG], + m4_bpatsubst(m4_dquote( + m4_bpatsubst(m4_dquote( + m4_bpatsubst(m4_dquote(m4_defn([_LT_LANG_CXX_CONFIG])), + [sed 5q`],[sed -n 1,5p`])), + [\$CC\( \$pic_flag\)? -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects ], + [$CC\1 -shared $libobjs $deplibs ])), + [pgcpp\*],[pgcpp* | pgc++* ]))dnl + m4_pushdef([_LT_LINKER_SHLIBS],m4_bpatsubst(m4_dquote( + m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote( + m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(m4_defn( + [_LT_LINKER_SHLIBS])),[tmp_sharedflag='-shared'], + [tmp_sharedflag='-shared' + tmp_compiler_flags='$compiler_flags'])), + [\$CC '"\$tmp_sharedflag""\$tmp_addflag"' \$libobjs \$deplibs \$compiler_flags \$wl-soname], + [$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs '"$tmp_compiler_flags"' $wl-soname])), + [ tmp_sharedflag='-Wl,-shared'], + [ tmp_sharedflag='-Wl,-shared' + tmp_compiler_flags='`echo \$compiler_flags | sed -e '"'"'s/ -W@<:@cl@:>@,-no-pie\\b//g'"'"'`'])), + [\*Sun\\ F\*\(.\)[ ]*# Sun Fortran 8\.3 +[ ]*tmp_sharedflag='-G' ;; +],[\& *NAG\\ Fortran\\ Compiler*\1 + tmp_sharedflag='-Wl,-shared' + tmp_compiler_flags='`echo \$compiler_flags | sed -e '"'"'s/ -W@<:@cl@:>@,-no-pie\\b//g'"'"'`' ;; +])),[sed 5q`],[sed -n 1,5p`]))dnl + m4_pushdef([_LT_SYS_HIDDEN_LIBDEPS],[AS_UNSET([output_verbose_link_cmd])] + m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote( + m4_defn([_LT_SYS_HIDDEN_LIBDEPS])),[test x-\([LR]\) = "\$p"], + [test x-\1 = x"$p"])), + [test x-R = x"\$p"],[\& || + test x-l = x"$p"]))])dnl + m4_foreach([acx_ltconfig],[[[_LT_LANG_C_CONFIG]],[[_LT_LANG_F77_CONFIG]],[[_LT_LANG_FC_CONFIG]]], + [m4_pushdef(acx_ltconfig,m4_bpatsubst(m4_dquote( + m4_bpatsubst(m4_dquote(m4_defn(acx_ltconfig)),[_LT_TAG_COMPILER +], + [\& _LT_TAGDECL([with_nagfor], [acx_is_nagfor], [0], [Is the compiler the NAG Fortran compiler?])])), + [_LT_CONFIG], + [AC_MSG_CHECKING([whether this is the NAG Fortran compiler]) + $CC -V 2>&1 | grep '^NAG Fortran Compiler Release' >/dev/null 2>&1 + _lt_result=$? + AS_IF([test $_lt_result -eq 0],[_lt_result=yes],[_lt_result=no]) + AC_MSG_RESULT([$_lt_result]) + _LT_TAGVAR([acx_is_nagfor], $][1)=$_lt_result + \&]))])dnl + LT_INIT([$1]) + m4_popdef([_LT_LANG_F77_CONFIG])dnl + m4_popdef([_LT_LANG_FC_CONFIG])dnl + m4_popdef([_LT_LANG_C_CONFIG])dnl + m4_if(m4_cmp(m4_version_compare(LT_PACKAGE_VERSION,[2.4.6]),1),-1, + [m4_popdef([_LT_COMPILER_PIC])m4_popdef([_LT_LINKER_SHLIBS])dnl + m4_popdef([_LT_SYS_HIDDEN_LIBDEPS])])dnl + dnl _KPSE_USE_LIBTOOL ensures libtool is also used for configure-time tests, + dnl which deduces dependent libraries automatically + _KPSE_USE_LIBTOOL +dnl substitute -shared-intel if present + AS_FOR([acx_flag_var],[acx_flag_var_],[CFLAGS CXXFLAGS FCFLAGS F77FLAGS LDFLAGS FCLDFLAGS], + [AS_IF([eval test x\$\{acx_flag_var+set\} = xset], + [eval acx_temp="\" \$$acx_flag_var_ \"" + AS_CASE([$acx_temp],[*\ -shared-intel\ *|*\ -static-intel\ *], + [acx_temp=`echo "$acx_temp" | sed -e 's/ \(-\(shared\|static\)-intel\)\b/ -Xcompiler \1 -XCClinker \1/'`]) +dnl take care of ifort/icc/icpc two-part options + eval acx_flag_var=\"`echo "$acx_temp" | sed -e 's/ -\(align\|allow\|assume\|ccdefault\|check\|convert\|debug\|debug-parameters\|diag-type\|diag-enable\|diag-disable\|double-size\|dynamic-linker\|dyncom\|export-dir\|extend-source\|fp-model\|fpscomp\|gen-interfaces\|heap-arrays\|imacros\|integer-size\|iprefix\|iquote\|iwithprefixbefore\|module\|names\|opt-report\|opt-streaming-stores\|pch-dir\|pch-use\|prof-dir\|prof-file\|real-size\|reentrancy\|stand\|tcollect-filter\|tune\|warn\|watch\) \(@<:@^-@:>@@<:@^ @:>@*\)\b/ -Xcompiler -\1 -Xcompiler \2/g' -e 's/^ //;s/ $//'`\"])]) + AC_PROVIDE_IFELSE([AC_PROG_CC], + [AS_IF([test -n "$CC" -a X"$CC" != Xno], + [AC_LANG_PUSH([C]) + _KPSE_CHECK_LIBTOOL + AC_LANG_POP([C])])]) + AC_PROVIDE_IFELSE([AC_PROG_FC], + [AS_IF([test -n "$FC" -a X"$FC" != Xno], + [AC_LANG_PUSH([Fortran]) + _ACX_LT_FORT_FLAGS_MANGLE + _KPSE_CHECK_LIBTOOL + AC_LANG_POP([Fortran])])]) + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AS_IF([test -n "$F77" -a X"$F77" != Xno], + [AC_LANG_PUSH([Fortran 77]) + _ACX_LT_FORT_FLAGS_MANGLE + _KPSE_CHECK_LIBTOOL + AC_LANG_POP([Fortran 77])])]) + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AS_IF([test -n "$CXX" -a X"$CXX" != Xno], + [AC_LANG_PUSH([C++]) + _KPSE_CHECK_LIBTOOL + AC_LANG_POP([C++])])])])dnl +dnl +dnl Local Variables: +dnl mode: autoconf +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" +dnl license-default: "bsd" +dnl End: diff --git a/m4/asx_tr_arg.m4 b/m4/asx_tr_arg.m4 index 58c27da6d5ca0c745f3fad7297afcb3efd3d6e83..a65cf790a6cf5a4302d10234c15c94c6b144e334 100644 --- a/m4/asx_tr_arg.m4 +++ b/m4/asx_tr_arg.m4 @@ -6,7 +6,7 @@ dnl Version: 1.0 dnl Keywords: dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -64,6 +64,6 @@ AS_LITERAL_IF([$1], dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/asx_unset.m4 b/m4/asx_unset.m4 index ff49581e4d5d297fbc07228ffc1f160673a49d93..2665953b59edccad1463a1d1d80e0d5a8b2a0906 100644 --- a/m4/asx_unset.m4 +++ b/m4/asx_unset.m4 @@ -6,7 +6,7 @@ dnl Version: 1.0 dnl Keywords: dnl Author: Thomas Jahns <jahns@dkrz.de> dnl Maintainer: Thomas Jahns <jahns@dkrz.de> -dnl URL: https://www.dkrz.de/redmine/projects/show/scales-ppm +dnl URL: https://www.dkrz.de/redmine/projects/scales-ppm dnl dnl Redistribution and use in source and binary forms, with or without dnl modification, are permitted provided that the following conditions are @@ -55,6 +55,6 @@ AC_DEFUN([ASX_VAR_UNSET], dnl dnl Local Variables: dnl mode: autoconf -dnl license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +dnl license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" dnl license-default: "bsd" dnl End: diff --git a/m4/ax_python_devel.m4 b/m4/ax_python_devel.m4 new file mode 100644 index 0000000000000000000000000000000000000000..780584eaeb5d27b79d8a248c4dae78c3997d2164 --- /dev/null +++ b/m4/ax_python_devel.m4 @@ -0,0 +1,416 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_python_devel.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PYTHON_DEVEL([version]) +# +# DESCRIPTION +# +# Note: Defines as a precious variable "PYTHON_VERSION". Don't override it +# in your configure.ac. +# +# This macro checks for Python and tries to get the include path to +# 'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LIBS) output +# variables. It also exports $(PYTHON_EXTRA_LIBS) and +# $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code. +# +# You can search for some particular version of Python by passing a +# parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please +# note that you *have* to pass also an operator along with the version to +# match, and pay special attention to the single quotes surrounding the +# version number. Don't use "PYTHON_VERSION" for this: that environment +# variable is declared as precious and thus reserved for the end-user. +# +# This macro should work for all versions of Python >= 2.1.0. As an end +# user, you can disable the check for the python version by setting the +# PYTHON_NOVERSIONCHECK environment variable to something else than the +# empty string. +# +# If you need to use this macro for an older Python version, please +# contact the authors. We're always open for feedback. +# +# LICENSE +# +# Copyright (c) 2009 Sebastian Huber <sebastian-huber@web.de> +# Copyright (c) 2009 Alan W. Irwin +# Copyright (c) 2009 Rafael Laboissiere <rafael@laboissiere.net> +# Copyright (c) 2009 Andrew Collier +# Copyright (c) 2009 Matteo Settenvini <matteo@member.fsf.org> +# Copyright (c) 2009 Horst Knorr <hk_classes@knoda.org> +# Copyright (c) 2013 Daniel Mullner <muellner@math.stanford.edu> +# +# 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 3 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, see <https://www.gnu.org/licenses/>. +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 32 + +AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL]) +AC_DEFUN([AX_PYTHON_DEVEL],[ + # + # Allow the use of a (user set) custom python version + # + AC_ARG_VAR([PYTHON_VERSION],[The installed Python + version to use, for example '2.3'. This string + will be appended to the Python interpreter + canonical name.]) + + AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]]) + if test -z "$PYTHON"; then + AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path]) + PYTHON_VERSION="" + fi + + # + # Check for a version of Python >= 2.1.0 + # + AC_MSG_CHECKING([for a version of Python >= '2.1.0']) + ac_supports_python_ver=`$PYTHON -c "import sys; \ + ver = sys.version.split ()[[0]]; \ + print (ver >= '2.1.0')"` + if test "$ac_supports_python_ver" != "True"; then + if test -z "$PYTHON_NOVERSIONCHECK"; then + AC_MSG_RESULT([no]) + AC_MSG_FAILURE([ +This version of the AC@&t@_PYTHON_DEVEL macro +doesn't work properly with versions of Python before +2.1.0. You may need to re-run configure, setting the +variables PYTHON_CPPFLAGS, PYTHON_LIBS, PYTHON_SITE_PKG, +PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. +Moreover, to disable this check, set PYTHON_NOVERSIONCHECK +to something else than an empty string. +]) + else + AC_MSG_RESULT([skip at user request]) + fi + else + AC_MSG_RESULT([yes]) + fi + + # + # If the macro parameter ``version'' is set, honour it. + # A Python shim class, VPy, is used to implement correct version comparisons via + # string expressions, since e.g. a naive textual ">= 2.7.3" won't work for + # Python 2.7.10 (the ".1" being evaluated as less than ".3"). + # + if test -n "$1"; then + AC_MSG_CHECKING([for a version of Python $1]) + cat << EOF > ax_python_devel_vpy.py +class VPy: + def vtup(self, s): + return tuple(map(int, s.strip().replace("rc", ".").split("."))) + def __init__(self): + import sys + self.vpy = tuple(sys.version_info) + def __eq__(self, s): + return self.vpy == self.vtup(s) + def __ne__(self, s): + return self.vpy != self.vtup(s) + def __lt__(self, s): + return self.vpy < self.vtup(s) + def __gt__(self, s): + return self.vpy > self.vtup(s) + def __le__(self, s): + return self.vpy <= self.vtup(s) + def __ge__(self, s): + return self.vpy >= self.vtup(s) +EOF + ac_supports_python_ver=`$PYTHON -c "import ax_python_devel_vpy; \ + ver = ax_python_devel_vpy.VPy(); \ + print (ver $1)"` + rm -rf ax_python_devel_vpy*.py* __pycache__/ax_python_devel_vpy*.py* + if test "$ac_supports_python_ver" = "True"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([this package requires Python $1. +If you have it installed, but it isn't the default Python +interpreter in your system path, please pass the PYTHON_VERSION +variable to configure. See ``configure --help'' for reference. +]) + PYTHON_VERSION="" + fi + fi + + # + # Check if you have distutils, else fail + # + AC_MSG_CHECKING([for the sysconfig Python package]) + ac_sysconfig_result=`$PYTHON -c "import sysconfig" 2>&1` + if test $? -eq 0; then + AC_MSG_RESULT([yes]) + IMPORT_SYSCONFIG="import sysconfig" + else + AC_MSG_RESULT([no]) + + AC_MSG_CHECKING([for the distutils Python package]) + ac_sysconfig_result=`$PYTHON -c "from distutils import sysconfig" 2>&1` + if test $? -eq 0; then + AC_MSG_RESULT([yes]) + IMPORT_SYSCONFIG="from distutils import sysconfig" + else + AC_MSG_ERROR([cannot import Python module "distutils". +Please check your Python installation. The error was: +$ac_sysconfig_result]) + PYTHON_VERSION="" + fi + fi + + # + # Check for Python include path + # + AC_MSG_CHECKING([for Python include path]) + if test -z "$PYTHON_CPPFLAGS"; then + if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then + # sysconfig module has different functions + python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + print (sysconfig.get_path ('include'));"` + plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + print (sysconfig.get_path ('platinclude'));"` + else + # old distutils way + python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + print (sysconfig.get_python_inc ());"` + plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + print (sysconfig.get_python_inc (plat_specific=1));"` + fi + if test -n "${python_path}"; then + if test "${plat_python_path}" != "${python_path}"; then + python_path="-I$python_path -I$plat_python_path" + else + python_path="-I$python_path" + fi + fi + PYTHON_CPPFLAGS=$python_path + fi + AC_MSG_RESULT([$PYTHON_CPPFLAGS]) + AC_SUBST([PYTHON_CPPFLAGS]) + + # + # Check for Python library path + # + AC_MSG_CHECKING([for Python library path]) + if test -z "$PYTHON_LIBS"; then + # (makes two attempts to ensure we've got a version number + # from the interpreter) + ac_python_version=`cat<<EOD | $PYTHON - + +# join all versioning strings, on some systems +# major/minor numbers could be in different list elements +from sysconfig import * +e = get_config_var('VERSION') +if e is not None: + print(e) +EOD` + + if test -z "$ac_python_version"; then + if test -n "$PYTHON_VERSION"; then + ac_python_version=$PYTHON_VERSION + else + ac_python_version=`$PYTHON -c "import sys; \ + print ("%d.%d" % sys.version_info[[:2]])"` + fi + fi + + # Make the versioning information available to the compiler + AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"], + [If available, contains the Python version number currently in use.]) + + # First, the library directory: + ac_python_libdir=`cat<<EOD | $PYTHON - + +# There should be only one +$IMPORT_SYSCONFIG +e = sysconfig.get_config_var('LIBDIR') +if e is not None: + print (e) +EOD` + + # Now, for the library: + ac_python_library=`cat<<EOD | $PYTHON - + +$IMPORT_SYSCONFIG +c = sysconfig.get_config_vars() +if 'LDVERSION' in c: + print ('python'+c[['LDVERSION']]) +else: + print ('python'+c[['VERSION']]) +EOD` + + # This small piece shamelessly adapted from PostgreSQL python macro; + # credits goes to momjian, I think. I'd like to put the right name + # in the credits, if someone can point me in the right direction... ? + # + if test -n "$ac_python_libdir" -a -n "$ac_python_library" + then + # use the official shared library + ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"` + PYTHON_LIBS="-L$ac_python_libdir -l$ac_python_library" + else + # old way: use libpython from python_configdir + ac_python_libdir=`$PYTHON -c \ + "from sysconfig import get_python_lib as f; \ + import os; \ + print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"` + PYTHON_LIBS="-L$ac_python_libdir -lpython$ac_python_version" + fi + + if test -z "PYTHON_LIBS"; then + AC_MSG_ERROR([ + Cannot determine location of your Python DSO. Please check it was installed with + dynamic libraries enabled, or try setting PYTHON_LIBS by hand. + ]) + fi + fi + AC_MSG_RESULT([$PYTHON_LIBS]) + AC_SUBST([PYTHON_LIBS]) + + # + # Check for site packages + # + AC_MSG_CHECKING([for Python site-packages path]) + if test -z "$PYTHON_SITE_PKG"; then + if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then + PYTHON_SITE_PKG=`$PYTHON -c " +$IMPORT_SYSCONFIG; +if hasattr(sysconfig, 'get_default_scheme'): + scheme = sysconfig.get_default_scheme() +else: + scheme = sysconfig._get_default_scheme() +if scheme == 'posix_local': + # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ + scheme = 'posix_prefix' +prefix = '$prefix' +if prefix == 'NONE': + prefix = '$ac_default_prefix' +sitedir = sysconfig.get_path('purelib', scheme, vars={'base': prefix}) +print(sitedir)"` + else + # distutils.sysconfig way + PYTHON_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + print (sysconfig.get_python_lib(0,0));"` + fi + fi + AC_MSG_RESULT([$PYTHON_SITE_PKG]) + AC_SUBST([PYTHON_SITE_PKG]) + + # + # Check for platform-specific site packages + # + AC_MSG_CHECKING([for Python platform specific site-packages path]) + if test -z "$PYTHON_PLATFORM_SITE_PKG"; then + if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then + PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c " +$IMPORT_SYSCONFIG; +if hasattr(sysconfig, 'get_default_scheme'): + scheme = sysconfig.get_default_scheme() +else: + scheme = sysconfig._get_default_scheme() +if scheme == 'posix_local': + # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ + scheme = 'posix_prefix' +prefix = '$prefix' +if prefix == 'NONE': + prefix = '$ac_default_prefix' +sitedir = sysconfig.get_path('platlib', scheme, vars={'platbase': prefix}) +print(sitedir)"` + else + # distutils.sysconfig way + PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + print (sysconfig.get_python_lib(1,0));"` + fi + fi + AC_MSG_RESULT([$PYTHON_PLATFORM_SITE_PKG]) + AC_SUBST([PYTHON_PLATFORM_SITE_PKG]) + + # + # libraries which must be linked in when embedding + # + AC_MSG_CHECKING(python extra libraries) + if test -z "$PYTHON_EXTRA_LIBS"; then + PYTHON_EXTRA_LIBS=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + conf = sysconfig.get_config_var; \ + print (conf('LIBS') + ' ' + conf('SYSLIBS'))"` + fi + AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) + AC_SUBST(PYTHON_EXTRA_LIBS) + + # + # linking flags needed when embedding + # + AC_MSG_CHECKING(python extra linking flags) + if test -z "$PYTHON_EXTRA_LDFLAGS"; then + PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "$IMPORT_SYSCONFIG; \ + conf = sysconfig.get_config_var; \ + print (conf('LINKFORSHARED'))"` + fi + AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) + AC_SUBST(PYTHON_EXTRA_LDFLAGS) + + # + # final check to see if everything compiles alright + # + AC_MSG_CHECKING([consistency of all components of python development environment]) + # save current global flags + ac_save_LIBS="$LIBS" + ac_save_LDFLAGS="$LDFLAGS" + ac_save_CPPFLAGS="$CPPFLAGS" + LIBS="$ac_save_LIBS $PYTHON_LIBS $PYTHON_EXTRA_LIBS" + LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS" + CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" + AC_LANG_PUSH([C]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[#include <Python.h>]], + [[Py_Initialize();]]) + ],[pythonexists=yes],[pythonexists=no]) + AC_LANG_POP([C]) + # turn back to default flags + CPPFLAGS="$ac_save_CPPFLAGS" + LIBS="$ac_save_LIBS" + LDFLAGS="$ac_save_LDFLAGS" + + AC_MSG_RESULT([$pythonexists]) + + if test ! "x$pythonexists" = "xyes"; then + AC_MSG_FAILURE([ + Could not link test program to Python. Maybe the main Python library has been + installed in some non-standard library path. If so, pass it to configure, + via the LIBS environment variable. + Example: ./configure LIBS="-L/usr/non-standard-path/python/lib" + ============================================================================ + ERROR! + You probably have to install the development version of the Python package + for your distribution. The exact name of this package varies among them. + ============================================================================ + ]) + PYTHON_VERSION="" + fi + + # + # all done! + # +]) diff --git a/m4/ax_tls.m4 b/m4/ax_tls.m4 new file mode 100644 index 0000000000000000000000000000000000000000..fb184fe201b71e8602a08ebe6b9b85fafeff4d04 --- /dev/null +++ b/m4/ax_tls.m4 @@ -0,0 +1,71 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_tls.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_TLS([action-if-found], [action-if-not-found]) +# +# DESCRIPTION +# +# Provides a test for the compiler support of thread local storage (TLS) +# extensions. Defines TLS if it is found. Currently knows about C++11, +# GCC/ICC, and MSVC. I think SunPro uses the same as GCC, and Borland +# apparently supports either. +# +# LICENSE +# +# Copyright (c) 2008 Alan Woodland <ajw05@aber.ac.uk> +# Copyright (c) 2010 Diego Elio Petteno` <flameeyes@gmail.com> +# +# 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 3 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, see <https://www.gnu.org/licenses/>. +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 15 + +AC_DEFUN([AX_TLS], [ + AC_MSG_CHECKING([for thread local storage (TLS) class]) + AC_CACHE_VAL([ac_cv_tls], + [for ax_tls_keyword in thread_local _Thread_local __thread '__declspec(thread)' none; do + AS_CASE([$ax_tls_keyword], + [none], [ac_cv_tls=none ; break], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [#include <stdlib.h>], + [static $ax_tls_keyword int bar;] + )], + [ac_cv_tls=$ax_tls_keyword ; break], + [ac_cv_tls=none] + )] + ) + done ] + ) + AC_MSG_RESULT([$ac_cv_tls]) + + AS_IF([test "$ac_cv_tls" != "none"], + [AC_DEFINE_UNQUOTED([TLS],[$ac_cv_tls],[If the compiler supports a TLS storage class, define it to that here]) + m4_ifnblank([$1],[$1],[[:]])], + [m4_ifnblank([$2],[$2],[[:]])]) +]) diff --git a/m4/kpse_libtool.m4 b/m4/kpse_libtool.m4 index c382294c586c62cf5181b005e2429a7cf6b6e116..0cc3feaf6a0e874db4150ab94a0eda8440fa5d7d 100644 --- a/m4/kpse_libtool.m4 +++ b/m4/kpse_libtool.m4 @@ -18,22 +18,33 @@ AC_DEFUN([_KPSE_USE_LIBTOOL], AC_PROVIDE_IFELSE([LT_INIT], , [m4_fatal([$0: requires libtool])])[]dnl LT_OUTPUT +AC_CONFIG_COMMANDS_PRE([ac_objext=${acx_lt_saved_ac_objext}]) +acx_lt_saved_ac_objext=$ac_objext +ac_objext=lo m4_append([AC_LANG(C)], -[ac_link="./libtool --mode=link --tag=CC $ac_link" +[ac_link="$ac_pwd/libtool --mode=link --tag=CC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CC $ac_compile" ])[]dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [m4_append([AC_LANG(C++)], -[ac_link="./libtool --mode=link --tag=CXX $ac_link" +[ac_link="$ac_pwd/libtool --mode=link --tag=CXX $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=CXX $ac_compile" ])])[]dnl AC_PROVIDE_IFELSE([AC_PROG_FC], [m4_append([AC_LANG(Fortran)], -[ac_link="./libtool --mode=link --tag=FC $ac_link" +[ac_link="$ac_pwd/libtool --mode=link --tag=FC $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=FC $ac_compile" ])])[]dnl AC_PROVIDE_IFELSE([AC_PROG_F77], [m4_append([AC_LANG(Fortran 77)], -[ac_link="./libtool --mode=link --tag=F77 $ac_link" +[ac_link="$ac_pwd/libtool --mode=link --tag=F77 $ac_link" +ac_compile="$ac_pwd/libtool --mode=compile --tag=F77 $ac_compile" ])])[]dnl AC_LANG(_AC_LANG)[]dnl +dnl After compiling/linking checks, now also $top_builddir/$objdir +dnl needs to be cleaned. +ac_clean_files_save="$ac_clean_files_save $ac_pwd/$objdir" +ac_clean_files="$ac_clean_files $ac_pwd/$objdir" ]) # _KPSE_USE_LIBTOOL # _KPSE_CHECK_LIBTOOL([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE]) diff --git a/m4/starlink_fpp.m4 b/m4/starlink_fpp.m4 deleted file mode 100644 index 7178f3e2dff13ddf711cfbc28b0145c18a58b3ce..0000000000000000000000000000000000000000 --- a/m4/starlink_fpp.m4 +++ /dev/null @@ -1,753 +0,0 @@ -# This file is part of Autoconf. -*- Autoconf -*- -# Fortran languages support. -# Copyright (C) 2001, 2003-2005 -# Free Software Foundation, Inc. -# -# 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, 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. -# -# As a special exception, the Free Software Foundation gives unlimited -# permission to copy, distribute and modify the configure scripts that -# are the output of Autoconf. You need not follow the terms of the GNU -# General Public License when using or distributing such scripts, even -# though portions of the text of Autoconf appear in them. The GNU -# General Public License (GPL) does govern all other use of the material -# that constitutes the Autoconf program. -# -# Certain portions of the Autoconf source text are designed to be copied -# (in certain cases, depending on the input) into the output of -# Autoconf. We call these the "data" portions. The rest of the Autoconf -# source text consists of comments plus executable code that decides which -# of the data portions to output in any given case. We call these -# comments and executable code the "non-data" portions. Autoconf never -# copies any of the non-data portions into its output. -# -# This special exception to the GPL applies to versions of Autoconf -# released by the Free Software Foundation. When you make and -# distribute a modified version of Autoconf, you may extend this special -# exception to the GPL to apply to your modified version as well, *unless* -# your modified version has the potential to copy into its output some -# of the text that was the non-data portion of the version that you started -# with. (In other words, unless your change moves or copies text from -# the non-data portions to the data portions.) If your modification has -# such potential, you must delete any notice of this special exception -# to the GPL from your modified version. -# -# Written by David MacKenzie, with help from -# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, -# Roland McGrath, Noah Friedman, david d zuhn, and many others. -# -# Fortran preprocessing support written by Martin Wilck, adapted and -# extended by Norman Gray and Toby White. -# -# Reduced to searching the Fortran preprocessor and flags for FC to -# preprocess by Thomas Jahns, 2009 - - -## ------------------------------- ## -## Preprocessor features ## -## ------------------------------- ## -# -# Supported features are: -# -# include : correctly process #include directives and -I -# define : correctly process -D -# substitute: substitute macros in Fortran code -# (some preprocessors touch only lines starting with #) -# wrap : wrap lines that become too long through macro substitution -# fpp is probably the only preprocessor that does this. -# cstyle : Do not suppress C style comments (-C option in cpp) -# CSTYLE : *Do* suppress C style comments -# (e.g. code contains C-style comments, and compiler may not -# know how to handle them) -# cxxstyle : Do not suppress C++ style comments (default) -# CXXSTYLE : *Do* suppress C++ style comments (seems unlikely, but in here -# for completeness) -# -# Features can be abbreviated: i, in, inc etc. are equivalent to include. -# Features can be deselected (feature not needed) by prepending "no", -# e.g. nodef (=nodefine), now (=nowrap). -# -# Default for the feature list is -# [include define substitute nowrap nocstyle noCSTYLE cxxstyle] -# Feature requirements corresponding to the defaults may be omitted -# -# Note that "wrap" implies "substitute", and CSTYLE and cstyle cannot -# be requested at the same time. The macro adjusts this automatically. -# - -# -------------------------------------- # -# Feature tests for Preprocessed Fortran # -# -------------------------------------- # - -# ------------------# -# Internal macros # -# ------------------# - -# ----------------------------------------------# -# Some test programs for different features # -# ----------------------------------------------# - -# _AC_LANG_PROGRAM_FPP_SIMPLE -# --------------------------- -# The minimum test program - any compiler supporting -# preprocessing should handle this -AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_SIMPLE], - [AC_LANG_PROGRAM(,[@%:@define OK -@%:@ifndef OK - syntax error -@%:@endif])])#_ACX_SL_LANG_PROGRAM_FPP_SIMPLE - - -# _ACX_SL_LANG_PROGRAM_FPP_ONLY -# --------------------------- -# Test program for pure preprocessing -# Note that other macros test for literal strings within this, so check -# for those if you have to change anything here. -AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_ONLY], - [AC_LANG_PROGRAM(,[@%:@define OK -@%:@ifdef OK - REAL A -@%:@else - syntax error -@%:@endif])])#_ACX_SL_LANG_PROGRAM_FPP_ONLY - - -# _ACX_SL_LANG_PROGRAM_FPP_D -# --------------------------- -# Like _ACX_SL_LANG_PROGRAM_FPP_SIMPLE, but OK is passed via -D switch -AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_D], -[AC_LANG_PROGRAM([],[@%:@ifndef OK - syntax error -@%:@endif])])#_ACX_SL_LANG_PROGRAM_FPP_D - - -# _ACX_SL_LANG_PROGRAM_FPP_I -# --------------------------- -# Test for #include statement -# If unsupported, this should give a type error -AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_I], - [AC_LANG_PROGRAM(,[ IMPLICIT CHARACTER (c) - ! Comments in test programs should be freeform compliant just in case. - ! conftest.inc contains the Fortran statement "REAL cc" -@%:@include "conftest.inc" - cc=1.])])#_ACX_SL_LANG_PROGRAM_FPP_I - - -# _ACX_SL_LANG_PROGRAM_FPP_SUBS -# --------------------------- -# Test whether cpp symbols are expanded in Fortran code lines -# If not, this should give a type error -AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_SUBS], -[AC_LANG_PROGRAM(,[@%:@define NM xxxx - IMPLICIT CHARACTER (n) - REAL xxxx - NM=1.])])#_ACX_SL_LANG_PROGRAM_FPP_SUBS - - -# _ACX_SL_LANG_PROGRAM_FPP_WRAP -# --------------------------- -# Test whether preprocessor breaks lines that become too long due -# to macro substitution. -# If not, this gives an "unterminated character constant" error -AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_WRAP], - [AC_LANG_PROGRAM(, - [m4_case(_AC_LANG, - [Fortran], -[@%:@define LONG '901234567890123456789012345678901234567890123456789012345678901234567890' - CHARACTER(LEN=80) :: A - A=LONG], - [Fortran 77], -[@%:@define LONG '901234567890123456789012345678901234567890123456789012345678901234567890' - CHARACTER*80 A - A=LONG], - [m4_fatal([$0: current language is not Fortran: ] _AC_LANG)])])])#_ACX_SL_LANG_PROGRAM_FPP_WRAP - - -# _ACX_SL_LANG_PROGRAM_FPP_CSTYLE -# --------------------------- -# Test program for C style comments -AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_CSTYLE], -[AC_LANG_PROGRAM(,[ A=1. /* C-style comment */])])#_ACX_SL_LANG_PROGRAM_FPP_CSTYLE - -# _ACX_SL_LANG_PROGRAM_FPP_CXXSTYLE -# --------------------------- -# Test program for C++ style comments -AC_DEFUN([_ACX_SL_LANG_PROGRAM_FPP_CXXSTYLE], - [AC_LANG_SOURCE([m4_case(_AC_LANG, - [Fortran], -[ PROGRAM MAIN - CHARACTER(LEN=10) :: C - C = "abcde" // "fghij"; END PROGRAM], - [Fortran 77], -[ PROGRAM MAIN - CHARACTER*10 C - C = "abcde" // "fghij"; END PROGRAM])])])#_ACX_SL_LANG_PROGRAM_FPP_CXXSTYLE - -# _ACX_SL_SET_FPP_FEATURE_VARS ([feature list]) -# -------------------------------------- -# Parse the feature list from configure.in -AC_DEFUN([_ACX_SL_SET_FPP_FEATURE_VARS], - [# defaults for needed features - ac_fpp_need_d=yes - ac_fpp_need_i=yes - ac_fpp_need_subs=no - ac_fpp_need_wrap=no - ac_fpp_need_cstyle=no - ac_fpp_need_CSTYLE=no - ac_fpp_need_cxxstyle=yes - ac_fpp_need_CXXSTYLE=no - dnl FIXME: this should be feasable within m4 constructs, i.e. without - dnl using shell loops - for _t in $1 nil - do - AS_CASE([$_t], - [define], [ac_fpp_need_d=yes], - [nodefine], [ac_fpp_need_d=no], - [include], [ac_fpp_need_i=yes], - [noinclude], [ac_fpp_need_i=no], - [substitute], [ac_fpp_need_subs=yes], - [nosubstitute], [ac_fpp_need_subs=no], - [wrap], [ac_fpp_need_wrap=yes], - [nowwrap], [ac_fpp_need_wrap=no], - [cstyle], [ac_fpp_need_cstyle=yes], - [nocstyle], [ac_fpp_need_cstyle=no], - [CSTYLE], [ac_fpp_need_CSTYLE=yes], - [noCSTYLE], [ac_fpp_need_CSTYLE=no], - [cxxstyle], [ac_fpp_need_cxxstyle=yes], - [nocxxstyle], [ac_fpp_need_cxxstyle=no], - [CXXSTYLE], [ac_fpp_need_CXXSTYLE=yes], - [noCXXSTYLE], [ac_fpp_need_CXXSTYLE=no], - [nil], []) - done - # Wrapping requires substitution - test $ac_fpp_need_wrap = yes && ac_fpp_need_subs=yes - # CSTYLE and cstyle are mutually exclusive. - # CSTYLE takes precedence, since if it is not fulfilled, - # compile errors may arise - test $ac_fpp_need_CSTYLE = yes && ac_fpp_need_cstyle=no - dnl Similarly for cxxstyle - test $ac_fpp_need_CXXSTYLE = yes && ac_fpp_need_cxxstyle=no - ])# _ACX_SL_SET_FPP_FEATURE_VARS - - -# _ACX_SL_TEST_FPP(COMMAND,SUFFIX,[ACTION-IF-SUCCESSFULL],[ACTION-IF-FAILED]) -# ------------------------ -# A helper macro to test correct fpp behaviour -# Invokes COMMAND <FILE_ONLY_COMPILABLE_WHEN_PREPROC_RUN> -# If the output on stdout is valid input to the Fortran compiler, it sets -# * acx_sl_prog_fpp -# * acx_sl_prog_fpp_suffix -# accordingly. -AC_DEFUN([_ACX_SL_TEST_FPP], - [rm -f conftest* - ACX_ASSERT_LANG_IS_FORTRAN_VARIANT - AC_LANG_CONFTEST([_ACX_SL_LANG_PROGRAM_FPP_ONLY]) - ac_tmp=conftest.fppout - AS_IF([_AC_RUN_LOG([$1 conftest.$2 >$ac_tmp],dnl - [_AC_DO_ECHO([$1 $FPPFLAGS conftest.$2 >$ac_tmp])])], - [AS_IF([test -f $ac_tmp \ - && ! cmp conftest.$2 $ac_tmp >/dev/null 2>&1 \ - && grep '^ REAL A' $ac_tmp >/dev/null 2>&1 \ - && ! grep 'syntax error' $ac_tmp >/dev/null 2>&1], - [# we have Fortran! See if the file can be compiled: - mv $ac_tmp conftest.$ac_ext - AC_COMPILE_IFELSE(, [_AC_MSG_LOG_CONFTEST - $3], - [_AC_MSG_LOG_CONFTEST - $4])], - [mv $ac_tmp conftest.$ac_ext - _AC_MSG_LOG_CONFTEST - $4])]) -dnl Preprocessing might fail for one of the following reasons: -dnl * no output was produced (disk full?), -dnl * FPP input and output have the same content, -dnl * the output did not contain the critical part of the source file -dnl * some syntax error crept into the output -dnl indicating that this is a case-insensitive filesystem or -dnl preprocessing failed. So this command doesn't work. - rm -f conftest* -])# _ACX_SL_TEST_FPP - -# _ACX_SL_PROG_FPP([SUFFIX], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ------------ -# Try to figure out how to preprocess files with the given suffix -# just like the selected Fortran compiler does -# -# Must be run after _ACX_SL_PROG_FC_CPP -AC_DEFUN([_ACX_SL_PROG_FPP], - [acx_sl_fpp_srcext=m4_default([$1],[${ac_fc_srcext-F}]) - AS_VAR_PUSHDEF([acx_sl_prog_fpp], - [acx_sl_cv_prog_fpp_]_AC_LANG_ABBREV[_]m4_default([$1],[${ac_fc_srcext-f}])) - AC_CACHE_CHECK([how to preprocess Fortran files with suffix $acx_sl_fpp_srcext], - [acx_sl_prog_fpp], - [AS_VAR_SET([acx_sl_prog_fpp], []) - # Let the user specify FPP - AS_IF([test -n "$FPP"], - [_ACX_SL_TEST_FPP([$FPP],[$acx_sl_fpp_srcext], - [AS_VAR_SET([acx_sl_prog_fpp], ["$FPP"])], - [AC_MSG_WARN([user-specified \$FPP ($FPP) does not work]) - FPP=])]) - AS_IF([test -z "$FPP"], - [for ac_fpp in `cd $srcdir ; pwd`/util/sxpreproc-wrapper \ - `cd $srcdir ; pwd`/util/xlfpreproc-wrapper \ - `cd $srcdir ; pwd`/util/sunf95preproc-wrapper \ - `cd $srcdir ; pwd`/util/crayftnpreproc-wrapper \ - "$FC -F" "$FC -F -fpp" "$FC -E" "$FC -E -cpp" \ - "$FC $FCFLAGS -F" "$FC $FCFLAGS -E" "$FC $FCFLAGS -E" \ - "$FC $FCFLAGS -E -cpp" "$FC $FCFLAGS -x f95-cpp-input -E -P" - do - _ACX_SL_TEST_FPP([$ac_fpp],[$acx_sl_fpp_srcext],[FPP="$ac_fpp" - break]) - _ACX_SL_TEST_FPP([$ac_fpp -P],[$acx_sl_fpp_srcext], - [FPP="$ac_fpp -P" - break]) - done - dnl the above tests might generate an executable - \rm a.out 2>/dev/null]) - AS_IF([test -z "$FPP"], [$3], - [AS_VAR_SET([acx_sl_prog_fpp], [$FPP]) - $2])]) - AS_VAR_PUSHDEF([acx_sl_prog_fpp]) -])# _ACX_SL_PROG_FPP - - - -# _ACX_SL_PROG_FPP_CSTYLE -# ------------------- -# Check whether FPP lets C-style comments through to FC -AC_DEFUN([_ACX_SL_PROG_FPP_CSTYLE], -[AC_CACHE_CHECK([how to pass C-style comments to $FC], - ac_cv_prog_fpp_cstyle, -[ac_cv_prog_fpp_cstyle=unknown -ACX_ASSERT_LANG_IS_FORTRAN_VARIANT -cat > conftest.$ac_ext << \_ACEOF -_ACX_SL_LANG_PROGRAM_FPP_CSTYLE -_ACEOF - -AC_LANG_PUSH(Fortran) -ac_cmd='$FPP $FPPFLAGS conftest.$ac_ext '"$ac_fpp_out" -AS_IF([AC_TRY_EVAL(ac_cmd) && \ - cat conftest.f | grep '[[*]]/.*[[*]]/' >/dev/null 2>&1], - [ac_cv_prog_fpp_cstyle=], - [ac_save_FPPFLAGS=$FPPFLAGS - ac_name=`expr "x$FPP" : 'x\(fpp\)'` - AS_IF([test "x$ac_name" = xfpp], - [ac_flag="-c_com=no"], - [ac_flag="-C"]) - FPPFLAGS="$FPPFLAGS $ac_flag" - ac_cmd='$FPP $FPPFLAGS conftest.$ac_ext '"$ac_fpp_out" - AS_IF([AC_TRY_EVAL(ac_cmd) && \ - cat conftest.f | grep '/[[*]].*[[*]]/' >/dev/null 2>&1], - [ac_cv_prog_fpp_cstyle=$ac_flag]) - FPPFLAGS=$ac_save_FPPFLAGS]) -rm -f conftest* -AC_LANG_POP(Fortran)dnl -]) -if test "x$ac_cv_prog_fpp_cstyle" = "xunknown"; then - AC_MSG_WARN([cannot find a way to make $FPP pass C-style comments]) -else - FPPFLAGS="$FPPFLAGS $ac_cv_prog_fpp_cstyle" -fi -])# _ACX_SL_PROG_FPP_CSTYLE - -# _ACX_CHECK_FPP_COMPILE([EXTRA-FLAGS], direct|indirect, -# [ACTION-IF-COMPILABLE],[ACTION-IF-NOT-COMPILABLE]) -# helper macro to run the preprocessor or compile directly -# with preprocessor flags -m4_define([_ACX_FPP_COMPILE_IFELSE], - [m4_if([$2],[direct], - [cp conftest.$acx_sl_fpp_srcext conftest.${ac_ext}.tmp], - [_AC_RUN_LOG([$FPP $FPPFLAGS m4_ifval([$1],[$1 ])conftest.$acx_sl_fpp_srcext \ - >conftest.${ac_ext}.tmp], - [echo Running preprocessor $FPP $FPPFLAGS m4_ifval([$1],[$1 ])conftest.$acx_sl_fpp_srcext])]) - m4_if([$2],[direct],[FCFLAGS="$FPPFLAGS $1 $ac_save_FCFLAGS"]) - mv conftest.${ac_ext}.tmp conftest.${ac_ext} - AC_COMPILE_IFELSE(,[$3],[$4])]) - -# ACX_SL_PROG_FC_FPP_FEATURES(FEATURES,METHOD,[SUFFIX], -# [ACTION-IF-SUCCESS],[ACTION-IF-FAILURE]) -# --------------- -# This macro checks whether the chosen preprocessing method -# has all the requested features. -# -# This macro must be called with METHOD set to either -# direct or indirect; it behaves differently accordingly. -# -# In case one of the checks fails, ACTION-IF-FAILED will be called. -# -#FIXME: this is only for fixed form code. Need a separate check for free-form. -# -# NB We are definitely using a suffix of .F in this case. If the filesystem -# is case-insensitive, we may need to force preprocessing. -# -# Sets ac_fpp_ok to "no" if a requested feature is unavailable -# -AC_DEFUN([ACX_SL_PROG_FC_FPP_FEATURES], - [AS_VAR_PUSHDEF([acx_sl_fpp_ok], [acx_sl_cv_]_AC_LANG_ABBREV[_$2_ok]) - AC_CACHE_CHECK([if ]m4_case([$2],[direct],[compilation with $FC], -[indirect],[preprocessing with $FPP], -[m4_fatal([$0: only direct or indirect method supported: ']$2['])])[ of Fortran source supports required preprocessor features], -[acx_sl_fpp_ok], - [AS_VAR_SET([acx_sl_fpp_ok], [yes]) - # Set up ac_fpp_need_* flags based on features in $1 - acx_sl_fpp_srcext=m4_default([$3],[${ac_fc_srcext-F}]) - _ACX_SL_SET_FPP_FEATURE_VARS([$1]) - - acx_sl_prog_fc_cpp_CSTYLE=no - acx_sl_prog_fc_cpp_cxxstyle=no - - ACX_ASSERT_LANG_IS_FORTRAN_VARIANT - ac_save_FCFLAGS=$FCFLAGS - - m4_case([$2],[direct],[],[indirect],[], - [m4_fatal([$0: only direct or indirect method supported: ] $2)]) - - # We need to skip the following tests if we're trying direct compilation - # and FC won't preprocess. - AS_IF([test x$ac_fpp_need_d = xyes], - [acx_sl_prog_fc_cpp_d=no - _AS_ECHO_LOG([Trying flag to create preprocessor defines.]) - ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext], - [_ACX_SL_LANG_PROGRAM_FPP_D]) - # Normally we expect to be able to define preprocessor macros - # with -D, but this might be IBM xlf compiler, which needs - # -WF,-D or Fujitsu VPP700 which needs -Wp,-D - mv conftest.$acx_sl_fpp_srcext conftest.${acx_sl_fpp_srcext}.bak - for FPP_DEFOPT in "$FPP_DEFOPT" '-D' '-WF,-D' '-Wp,-D' - do - AS_IF([test x"$FPP_DEFOPT" != x ], - [cp conftest.${acx_sl_fpp_srcext}.bak conftest.$acx_sl_fpp_srcext - _ACX_FPP_COMPILE_IFELSE([${FPP_DEFOPT}OK],[$2], - [acx_sl_prog_fc_cpp_d=yes; break])]) - done - FCFLAGS=$ac_save_FCFLAGS - AS_IF([test $acx_sl_prog_fc_cpp_d = no], - [AS_VAR_SET([acx_sl_fpp_ok], [no])]) - AS_IF([test x[]AS_VAR_GET([acx_sl_fpp_ok]) = xyes], - [_AS_ECHO_LOG([Test successful.])], - [_AS_ECHO_LOG([Test failed.])]) - ]) - - AS_IF([test $ac_fpp_need_i = yes], - [acx_sl_prog_fc_cpp_i=no - _AS_ECHO_LOG([Trying flag to add directories to preprocessor search path.]) - AS_MKDIR_P([conftst]) - cd conftst - ACX_LANG_OTHER_SUFFIX_CONFTEST([inc], - [AC_LANG_SOURCE([ ! This statement overrides the IMPLICIT statement in the program - REAL cc])]) - cd .. - ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext],[_ACX_SL_LANG_PROGRAM_FPP_I]) - mv conftest.$acx_sl_fpp_srcext conftest.${acx_sl_fpp_srcext}.bak - for FPP_INCOPT in "$FPP_INCOPT" '-I' '-WF,-I' '-Wp,-I' - do - AS_IF([test x"$FPP_INCOPT" != x ], - [cp conftest.${acx_sl_fpp_srcext}.bak conftest.$acx_sl_fpp_srcext - _ACX_FPP_COMPILE_IFELSE([${FPP_INCOPT}conftst],[$2], - [acx_sl_prog_fc_cpp_i=yes - break])]) - done - FCFLAGS=$ac_save_FCFLAGS - rm -rf conftst - AS_IF([test $acx_sl_prog_fc_cpp_i = no], - [AS_VAR_SET([acx_sl_fpp_ok], [no])]) - AS_IF([test x[]AS_VAR_GET([acx_sl_fpp_ok]) = xyes], - [_AS_ECHO_LOG([Test successful.])], - [_AS_ECHO_LOG([Test failed.])])]) -dnl -dnl - AS_IF([test $ac_fpp_need_subs = yes], - [acx_sl_prog_fc_cpp_subs=no - _AS_ECHO_LOG([Testing preprocessor expansion in Fortran code.]) - ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext], - [_ACX_SL_LANG_PROGRAM_FPP_SUBS]) - _ACX_FPP_COMPILE_IFELSE(,[$2], - [acx_sl_prog_fc_cpp_subs=yes],[AS_VAR_SET([acx_sl_fpp_ok], [no])]) - AS_IF([test x[]AS_VAR_GET([acx_sl_fpp_ok]) = xyes], - [_AS_ECHO_LOG([Test successful.])], - [_AS_ECHO_LOG([Test failed.])]) - ]) -dnl -dnl - AS_IF([test $ac_fpp_need_wrap = yes], - [acx_sl_prog_fc_cpp_wrap=no - _AS_ECHO_LOG([Testing wether preprocessor wraps long lines.]) - ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext], - [_ACX_SL_LANG_PROGRAM_FPP_WRAP]) - _ACX_FPP_COMPILE_IFELSE(,[$2], - [acx_sl_prog_fc_cpp_wrap=yes], [AS_VAR_SET([acx_sl_fpp_ok], [no])]) - AS_IF([test x[]AS_VAR_GET([acx_sl_fpp_ok]) = xyes], - [_AS_ECHO_LOG([Test successful.])], - [_AS_ECHO_LOG([Test failed.])]) - ]) -dnl -dnl - AS_IF([test $ac_fpp_need_CSTYLE = yes], - [_AS_ECHO_LOG([Testing wether preprocessor removes C-style comments.]) - ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext], - [_ACX_SL_LANG_PROGRAM_FPP_CSTYLE]) - _ACX_FPP_COMPILE_IFELSE(,[$2], - [acx_sl_prog_fc_cpp_CSTYLE=yes], [AS_VAR_SET([acx_sl_fpp_ok], [no])]) - AS_IF([test x[]AS_VAR_GET([acx_sl_fpp_ok]) = xyes], - [_AS_ECHO_LOG([Test successful.])], - [_AS_ECHO_LOG([Test failed.])]) - ]) -dnl - AS_IF([test $ac_fpp_need_cstyle = yes], - [_AS_ECHO_LOG([Testing wether preprocessor leaves C-style comments in place.]) - ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext], - [_ACX_SL_LANG_PROGRAM_FPP_CSTYLE]) - _ACX_FPP_COMPILE_IFELSE(,[$2], - [acx_sl_prog_fc_cpp_CSTYLE=yes], [AS_VAR_SET([acx_sl_fpp_ok], [no])]) - AS_IF([test x[]AS_VAR_GET([acx_sl_fpp_ok]) = xyes], - [_AS_ECHO_LOG([Test failed.])], - [_AS_ECHO_LOG([Test successful.])]) - ]) -dnl - AS_IF([test $ac_fpp_need_cxxstyle = yes], - [_AS_ECHO_LOG([Testing if preprocessor leaves C++-style comments in place.]) - ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext], - [_ACX_SL_LANG_PROGRAM_FPP_CXXSTYLE]) - _ACX_FPP_COMPILE_IFELSE(,[$2], - [acx_sl_prog_fc_cpp_cxxstyle=yes],[AS_VAR_SET([acx_sl_fpp_ok], [no])]) - AS_IF([test x[]AS_VAR_GET([acx_sl_fpp_ok]) = xyes], - [_AS_ECHO_LOG([Test successful.])], - [_AS_ECHO_LOG([Test failed.])]) - ]) -dnl - AS_IF([test $ac_fpp_need_CXXSTYLE = yes], - [_AS_ECHO_LOG([Testing if preprocessor suppresses C++-style comments.]) - ACX_LANG_OTHER_SUFFIX_CONFTEST([$acx_sl_fpp_srcext], - [_ACX_SL_LANG_PROGRAM_FPP_CXXSTYLE]) - _ACX_FPP_COMPILE_IFELSE(,[$2], - [acx_sl_prog_fc_cpp_cxxstyle=yes], - [AS_VAR_SET([acx_sl_fpp_ok], [no])]) - AS_IF([test x[]AS_VAR_GET([acx_sl_fpp_ok]) = xyes], - [_AS_ECHO_LOG([Test failed.])], - [_AS_ECHO_LOG([Test successful.])]) - ]) -dnl - FCFLAGS=$ac_save_FCFLAGS - rm -f conftest.* - AS_IF([test x[]AS_VAR_GET([acx_sl_fpp_ok]) = xyes],[$4],[$5]) - ]) - #FIXME we should probably do the AC_SUBST somewhere else. - AC_SUBST([FPP_DEFOPT]) - AC_SUBST([FPP_INCOPT]) - AS_VAR_POPDEF([acx_sl_fpp_ok]) - ])#ACX_SL_PROG_FC_FPP_FEATURES - - - -# _ACX_SL_FC_CHECK_CIFS -# ----------------- -# Check whether the filesystem is case-insensitive (eg, HFS+ on -# MacOS X). Set ac_cv_fc_cifs=yes if so. -AC_DEFUN([_ACX_SL_FC_CHECK_CIFS], - [AC_CACHE_CHECK([whether the filesystem is case-insensitive], - [ac_cv_fc_cifs], - [rm -f conftest.* - echo wibble >conftest.F - AS_IF([test -f conftest.f && test "`cat conftest.f`" = wibble], - [ac_cv_fc_cifs=yes], [ac_cv_fc_cifs=no]) -])])# _ACX_SL_FC_CHECK_CIFS - - - -# ----------------------- -# User macros -# ----------------------- - -# AC_PROG_FPP([required features], [SUFFIX]) -# -------------------------------------------------- -# -# [required features] is a space-separated list of features that the Fortran -# preprocessor must have for the code to compile. -# It is up to the package maintainer to properly set these requirements. -# -# If SUFFIX is set it's assumed that files for the preprocessor have -# this suffix, otherwise .F is assumed. The output of the preprocessor -# is placed in files with the extension .f or whatever was last setup -# with AC_FC_SRCEXT. -# -# This macro will find out how to compile a preprocessable fixed-form -# file, with a .SUFFIX file extension. The type of Fortran code used -# for tests will be determined by the currently selected AC_LANG -# (Fortran or Fortran 77 at the time of this writing) -# -# See the section Preprocessor features for discussion of individual -# features. -# -# This macro sets and substitutes the variables FPP and FPPFLAGS. -# -# The macro depends on both FC and CPP, because we must possibly fall -# back on CPP for preprocessing. -# -AC_DEFUN([AC_PROG_FPP], - [AC_REQUIRE([AC_PROG_FC])dnl -dnl We are not going to use AC_REQUIRE(AC_PROG_CPP) here for -dnl two reasons: -dnl 1. we don't really need to if FC will preprocess itself -dnl 2. we can't pass in an optional parameter to change the -dnl default CPP search order, which we need to. -dnl AC_REQUIRE([AC_PROG_CPP([cpp])])dnl - - # Prefer AC_PROG_FC to AC_PROG_F77 - export FC FCFLAGS - AS_IF([test "X$F77" != X], - [AC_MSG_WARN([Use A@&t@C_PROG_FC with A@&t@C_PROG_FPP, instead of A@&t@C_PROG_F77])]) - - - AC_ARG_VAR([FPP], [Command to preprocess Fortran code]) - AC_ARG_VAR([FPPFLAGS], [Flags for the Fortran preprocessor]) - - _ACX_SL_PROG_FPP([$2]) - - # ACX_SL_PROG_FC_FPP_FEATURES does the actual feature tests, - # storing results of the checks in non-cv variables like - # ac_prog_fc_cpp_*, which we copy to cv variables afterwards. This - # allows this macro to be reusable for other cv variables (see - # below) - ACX_SL_PROG_FC_FPP_FEATURES([$1],[indirect],[$2],, - [AC_MSG_FAILURE([required Fortran preprocessor not available])]) - ])# AC_PROG_FPP - -# -# ACX_FC_INTEGRAL_FPP(FEATURES,[SUFFIX],[ACTION-IF-TRUE],[ACTION-IF-NOT]) -# Determines wether $FC can process files containing preprocessor directives -# and processes each of the requested features correctly -# and run the according ACTION-*. -AC_DEFUN([ACX_FC_INTEGRAL_FPP], - [# On nearly all systems where direct compilation is possible, a - # .F file containing preprocessable fixed-form will be compiled - # and preprocessed automatically. However, case-insensitive - # filesystems (eg HFS+ on MacOSX) may get confused. Therefore, - # we must check for cpp flags. - AC_ARG_VAR([FPPFLAGS], [Flags for the Fortran preprocessor]) - acx_sl_prog_fc_cpp=no - AC_COMPILE_IFELSE([AC_LANG_PP_MANDATORY_SOURCE], - [acx_sl_prog_fc_cpp=yes], [AS_VAR_SET([acx_sl_fpp_ok], [no])]) - # It is possible we've failed the previous test because of a - # Tru64 bug where the compiler fails when called as 'f95' on - # a .F file. It works when called as f90. - #FIXME: this does not protect the user's setting of FC, though - # we set it back if sensible. - AS_IF([test x$acx_sl_prog_fc_cpp = xno && test $FC = f95], - [FC=f90 - AC_LINK_IFELSE([AC_LANG_PP_MANDATORY_SOURCE], - [acx_sl_prog_fc_cpp=yes],[FC=f95 - AS_VAR_SET([acx_sl_fpp_ok], [no])]) - ]) - ACX_SL_PROG_FC_FPP_FEATURES([$1],[indirect],[$2],, - [AC_MSG_FAILURE([required Fortran preprocessor not available])]) - ac_first_save_FPPFLAGS=$FPPFLAGS - FPPFLAGS="$FPPFLAGS $FPPFLAGS_F" - # Don't need to test if $FC removes C++ comments - that - # way madness lies. - ACX_SL_PROG_FC_FPP_FEATURES([$1],[direct],[$2],[$3],[$4]) -]) - -AC_DEFUN([_ACX_CHOOSE_FPP_BUILD_RULE], - [# If so, we don't need to go any further. -if test x$acx_sl_fpp_ok = xyes; then - ac_cv_fpp_build_rule=direct - AC_MSG_RESULT([direct]) -else -# indirect compilation - AC_MSG_RESULT([indirect]) - -# Before we go any further, check that we're not courting disaster, -# here, by using indirect compilation (.F -> .f -> .o) on a -# case-insensitive filesystem. If we are, there's nothing we can do -# other than fail noisily. -_ACX_SL_FC_CHECK_CIFS -if test $ac_cv_fc_cifs = yes; then - AC_MSG_ERROR([disaster: this Fortran needs indirect compilation, but we - have a case-insensitive filesystem, so .F -> .f would fail; further compilation isn't going to work -- consider filing a bug]) -fi - -# Now we check how to invoke a preprocessor that outputs Fortran code -# that FC can understand -#FIXME: in a joint C/Fortran project, CPP might have already -# been defined. Here we are potentially (probably) redefining it. -# I don't think this matters. Not sure, though. -# In that case, AC_SUBST has already been called on CPP. -# We don't want to fail if we can't find cpp - we might be able -# to fall back on fpp. -#FIXME: actually, we should just prefer cpp to $CPP -# The next macro sets FPP (unless already set by the user) -_ACX_SL_PROG_FPP - -# Redefine the compile and link commands for indirect compilation - ac_fpp_compile='${FPP-fpp} $FPPFLAGS $FPPFLAGS_SRCEXT conftest.$ac_ext '"$ac_fpp_out"' && ${FC-fc} -c $FCFLAGS conftest.f >&AS_MESSAGE_LOG_FD' - ac_fpp_link='${FPP-fpp} $FPPFLAGS conftest.$ac_ext $FPPFLAGS_SRCEXT '"$ac_fpp_out"' && ${FC-fc} -o conftest${ac_exeext} $FCFLAGS $LDFLAGS conftest.f $LIBS >&AS_MESSAGE_LOG_FD' - - ac_compile=$ac_fpp_compile - ac_link=$ac_fpp_link -# Redo all the feature checks for indirect compilation. - - ACX_SL_PROG_FC_FPP_FEATURES([$1], [indirect], - ,[AC_MSG_FAILURE([required fortran preprocessor not available])]) - -if test $ac_fpp_need_d = yes; then - AC_CACHE_CHECK([whether $FPP accepts -D], - ac_cv_prog_fpp_d, - [ac_cv_prog_fpp_d=$ac_prog_fc_cpp_d]) -fi - -if test $ac_fpp_need_i = yes; then - AC_CACHE_CHECK([whether $FPP accepts -I], - ac_cv_prog_fpp_i, - [ac_cv_prog_fpp_i=$ac_prog_fc_cpp_i]) -fi - -if test $ac_fpp_need_subs = yes; then - AC_CACHE_CHECK([whether $FPP substitutes macros in Fortran code], - ac_cv_prog_fpp_subs, - [ac_cv_prog_fpp_subs=$ac_prog_fc_cpp_subs]) -fi - -if test $ac_fpp_need_wrap = yes; then - AC_CACHE_CHECK([whether $FPP wraps long lines automatically], - ac_cv_prog_fpp_wrap, - [ac_cv_prog_fpp_wrap=$ac_prog_fc_cpp_wrap]) -fi - -if test $ac_fpp_need_CSTYLE = yes; then - AC_CACHE_CHECK([whether $FPP suppresses C-style comments], - ac_cv_prog_fpp_CSTYLE, - [ac_cv_prog_fpp_CSTYLE=$ac_prog_fc_cpp_CSTYLE]) - -elif test $ac_fpp_need_cstyle = yes; then -# It only makes sense to test this for indirect compilation, -# i.e., if .f files are generated - _ACX_SL_PROG_FPP_CSTYLE -fi - -if test $ac_fpp_need_cxxstyle = yes; then - AC_CACHE_CHECK([whether $FPP preserves C++-style comments], - ac_cv_prog_fpp_cxxstyle, - [ac_cv_prog_fpp_cxxstyle=$ac_prog_fc_cpp_cxxstyle]) -fi - -AC_CACHE_CHECK([whether $FPP fulfils requested features], - ac_cv_prog_fpp_ok, - [ac_cv_prog_fpp_ok=AS_VAR_GET([acx_sl_fpp_ok])]) - - ac_cv_fpp_build_rule=indirect - -fi # test acx_sl_fpp_ok != yes -]) diff --git a/patch/libtool.m4.arg_spaces.patch b/patch/libtool.m4.arg_spaces.patch deleted file mode 100644 index fa8e0d811ded3a6bd4522e73ae6252f03e7c5ddd..0000000000000000000000000000000000000000 --- a/patch/libtool.m4.arg_spaces.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/m4/libtool.m4 -+++ b/m4/libtool.m4 -@@ -7538,10 +7538,11 @@ if AC_TRY_EVAL(ac_compile); then - case $prev$p in - - -L* | -R* | -l*) -- # Some compilers place space between "-{L,R}" and the path. -+ # Some compilers place space between "-{L,R,l}" and the path (value). - # Remove the space. -- if test x-L = "$p" || -- test x-R = "$p"; then -+ if test x-L = x"$p" || -+ test x-R = x"$p" || -+ test x-l = x"$p"; then - prev=$p - continue - fi diff --git a/patch/libtool.m4.nag_wrapper.patch b/patch/libtool.m4.nag_wrapper.patch deleted file mode 100644 index fcbb0753984fcab944728ca5e81bf3e85afdee7c..0000000000000000000000000000000000000000 --- a/patch/libtool.m4.nag_wrapper.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/config/ltmain.sh -+++ b/config/ltmain.sh -@@ -8881,7 +8881,8 @@ func_mode_link () - xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - # On Darwin other compilers -- case $CC in -+ func_cc_basename $CC -+ case $func_cc_basename_result in - nagfor*) - verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" - ;; ---- a/m4/libtool.m4 -+++ b/m4/libtool.m4 -@@ -118,6 +118,12 @@ func_cc_basename () - esac - done - func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -+ -+ # Set result to 'nagfor-wrapper' when NAG compiler is called via a wrapper (e.g. mpif90). -+ case $func_cc_basename_result in -+ nagfor*) ;; -+ *) $cc_temp -V 2>&1 | $GREP '^NAG Fortran Compiler Release' >/dev/null 2>&1 && func_cc_basename_result='nagfor-wrapper' ;; -+ esac - } - ])# _LT_PREPARE_CC_BASENAME - diff --git a/scripts/git_add_dist b/scripts/git_add_dist new file mode 100755 index 0000000000000000000000000000000000000000..ad689cc5e6718cb61fe2acd9811f9824cf09a754 --- /dev/null +++ b/scripts/git_add_dist @@ -0,0 +1,34 @@ +#!/bin/bash + +set -eu +set -o pipefail + +script_dir=$(cd "$(dirname "$0")"; pwd) +top_srcdir=$(cd "${script_dir}/.."; pwd) + +cd "${top_srcdir}" + +git update-index -q --refresh || { + echo "ERROR: failed to update git index in '${top_srcdir}'" >&2 + exit 1 +} + +git diff-files --quiet || { + echo "ERROR: '${top_srcdir}' has unstaged changes" >&2 + exit 1 +} + +git diff-index --cached --quiet HEAD -- || { + echo "ERROR: '${top_srcdir}' has uncommited changes" >&2 + exit 1 +} + +./autogen.sh +./configure --enable-maintainer-mode + +distdir='cdi-dist' +make distdir distdir="${distdir}" +for f in $(find "${distdir}" -type f -o -type l); do + git add -f "${f#"${distdir}/"}"; +done +rm -rf "${distdir}" diff --git a/scripts/reconfigure b/scripts/reconfigure new file mode 100755 index 0000000000000000000000000000000000000000..9a5eb6577744753c9cc61548bb3af5d6b59461b2 --- /dev/null +++ b/scripts/reconfigure @@ -0,0 +1,55 @@ +#! /bin/bash +# +# This script contains all the necessary steps to recreate the +# autotools files to build CDI. +# +libtoolize --force --copy +libtoolversion=$(libtoolize --version \ + | sed -e 's/^libtoolize \(([^)]*) \)\{0,1\}\([0-9.]*\)/\2/;q') +declare -a patches +case "$libtoolversion" in + 2.4.6) + patches=(contrib/00nagfor-libtool-patch/nagfor-libtool-2.4.6.patch \ + contrib/01aix-deplib-rpath-patch/aix-deplib-libtool.patch \ + contrib/03ltmain-ld-groups-patch/ltmain-ld-groups-libtool-2.4.6.patch \ + contrib/04ltmain-xlinker-patch/ltmain-xlinker-patch.patch \ + contrib/05macos-nagfor-patch/macos-nagfor.patch \ + contrib/06ltmain_nag_pthread-patch/ltmain_nag_pthread.patch \ + contrib/07ltmain-early-xcompile-patch/ltmain-early-xcompile-libtool-2.4.6.patch \ + contrib/08ltmain-parallel-printf-patch/ltmain-parallel-printf.patch) + + # We skip contrib/09debian-no-overlink-patch/debian-no-overlink.patch: + # 1) it has no real effect without + # contrib/09debian-no-overlink-patch/debian-no-overlink.libtool.m4.patch, + # which should be implemented as a monkey patch for libtool.m4; + # 2) it is already applied to the Debian-provided libtool and the current + # way we apply our patches does not handle such cases. + ;; + 2.4.2) + patches=(contrib/00nagfor-libtool-patch/nagfor-libtool.patch \ + contrib/01aix-deplib-rpath-patch/aix-deplib-libtool.patch \ + contrib/02nagfor53-shared-patch/nagfor53-shared.patch \ + contrib/03ltmain-ld-groups-patch/ltmain-ld-groups-libtool-2.4.2.patch \ + contrib/04ltmain-xlinker-patch/ltmain-xlinker-patch.patch \ + contrib/05macos-nagfor-patch/macos-nagfor.patch \ + contrib/06ltmain_nag_pthread-patch/ltmain_nag_pthread.patch) + ;; +esac +for patch in "${patches[@]}"; do + echo "applying $patch" >&2 + patch -p1 <$patch +done +autoreconf -i +find . -name Makefile.in -print0 | xargs -0 sed -i -e 's/[ ][ ]*$//' +\rm -f config/ltmain.sh.orig m4/libtool.m4.orig +wget -o /dev/null -O config/config.guess \ + 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' +wget -o /dev/null -O config/config.sub \ + 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' + +# +# to test if this succeeded, one can run +# diff -x autom4te.cache -x .git -ur orig/libcdi new/libcdi 2>&1 |less +# if a known good checkout is at orig/libcdi and a newly reconfigured +# tree is at new/libcdi +# diff --git a/src/Makefile.am b/src/Makefile.am index 77e1c06cbbe4c46157ffebb9d482887d8b935d1a..9eecea15a43c01c111178a3f5c319472e9bfeda7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,374 +1,359 @@ -## Process this file with automake to produce Makefile.in -# -EXTRA_DIST = cdilib.c $(top_srcdir)/interfaces/f2003/bindGen.rb - -noinst_LTLIBRARIES = libcdiresunpack.la +pkgconfigdir = $(libdir)/pkgconfig +cmakedir = $(libdir)/cmake include_HEADERS = +nodist_include_HEADERS = lib_LTLIBRARIES = +check_LTLIBRARIES = +noinst_LTLIBRARIES = +EXTRA_PROGRAMS = make_fint +EXTRA_DIST = \ + cdilib.c \ + make_cdilib +nodist_pkgconfig_DATA = +nodist_cmake_DATA = + +if FC_MOD_UPPERCASE +mo_cdi_mod = MO_CDI.$(FCMODEXT) +else !FC_MOD_UPPERCASE +mo_cdi_mod = mo_cdi.$(FCMODEXT) +endif !FC_MOD_UPPERCASE if ENABLE_CDI_LIB - lib_LTLIBRARIES += libcdi.la - include_HEADERS += cdi.h cdi_datetime.h julian_date.h calendar.h -# add cdi.inc only if cfortran interface is required -if USE_FC - include_HEADERS += cdi.inc -endif -if CREATE_ISOC - lib_LTLIBRARIES += libcdi_f2003.la -endif -else - noinst_LTLIBRARIES += libcdi.la -if CREATE_ISOC - noinst_LTLIBRARIES += libcdi_f2003.la -endif +include_HEADERS += \ + calendar.h \ + cdi.h \ + cdi_datetime.h \ + julian_date.h +lib_LTLIBRARIES += libcdi.la +nodist_pkgconfig_DATA += pkgconfig/cdi.pc +nodist_cmake_DATA += \ + cmake/cdi/cdi-config-version.cmake \ + cmake/cdi/cdi-config.cmake +if ENABLE_CF_INTERFACE +include_HEADERS += cdi.inc +endif ENABLE_CF_INTERFACE +if ENABLE_ISOC_INTERFACE +nodist_include_HEADERS += $(mo_cdi_mod) +lib_LTLIBRARIES += libcdi_f2003.la +nodist_pkgconfig_DATA += pkgconfig/cdi_f2003.pc +endif ENABLE_ISOC_INTERFACE +if ENABLE_MPI +include_HEADERS += cdipio.h +lib_LTLIBRARIES += libcdipio.la +nodist_pkgconfig_DATA += pkgconfig/cdipio.pc +if ENABLE_CF_INTERFACE +include_HEADERS += cdipio.inc +endif ENABLE_CF_INTERFACE +endif ENABLE_MPI +else !ENABLE_CDI_LIB +noinst_LTLIBRARIES += libcdi.la +if ENABLE_ISOC_INTERFACE +noinst_LTLIBRARIES += libcdi_f2003.la +endif ENABLE_ISOC_INTERFACE +if ENABLE_MPI +noinst_LTLIBRARIES += libcdipio.la +endif ENABLE_MPI +endif !ENABLE_CDI_LIB + +if with_on_demand_check_programs +check_LTLIBRARIES += libcdiresunpack.la +else !with_on_demand_check_programs +noinst_LTLIBRARIES += libcdiresunpack.la +endif !with_on_demand_check_programs + +AM_CPPFLAGS = $(PPM_CORE_C_INCLUDE) $(YAXT_C_INCLUDE) $(MPI_C_INCLUDE) +if ENABLE_MPI +# TODO: this needs a refactoring but for now we set this macro here and not in +# config.h because the macro is used in several files that do not include the +# header file directly. +AM_CPPFLAGS += -DUSE_MPI endif -AM_CFLAGS = $(PPM_CORE_CFLAGS) $(YAXT_CFLAGS) $(MPI_C_INCLUDE) - -libcdi_la_SOURCES = \ - async_worker.c \ - async_worker.h \ - basetime.c \ - basetime.h \ - binary.c \ - binary.h \ - calendar.c \ - calendar.h \ - cdf.c \ - cdf.h \ - cdf_config.h \ - cdf_int.c \ - cdf_int.h \ - cdf_util.c \ - cdf_util.h \ - cdi.h \ - cdi_datetime.c \ - cdi_datetime.h \ - cdi_error.c \ - cdi_limits.h \ - cdi_util.c \ - cgribex.h \ - cgribexlib.c \ - cksum.c \ - cksum.h \ - cdi_cksum.c \ - cdi_cksum.h \ - cdi_uuid.h \ - datetime.h \ - dmemory.c \ - dmemory.h \ - dtypes.h \ - error.c \ - error.h \ - exse.h \ - extra.h \ - extralib.c \ - file.c \ - file.h \ - get_num_missvals.c \ - get_num_missvals.h \ - gaussian_latitudes.c \ - gribapi.c \ - gribapi.h \ - gribapi_utilities.h \ - grid.c \ - grid.h \ - ieg.h \ - ieglib.c \ - input_file.c \ - input_file.h \ - institution.c \ - institution.h \ - julian_date.c \ - julian_date.h \ - model.c \ - model.h \ - namespace.c \ - namespace.h \ - serialize.h \ - serialize.c \ - referenceCounting.c \ - referenceCounting.h \ - resource_handle.c\ - resource_handle.h\ - service.h \ - servicelib.c \ - stream_cdf_i.c \ - stream_cdf_o.c \ - stream_cdf_time.c \ - stream_cdf.h \ - stream_cgribex.c \ - stream_cgribex.h \ - stream_ext.c \ - stream_ext.h \ - stream_grb.c \ - stream_grb.h \ - stream_gribapi.h \ - stream_ieg.c \ - stream_ieg.h \ - cdi_int.c \ - cdi_int.h \ - cdi_across.c \ - cdi_across.h \ - cdi_fdb.c \ - cdi_fdb.h \ - stream_scan.c \ - stream_scan.h \ - stream_record.c \ - stream_srv.c \ - stream_srv.h \ - stream_var.c \ - grb_write.c \ - grb_read.c \ - cdf_write.c \ - cdf_read.c \ - cdf_lazy_grid.c \ - cdf_lazy_grid.h \ - subtype.c \ - subtype.h \ - swap.h \ - table.c \ - table.h \ - tablepar.h \ - taxis.c \ - taxis.h \ - tsteps.c \ - util.c \ - varscan.c \ - varscan.h \ - version.c \ - vlist.c \ - vlist.h \ - cdi_key.c \ - cdi_key.h \ - cdi_att.c \ - cdi_att.h \ - vlist_var.c \ - vlist_var.h \ - vlist_var_pack.c \ - vlist_var_key.c \ - zaxis.c \ - zaxis.h \ - stream.c \ - stream_write.c \ - stream_read.c \ - swap.c \ - iterator.c \ - iterator.h \ - iterator_fallback.c \ - iterator_fallback.h \ - iterator_grib.c \ - iterator_grib.h - -# cfortran.h is an optional part of libcdi -libcdi_la_USE_FC_extra_sources = \ - cfortran.h \ - cdiFortran.c - -# these only contain code if grib_api is available -libcdi_la_HAVE_LIBGRIB_API_extra_sources = \ - gribapi_utilities.c stream_gribapi.c - -if USE_FC -libcdi_la_SOURCES += \ - $(libcdi_la_USE_FC_extra_sources) -endif +libcdiresunpack_la_SOURCES = \ + resource_unpack.c \ + resource_unpack.h +libcdiresunpack_la_LIBADD = libcdi.la + +make_fint_SOURCES = make_fint.c +make_fint_CFLAGS = -static +make_fint_LDADD = $(LIBOBJS) + +libcdi_la_SOURCES = \ + async_worker.c \ + async_worker.h \ + basetime.c \ + basetime.h \ + binary.c \ + binary.h \ + calendar.c \ + calendar.h \ + cdf.c \ + cdf.h \ + cdf_config.h \ + cdf_int.c \ + cdf_int.h \ + cdf_lazy_grid.c \ + cdf_lazy_grid.h \ + cdf_read.c \ + cdf_records.c \ + cdf_util.c \ + cdf_util.h \ + cdf_write.c \ + cdi.h \ + cdi_across.c \ + cdi_across.h \ + cdi_att.c \ + cdi_att.h \ + cdi_cksum.c \ + cdi_cksum.h \ + cdi_datetime.c \ + cdi_datetime.h \ + cdi_error.c \ + cdi_fdb.c \ + cdi_fdb.h \ + cdi_int.c \ + cdi_int.h \ + cdi_key.c \ + cdi_key.h \ + cdi_limits.h \ + cdi_query.c \ + cdi_util.c \ + cdi_uuid.h \ + cgribex.h \ + cgribexlib.c \ + cksum.c \ + cksum.h \ + dmemory.c \ + dmemory.h \ + dtypes.h \ + error.c \ + error.h \ + exse.h \ + extra.h \ + extralib.c \ + file.c \ + file.h \ + gaussian_latitudes.c \ + get_num_missvals.c \ + get_num_missvals.h \ + grb_read.c \ + grb_write.c \ + gribapi.c \ + gribapi.h \ + gribapi_utilities.h \ + grid.c \ + grid.h \ + ieg.h \ + ieglib.c \ + input_file.c \ + input_file.h \ + institution.c \ + institution.h \ + iterator.c \ + iterator.h \ + iterator_fallback.c \ + iterator_fallback.h \ + iterator_grib.c \ + iterator_grib.h \ + julian_date.c \ + julian_date.h \ + model.c \ + model.h \ + namespace.c \ + namespace.h \ + normalize_month.h \ + referenceCounting.c \ + referenceCounting.h \ + resource_handle.c \ + resource_handle.h \ + serialize.c \ + serialize.h \ + service.h \ + servicelib.c \ + stream.c \ + stream_cdf.h \ + stream_cdf_i.c \ + stream_cdf_o.c \ + stream_cdf_postdef.h \ + stream_cdf_time.c \ + stream_cgribex.c \ + stream_cgribex.h \ + stream_ext.c \ + stream_ext.h \ + stream_grb.c \ + stream_grb.h \ + stream_gribapi.h \ + stream_ieg.c \ + stream_ieg.h \ + stream_read.c \ + stream_record.c \ + stream_scan.c \ + stream_scan.h \ + stream_srv.c \ + stream_srv.h \ + stream_var.c \ + stream_write.c \ + subtype.c \ + subtype.h \ + swap.c \ + swap.h \ + table.c \ + table.h \ + tablepar.h \ + taxis.c \ + taxis.h \ + tsteps.c \ + util.c \ + varscan.c \ + varscan.h \ + version.c \ + vlist.c \ + vlist.h \ + vlist_var.c \ + vlist_var.h \ + vlist_var_key.c \ + vlist_var_pack.c \ + zaxis.c \ + zaxis.h + +if ENABLE_CF_INTERFACE +libcdi_la_SOURCES += \ + cdiFortran.c \ + cfortran.h +endif ENABLE_CF_INTERFACE if HAVE_LIBGRIB_API -libcdi_la_SOURCES += \ - $(libcdi_la_HAVE_LIBGRIB_API_extra_sources) -endif - -EXTRA_DIST += \ - $(libcdi_la_USE_FC_extra_sources) \ - $(libcdi_la_HAVE_LIBGRIB_API_extra_sources) \ - $(libcdipio_la_HAVE_PARALLEL_NC4_extra_sources) - - +libcdi_la_SOURCES += \ + gribapi_utilities.c \ + stream_gribapi.c +endif HAVE_LIBGRIB_API libcdi_f2003_la_SOURCES = mo_cdi.f90 -libcdi_f2003_ladir = $(includedir) -nodist_libcdi_f2003_la_HEADERS = -if CREATE_ISOC -if FORTRAN_MOD_UC -nodist_libcdi_f2003_la_HEADERS += MO_CDI.$(FCMODEXT) -else -nodist_libcdi_f2003_la_HEADERS += mo_cdi.$(FCMODEXT) -endif -endif libcdi_f2003_la_LIBADD = libcdi.la -libcdiresunpack_la_SOURCES = \ - resource_unpack.c - -if USE_MPI -if ENABLE_CDI_LIB -lib_LTLIBRARIES += libcdipio.la -include_HEADERS += cdipio.h cdipio.inc -else -noinst_LTLIBRARIES += libcdipio.la -endif -endif - -libcdipio_la_SOURCES = \ - cdipio.h \ - cdipioFortran.c \ - cfortran.h \ - pio.c \ - pio.h \ - pio_comm.c \ - pio_comm.h \ - pio_conf.c \ - pio_conf.h \ - pio_dbuffer.c \ - pio_id_set.h \ - pio_impl.h \ - pio_interface.c \ - pio_interface.h \ - pio_mpinonb.c \ - pio_mpi_fw_ordered.c \ - pio_mpi_fw_at_all.c \ - pio_mpi_fw_at_reblock.c \ - pio_record_send.c \ - pio_posixasynch.c \ - pio_posixfpguardsendrecv.c \ - pio_posixnonb.c \ - pio_list_set.c \ - resource_unpack.h \ - resource_unpack.c \ - pio_client.c \ - pio_client.h \ - pio_roles.c \ - pio_rpc.c \ - pio_rpc.h \ - pio_server.c \ - pio_server.h \ - pio_serialize.h \ - pio_serialize.c \ - pio_util.c \ - pio_util.h \ - pio_cdf_int.h - -libcdipio_la_HAVE_PARALLEL_NC4_extra_sources = \ - pio_cdf_int.c +libcdipio_la_SOURCES = \ + cdipio.h \ + pio.c \ + pio.h \ + pio_cdf_int.h \ + pio_client.c \ + pio_client.h \ + pio_comm.c \ + pio_comm.h \ + pio_conf.c \ + pio_conf.h \ + pio_dbuffer.c \ + pio_dbuffer.h \ + pio_dist_grid.c \ + pio_dist_grid.h \ + pio_id_set.h \ + pio_idxlist_cache.c \ + pio_idxlist_cache.h \ + pio_impl.h \ + pio_interface.c \ + pio_interface.h \ + pio_mpi_fw_at_all.c \ + pio_mpi_fw_at_reblock.c \ + pio_mpi_fw_ordered.c \ + pio_mpinonb.c \ + pio_posixasynch.c \ + pio_posixfpguardsendrecv.c \ + pio_posixnonb.c \ + pio_record_send.c \ + pio_roles.c \ + pio_rpc.c \ + pio_rpc.h \ + pio_serialize.c \ + pio_serialize.h \ + pio_server.c \ + pio_server.h \ + pio_util.c \ + pio_util.h \ + pio_xmap_cache.c \ + pio_xmap_cache.h \ + resource_unpack.c \ + resource_unpack.h + +if ENABLE_CF_INTERFACE +libcdipio_la_SOURCES += \ + cdipioFortran.c \ + cfortran.h +endif ENABLE_CF_INTERFACE -if USE_MPI if HAVE_PARALLEL_NC4 -libcdipio_la_SOURCES += $(libcdipio_la_HAVE_PARALLEL_NC4_extra_sources) +libcdipio_la_SOURCES += pio_cdf_int.c +endif HAVE_PARALLEL_NC4 + +libcdipio_la_LIBADD = libcdi.la $(LIBRT) $(PPM_CORE_C_LIB) $(YAXT_C_LIB) $(MPI_C_LIB) + +if MAINTAINER_MODE +cdi.inc: cdi.h make_fint.c + $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) make_fint + $(AM_V_GEN)$(top_builddir)/libtool --mode=execute ./make_fint -o $(@D) $< +cdiFortran.c: cdi.inc + $(AM_V_at)test -f $@ || rm -f $< + $(AM_V_at)test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $< + +cdipio.inc: cdipio.h make_fint.c cdi.inc + $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) make_fint + $(AM_V_GEN)$(top_builddir)/libtool --mode=execute ./make_fint -o $(@D) $< +cdipioFortran.c: cdipio.inc + $(AM_V_at)test -f $@ || rm -f $< + $(AM_V_at)test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $< + +mo_cdi.f90: cdi.h $(top_srcdir)/interfaces/f2003/bindGen.rb + $(AM_V_GEN)$(RUBY) $(top_srcdir)/interfaces/f2003/bindGen.rb $< $@ + +cdilib.c: $(libcdi_la_SOURCES) $(srcdir)/make_cdilib + $(AM_V_GEN)CPP='$(CPP)' $(srcdir)/make_cdilib $(srcdir) +else !MAINTAINER_MODE +cdiFortran.c cdi.inc cdipioFortran.c cdipio.inc mo_cdi.f90 cdilib.c: + @:;{ \ + echo "ERROR: cannot generate '$@' when the maintainer mode is disabled:"; \ + echo " re-configure with the '--enable-maintainer-mode' option"; \ + } >&2; exit 1 +endif !MAINTAINER_MODE + +$(mo_cdi_mod): mo_cdi.lo + $(AM_V_at)test -f $@ || rm -f $< + $(AM_V_at)test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $< + +cmake/cdi/cdi-config.cmake: $(top_builddir)/config.status cmake/cdi/cdi-config.cmake.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +cmake/cdi/cdi-config-version.cmake: $(top_builddir)/config.status cmake/cdi/cdi-config-version.cmake.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +pkgconfig/cdi.pc: $(top_builddir)/config.status $(srcdir)/pkgconfig/cdi.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +pkgconfig/cdipio.pc: $(top_builddir)/config.status $(srcdir)/pkgconfig/cdipio.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +pkgconfig/cdi_f2003.pc: $(top_builddir)/config.status $(srcdir)/pkgconfig/cdi_f2003.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +MOSTLYCLEANFILES = make_fint +if ENABLE_ISOC_INTERFACE +MOSTLYCLEANFILES += $(mo_cdi_mod) endif -endif - -libcdipio_la_LIBADD = libcdi.la $(LIBRT) $(PPM_CORE_LIBS) $(YAXT_LIBS) $(MPI_C_LIB) - -# -#cdilib.c: -# $(top_srcdir)/src/make_cdilib $(top_srcdir)/src -# -#cdilib.o: cdilib.c -# $(COMPILE) -c $< - -LOCALTARGETS = -if ENABLE_CDI_LIB -LOCALTARGETS += cmake/cdi/cdi-config.cmake -LOCALTARGETS += cmake/cdi/cdi-config-version.cmake -LOCALTARGETS += pkgconfig/cdi.pc -if USE_MPI -LOCALTARGETS += pkgconfig/cdipio.pc -endif -if CREATE_ISOC -LOCALTARGETS += pkgconfig/cdi_f2003.pc -endif -endif - -# -# cat $(top_srcdir)/src/cdi.h |sed -e 's/SizeType/size_t/g' -e s/DateType/int64_t/g > cditmp.h -mo_cdi.f90: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/src/cdi.h $(top_srcdir)/interfaces/f2003/bindGen.rb - cat $(top_srcdir)/src/cdi.h |sed -e 's/SizeType/int/g' -e s/DateType/int/g > cditmp.h - $(AM_V_GEN)$(RUBY) $(top_srcdir)/interfaces/f2003/bindGen.rb cditmp.h $@ - rm cditmp.h - -if FORTRAN_MOD_UC -MO_CDI.$(FCMODEXT): mo_cdi.lo -else -mo_cdi.$(FCMODEXT): mo_cdi.lo -endif - @if test ! -f $@; then rm -f $<; $(MAKE) $<; fi -# -cmake/cdi/cdi-config.cmake: cmake/cdi/cdi-config.cmake.in ../config.status - (cd .. ; ./config.status src/cmake/cdi/cdi-config.cmake) - -cmake/cdi/cdi-config-version.cmake: cmake/cdi/cdi-config-version.cmake.in ../config.status - (cd .. ; ./config.status src/cmake/cdi/cdi-config-version.cmake) - -pkgconfig/cdi.pc: pkgconfig/cdi.pc.in ../config.status - (cd .. ; ./config.status src/pkgconfig/cdi.pc) - -pkgconfig/cdipio.pc: pkgconfig/cdipio.pc.in ../config.status - (cd .. ; ./config.status src/pkgconfig/cdipio.pc) - -pkgconfig/cdi_f2003.pc: pkgconfig/cdi_f2003.pc.in ../config.status - (cd .. ; ./config.status src/pkgconfig/cdi_f2003.pc) - -cdilib.c: - (cd $(top_srcdir)/src ; ./make_cdilib ) -# -all-local: $(LOCALTARGETS) -# -CLEANFILES := `ls *~` -#CLEANFILES += cdilib.c -if CREATE_ISOC -if FORTRAN_MOD_UC -CLEANFILES += MO_CDI.$(FCMODEXT) -else -CLEANFILES += mo_cdi.$(FCMODEXT) -endif -endif - -if ENABLE_CDI_LIB -CMAKECONFIG_FILES = cmake/cdi/cdi-config.cmake -CLEANFILES += cmake/cdi/cdi-config.cmake -CMAKECONFIG_FILES += cmake/cdi/cdi-config-version.cmake -CLEANFILES += cmake/cdi/cdi-config-version.cmake -PKGCONFIG_FILES = pkgconfig/cdi.pc -CLEANFILES += pkgconfig/cdi.pc -if USE_MPI -PKGCONFIG_FILES += pkgconfig/cdipio.pc -CLEANFILES += pkgconfig/cdipio.pc -endif -if CREATE_ISOC -PKGCONFIG_FILES += pkgconfig/cdi_f2003.pc -CLEANFILES += pkgconfig/cdi_f2003.pc -endif - -install-exec-local: $(PKGCONFIG_FILES) $(CMAKECONFIG_FILES) - $(mkinstalldirs) "$(DESTDIR)$(libdir)/pkgconfig" - @for pkgconfigfile in $(PKGCONFIG_FILES) ; do \ - echo $(install_sh_DATA) $$pkgconfigfile "$(DESTDIR)$(libdir)/$$pkgconfigfile" ; \ - $(install_sh_DATA) $$pkgconfigfile "$(DESTDIR)$(libdir)/$$pkgconfigfile" ; \ - done - $(mkinstalldirs) "$(DESTDIR)$(libdir)/cmake" - @for cmakeconfigfile in $(CMAKECONFIG_FILES) ; do \ - echo $(install_sh_DATA) $$cmakeconfigfile "$(DESTDIR)$(libdir)/$$cmakeconfigfile" ; \ - $(install_sh_DATA) $$cmakeconfigfile "$(DESTDIR)$(libdir)/$$cmakeconfigfile" ; \ - done - -uninstall-local: - @for pkgconfigfile in $(PKGCONFIG_FILES) ; do \ - echo rm -f "$(DESTDIR)$(libdir)/$$pkgconfigfile" ; \ - rm -f "$(DESTDIR)$(libdir)/$$pkgconfigfile" ; \ - done - -@rmdir "$(DESTDIR)$(libdir)/pkgconfig" - @for cmakeconfigfile in $(CMAKECONFIG_FILES) ; do \ - echo rm -f "$(DESTDIR)$(libdir)/$$cmakeconfigfile" ; \ - rm -f "$(DESTDIR)$(libdir)/$$cmakeconfigfile" ; \ - done - -@rmdir "$(DESTDIR)$(libdir)/cmake" - -endif - -install-exec-hook: - -@rmdir "$(DESTDIR)$(libdir)" -install-data-hook: - -@rmdir "$(DESTDIR)$(includedir)" +MAINTAINERCLEANFILES = \ + cdi.inc \ + cdiFortran.c \ + cdilib.c \ + cdipio.inc \ + cdipioFortran.c \ + mo_cdi.f90 + +# Compile programs using Libtool: +COMPILE = $(LTCOMPILE) +FCCOMPILE = $(LTFCCOMPILE) +PPFCCOMPILE = $(LTPPFCCOMPILE) +CXXCOMPILE = $(LTCXXCOMPILE) + +# Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler +# and might not be compatible with the Fortran compiler: +LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) diff --git a/src/basetime.c b/src/basetime.c index c4e32a93472afdf6a3ee518a5ae4fed62e39f902..5113a1c9786943e172a1598845e1eb182943d966 100644 --- a/src/basetime.c +++ b/src/basetime.c @@ -14,9 +14,8 @@ basetimeInit(basetime_t *basetime) basetime->ncdimid = CDI_UNDEFID; basetime->ncvarboundsid = CDI_UNDEFID; basetime->leadtimeid = CDI_UNDEFID; - basetime->lunits = false; - basetime->lwrf = false; - basetime->timevar_cache = NULL; + basetime->hasUnits = false; + basetime->isWRF = false; } } diff --git a/src/basetime.h b/src/basetime.h index 87181487ca8c155c92da0b15ea74108c9eb84d4d..5751aec88ea938c68b042ac92f0ce54c1aeb34de 100644 --- a/src/basetime.h +++ b/src/basetime.h @@ -3,26 +3,14 @@ #include <stdbool.h> -//#define USE_TIMECACHE 1 -#define MAX_TIMECACHE_SIZE 1024 * 1024 - -typedef struct -{ - size_t size; - size_t startid; - size_t maxvals; - double cache[MAX_TIMECACHE_SIZE]; -} timecache_t; - typedef struct { int ncvarid; int ncdimid; int ncvarboundsid; int leadtimeid; - bool lunits; - bool lwrf; // true for time axis in WRF format - timecache_t *timevar_cache; + bool hasUnits; + bool isWRF; // true for time axis in WRF format } basetime_t; void basetimeInit(basetime_t *basetime); diff --git a/src/calendar.c b/src/calendar.c index eb3bd7ccf87eb68f710699f49bd326348c57c7e0..e35a1a948dbead014cf462fbbe0884373d554ea6 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -6,20 +6,6 @@ static const int month_360[12] = { 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 3 static const int month_365[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; static const int month_366[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; -int -calendar_dpy(int calendar) -{ - int daysPerYear = 0; - - // clang-format off - if (calendar == CALENDAR_360DAYS) daysPerYear = 360; - else if (calendar == CALENDAR_365DAYS) daysPerYear = 365; - else if (calendar == CALENDAR_366DAYS) daysPerYear = 366; - // clang-format on - - return daysPerYear; -} - static const int * get_dayspermonth_array(int daysPerYear) { diff --git a/src/calendar.h b/src/calendar.h index cf38f24d7355af213743d526d27ba68960d1f58a..6e2a6757abacb5a1185a49c8ddf7d69b6d0de80a 100644 --- a/src/calendar.h +++ b/src/calendar.h @@ -6,6 +6,8 @@ // clang-format off +#include "cdi.h" + #ifdef __cplusplus extern "C" { #endif @@ -13,7 +15,18 @@ extern "C" { void decode_calday(int daysPerYear, int days, int *year, int *month, int *day); int64_t encode_calday(int daysPerYear, int year, int month, int day); -int calendar_dpy(int calendar); +static inline int +calendar_dpy(int calendar) +{ + int daysPerYear = 0; + + if (calendar == CALENDAR_360DAYS) daysPerYear = 360; + else if (calendar == CALENDAR_365DAYS) daysPerYear = 365; + else if (calendar == CALENDAR_366DAYS) daysPerYear = 366; + + return daysPerYear; +} + int days_per_year(int calendar, int year); int days_per_month(int calendar, int year, int month); @@ -23,4 +36,4 @@ int days_per_month(int calendar, int year, int month); // clang-format on -#endif /* CALENDAR_H */ +#endif diff --git a/src/cdf.c b/src/cdf.c index 8b0061cd6c60db4e7c65935fcaccc3b61b311fdc..6258e26cc65b329a2ab9f7491f061148f9d77e83 100644 --- a/src/cdf.c +++ b/src/cdf.c @@ -9,14 +9,11 @@ #include "cdi_int.h" #include "cdf_int.h" +#ifdef HAVE_LIBNETCDF const char * cdfLibraryVersion(void) { -#ifdef HAVE_LIBNETCDF return nc_inq_libvers(); -#else - return "library undefined"; -#endif } #ifdef HAVE_H5GET_LIBVERSION @@ -42,9 +39,9 @@ hdfLibraryVersion(void) unsigned majnum, minnum, relnum; H5get_libversion(&majnum, &minnum, &relnum); #ifdef HAVE_NC4HDF5_THREADSAFE - sprintf(hdf_libvers, "%u.%u.%u threadsafe", majnum, minnum, relnum); + snprintf(hdf_libvers, sizeof(hdf_libvers), "%u.%u.%u threadsafe", majnum, minnum, relnum); #else - sprintf(hdf_libvers, "%u.%u.%u", majnum, minnum, relnum); + snprintf(hdf_libvers, sizeof(hdf_libvers), "%u.%u.%u", majnum, minnum, relnum); #endif } @@ -64,7 +61,6 @@ cdfDebug(int debug) if (CDF_Debug) Message("debug level %d", debug); } -#ifdef HAVE_LIBNETCDF static void cdfComment(int ncid) { @@ -85,12 +81,11 @@ cdfComment(int ncid) cdf_put_att_text(ncid, NC_GLOBAL, "CDI", strlen(comment), comment); } -#endif static bool has_uri_scheme(const char *uri) { - char *pos = strstr(uri, "://"); + const char *pos = strstr(uri, "://"); if (pos) { const int len = pos - uri; @@ -104,7 +99,6 @@ static int cdfOpenFile(const char *filename, const char *mode, int *filetype) { int ncid = -1; -#ifdef HAVE_LIBNETCDF const int fmode = tolower(*mode); int writemode = NC_CLOBBER; int readmode = NC_NOWRITE; @@ -122,7 +116,7 @@ cdfOpenFile(const char *filename, const char *mode, int *filetype) #ifdef HAVE_NETCDF4 else { - int format; + int format = -1; (void) nc_inq_format(ncid, &format); if (format == NC_FORMAT_NETCDF4_CLASSIC) *filetype = CDI_FILETYPE_NC4C; } @@ -141,11 +135,9 @@ cdfOpenFile(const char *filename, const char *mode, int *filetype) if (*filetype == CDI_FILETYPE_NC4) writemode |= NC_NETCDF4; if (*filetype == CDI_FILETYPE_NCZARR) writemode |= NC_NETCDF4; #endif - const bool hasUriScheme = has_uri_scheme(filename); - if (*filetype == CDI_FILETYPE_NCZARR) { - if (!hasUriScheme) + if (!has_uri_scheme(filename)) { fprintf(stderr, "URI scheme is missing in NCZarr path!\n"); return CDI_EINVAL; @@ -155,7 +147,7 @@ cdfOpenFile(const char *filename, const char *mode, int *filetype) } else { - if (hasUriScheme) fprintf(stderr, "URI scheme defined for non NCZarr Data Model!\n"); + if (has_uri_scheme(filename)) fprintf(stderr, "URI scheme defined for non NCZarr Data Model!\n"); cdf__create(filename, writemode, &ncid); } @@ -167,7 +159,6 @@ cdfOpenFile(const char *filename, const char *mode, int *filetype) default: ncid = CDI_EINVAL; } } -#endif return ncid; } @@ -180,13 +171,11 @@ cdfOpen(const char *filename, const char *mode, int filetype) if (CDF_Debug) Message("Open %s with mode %c", filename, *mode); -#ifdef HAVE_LIBNETCDF #ifndef NC_64BIT_OFFSET if (filetype == CDI_FILETYPE_NC2) open_file = false; #endif #ifndef NC_64BIT_DATA if (filetype == CDI_FILETYPE_NC5) open_file = false; -#endif #endif if (open_file) @@ -260,9 +249,7 @@ cdf4Open(const char *filename, const char *mode, int *filetype) static void cdfCloseFile(int fileID) { -#ifdef HAVE_LIBNETCDF cdf_close(fileID); -#endif } void @@ -270,6 +257,7 @@ cdfClose(int fileID) { cdfCloseFile(fileID); } +#endif /* * Local Variables: * c-file-style: "Java" diff --git a/src/cdf_int.c b/src/cdf_int.c index e3485f02438959ed5723b7acf779a6f4e4ae2c8a..ab04a510ba954d4fcb56447e8b8bbd6e04fee98a 100644 --- a/src/cdf_int.c +++ b/src/cdf_int.c @@ -44,9 +44,11 @@ cdf__create(const char *path, int cmode, int *ncidp) cdi_nc__create_funcp my_nc__create = (cdi_nc__create_funcp) namespaceSwitchGet(NSSWITCH_NC__CREATE).func; status = my_nc__create(path, cmode, initialsz, &chunksizehint, ncidp); - if (CDF_Debug || status != NC_NOERR) Message("ncid=%d mode=%d chunksizehint=%zu file=%s", *ncidp, cmode, chunksizehint, path); - - if (status != NC_NOERR) Error("%s: %s", path, nc_strerror(status)); + if (status != NC_NOERR) + { + if (CDF_Debug) Message("ncid=%d mode=%d chunksizehint=%zu file=%s", *ncidp, cmode, chunksizehint, path); + Error("%s: %s", path, nc_strerror(status)); + } int oldfill; status = nc_set_fill(*ncidp, NC_NOFILL, &oldfill); @@ -92,47 +94,63 @@ cdf_open(const char *path, int omode, int *ncidp) void cdf_close(int ncid) { - const int status = nc_close(ncid); + int status = nc_close(ncid); if (status != NC_NOERR) Error("%s", nc_strerror(status)); } void cdf_redef(int ncid) { - const int status = nc_redef(ncid); + int status = nc_redef(ncid); if (status != NC_NOERR) Error("%s", nc_strerror(status)); } +int +cdi_nc_enddef_serial(int ncid, int streamID) +{ + (void) streamID; + return nc_enddef(ncid); +} + +int +cdi_nc__enddef_serial(int ncid, int streamID, size_t hdr_pad, size_t v_align, size_t v_minfree, size_t r_align) +{ + (void) streamID; + return nc__enddef(ncid, hdr_pad, v_align, v_minfree, r_align); +} + void -cdf_enddef(int ncid) +cdf_enddef(int ncid, int streamID) { - const int status = nc_enddef(ncid); + cdi_nc_enddef_funcp my_nc_enddef = (cdi_nc_enddef_funcp) namespaceSwitchGet(NSSWITCH_NC_ENDDEF).func; + int status = my_nc_enddef(ncid, streamID); if (status != NC_NOERR) Error("%s", nc_strerror(status)); } void -cdf__enddef(const int ncid, const size_t hdr_pad) +cdf__enddef(int ncid, int streamID, const size_t hdr_pad) { const size_t v_align = 4UL; // [B] Alignment of beginning of data section for fixed variables const size_t v_minfree = 0UL; // [B] Pad at end of data section for fixed size variables const size_t r_align = 4UL; // [B] Alignment of beginning of data section for record variables // nc_enddef(ncid) is equivalent to nc__enddef(ncid, 0, 4, 0, 4) - const int status = nc__enddef(ncid, hdr_pad, v_align, v_minfree, r_align); + cdi_nc__enddef_funcp my_nc__enddef = (cdi_nc__enddef_funcp) namespaceSwitchGet(NSSWITCH_NC_ENDDEF).func; + int status = my_nc__enddef(ncid, streamID, hdr_pad, v_align, v_minfree, r_align); if (status != NC_NOERR) Error("%s", nc_strerror(status)); } void cdf_sync(int ncid) { - const int status = nc_sync(ncid); + int status = nc_sync(ncid); if (status != NC_NOERR) Error("%s", nc_strerror(status)); } void cdf_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp) { - const int status = nc_inq(ncid, ndimsp, nvarsp, ngattsp, unlimdimidp); + int status = nc_inq(ncid, ndimsp, nvarsp, ngattsp, unlimdimidp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d ndims=%d nvars=%d ngatts=%d unlimid=%d", ncid, *ndimsp, *nvarsp, *ngattsp, *unlimdimidp); @@ -143,7 +161,7 @@ cdf_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp) void cdf_def_dim(int ncid, const char *name, size_t len, int *dimidp) { - const int status = nc_def_dim(ncid, name, len, dimidp); + int status = nc_def_dim(ncid, name, len, dimidp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d name=%s len=%d", ncid, name, len); @@ -153,7 +171,7 @@ cdf_def_dim(int ncid, const char *name, size_t len, int *dimidp) void cdf_inq_dimid(int ncid, const char *name, int *dimidp) { - const int status = nc_inq_dimid(ncid, name, dimidp); + int status = nc_inq_dimid(ncid, name, dimidp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d name=%s dimid=%d", ncid, name, *dimidp); @@ -163,7 +181,7 @@ cdf_inq_dimid(int ncid, const char *name, int *dimidp) void cdf_inq_dim(int ncid, int dimid, char *name, size_t *lengthp) { - const int status = nc_inq_dim(ncid, dimid, name, lengthp); + int status = nc_inq_dim(ncid, dimid, name, lengthp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d dimid=%d length=%d name=%s", ncid, dimid, *lengthp, name); @@ -173,7 +191,7 @@ cdf_inq_dim(int ncid, int dimid, char *name, size_t *lengthp) void cdf_inq_dimname(int ncid, int dimid, char *name) { - const int status = nc_inq_dimname(ncid, dimid, name); + int status = nc_inq_dimname(ncid, dimid, name); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d dimid=%d name=%s", ncid, dimid, name); @@ -183,7 +201,7 @@ cdf_inq_dimname(int ncid, int dimid, char *name) void cdf_inq_dimlen(int ncid, int dimid, size_t *lengthp) { - const int status = nc_inq_dimlen(ncid, dimid, lengthp); + int status = nc_inq_dimlen(ncid, dimid, lengthp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d dimid=%d length=%d", ncid, dimid, *lengthp); @@ -200,17 +218,22 @@ cdf_def_var(int ncid, const char *name, nc_type xtype, int ndims, const int dimi void cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims, const int dimids[], int *varidp) { - const int status = nc_def_var(ncid, name, xtype, ndims, dimids, varidp); - + int status = nc_def_var(ncid, name, xtype, ndims, dimids, varidp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d name=%s xtype=%d ndims=%d varid=%d", ncid, name, xtype, ndims, *varidp); - + if (status == NC_NOERR) + { + int fileFormat; + status = nc_inq_format(ncid, &fileFormat); + if (status == NC_NOERR && (fileFormat == NC_FORMAT_NETCDF4 || fileFormat == NC_FORMAT_NETCDF4_CLASSIC)) + status = nc_def_var_fill(ncid, *varidp, 1, NULL); + } if (status != NC_NOERR) Error("%s", nc_strerror(status)); } void cdf_inq_varid(int ncid, const char *name, int *varidp) { - const int status = nc_inq_varid(ncid, name, varidp); + int status = nc_inq_varid(ncid, name, varidp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d name=%s varid=%d", ncid, name, *varidp); @@ -220,7 +243,7 @@ cdf_inq_varid(int ncid, const char *name, int *varidp) void cdf_inq_nvars(int ncid, int *nvarsp) { - const int status = nc_inq_nvars(ncid, nvarsp); + int status = nc_inq_nvars(ncid, nvarsp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d nvars=%d", ncid, *nvarsp); @@ -230,7 +253,7 @@ cdf_inq_nvars(int ncid, int *nvarsp) void cdf_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, int dimids[], int *nattsp) { - const int status = nc_inq_var(ncid, varid, name, xtypep, ndimsp, dimids, nattsp); + int status = nc_inq_var(ncid, varid, name, xtypep, ndimsp, dimids, nattsp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d ndims=%d xtype=%d natts=%d name=%s", ncid, varid, *ndimsp, *xtypep, *nattsp, name); @@ -241,7 +264,7 @@ cdf_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, int d void cdf_inq_varname(int ncid, int varid, char *name) { - const int status = nc_inq_varname(ncid, varid, name); + int status = nc_inq_varname(ncid, varid, name); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d name=%s", ncid, varid, name); @@ -251,7 +274,7 @@ cdf_inq_varname(int ncid, int varid, char *name) void cdf_inq_vartype(int ncid, int varid, nc_type *xtypep) { - const int status = nc_inq_vartype(ncid, varid, xtypep); + int status = nc_inq_vartype(ncid, varid, xtypep); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d xtype=%s", ncid, varid, *xtypep); @@ -261,7 +284,7 @@ cdf_inq_vartype(int ncid, int varid, nc_type *xtypep) void cdf_inq_varndims(int ncid, int varid, int *ndimsp) { - const int status = nc_inq_varndims(ncid, varid, ndimsp); + int status = nc_inq_varndims(ncid, varid, ndimsp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); @@ -271,7 +294,7 @@ cdf_inq_varndims(int ncid, int varid, int *ndimsp) void cdf_inq_vardimid(int ncid, int varid, int dimids[]) { - const int status = nc_inq_vardimid(ncid, varid, dimids); + int status = nc_inq_vardimid(ncid, varid, dimids); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); @@ -281,7 +304,7 @@ cdf_inq_vardimid(int ncid, int varid, int dimids[]) void cdf_inq_varnatts(int ncid, int varid, int *nattsp) { - const int status = nc_inq_varnatts(ncid, varid, nattsp); + int status = nc_inq_varnatts(ncid, varid, nattsp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d nattsp=%d", ncid, varid, *nattsp); @@ -291,7 +314,7 @@ cdf_inq_varnatts(int ncid, int varid, int *nattsp) void cdf_put_var_text(int ncid, int varid, const char *tp) { - const int status = nc_put_var_text(ncid, varid, tp); + int status = nc_put_var_text(ncid, varid, tp); if (CDF_Debug || status != NC_NOERR) Message("%d %d %s", ncid, varid, tp); @@ -301,7 +324,7 @@ cdf_put_var_text(int ncid, int varid, const char *tp) void cdf_put_var_short(int ncid, int varid, const short *sp) { - const int status = nc_put_var_short(ncid, varid, sp); + int status = nc_put_var_short(ncid, varid, sp); if (CDF_Debug || status != NC_NOERR) Message("%d %d %hd", ncid, varid, *sp); @@ -311,7 +334,7 @@ cdf_put_var_short(int ncid, int varid, const short *sp) void cdf_put_var_int(int ncid, int varid, const int *ip) { - const int status = nc_put_var_int(ncid, varid, ip); + int status = nc_put_var_int(ncid, varid, ip); if (CDF_Debug || status != NC_NOERR) Message("%d %d %d", ncid, varid, *ip); @@ -321,7 +344,7 @@ cdf_put_var_int(int ncid, int varid, const int *ip) void cdf_put_var_long(int ncid, int varid, const long *lp) { - const int status = nc_put_var_long(ncid, varid, lp); + int status = nc_put_var_long(ncid, varid, lp); if (CDF_Debug || status != NC_NOERR) Message("%d %d %ld", ncid, varid, *lp); @@ -331,7 +354,7 @@ cdf_put_var_long(int ncid, int varid, const long *lp) void cdf_put_var_float(int ncid, int varid, const float *fp) { - const int status = nc_put_var_float(ncid, varid, fp); + int status = nc_put_var_float(ncid, varid, fp); if (CDF_Debug || status != NC_NOERR) Message("%d %d %f", ncid, varid, *fp); @@ -396,7 +419,7 @@ minmaxvalf(size_t nvals, const float *array, double *minval, double *maxval) void cdf_put_vara_double(int ncid, int varid, const size_t start[], const size_t count[], const double *dp) { - const int status = nc_put_vara_double(ncid, varid, start, count, dp); + int status = nc_put_vara_double(ncid, varid, start, count, dp); if (CDF_Debug || status != NC_NOERR) { @@ -410,7 +433,6 @@ cdf_put_vara_double(int ncid, int varid, const size_t start[], const size_t coun size_t nvals = 1; for (int i = 0; i < ndims; ++i) nvals *= count[i]; minmaxval(nvals, dp, &minval, &maxval); - // Message("ncid=%d varid=%d val0=%f", ncid, varid, *dp); Message("name=%s type=%s minval=%f maxval=%f", name, cdf_var_type(xtype), minval, maxval); } @@ -420,7 +442,7 @@ cdf_put_vara_double(int ncid, int varid, const size_t start[], const size_t coun void cdf_put_vara_float(int ncid, int varid, const size_t start[], const size_t count[], const float *fp) { - const int status = nc_put_vara_float(ncid, varid, start, count, fp); + int status = nc_put_vara_float(ncid, varid, start, count, fp); if (CDF_Debug || status != NC_NOERR) { @@ -434,7 +456,6 @@ cdf_put_vara_float(int ncid, int varid, const size_t start[], const size_t count size_t nvals = 1; for (int i = 0; i < ndims; ++i) nvals *= count[i]; minmaxvalf(nvals, fp, &minval, &maxval); - // Message("ncid=%d varid=%d val0=%f", ncid, varid, *dp); Message("name=%s type=%s minval=%f maxval=%f", name, cdf_var_type(xtype), minval, maxval); } @@ -444,7 +465,7 @@ cdf_put_vara_float(int ncid, int varid, const size_t start[], const size_t count void cdf_put_vara(int ncid, int varid, const size_t start[], const size_t count[], const void *cp) { - const int status = nc_put_vara(ncid, varid, start, count, cp); + int status = nc_put_vara(ncid, varid, start, count, cp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); @@ -454,7 +475,7 @@ cdf_put_vara(int ncid, int varid, const size_t start[], const size_t count[], co void cdf_get_vara(int ncid, int varid, const size_t start[], const size_t count[], void *cp) { - const int status = nc_get_vara(ncid, varid, start, count, cp); + int status = nc_get_vara(ncid, varid, start, count, cp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); @@ -464,7 +485,7 @@ cdf_get_vara(int ncid, int varid, const size_t start[], const size_t count[], vo void cdf_get_vara_int(int ncid, int varid, const size_t start[], const size_t count[], int *dp) { - const int status = nc_get_vara_int(ncid, varid, start, count, dp); + int status = nc_get_vara_int(ncid, varid, start, count, dp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); @@ -474,7 +495,7 @@ cdf_get_vara_int(int ncid, int varid, const size_t start[], const size_t count[] void cdf_get_vara_double(int ncid, int varid, const size_t start[], const size_t count[], double *dp) { - const int status = nc_get_vara_double(ncid, varid, start, count, dp); + int status = nc_get_vara_double(ncid, varid, start, count, dp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d start[0]=%zu count[0]=%zu", ncid, varid, start[0], count[0]); @@ -484,7 +505,7 @@ cdf_get_vara_double(int ncid, int varid, const size_t start[], const size_t coun void cdf_get_vara_float(int ncid, int varid, const size_t start[], const size_t count[], float *fp) { - const int status = nc_get_vara_float(ncid, varid, start, count, fp); + int status = nc_get_vara_float(ncid, varid, start, count, fp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d start[0]=%zu count[0]=%zu", ncid, varid, start[0], count[0]); @@ -494,7 +515,7 @@ cdf_get_vara_float(int ncid, int varid, const size_t start[], const size_t count void cdf_get_vara_text(int ncid, int varid, const size_t start[], const size_t count[], char *tp) { - const int status = nc_get_vara_text(ncid, varid, start, count, tp); + int status = nc_get_vara_text(ncid, varid, start, count, tp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); @@ -504,7 +525,7 @@ cdf_get_vara_text(int ncid, int varid, const size_t start[], const size_t count[ void cdf_get_vara_uchar(int ncid, int varid, const size_t start[], const size_t count[], unsigned char *tp) { - const int status = nc_get_vara_uchar(ncid, varid, start, count, tp); + int status = nc_get_vara_uchar(ncid, varid, start, count, tp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); @@ -514,7 +535,7 @@ cdf_get_vara_uchar(int ncid, int varid, const size_t start[], const size_t count void cdf_put_var_double(int ncid, int varid, const double *dp) { - const int status = nc_put_var_double(ncid, varid, dp); + int status = nc_put_var_double(ncid, varid, dp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d val0=%f", ncid, varid, *dp); @@ -524,7 +545,7 @@ cdf_put_var_double(int ncid, int varid, const double *dp) void cdf_get_var1_text(int ncid, int varid, const size_t index[], char *tp) { - const int status = nc_get_var1_text(ncid, varid, index, tp); + int status = nc_get_var1_text(ncid, varid, index, tp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); @@ -534,7 +555,7 @@ cdf_get_var1_text(int ncid, int varid, const size_t index[], char *tp) void cdf_get_var1_double(int ncid, int varid, const size_t index[], double *dp) { - const int status = nc_get_var1_double(ncid, varid, index, dp); + int status = nc_get_var1_double(ncid, varid, index, dp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); @@ -544,7 +565,7 @@ cdf_get_var1_double(int ncid, int varid, const size_t index[], double *dp) void cdf_put_var1_double(int ncid, int varid, const size_t index[], const double *dp) { - const int status = nc_put_var1_double(ncid, varid, index, dp); + int status = nc_put_var1_double(ncid, varid, index, dp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d val=%f", ncid, varid, *dp); @@ -554,7 +575,7 @@ cdf_put_var1_double(int ncid, int varid, const size_t index[], const double *dp) void cdf_get_var_text(int ncid, int varid, char *tp) { - const int status = nc_get_var_text(ncid, varid, tp); + int status = nc_get_var_text(ncid, varid, tp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); @@ -564,7 +585,7 @@ cdf_get_var_text(int ncid, int varid, char *tp) void cdf_get_var_short(int ncid, int varid, short *sp) { - const int status = nc_get_var_short(ncid, varid, sp); + int status = nc_get_var_short(ncid, varid, sp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); @@ -574,7 +595,7 @@ cdf_get_var_short(int ncid, int varid, short *sp) void cdf_get_var_int(int ncid, int varid, int *ip) { - const int status = nc_get_var_int(ncid, varid, ip); + int status = nc_get_var_int(ncid, varid, ip); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); @@ -584,7 +605,7 @@ cdf_get_var_int(int ncid, int varid, int *ip) void cdf_get_var_long(int ncid, int varid, long *lp) { - const int status = nc_get_var_long(ncid, varid, lp); + int status = nc_get_var_long(ncid, varid, lp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); @@ -594,7 +615,7 @@ cdf_get_var_long(int ncid, int varid, long *lp) void cdf_get_var_float(int ncid, int varid, float *fp) { - const int status = nc_get_var_float(ncid, varid, fp); + int status = nc_get_var_float(ncid, varid, fp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d", ncid, varid); @@ -604,7 +625,7 @@ cdf_get_var_float(int ncid, int varid, float *fp) void cdf_get_var_double(int ncid, int varid, double *dp) { - const int status = nc_get_var_double(ncid, varid, dp); + int status = nc_get_var_double(ncid, varid, dp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d val[0]=%f", ncid, varid, *dp); @@ -614,7 +635,7 @@ cdf_get_var_double(int ncid, int varid, double *dp) void cdf_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out, int varid_out) { - const int status = nc_copy_att(ncid_in, varid_in, name, ncid_out, varid_out); + int status = nc_copy_att(ncid_in, varid_in, name, ncid_out, varid_out); if (CDF_Debug || status != NC_NOERR) Message("%d %d %s %d %d", ncid_in, varid_out, name, ncid_out, varid_out); @@ -624,7 +645,7 @@ cdf_copy_att(int ncid_in, int varid_in, const char *name, int ncid_out, int vari void cdf_put_att_text(int ncid, int varid, const char *name, size_t len, const char *tp) { - const int status = nc_put_att_text(ncid, varid, name, len, tp); + int status = nc_put_att_text(ncid, varid, name, len, tp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s text=%.*s", ncid, varid, name, (int) len, tp); @@ -646,7 +667,7 @@ cdf_put_att_int(int ncid, int varid, const char *name, nc_type xtype, size_t len void cdf_put_att_float(int ncid, int varid, const char *name, nc_type xtype, size_t len, const float *dp) { - const int status = nc_put_att_float(ncid, varid, name, xtype, len, dp); + int status = nc_put_att_float(ncid, varid, name, xtype, len, dp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s val=%g", ncid, varid, name, *dp); @@ -656,7 +677,7 @@ cdf_put_att_float(int ncid, int varid, const char *name, nc_type xtype, size_t l void cdf_put_att_double(int ncid, int varid, const char *name, nc_type xtype, size_t len, const double *dp) { - const int status = nc_put_att_double(ncid, varid, name, xtype, len, dp); + int status = nc_put_att_double(ncid, varid, name, xtype, len, dp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s val=%g", ncid, varid, name, *dp); @@ -666,7 +687,7 @@ cdf_put_att_double(int ncid, int varid, const char *name, nc_type xtype, size_t void cdf_get_att_text(int ncid, int varid, const char *name, char *tp) { - const int status = nc_get_att_text(ncid, varid, name, tp); + int status = nc_get_att_text(ncid, varid, name, tp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d name=%s", ncid, varid, name); @@ -677,7 +698,7 @@ void cdf_get_att_string(int ncid, int varid, const char *name, char **tp) { #ifdef HAVE_NETCDF4 - const int status = nc_get_att_string(ncid, varid, name, tp); + int status = nc_get_att_string(ncid, varid, name, tp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d name=%s", ncid, varid, name); @@ -700,7 +721,7 @@ cdf_get_att_int(int ncid, int varid, const char *name, int *ip) void cdf_get_att_double(int ncid, int varid, const char *name, double *dp) { - const int status = nc_get_att_double(ncid, varid, name, dp); + int status = nc_get_att_double(ncid, varid, name, dp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s val=%.9g", ncid, varid, name, *dp); @@ -710,7 +731,7 @@ cdf_get_att_double(int ncid, int varid, const char *name, double *dp) void cdf_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, size_t *lenp) { - const int status = nc_inq_att(ncid, varid, name, xtypep, lenp); + int status = nc_inq_att(ncid, varid, name, xtypep, lenp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s", ncid, varid, name); @@ -720,7 +741,7 @@ cdf_inq_att(int ncid, int varid, const char *name, nc_type *xtypep, size_t *lenp void cdf_inq_atttype(int ncid, int varid, const char *name, nc_type *xtypep) { - const int status = nc_inq_atttype(ncid, varid, name, xtypep); + int status = nc_inq_atttype(ncid, varid, name, xtypep); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s", ncid, varid, name); @@ -730,7 +751,7 @@ cdf_inq_atttype(int ncid, int varid, const char *name, nc_type *xtypep) void cdf_inq_attlen(int ncid, int varid, const char *name, size_t *lenp) { - const int status = nc_inq_attlen(ncid, varid, name, lenp); + int status = nc_inq_attlen(ncid, varid, name, lenp); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s len=%d", ncid, varid, name, *lenp); @@ -740,7 +761,7 @@ cdf_inq_attlen(int ncid, int varid, const char *name, size_t *lenp) void cdf_inq_attname(int ncid, int varid, int attnum, char *name) { - const int status = nc_inq_attname(ncid, varid, attnum, name); + int status = nc_inq_attname(ncid, varid, attnum, name); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d attnum=%d att=%s", ncid, varid, attnum, name); @@ -750,7 +771,7 @@ cdf_inq_attname(int ncid, int varid, int attnum, char *name) void cdf_inq_attid(int ncid, int varid, const char *name, int *attnump) { - const int status = nc_inq_attid(ncid, varid, name, attnump); + int status = nc_inq_attid(ncid, varid, name, attnump); if (CDF_Debug || status != NC_NOERR) Message("ncid=%d varid=%d att=%s", ncid, varid, name); @@ -761,7 +782,7 @@ cdf_inq_attid(int ncid, int varid, const char *name, int *attnump) void cdf_def_var_chunking(int ncid, int varid, int storage, const size_t *chunksizesp) { - const int status = nc_def_var_chunking(ncid, varid, storage, chunksizesp); + int status = nc_def_var_chunking(ncid, varid, storage, chunksizesp); if (status != NC_NOERR) Error("%s", nc_strerror(status)); } #endif diff --git a/src/cdf_int.h b/src/cdf_int.h index 3d9ae3f78c9f0164ad8194603e6cdc3ea4178c9b..2925d99b6576f4f30479c802f94a2ddc3f66e149 100644 --- a/src/cdf_int.h +++ b/src/cdf_int.h @@ -11,8 +11,8 @@ int cdf_open(const char *path, int omode, int *idp); void cdf_close(int ncid); void cdf_redef(int ncid); -void cdf_enddef(int ncid); -void cdf__enddef(const int ncid, const size_t hdr_pad); +void cdf_enddef(int ncid, int streamID); +void cdf__enddef(int ncid, int streamID, const size_t hdr_pad); void cdf_sync(int ncid); void cdf_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp); @@ -93,6 +93,10 @@ typedef int (*cdi_nc__create_funcp)(const char *path, int cmode, size_t initials typedef void (*cdi_cdf_def_var_funcp)(int ncid, const char *name, nc_type xtype, int ndims, const int dimids[], int *varidp); +int cdi_nc_enddef_serial(int ncid, int streamID); +int cdi_nc__enddef_serial(int ncid, int streamID, size_t hdr_pad, size_t v_align, size_t v_minfree, size_t r_align); +typedef int (*cdi_nc_enddef_funcp)(int ncid, int streamID); +typedef int (*cdi_nc__enddef_funcp)(int ncid, int streamID, size_t hdr_pad, size_t v_align, size_t v_minfree, size_t r_align); #endif #endif /* CDF_INT_H */ diff --git a/src/cdf_lazy_grid.c b/src/cdf_lazy_grid.c index 19e0b51daf78bb76154287a9ce75de9a4b6a7252..4804117cf928e28d76fc81c2e08855138e0fbc1d 100644 --- a/src/cdf_lazy_grid.c +++ b/src/cdf_lazy_grid.c @@ -29,6 +29,7 @@ static bool cdfLazyInitialized; void cdfLazyGridDestroy(struct cdfLazyGrid *lazyGrid) { + lazyGrid->base.extraData = NULL; if (lazyGrid->base.area == cdfPendingLoad) lazyGrid->base.area = NULL; if (lazyGrid->base.x.vals == cdfPendingLoad) lazyGrid->base.x.vals = NULL; if (lazyGrid->base.y.vals == cdfPendingLoad) lazyGrid->base.y.vals = NULL; @@ -189,7 +190,7 @@ cdfLazyGridDefYVals(grid_t *grid, const double *vals) } static double -cdfLazyGridInqXVal(grid_t *grid, size_t index) +cdfLazyGridInqXVal(grid_t *grid, SizeType index) { struct cdfLazyGrid *lazyGrid = (struct cdfLazyGrid *) grid; lock_lazy_load(lazyGrid); @@ -199,7 +200,7 @@ cdfLazyGridInqXVal(grid_t *grid, size_t index) } static double -cdfLazyGridInqYVal(grid_t *grid, size_t index) +cdfLazyGridInqYVal(grid_t *grid, SizeType index) { struct cdfLazyGrid *lazyGrid = (struct cdfLazyGrid *) grid; lock_lazy_load(lazyGrid); diff --git a/src/cdf_read.c b/src/cdf_read.c index 0e7bcb4de6e9dec21a0b72a97056660b917dd508..cb9e6bf44a454d059df6cfe779cb85505196f065 100644 --- a/src/cdf_read.c +++ b/src/cdf_read.c @@ -19,19 +19,19 @@ static void cdfReadGridTraj(stream_t *streamptr, int gridID) { - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; - const int gridindex = vlistGridIndex(vlistID, gridID); - const int lonID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X]; - const int latID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; + int gridindex = vlistGridIndex(vlistID, gridID); + int ncLonId = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X]; + int ncLatId = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; - const int tsID = streamptr->curTsID; - const size_t index = (size_t) tsID; + int tsID = streamptr->curTsID; + size_t ncStepIndex = (size_t) streamptr->tsteps[tsID].ncStepIndex; double xlon, xlat; - cdf_get_var1_double(fileID, lonID, &index, &xlon); - cdf_get_var1_double(fileID, latID, &index, &xlat); + cdf_get_var1_double(fileID, ncLonId, &ncStepIndex, &xlon); + cdf_get_var1_double(fileID, ncLatId, &ncStepIndex, &xlat); gridDefXvals(gridID, &xlon); gridDefYvals(gridID, &xlat); @@ -40,14 +40,13 @@ cdfReadGridTraj(stream_t *streamptr, int gridID) static void cdfGetSlapDescription(stream_t *streamptr, int varID, size_t (*start)[MAX_DIMENSIONS], size_t (*count)[MAX_DIMENSIONS]) { - const int vlistID = streamptr->vlistID; - const int tsID = streamptr->curTsID; - const int gridID = vlistInqVarGrid(vlistID, varID); - const int zaxisID = vlistInqVarZaxis(vlistID, varID); - const int timetype = vlistInqVarTimetype(vlistID, varID); - const int gridindex = vlistGridIndex(vlistID, gridID); - - if (CDI_Debug) Message("tsID = %d", tsID); + int vlistID = streamptr->vlistID; + int tsID = streamptr->curTsID; + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); + int timetype = vlistInqVarTimetype(vlistID, varID); + int gridindex = vlistGridIndex(vlistID, gridID); + size_t ncStepIndex = (size_t) streamptr->tsteps[tsID].ncStepIndex; int xid = CDI_UNDEFID, yid = CDI_UNDEFID; if (gridInqType(gridID) == GRID_TRAJECTORY) @@ -59,8 +58,8 @@ cdfGetSlapDescription(stream_t *streamptr, int varID, size_t (*start)[MAX_DIMENS xid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X]; yid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y]; } - const int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); - const int zid = streamptr->zaxisID[zaxisindex]; + int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); + int zid = streamptr->zaxisID[zaxisindex]; int ndims = 0; #define addDimension(startCoord, length) \ @@ -71,7 +70,7 @@ cdfGetSlapDescription(stream_t *streamptr, int varID, size_t (*start)[MAX_DIMENS ndims++; \ } \ while (0) - if (timetype != TIME_CONSTANT) addDimension((size_t) tsID, 1); + if (timetype != TIME_CONSTANT) addDimension(ncStepIndex, 1); if (zid != CDI_UNDEFID) addDimension(0, (size_t) zaxisInqSize(zaxisID)); if (yid != CDI_UNDEFID) addDimension(0, gridInqYsize(gridID)); if (xid != CDI_UNDEFID) addDimension(0, gridInqXsize(gridID)); @@ -89,16 +88,15 @@ cdfGetSlapDescription(stream_t *streamptr, int varID, size_t (*start)[MAX_DIMENS static size_t cdfDoInputDataTransformationDP(int vlistID, int varID, size_t valueCount, double *data) { - const double missVal = vlistInqVarMissval(vlistID, varID); - const int haveMissVal = vlistInqVarMissvalUsed(vlistID, varID); + double missVal = vlistInqVarMissval(vlistID, varID); + int haveMissVal = vlistInqVarMissvalUsed(vlistID, varID); double validRange[2]; if (!(haveMissVal && vlistInqVarValidrange(vlistID, varID, validRange))) validRange[0] = DBL_MIN, validRange[1] = DBL_MAX; - const double offset = vlistInqVarAddoffset(vlistID, varID); - const double scaleFactor = vlistInqVarScalefactor(vlistID, varID); + double addoffset = 0.0, scalefactor = 1.0; + int haveAddoffset = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_ADDOFFSET, &addoffset) == CDI_NOERR); + int haveScalefactor = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_SCALEFACTOR, &scalefactor) == CDI_NOERR); - const bool missValIsNaN = DBL_IS_NAN(missVal); - const int haveOffset = IS_NOT_EQUAL(offset, 0.0); - const int haveScaleFactor = IS_NOT_EQUAL(scaleFactor, 1.0); + bool missValIsNaN = DBL_IS_NAN(missVal); size_t missValCount = 0; double validMin = validRange[0]; @@ -106,36 +104,36 @@ cdfDoInputDataTransformationDP(int vlistID, int varID, size_t valueCount, double if (IS_EQUAL(validMin, VALIDMISS)) validMin = DBL_MIN; if (IS_EQUAL(validMax, VALIDMISS)) validMax = DBL_MAX; - const int haveRangeCheck = (IS_NOT_EQUAL(validMax, DBL_MAX)) | (IS_NOT_EQUAL(validMin, DBL_MIN)); + int haveRangeCheck = (IS_NOT_EQUAL(validMax, DBL_MAX)) | (IS_NOT_EQUAL(validMin, DBL_MIN)); assert(!haveRangeCheck || haveMissVal); - switch (haveMissVal | (haveScaleFactor << 1) | (haveOffset << 2) | (haveRangeCheck << 3)) + switch (haveMissVal | (haveScalefactor << 1) | (haveAddoffset << 2) | (haveRangeCheck << 3)) { - case 15: // haveRangeCheck & haveMissVal & haveScaleFactor & haveOffset + case 15: // haveRangeCheck & haveMissVal & haveScalefactor & haveAddoffset for (size_t i = 0; i < valueCount; ++i) { int outOfRange = (data[i] < validMin || data[i] > validMax); int isMissVal = DBL_IS_EQUAL(data[i], missVal); missValCount += (size_t) (outOfRange | isMissVal); - data[i] = outOfRange ? missVal : isMissVal ? data[i] : data[i] * scaleFactor + offset; + data[i] = outOfRange ? missVal : isMissVal ? data[i] : data[i] * scalefactor + addoffset; } break; - case 13: // haveRangeCheck & haveMissVal & haveOffset + case 13: // haveRangeCheck & haveMissVal & haveAddoffset for (size_t i = 0; i < valueCount; ++i) { int outOfRange = (data[i] < validMin || data[i] > validMax); int isMissVal = DBL_IS_EQUAL(data[i], missVal); missValCount += (size_t) (outOfRange | isMissVal); - data[i] = outOfRange ? missVal : isMissVal ? data[i] : data[i] + offset; + data[i] = outOfRange ? missVal : isMissVal ? data[i] : data[i] + addoffset; } break; - case 11: // haveRangeCheck & haveMissVal & haveScaleFactor + case 11: // haveRangeCheck & haveMissVal & haveScalefactor for (size_t i = 0; i < valueCount; ++i) { int outOfRange = (data[i] < validMin || data[i] > validMax); int isMissVal = DBL_IS_EQUAL(data[i], missVal); missValCount += (size_t) (outOfRange | isMissVal); - data[i] = outOfRange ? missVal : isMissVal ? data[i] : data[i] * scaleFactor; + data[i] = outOfRange ? missVal : isMissVal ? data[i] : data[i] * scalefactor; } break; case 9: // haveRangeCheck & haveMissVal @@ -147,35 +145,35 @@ cdfDoInputDataTransformationDP(int vlistID, int varID, size_t valueCount, double data[i] = outOfRange ? missVal : data[i]; } break; - case 7: // haveMissVal & haveScaleFactor & haveOffset + case 7: // haveMissVal & haveScalefactor & haveAddoffset for (size_t i = 0; i < valueCount; ++i) if (DBL_IS_EQUAL(data[i], missVal)) missValCount++; else - data[i] = data[i] * scaleFactor + offset; + data[i] = data[i] * scalefactor + addoffset; break; - case 6: // haveOffset & haveScaleFactor - for (size_t i = 0; i < valueCount; ++i) data[i] = data[i] * scaleFactor + offset; + case 6: // haveAddoffset & haveScalefactor + for (size_t i = 0; i < valueCount; ++i) data[i] = data[i] * scalefactor + addoffset; break; - case 5: // haveMissVal & haveOffset + case 5: // haveMissVal & haveAddoffset for (size_t i = 0; i < valueCount; ++i) if (DBL_IS_EQUAL(data[i], missVal)) missValCount++; else - data[i] += offset; + data[i] += addoffset; break; - case 4: // haveOffset - for (size_t i = 0; i < valueCount; ++i) data[i] += offset; + case 4: // haveAddoffset + for (size_t i = 0; i < valueCount; ++i) data[i] += addoffset; break; - case 3: // haveMissVal & haveScaleFactor + case 3: // haveMissVal & haveScalefactor for (size_t i = 0; i < valueCount; ++i) if (DBL_IS_EQUAL(data[i], missVal)) missValCount++; else - data[i] *= scaleFactor; + data[i] *= scalefactor; break; - case 2: // haveScaleFactor - for (size_t i = 0; i < valueCount; ++i) data[i] *= scaleFactor; + case 2: // haveScalefactor + for (size_t i = 0; i < valueCount; ++i) data[i] *= scalefactor; break; case 1: // haveMissVal if (missValIsNaN) @@ -195,16 +193,15 @@ cdfDoInputDataTransformationDP(int vlistID, int varID, size_t valueCount, double static size_t cdfDoInputDataTransformationSP(int vlistID, int varID, size_t valueCount, float *data) { - const double missVal = vlistInqVarMissval(vlistID, varID); - const int haveMissVal = vlistInqVarMissvalUsed(vlistID, varID); + double missVal = vlistInqVarMissval(vlistID, varID); + int haveMissVal = vlistInqVarMissvalUsed(vlistID, varID); double validRange[2]; if (!(haveMissVal && vlistInqVarValidrange(vlistID, varID, validRange))) validRange[0] = DBL_MIN, validRange[1] = DBL_MAX; - const double offset = vlistInqVarAddoffset(vlistID, varID); - const double scaleFactor = vlistInqVarScalefactor(vlistID, varID); + double addoffset = 0.0, scalefactor = 1.0; + int haveAddoffset = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_ADDOFFSET, &addoffset) == CDI_NOERR); + int haveScalefactor = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_SCALEFACTOR, &scalefactor) == CDI_NOERR); - const bool missValIsNaN = DBL_IS_NAN(missVal); - const int haveOffset = IS_NOT_EQUAL(offset, 0.0); - const int haveScaleFactor = IS_NOT_EQUAL(scaleFactor, 1.0); + bool missValIsNaN = DBL_IS_NAN(missVal); size_t missValCount = 0; double validMin = validRange[0]; @@ -212,36 +209,36 @@ cdfDoInputDataTransformationSP(int vlistID, int varID, size_t valueCount, float if (IS_EQUAL(validMin, VALIDMISS)) validMin = DBL_MIN; if (IS_EQUAL(validMax, VALIDMISS)) validMax = DBL_MAX; - const int haveRangeCheck = (IS_NOT_EQUAL(validMax, DBL_MAX)) | (IS_NOT_EQUAL(validMin, DBL_MIN)); + int haveRangeCheck = (IS_NOT_EQUAL(validMax, DBL_MAX)) | (IS_NOT_EQUAL(validMin, DBL_MIN)); assert(!haveRangeCheck || haveMissVal); - switch (haveMissVal | (haveScaleFactor << 1) | (haveOffset << 2) | (haveRangeCheck << 3)) + switch (haveMissVal | (haveScalefactor << 1) | (haveAddoffset << 2) | (haveRangeCheck << 3)) { - case 15: // haveRangeCheck & haveMissVal & haveScaleFactor & haveOffset + case 15: // haveRangeCheck & haveMissVal & haveScalefactor & haveAddoffset for (size_t i = 0; i < valueCount; ++i) { int outOfRange = (data[i] < validMin || data[i] > validMax); int isMissVal = DBL_IS_EQUAL(data[i], missVal); missValCount += (size_t) (outOfRange | isMissVal); - data[i] = outOfRange ? (float) missVal : isMissVal ? data[i] : (float) (data[i] * scaleFactor + offset); + data[i] = outOfRange ? (float) missVal : isMissVal ? data[i] : (float) (data[i] * scalefactor + addoffset); } break; - case 13: // haveRangeCheck & haveMissVal & haveOffset + case 13: // haveRangeCheck & haveMissVal & haveAddoffset for (size_t i = 0; i < valueCount; ++i) { int outOfRange = (data[i] < validMin || data[i] > validMax); int isMissVal = DBL_IS_EQUAL(data[i], missVal); missValCount += (size_t) (outOfRange | isMissVal); - data[i] = outOfRange ? (float) missVal : isMissVal ? data[i] : (float) (data[i] + offset); + data[i] = outOfRange ? (float) missVal : isMissVal ? data[i] : (float) (data[i] + addoffset); } break; - case 11: // haveRangeCheck & haveMissVal & haveScaleFactor + case 11: // haveRangeCheck & haveMissVal & haveScalefactor for (size_t i = 0; i < valueCount; ++i) { int outOfRange = (data[i] < validMin || data[i] > validMax); int isMissVal = DBL_IS_EQUAL(data[i], missVal); missValCount += (size_t) (outOfRange | isMissVal); - data[i] = outOfRange ? (float) missVal : isMissVal ? data[i] : (float) (data[i] * scaleFactor); + data[i] = outOfRange ? (float) missVal : isMissVal ? data[i] : (float) (data[i] * scalefactor); } break; case 9: // haveRangeCheck & haveMissVal @@ -253,35 +250,35 @@ cdfDoInputDataTransformationSP(int vlistID, int varID, size_t valueCount, float data[i] = outOfRange ? (float) missVal : data[i]; } break; - case 7: // haveMissVal & haveScaleFactor & haveOffset + case 7: // haveMissVal & haveScalefactor & haveAddoffset for (size_t i = 0; i < valueCount; ++i) if (DBL_IS_EQUAL(data[i], missVal)) missValCount++; else - data[i] = (float) (data[i] * scaleFactor + offset); + data[i] = (float) (data[i] * scalefactor + addoffset); break; - case 6: // haveOffset & haveScaleFactor - for (size_t i = 0; i < valueCount; ++i) data[i] = (float) (data[i] * scaleFactor + offset); + case 6: // haveAddoffset & haveScalefactor + for (size_t i = 0; i < valueCount; ++i) data[i] = (float) (data[i] * scalefactor + addoffset); break; - case 5: // haveMissVal & haveOffset + case 5: // haveMissVal & haveAddoffset for (size_t i = 0; i < valueCount; ++i) if (DBL_IS_EQUAL(data[i], missVal)) missValCount++; else - data[i] = (float) (data[i] + offset); + data[i] = (float) (data[i] + addoffset); break; - case 4: // haveOffset - for (size_t i = 0; i < valueCount; ++i) data[i] = (float) (data[i] + offset); + case 4: // haveAddoffset + for (size_t i = 0; i < valueCount; ++i) data[i] = (float) (data[i] + addoffset); break; - case 3: // haveMissVal & haveScaleFactor + case 3: // haveMissVal & haveScalefactor for (size_t i = 0; i < valueCount; ++i) if (DBL_IS_EQUAL(data[i], missVal)) missValCount++; else - data[i] = (float) (data[i] * scaleFactor); + data[i] = (float) (data[i] * scalefactor); break; - case 2: // haveScaleFactor - for (size_t i = 0; i < valueCount; ++i) data[i] = (float) (data[i] * scaleFactor); + case 2: // haveScalefactor + for (size_t i = 0; i < valueCount; ++i) data[i] = (float) (data[i] * scalefactor); break; case 1: // haveMissVal if (missValIsNaN) @@ -310,8 +307,8 @@ transpose2dArrayDP(int gridId, double *data) size_t inWidth = gridInqYsize(gridId); size_t inHeight = gridInqXsize(gridId); - const size_t cacheBlockSize = 256; // Purely an optimization parameter. Current value of 32 means we are handling 8kB blocks, - // which should be a decent compromise on many architectures. + size_t cacheBlockSize = 256; // Purely an optimization parameter. Current value of 32 means we are handling 8kB blocks, + // which should be a decent compromise on many architectures. double **out = (double **) malloc(inWidth * sizeof(double *)); double **temp = (double **) malloc(inHeight * sizeof(double *)); temp[0] = (double *) malloc(inHeight * inWidth * sizeof(double)); @@ -344,8 +341,8 @@ transpose2dArraySP(size_t gridId, float *data) size_t inWidth = gridInqYsize(gridId); size_t inHeight = gridInqXsize(gridId); - const size_t cacheBlockSize = 256; // Purely an optimization parameter. Current value of 32 means we are handling 8kB blocks, - // which should be a decent compromise on many architectures. + size_t cacheBlockSize = 256; // Purely an optimization parameter. Current value of 32 means we are handling 8kB blocks, + // which should be a decent compromise on many architectures. float **out = (float **) malloc(inWidth * sizeof(float *)); float **temp = (float **) malloc(inHeight * sizeof(float *)); temp[0] = (float *) malloc(inHeight * inWidth * sizeof(float)); @@ -373,14 +370,13 @@ transpose2dArraySP(size_t gridId, float *data) } static void -cdfInqDimIds(stream_t *streamptr, int varId, int (*outDimIds)[4]) +cdf_inq_dimIds(stream_t *streamptr, int varId, int (*outDimIds)[4]) { - const int vlistID = streamptr->vlistID; - const int gridId = vlistInqVarGrid(vlistID, varId); - const int gridindex = vlistGridIndex(vlistID, gridId); + int vlistID = streamptr->vlistID; + int gridId = vlistInqVarGrid(vlistID, varId); + int gridindex = vlistGridIndex(vlistID, gridId); const int *ncIDs = streamptr->ncgrid[gridindex].ncIDs; - (*outDimIds)[0] = (*outDimIds)[1] = (*outDimIds)[2] = (*outDimIds)[3] = CDI_UNDEFID; switch (gridInqType(gridId)) { case GRID_TRAJECTORY: cdfReadGridTraj(streamptr, gridId); break; @@ -396,65 +392,84 @@ cdfInqDimIds(stream_t *streamptr, int varId, int (*outDimIds)[4]) break; } - const int zaxisID = vlistInqVarZaxis(vlistID, varId); - const int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); + int zaxisID = vlistInqVarZaxis(vlistID, varId); + int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); (*outDimIds)[2] = streamptr->zaxisID[zaxisindex]; } +static size_t +stream_inq_dimlen(stream_t *streamptr, int dimid) +{ + int ndims = streamptr->ncNumDims; + int *ncdimid = streamptr->ncDimID; + size_t *ncdimlen = streamptr->ncDimLen; + for (int i = 0; i < ndims; ++i) + { + if (dimid == ncdimid[i]) return ncdimlen[i]; + } + + size_t size = 0; + int fileId = streamptr->fileID; + cdf_inq_dimlen(fileId, dimid, &size); + return size; +} + static int -cdfGetSkipDim(int fileId, int ncvarid, int dimIds[3]) +stream_get_skip_dim(stream_t *streamptr, int ncvarid, int dimIds[3]) { if (dimIds[0] != CDI_UNDEFID || dimIds[1] != CDI_UNDEFID) return 0; + int fileId = streamptr->fileID; int nvdims; cdf_inq_varndims(fileId, ncvarid, &nvdims); if (nvdims != 3) return 0; - int varDimIds[3]; + int varDimIds[3] = { -1, -1, -1 }; cdf_inq_vardimid(fileId, ncvarid, varDimIds); - size_t size = 0; if (dimIds[2] == varDimIds[2]) { - cdf_inq_dimlen(fileId, varDimIds[1], &size); - if (size == 1) return 1; + if (stream_inq_dimlen(streamptr, varDimIds[1]) == 1) return 1; } else if (dimIds[2] == varDimIds[1]) { - cdf_inq_dimlen(fileId, varDimIds[2], &size); - if (size == 1) return 2; + if (stream_inq_dimlen(streamptr, varDimIds[2]) == 1) return 2; } return 0; } -static void -cdfGetSliceSlapDescription(stream_t *streamptr, int varID, int levelID, bool *outSwapXY, size_t (*start)[MAX_DIMENSIONS], - size_t (*count)[MAX_DIMENSIONS]) +enum { - const int tsID = streamptr->curTsID; - if (CDI_Debug) Message("tsID = %d", tsID); + cdfSliceNDim = MAX_DIMENSIONS +}; - const int fileId = streamptr->fileID; - const int vlistID = streamptr->vlistID; - const int ncvarid = streamptr->vars[varID].ncvarid; +static void +cdfGetSliceSlapDescription(stream_t *streamptr, int varID, int levelID, bool *outSwapXY, size_t start[cdfSliceNDim], + size_t count[cdfSliceNDim]) +{ + int tsID = streamptr->curTsID; + int fileId = streamptr->fileID; + int vlistID = streamptr->vlistID; + int ncvarid = streamptr->vars[varID].ncvarid; + size_t ncStepIndex = (size_t) streamptr->tsteps[tsID].ncStepIndex; - const int gridId = vlistInqVarGrid(vlistID, varID); - const int timetype = vlistInqVarTimetype(vlistID, varID); - const size_t gridsize = gridInqSize(gridId); + int gridId = vlistInqVarGrid(vlistID, varID); + int timetype = vlistInqVarTimetype(vlistID, varID); + size_t gridsize = gridInqSize(gridId); streamptr->numvals += gridsize; - int dimIds[4]; // this array joins the old variables xid, yid, and zid - cdfInqDimIds(streamptr, varID, &dimIds); + int dimIds[4] = { -1, -1, -1, -1 }; // this array joins the old variables xid, yid, and zid + cdf_inq_dimIds(streamptr, varID, &dimIds); - const int skipdim = cdfGetSkipDim(fileId, ncvarid, dimIds); + int skipdim = stream_get_skip_dim(streamptr, ncvarid, dimIds); int dimorder[4] = { 3, 4, 2, 1 }; // order of cube sphere grid if (dimIds[3] == CDI_UNDEFID) { int tmpdimorder[3]; - vlistInqVarDimorder(vlistID, varID, &tmpdimorder); + vlistInqVarDimorder(vlistID, varID, tmpdimorder); for (int i = 0; i < 3; ++i) dimorder[i] = tmpdimorder[i]; dimorder[3] = 4; *outSwapXY = ((dimorder[2] == 2 || dimorder[0] == 1) && (dimIds[0] != CDI_UNDEFID) && (dimIds[1] != CDI_UNDEFID)); @@ -465,42 +480,46 @@ cdfGetSliceSlapDescription(stream_t *streamptr, int varID, int levelID, bool *ou #define addDimension(startIndex, extent) \ do \ { \ - (*start)[ndims] = startIndex; \ - (*count)[ndims] = extent; \ + start[ndims] = startIndex; \ + count[ndims] = extent; \ ndims++; \ } \ while (0) - if (timetype != TIME_CONSTANT) addDimension((size_t) tsID, 1); + if (timetype != TIME_CONSTANT) addDimension(ncStepIndex, 1); if (skipdim == 1) addDimension(0, 1); + int gridindex = vlistGridIndex(vlistID, gridId); + const ncgrid_t *ncGrid = &streamptr->ncgrid[gridindex]; + bool readPart = (ncGrid->gridID == gridId && ncGrid->start != -1 && ncGrid->count != -1); + for (int id = 0; id < 4; ++id) { - size_t size; - const int curDimId = dimIds[dimorder[id] - 1]; + int curDimId = dimIds[dimorder[id] - 1]; if (curDimId == CDI_UNDEFID) continue; switch (dimorder[id]) { case 1: case 2: case 4: - cdf_inq_dimlen(fileId, curDimId, &size); - addDimension(0, size); + if (readPart && curDimId == dimIds[0]) + addDimension(ncGrid->start, ncGrid->count); + else + addDimension(0, stream_inq_dimlen(streamptr, curDimId)); break; case 3: addDimension((size_t) levelID, 1); break; - default: Error("Internal errror: Malformed dimension order encountered. Please report this bug.\n"); + default: Error("Internal errror: Malformed dimension order encountered. Please report this bug."); } } if (skipdim == 2) addDimension(0, 1); - assert(ndims <= (int) (sizeof(*start) / sizeof(**start))); - assert(ndims <= (int) (sizeof(*count) / sizeof(**count))); + assert(ndims <= cdfSliceNDim); #undef addDimension if (CDI_Debug) - for (int idim = 0; idim < ndims; ++idim) Message("dim = %d start = %d count = %d", idim, (*start)[idim], (*count)[idim]); + for (int idim = 0; idim < ndims; ++idim) Message("dim = %d start = %zu count = %zu", idim, start[idim], count[idim]); int nvdims; cdf_inq_varndims(fileId, ncvarid, &nvdims); @@ -516,8 +535,8 @@ cdfGetSliceSlapDescription(stream_t *streamptr, int varID, int levelID, bool *ou static size_t getSizeVar3D(int vlistID, int varID) { - const int gridID = vlistInqVarGrid(vlistID, varID); - const int zaxisID = vlistInqVarZaxis(vlistID, varID); + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); return gridInqSize(gridID) * (size_t) zaxisInqSize(zaxisID); } @@ -575,10 +594,10 @@ static void cdfReadDataDP(stream_t *streamptr, int varID, size_t length, size_t start[MAX_DIMENSIONS], size_t count[MAX_DIMENSIONS], double *data) { - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; - const int ncvarid = streamptr->vars[varID].ncvarid; - const int datatype = vlistInqVarDatatype(vlistID, varID); + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int ncvarid = streamptr->vars[varID].ncvarid; + int datatype = vlistInqVarDatatype(vlistID, varID); if (datatype == CDI_DATATYPE_CPX32 || datatype == CDI_DATATYPE_CPX64) { @@ -611,10 +630,10 @@ static void cdfReadDataSP(stream_t *streamptr, int varID, size_t length, size_t start[MAX_DIMENSIONS], size_t count[MAX_DIMENSIONS], float *data) { - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; - const int ncvarid = streamptr->vars[varID].ncvarid; - const int datatype = vlistInqVarDatatype(vlistID, varID); + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int ncvarid = streamptr->vars[varID].ncvarid; + int datatype = vlistInqVarDatatype(vlistID, varID); if (datatype == CDI_DATATYPE_CPX32 || datatype == CDI_DATATYPE_CPX64) { @@ -654,12 +673,12 @@ cdfReadVarDP(stream_t *streamptr, int varID, double *data, size_t *nmiss) { if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); - const int vlistID = streamptr->vlistID; + int vlistID = streamptr->vlistID; size_t start[MAX_DIMENSIONS], count[MAX_DIMENSIONS]; cdfGetSlapDescription(streamptr, varID, &start, &count); - const size_t length = getSizeVar3D(vlistID, varID); + size_t length = getSizeVar3D(vlistID, varID); cdfReadDataDP(streamptr, varID, length, start, count, data); *nmiss = cdfDoInputDataTransformationDP(vlistID, varID, length, data); @@ -670,12 +689,12 @@ cdfReadVarSP(stream_t *streamptr, int varID, float *data, size_t *nmiss) { if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); - const int vlistID = streamptr->vlistID; + int vlistID = streamptr->vlistID; size_t start[MAX_DIMENSIONS], count[MAX_DIMENSIONS]; cdfGetSlapDescription(streamptr, varID, &start, &count); - const size_t length = getSizeVar3D(vlistID, varID); + size_t length = getSizeVar3D(vlistID, varID); cdfReadDataSP(streamptr, varID, length, start, count, data); *nmiss = cdfDoInputDataTransformationSP(vlistID, varID, length, data); @@ -696,12 +715,12 @@ cdfReadVarSliceDP(stream_t *streamptr, int varID, int levelID, double *data, siz if (CDI_Debug) Message("streamID = %d varID = %d levelID = %d", streamptr->self, varID, levelID); bool swapxy = false; - size_t start[MAX_DIMENSIONS], count[MAX_DIMENSIONS]; - cdfGetSliceSlapDescription(streamptr, varID, levelID, &swapxy, &start, &count); + size_t start[cdfSliceNDim], count[cdfSliceNDim]; + cdfGetSliceSlapDescription(streamptr, varID, levelID, &swapxy, start, count); - const int vlistID = streamptr->vlistID; - const int gridId = vlistInqVarGrid(vlistID, varID); - const size_t length = gridInqSize(gridId); + int vlistID = streamptr->vlistID; + int gridId = vlistInqVarGrid(vlistID, varID); + size_t length = gridInqSize(gridId); cdfReadDataDP(streamptr, varID, length, start, count, data); if (swapxy) transpose2dArrayDP(gridId, data); @@ -715,12 +734,12 @@ cdfReadVarSliceSP(stream_t *streamptr, int varID, int levelID, float *data, size if (CDI_Debug) Message("streamID = %d varID = %d levelID = %d", streamptr->self, varID, levelID); bool swapxy = false; - size_t start[MAX_DIMENSIONS], count[MAX_DIMENSIONS]; - cdfGetSliceSlapDescription(streamptr, varID, levelID, &swapxy, &start, &count); + size_t start[cdfSliceNDim], count[cdfSliceNDim]; + cdfGetSliceSlapDescription(streamptr, varID, levelID, &swapxy, start, count); - const int vlistID = streamptr->vlistID; - const int gridId = vlistInqVarGrid(vlistID, varID); - const size_t length = gridInqSize(gridId); + int vlistID = streamptr->vlistID; + int gridId = vlistInqVarGrid(vlistID, varID); + size_t length = gridInqSize(gridId); cdfReadDataSP(streamptr, varID, length, start, count, data); if (swapxy) transpose2dArraySP(gridId, data); @@ -742,11 +761,11 @@ cdf_read_record(stream_t *streamptr, int memtype, void *data, size_t *nmiss) { if (CDI_Debug) Message("streamID = %d", streamptr->self); - const int tsID = streamptr->curTsID; - const int vrecID = streamptr->tsteps[tsID].curRecID; - const int recID = streamptr->tsteps[tsID].recIDs[vrecID]; - const int varID = streamptr->tsteps[tsID].records[recID].varID; - const int levelID = streamptr->tsteps[tsID].records[recID].levelID; + int tsID = streamptr->curTsID; + int vrecID = streamptr->tsteps[tsID].curRecID; + int recID = streamptr->tsteps[tsID].recIDs[vrecID]; + int varID = streamptr->tsteps[tsID].records[recID].varID; + int levelID = streamptr->tsteps[tsID].records[recID].levelID; if (memtype == MEMTYPE_DOUBLE) cdfReadVarSliceDP(streamptr, varID, levelID, (double *) data, nmiss); @@ -766,14 +785,14 @@ cdfReadVarSliceDPPart(stream_t *streamptr, int varID, int levelID, int varType, if (CDI_Debug) Message("streamID = %d varID = %d levelID = %d", streamptr->self, varID, levelID); - const int vlistID = streamptr->vlistID; + int vlistID = streamptr->vlistID; bool swapxy = false; - size_t start[MAX_DIMENSIONS], count[MAX_DIMENSIONS]; - cdfGetSliceSlapDescription(streamptr, varID, levelID, &swapxy, &start, &count); + size_t start[cdfSliceNDim], count[cdfSliceNDim]; + cdfGetSliceSlapDescription(streamptr, varID, levelID, &swapxy, start, count); - const int gridId = vlistInqVarGrid(vlistID, varID); - const size_t gridsize = gridInqSize(gridId); + int gridId = vlistInqVarGrid(vlistID, varID); + size_t gridsize = gridInqSize(gridId); unsigned int position = 0; for (int i = 0; i < MAX_DIMENSIONS; ++i) @@ -797,13 +816,13 @@ cdfReadVarSliceSPPart(stream_t *streamptr, int varID, int levelID, int varType, if (CDI_Debug) Message("streamID = %d varID = %d levelID = %d", streamptr->self, varID, levelID); - const int vlistID = streamptr->vlistID; + int vlistID = streamptr->vlistID; bool swapxy = false; - size_t start[MAX_DIMENSIONS], count[MAX_DIMENSIONS]; - cdfGetSliceSlapDescription(streamptr, varID, levelID, &swapxy, &start, &count); + size_t start[cdfSliceNDim], count[cdfSliceNDim]; + cdfGetSliceSlapDescription(streamptr, varID, levelID, &swapxy, start, count); - const int gridId = vlistInqVarGrid(vlistID, varID); + int gridId = vlistInqVarGrid(vlistID, varID); size_t gridsize = gridInqSize(gridId); unsigned int position = 0; @@ -832,7 +851,7 @@ cdiStreamReadVarSlicePart(int streamID, int varID, int levelID, int varType, int check_parg(nmiss); stream_t *streamptr = stream_to_pointer(streamID); - const int filetype = streamptr->filetype; + int filetype = streamptr->filetype; *nmiss = 0; @@ -874,13 +893,13 @@ cdfReadVarDPPart(stream_t *streamptr, int varID, int varType, int startpoint, si (void) (varType); if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); - const int vlistID = streamptr->vlistID; - const int ncvarid = streamptr->vars[varID].ncvarid; + int vlistID = streamptr->vlistID; + int ncvarid = streamptr->vars[varID].ncvarid; size_t start[MAX_DIMENSIONS], count[MAX_DIMENSIONS]; cdfGetSlapDescription(streamptr, varID, &start, &count); - const int ltime = (TIME_CONSTANT != vlistInqVarTimetype(vlistID, varID)); + int ltime = (TIME_CONSTANT != vlistInqVarTimetype(vlistID, varID)); start[1 + ltime] = start[1 + ltime] + startpoint; count[1 + ltime] = length; @@ -895,13 +914,13 @@ cdfReadVarSPPart(stream_t *streamptr, int varID, int varType, int startpoint, si (void) (varType); if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); - const int vlistID = streamptr->vlistID; - const int ncvarid = streamptr->vars[varID].ncvarid; + int vlistID = streamptr->vlistID; + int ncvarid = streamptr->vars[varID].ncvarid; size_t start[MAX_DIMENSIONS], count[MAX_DIMENSIONS]; cdfGetSlapDescription(streamptr, varID, &start, &count); - const int ltime = (TIME_CONSTANT != vlistInqVarTimetype(vlistID, varID)); + int ltime = (TIME_CONSTANT != vlistInqVarTimetype(vlistID, varID)); start[1 + ltime] = start[1 + ltime] + startpoint; count[1 + ltime] = length; @@ -920,7 +939,7 @@ cdiStreamReadVarPart(int streamID, int varID, int varType, int start, size_t siz check_parg(nmiss); stream_t *streamptr = stream_to_pointer(streamID); - const int filetype = streamptr->filetype; + int filetype = streamptr->filetype; *nmiss = 0; diff --git a/src/cdf_records.c b/src/cdf_records.c new file mode 100644 index 0000000000000000000000000000000000000000..6b873fbdea426f1adcec21d98f856cfef68d47ff --- /dev/null +++ b/src/cdf_records.c @@ -0,0 +1,121 @@ +#include "dmemory.h" +#include "cdi_int.h" + +static void +cdf_init_timestep(tsteps_t *timeStep, int numRecs, int numRecsAvail) +{ + timeStep->records = (record_t *) Malloc((size_t) numRecs * sizeof(record_t)); + timeStep->nrecs = numRecsAvail; + timeStep->nallrecs = numRecs; + timeStep->recordSize = numRecs; + timeStep->curRecID = CDI_UNDEFID; +} + +static int +cdf_get_numRecsAvail(int vlistID) +{ + int numRecsAvail = 0; + int numVars = vlistNvars(vlistID); + for (int varID = 0; varID < numVars; varID++) + { + if (vlistInqVarTimetype(vlistID, varID) != TIME_CONSTANT) + { + numRecsAvail += zaxisInqSize(vlistInqVarZaxis(vlistID, varID)); + } + } + return numRecsAvail; +} + +static void +cdf_init_records_step0(int numRecs, int *recIDs, record_t *records, int vlistID) +{ + for (int recID = 0; recID < numRecs; recID++) recIDs[recID] = recID; + + int numVars = vlistNvars(vlistID); + for (int varID = 0, recID = 0; varID < numVars; varID++) + { + int zaxisID = vlistInqVarZaxis(vlistID, varID); + int nlevels = zaxisInqSize(zaxisID); + for (int levelID = 0; levelID < nlevels; levelID++) + { + recordInitEntry(&records[recID]); + records[recID].varID = (short) varID; + records[recID].levelID = levelID; + recID++; + } + } +} + +static void +cdf_init_records_step1(int numRecs, int *recIDs, record_t *records, int vlistID) +{ + for (int recID = 0, vrecID = 0; recID < numRecs; recID++) + { + if (vlistInqVarTimetype(vlistID, records[recID].varID) != TIME_CONSTANT) + { + recIDs[vrecID++] = recID; + } + } +} + +void +cdf_create_records(stream_t *streamptr, int tsID) +{ + if (tsID < 0 || (tsID >= streamptr->ntsteps && tsID > 0)) return; + + if (streamptr->tsteps[tsID].nallrecs > 0) return; + + int vlistID = streamptr->vlistID; + + tsteps_t *sourceTstep = streamptr->tsteps; + tsteps_t *destTstep = sourceTstep + tsID; + + int numRecs = vlistNrecs(vlistID); + if (numRecs <= 0) return; + + if (tsID == 0) + { + int numRecsAvail = numRecs; // use all records at first timestep + + streamptr->nrecs += numRecs; + + cdf_init_timestep(destTstep, numRecs, numRecsAvail); + + destTstep->recIDs = (int *) Malloc((size_t) numRecsAvail * sizeof(int)); + cdf_init_records_step0(numRecs, destTstep->recIDs, destTstep->records, vlistID); + } + else if (tsID == 1) + { + int numRecsAvail = cdf_get_numRecsAvail(vlistID); + + streamptr->nrecs += numRecsAvail; + + cdf_init_timestep(destTstep, numRecs, numRecsAvail); + + memcpy(destTstep->records, sourceTstep->records, (size_t) numRecs * sizeof(record_t)); + + if (numRecsAvail) + { + destTstep->recIDs = (int *) Malloc((size_t) numRecsAvail * sizeof(int)); + cdf_init_records_step1(numRecs, destTstep->recIDs, destTstep->records, vlistID); + } + } + else + { + if (streamptr->tsteps[1].records == 0) cdf_create_records(streamptr, 1); + + int numRecsAvail = streamptr->tsteps[1].nrecs; + + streamptr->nrecs += numRecsAvail; + + cdf_init_timestep(destTstep, numRecs, numRecsAvail); + + memcpy(destTstep->records, sourceTstep->records, (size_t) numRecs * sizeof(record_t)); + + if (numRecsAvail) + { + destTstep->recIDs = (int *) Malloc((size_t) numRecsAvail * sizeof(int)); + memcpy(destTstep->recIDs, streamptr->tsteps[1].recIDs, (size_t) numRecsAvail * sizeof(int)); + } + } +} diff --git a/src/cdf_util.c b/src/cdf_util.c index 7735fbf1b51614374aedd7a0cdf8a12241747b6e..73cd87caddeade3aff8620f8b072c25a2246401e 100644 --- a/src/cdf_util.c +++ b/src/cdf_util.c @@ -8,7 +8,7 @@ #include "error.h" char * -strToLower(char *str) +str_to_lower(char *str) { if (str) for (size_t i = 0; str[i]; ++i) str[i] = (char) tolower((int) str[i]); @@ -63,16 +63,14 @@ is_time_units(const char *timeunits) while (isspace(*timeunits)) timeunits++; // clang-format off - bool status = strStartsWith(timeunits, "sec") - || strStartsWith(timeunits, "minute") - || strStartsWith(timeunits, "hour") - || strStartsWith(timeunits, "day") - || strStartsWith(timeunits, "month") - || strStartsWith(timeunits, "calendar_month") - || strStartsWith(timeunits, "year"); + return (strStartsWith(timeunits, "sec") + || strStartsWith(timeunits, "minute") + || strStartsWith(timeunits, "hour") + || strStartsWith(timeunits, "day") + || strStartsWith(timeunits, "month") + || strStartsWith(timeunits, "calendar_month") + || strStartsWith(timeunits, "year")); // clang-format on - - return status; } bool @@ -82,20 +80,19 @@ is_timeaxis_units(const char *timeunits) const size_t len = strlen(timeunits); char *tu = (char *) malloc((len + 1) * sizeof(char)); - memcpy(tu, timeunits, (len + 1) * sizeof(char)); - char *ptu = tu; - for (size_t i = 0; i < len; i++) ptu[i] = (char) tolower((int) ptu[i]); + for (size_t i = 0; i < len; i++) tu[i] = (char) tolower((int) timeunits[i]); - int timeunit = get_time_units(len, ptu); + int timeunit = get_time_units(len, tu); if (timeunit != -1) { - while (!isspace(*ptu) && *ptu != 0) ptu++; - if (*ptu) + size_t pos = 0; + while (!isspace(tu[pos]) && tu[pos] != 0) pos++; + if (tu[pos]) { - while (isspace(*ptu)) ptu++; - int timetype = strStartsWith(ptu, "as") ? TAXIS_ABSOLUTE : strStartsWith(ptu, "since") ? TAXIS_RELATIVE : -1; - status = (timetype != -1); + while (isspace(tu[pos])) pos++; + + status = strStartsWith(tu + pos, "as") || strStartsWith(tu + pos, "since"); } } @@ -107,79 +104,76 @@ is_timeaxis_units(const char *timeunits) bool is_height_units(const char *units) { - const int u0 = units[0]; + int u0 = units[0]; // clang-format off - bool status = (u0=='m' && (!units[1] || strStartsWith(units, "meter"))) - || (!units[2] && units[1]=='m' && (u0=='c' || u0=='d' || u0=='k')) - || (strStartsWith(units, "decimeter")) - || (strStartsWith(units, "centimeter")) - || (strStartsWith(units, "millimeter")) - || (strStartsWith(units, "kilometer")); + return ((u0=='m' && (!units[1] || strStartsWith(units, "meter"))) + || (!units[2] && units[1]=='m' && (u0=='c' || u0=='d' || u0=='k')) + || (strStartsWith(units, "decimeter")) + || (strStartsWith(units, "centimeter")) + || (strStartsWith(units, "millimeter")) + || (strStartsWith(units, "kilometer"))); // clang-format on - - return status; } bool is_pressure_units(const char *units) { // clang-format off - bool status = strStartsWith(units, "millibar") - || strStartsWith(units, "mb") - || strStartsWith(units, "hectopas") - || strStartsWith(units, "hPa") - || strStartsWith(units, "Pa"); + return (strStartsWith(units, "millibar") + || strStartsWith(units, "mb") + || strStartsWith(units, "hectopas") + || strStartsWith(units, "hPa") + || strStartsWith(units, "Pa")); // clang-format on - - return status; } bool is_DBL_axis(const char *longname) { // clang-format off - bool status = strIsEqual(longname, "depth below land") - || strIsEqual(longname, "depth_below_land") - || strIsEqual(longname, "levels below the surface"); + return (str_is_equal(longname, "depth below land") + || str_is_equal(longname, "depth_below_land") + || str_is_equal(longname, "levels below the surface")); // clang-format on - - return status; } bool is_depth_axis(const char *stdname, const char *longname) { // clang-format off - bool status = strIsEqual(stdname, "depth") - || strIsEqual(longname, "depth_below_sea") - || strIsEqual(longname, "depth below sea"); + return (str_is_equal(stdname, "depth") + || str_is_equal(longname, "depth_below_sea") + || str_is_equal(longname, "depth below sea")); // clang-format ofn - - return status; } bool is_height_axis(const char *stdname, const char *longname) { // clang-format off - bool status = strIsEqual(stdname, "height") - || strIsEqual(longname, "height") - || strIsEqual(longname, "height above the surface"); + return (str_is_equal(stdname, "height") + || str_is_equal(longname, "height") + || str_is_equal(longname, "height above the surface")); // clang-format on - - return status; } bool is_altitude_axis(const char *stdname, const char *longname) { // clang-format off - bool status = strIsEqual(stdname, "altitude") - || strIsEqual(longname, "altitude"); + return (str_is_equal(stdname, "altitude") + || str_is_equal(longname, "altitude")); // clang-format on +} - return status; +bool +is_reference_axis(const char *stdname, const char *longname) +{ + // clang-format off + return ((str_is_equal(longname, "generalized_height") || str_is_equal(longname, "generalized height")) + && str_is_equal(stdname, "height")); + // clang-format on } bool @@ -190,7 +184,7 @@ is_lon_axis(const char *units, const char *stdname) memcpy(lc_units, units, 15); lc_units[15] = 0; - strToLower(lc_units); + str_to_lower(lc_units); if ((strStartsWith(lc_units, "degree") || strStartsWith(lc_units, "radian")) && (strStartsWith(stdname, "grid_longitude") || strStartsWith(stdname, "longitude"))) @@ -217,7 +211,7 @@ is_lat_axis(const char *units, const char *stdname) memcpy(lc_units, units, 15); lc_units[15] = 0; - strToLower(lc_units); + str_to_lower(lc_units); if ((strStartsWith(lc_units, "degree") || strStartsWith(lc_units, "radian")) && (strStartsWith(stdname, "grid_latitude") || strStartsWith(stdname, "latitude"))) @@ -240,34 +234,34 @@ bool is_x_axis(const char *units, const char *stdname) { (void) units; - return (strIsEqual(stdname, "projection_x_coordinate")); + return (str_is_equal(stdname, "projection_x_coordinate")); } bool is_y_axis(const char *units, const char *stdname) { (void) units; - return (strIsEqual(stdname, "projection_y_coordinate")); + return (str_is_equal(stdname, "projection_y_coordinate")); } void cdf_set_gridtype(const char *attstring, int *gridtype) { // clang-format off - if (strIsEqual(attstring, "gaussian_reduced")) *gridtype = GRID_GAUSSIAN_REDUCED; - else if (strIsEqual(attstring, "gaussian")) *gridtype = GRID_GAUSSIAN; + if (str_is_equal(attstring, "gaussian_reduced")) *gridtype = GRID_GAUSSIAN_REDUCED; + else if (str_is_equal(attstring, "gaussian")) *gridtype = GRID_GAUSSIAN; else if (strStartsWith(attstring, "spectral")) *gridtype = GRID_SPECTRAL; else if (strStartsWith(attstring, "fourier")) *gridtype = GRID_FOURIER; - else if (strIsEqual(attstring, "trajectory")) *gridtype = GRID_TRAJECTORY; - else if (strIsEqual(attstring, "generic")) *gridtype = GRID_GENERIC; - else if (strIsEqual(attstring, "cell")) *gridtype = GRID_UNSTRUCTURED; - else if (strIsEqual(attstring, "unstructured")) *gridtype = GRID_UNSTRUCTURED; - else if (strIsEqual(attstring, "curvilinear")) ; - else if (strIsEqual(attstring, "characterxy")) *gridtype = GRID_CHARXY; - else if (strIsEqual(attstring, "sinusoidal")) ; - else if (strIsEqual(attstring, "laea")) ; - else if (strIsEqual(attstring, "lcc2")) ; - else if (strIsEqual(attstring, "linear")) ; // ignore grid type linear + else if (str_is_equal(attstring, "trajectory")) *gridtype = GRID_TRAJECTORY; + else if (str_is_equal(attstring, "generic")) *gridtype = GRID_GENERIC; + else if (str_is_equal(attstring, "cell")) *gridtype = GRID_UNSTRUCTURED; + else if (str_is_equal(attstring, "unstructured")) *gridtype = GRID_UNSTRUCTURED; + else if (str_is_equal(attstring, "curvilinear")) ; + else if (str_is_equal(attstring, "characterxy")) *gridtype = GRID_CHARXY; + else if (str_is_equal(attstring, "sinusoidal")) ; + else if (str_is_equal(attstring, "laea")) ; + else if (str_is_equal(attstring, "lcc2")) ; + else if (str_is_equal(attstring, "linear")) ; // ignore grid type linear else { static bool warn = true; @@ -284,18 +278,18 @@ void cdf_set_zaxistype(const char *attstring, int *zaxistype) { // clang-format off - if (strIsEqual(attstring, "toa")) *zaxistype = ZAXIS_TOA; - else if (strIsEqual(attstring, "tropopause")) *zaxistype = ZAXIS_TROPOPAUSE; - else if (strIsEqual(attstring, "cloudbase")) *zaxistype = ZAXIS_CLOUD_BASE; - else if (strIsEqual(attstring, "cloudtop")) *zaxistype = ZAXIS_CLOUD_TOP; - else if (strIsEqual(attstring, "isotherm0")) *zaxistype = ZAXIS_ISOTHERM_ZERO; - else if (strIsEqual(attstring, "seabottom")) *zaxistype = ZAXIS_SEA_BOTTOM; - else if (strIsEqual(attstring, "lakebottom")) *zaxistype = ZAXIS_LAKE_BOTTOM; - else if (strIsEqual(attstring, "sedimentbottom")) *zaxistype = ZAXIS_SEDIMENT_BOTTOM; - else if (strIsEqual(attstring, "sedimentbottomta")) *zaxistype = ZAXIS_SEDIMENT_BOTTOM_TA; - else if (strIsEqual(attstring, "sedimentbottomtw")) *zaxistype = ZAXIS_SEDIMENT_BOTTOM_TW; - else if (strIsEqual(attstring, "mixlayer")) *zaxistype = ZAXIS_MIX_LAYER; - else if (strIsEqual(attstring, "atmosphere")) *zaxistype = ZAXIS_ATMOSPHERE; + if (str_is_equal(attstring, "toa")) *zaxistype = ZAXIS_TOA; + else if (str_is_equal(attstring, "tropopause")) *zaxistype = ZAXIS_TROPOPAUSE; + else if (str_is_equal(attstring, "cloudbase")) *zaxistype = ZAXIS_CLOUD_BASE; + else if (str_is_equal(attstring, "cloudtop")) *zaxistype = ZAXIS_CLOUD_TOP; + else if (str_is_equal(attstring, "isotherm0")) *zaxistype = ZAXIS_ISOTHERM_ZERO; + else if (str_is_equal(attstring, "seabottom")) *zaxistype = ZAXIS_SEA_BOTTOM; + else if (str_is_equal(attstring, "lakebottom")) *zaxistype = ZAXIS_LAKE_BOTTOM; + else if (str_is_equal(attstring, "sedimentbottom")) *zaxistype = ZAXIS_SEDIMENT_BOTTOM; + else if (str_is_equal(attstring, "sedimentbottomta")) *zaxistype = ZAXIS_SEDIMENT_BOTTOM_TA; + else if (str_is_equal(attstring, "sedimentbottomtw")) *zaxistype = ZAXIS_SEDIMENT_BOTTOM_TW; + else if (str_is_equal(attstring, "mixlayer")) *zaxistype = ZAXIS_MIX_LAYER; + else if (str_is_equal(attstring, "atmosphere")) *zaxistype = ZAXIS_ATMOSPHERE; else { static bool warn = true; diff --git a/src/cdf_util.h b/src/cdf_util.h index 22f5061a409255bdc6d012f98c34391d2322ca32..021f0467a32740a3c326272291a62dd21b9c24c6 100644 --- a/src/cdf_util.h +++ b/src/cdf_util.h @@ -3,6 +3,8 @@ #include <stdbool.h> +bool xtypeIsText(int xtype); + int get_time_units(size_t len, const char *ptu); bool is_time_units(const char *timeunits); @@ -14,6 +16,7 @@ bool is_DBL_axis(/*const char *units,*/ const char *longname); bool is_depth_axis(const char *stdname, const char *longname); bool is_height_axis(const char *stdname, const char *longname); bool is_altitude_axis(const char *stdname, const char *longname); +bool is_reference_axis(const char *stdname, const char *longname); bool is_lon_axis(const char *units, const char *stdname); bool is_lat_axis(const char *units, const char *stdname); diff --git a/src/cdf_write.c b/src/cdf_write.c index 679defba8f11cf0d8cdbb30b526baf5472a8c879..fc55629327f24ce937de6220b3d79e5955db2263 100644 --- a/src/cdf_write.c +++ b/src/cdf_write.c @@ -13,17 +13,38 @@ #include "vlist.h" #include "vlist_var.h" +//#include <netcdf_filter.h> + void -cdfDefVarDeflate(int ncid, int ncvarID, int deflate_level) +cdf_def_var_filter(int ncid, int ncvarID, unsigned int id, size_t nparams, const unsigned int *params) +{ +#ifdef HAVE_NETCDF4 + int status; + if ((status = nc_def_var_filter(ncid, ncvarID, id, nparams, params))) + { + Error("nc_def_var_filter failed; %s", nc_strerror(status)); + } +#else + static bool lwarn = true; + if (lwarn) + { + lwarn = false; + Warning("filter failed, NetCDF4 not available!"); + } +#endif +} + +void +cdfDefVarDeflate(int ncid, int ncvarID, int compLevel) { #ifdef HAVE_NETCDF4 // Set chunking, shuffle, and deflate. - const int shuffle = 1, deflate = 1; + int shuffle = (CDI_Shuffle > 0), deflate = 1; - if (deflate_level < 1 || deflate_level > 9) deflate_level = 1; + if (compLevel < 1 || compLevel > 9) compLevel = 1; int status; - if ((status = nc_def_var_deflate(ncid, ncvarID, shuffle, deflate, deflate_level))) + if ((status = nc_def_var_deflate(ncid, ncvarID, shuffle, deflate, compLevel))) { Error("nc_def_var_deflate failed; %s", nc_strerror(status)); } @@ -73,7 +94,7 @@ cdfTypeComplexFloat(stream_t *streamptr) { float r, i; } complex_float; - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; int nc_complex_id; int status; status = nc_def_compound(fileID, sizeof(complex_float), "complex_float", &nc_complex_id); @@ -97,7 +118,7 @@ cdfTypeComplexDouble(stream_t *streamptr) { double r, i; } complex_double; - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; int nc_complex_id; int status; status = nc_def_compound(fileID, sizeof(complex_double), "complex_double", &nc_complex_id); @@ -163,10 +184,10 @@ cdfDefVarMissval(stream_t *streamptr, int varID, int dtype, int lcheck) { if (streamptr->vars[varID].defmiss == false) { - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; - const int ncvarID = streamptr->vars[varID].ncvarid; - const double missval = vlistInqVarMissval(vlistID, varID); + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int ncvarID = streamptr->vars[varID].ncvarid; + double missval = vlistInqVarMissval(vlistID, varID); if (lcheck && streamptr->ncmode == 2) cdf_redef(fileID); @@ -179,7 +200,7 @@ cdfDefVarMissval(stream_t *streamptr, int varID, int dtype, int lcheck) cdf_put_att_double(fileID, ncvarID, "missing_value", xtype, 1, &missval); - if (lcheck && streamptr->ncmode == 2) cdf_enddef(fileID); + if (lcheck && streamptr->ncmode == 2) cdf_enddef(fileID, streamptr->self); streamptr->vars[varID].defmiss = true; } @@ -188,21 +209,21 @@ cdfDefVarMissval(stream_t *streamptr, int varID, int dtype, int lcheck) static void cdfDefInstituteGlobal(const stream_t *streamptr) { - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; - const int instID = vlistInqInstitut(vlistID); + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int instID = vlistInqInstitut(vlistID); if (instID != CDI_UNDEFID) { const char *longname = institutInqLongnamePtr(instID); if (longname) { - const size_t len = strlen(longname); + size_t len = strlen(longname); if (len > 0) { if (streamptr->ncmode == 2) cdf_redef(fileID); cdf_put_att_text(fileID, NC_GLOBAL, "institution", len, longname); - if (streamptr->ncmode == 2) cdf_enddef(fileID); + if (streamptr->ncmode == 2) cdf_enddef(fileID, streamptr->self); } } } @@ -211,9 +232,9 @@ cdfDefInstituteGlobal(const stream_t *streamptr) static void cdfDefSourceGlobal(const stream_t *streamptr) { - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; - const int modelID = vlistInqModel(vlistID); + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int modelID = vlistInqModel(vlistID); if (modelID != CDI_UNDEFID) { @@ -225,7 +246,7 @@ cdfDefSourceGlobal(const stream_t *streamptr) { if (streamptr->ncmode == 2) cdf_redef(fileID); cdf_put_att_text(fileID, NC_GLOBAL, "source", len, longname); - if (streamptr->ncmode == 2) cdf_enddef(fileID); + if (streamptr->ncmode == 2) cdf_enddef(fileID, streamptr->self); } } } @@ -246,13 +267,13 @@ static void cdfDefineCellMethods(stream_t *streamptr, int cdiID, int varID, int fileID, int ncvarID) { taxis_t *taxis = &streamptr->tsteps[0].taxis; - if (!taxis->has_bounds) return; + if (!taxis->hasBounds) return; - const int timeVarId = streamptr->basetime.ncvarid; + int timeVarId = streamptr->basetime.ncvarid; char timeVarName[CDI_MAX_NAME]; cdf_inq_varname(fileID, timeVarId, timeVarName); - const int stepType = vlistInqVarTsteptype(cdiID, varID); + int stepType = vlistInqVarTsteptype(cdiID, varID); const char *cellMethod = NULL; // clang-format off @@ -267,7 +288,7 @@ cdfDefineCellMethods(stream_t *streamptr, int cdiID, int varID, int fileID, int { const char *attname = "cell_methods"; char atttxt[CDI_MAX_NAME + 10]; - sprintf(atttxt, "%s: %s", timeVarName, cellMethod); + snprintf(atttxt, sizeof(atttxt), "%s: %s", timeVarName, cellMethod); cdf_put_att_text(fileID, ncvarID, attname, strlen(atttxt), atttxt); } } @@ -291,7 +312,7 @@ cdfDefineAttributes(int cdiID, int varID, int fileID, int ncvarID) if (atttype == CDI_DATATYPE_TXT) { - const size_t attSize = (size_t) attlen * sizeof(char); + size_t attSize = (size_t) attlen * sizeof(char); char *atttxt = (char *) resizeBuf(&attBuf, &attBufSize, attSize); cdiInqAttTxt(cdiID, varID, attname, attlen, atttxt); size_t len = (size_t) attlen; @@ -301,7 +322,7 @@ cdfDefineAttributes(int cdiID, int varID, int fileID, int ncvarID) || atttype == CDI_DATATYPE_UINT16 || atttype == CDI_DATATYPE_INT32 || atttype == CDI_DATATYPE_UINT32) { if (attlen == 0) continue; - const size_t attSize = (size_t) attlen * sizeof(int); + size_t attSize = (size_t) attlen * sizeof(int); int *attint = (int *) resizeBuf(&attBuf, &attBufSize, attSize); cdiInqAttInt(cdiID, varID, attname, attlen, &attint[0]); size_t len = (size_t) attlen; @@ -320,7 +341,7 @@ cdfDefineAttributes(int cdiID, int varID, int fileID, int ncvarID) else if (atttype == CDI_DATATYPE_FLT32 || atttype == CDI_DATATYPE_FLT64) { if (attlen == 0) continue; - const size_t attSize = (size_t) attlen * sizeof(double); + size_t attSize = (size_t) attlen * sizeof(double); double *attflt = (double *) resizeBuf(&attBuf, &attBufSize, attSize); cdiInqAttFlt(cdiID, varID, attname, attlen, attflt); size_t len = (size_t) attlen; @@ -337,13 +358,13 @@ cdfDefineAttributes(int cdiID, int varID, int fileID, int ncvarID) } } - Free(attBuf); + if (attBuf) Free(attBuf); } static void cdfDefineInstituteName(int vlistID, int varID, int fileID, int ncvarID) { - const int instID = vlistInqVarInstitut(vlistID, varID); + int instID = vlistInqVarInstitut(vlistID, varID); if (instID != CDI_UNDEFID) { const char *name = institutInqNamePtr(instID); @@ -356,8 +377,8 @@ cdfDefGlobalAtts(stream_t *streamptr) { if (streamptr->globalatts) return; - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; cdfDefSourceGlobal(streamptr); cdfDefInstituteGlobal(streamptr); @@ -369,7 +390,7 @@ cdfDefGlobalAtts(stream_t *streamptr) cdfDefineAttributes(vlistID, CDI_GLOBAL, fileID, NC_GLOBAL); - if (natts > 0 && streamptr->ncmode == 2) cdf_enddef(fileID); + if (natts > 0 && streamptr->ncmode == 2) cdf_enddef(fileID, streamptr->self); streamptr->globalatts = 1; } @@ -393,8 +414,8 @@ static int nc_grid_index(stream_t *streamptr, int gridID) { int index = 0; - const int vlistID = streamptr->vlistID; - const int ngrids = vlistNgrids(vlistID); + int vlistID = streamptr->vlistID; + int ngrids = vlistNgrids(vlistID); for (index = 0; index < ngrids; ++index) if (streamptr->ncgrid[index].gridID == gridID) break; @@ -421,6 +442,27 @@ xtype2ppb(nc_type xtype) return ppb; } +static void +cdfDefVarFilter(const stream_t *s, int ncvarID) +{ + if (s->filterId != 0) + { + if (s->filetype == CDI_FILETYPE_NC4 || s->filetype == CDI_FILETYPE_NC4C || s->filetype == CDI_FILETYPE_NCZARR) + { + cdf_def_var_filter(s->fileID, ncvarID, s->filterId, s->numParams, s->params); + } + else + { + static bool lwarn = true; + if (lwarn) + { + lwarn = false; + Warning("Filter is only available for NetCDF4!"); + } + } + } +} + static void cdfDefVarCompression(const stream_t *streamptr, int ncvarID, nc_type xtype) { @@ -441,6 +483,25 @@ cdfDefVarCompression(const stream_t *streamptr, int ncvarID, nc_type xtype) } } } + /* + else if (streamptr->comptype == CDI_COMPRESS_ZSTD) + { + if (streamptr->filetype == CDI_FILETYPE_NC4 || streamptr->filetype == CDI_FILETYPE_NC4C + || streamptr->filetype == CDI_FILETYPE_NCZARR) + { + cdfDefVarZstd(streamptr->fileID, ncvarID, streamptr->complevel); + } + else + { + static bool lwarn = true; + if (lwarn) + { + lwarn = false; + Warning("SZIP compression is only available for NetCDF4!"); + } + } + } + */ else if (streamptr->comptype == CDI_COMPRESS_SZIP) { if (streamptr->filetype == CDI_FILETYPE_NC4 || streamptr->filetype == CDI_FILETYPE_NC4C @@ -465,12 +526,11 @@ cdfDefVarPacking(const stream_t *streamptr, int ncvarID, nc_type xtype, int vlis { // if ( xtype == NC_BYTE || xtype == NC_SHORT || xtype == NC_INT ) { - const double addoffset = vlistInqVarAddoffset(vlistID, varID); - const double scalefactor = vlistInqVarScalefactor(vlistID, varID); - const bool laddoffset = IS_NOT_EQUAL(addoffset, 0); - const bool lscalefactor = IS_NOT_EQUAL(scalefactor, 1); + double addoffset = 0.0, scalefactor = 1.0; + bool haveAddoffset = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_ADDOFFSET, &addoffset) == CDI_NOERR); + bool haveScalefactor = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_SCALEFACTOR, &scalefactor) == CDI_NOERR); - if (laddoffset || lscalefactor) + if (haveAddoffset || haveScalefactor) { nc_type astype = (xtype == NC_FLOAT) ? NC_FLOAT : NC_DOUBLE; if ((astype == NC_DOUBLE) && IS_EQUAL(addoffset, (double) ((float) addoffset)) @@ -500,12 +560,12 @@ static void cdfDefineCoordinates(const stream_t *streamptr, int ncvarID, int nczvarID, int gridtype, int gridID, int gridindex, int xid, int yid, size_t gridsize, char axis[5], size_t iax) { - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; if (gridtype != GRID_GENERIC && gridtype != GRID_LONLAT && gridtype != GRID_PROJECTION && gridtype != GRID_CURVILINEAR && gridtype != GRID_CHARXY) { - const size_t len = strlen(gridNamePtr(gridtype)); + size_t len = strlen(gridNamePtr(gridtype)); if (len > 0) cdf_put_att_text(fileID, ncvarID, "CDI_grid_type", len, gridNamePtr(gridtype)); } @@ -516,29 +576,29 @@ cdfDefineCoordinates(const stream_t *streamptr, int ncvarID, int nczvarID, int g if (gridtype == GRID_GAUSSIAN || gridtype == GRID_GAUSSIAN_REDUCED) { - const int numLPE = gridInqNP(gridID); + int numLPE = gridInqNP(gridID); if (numLPE > 0) cdf_put_att_int(fileID, ncvarID, "CDI_grid_num_LPE", NC_INT, 1, &numLPE); } if (gridtype == GRID_GAUSSIAN_REDUCED) { - const int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; + int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; if (ncyvarID != CDI_UNDEFID) { char name[CDI_MAX_NAME]; name[0] = 0; cdf_inq_varname(fileID, ncyvarID, name); - const size_t len = strlen(name); + size_t len = strlen(name); cdf_put_att_text(fileID, ncvarID, "CDI_grid_latitudes", len, name); } - const int ncrpvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_RP]; + int ncrpvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_RP]; if (ncrpvarID != CDI_UNDEFID) { char name[CDI_MAX_NAME]; name[0] = 0; cdf_inq_varname(fileID, ncrpvarID, name); - const size_t len = strlen(name); + size_t len = strlen(name); cdf_put_att_text(fileID, ncvarID, "CDI_grid_reduced_points", len, name); } } @@ -556,25 +616,25 @@ cdfDefineCoordinates(const stream_t *streamptr, int ncvarID, int nczvarID, int g } else if (gridtype == GRID_LONLAT && xid == CDI_UNDEFID && yid == CDI_UNDEFID && gridsize == 1) { - const int ncxvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X]; - const int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; + int ncxvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X]; + int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; cdfAppendCoordinates(fileID, ncyvarID, coordinates); cdfAppendCoordinates(fileID, ncxvarID, coordinates); } else if (gridtype == GRID_GAUSSIAN_REDUCED) { /* - const int ncxvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X]; - const int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; + int ncxvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X]; + int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; cdfAppendCoordinates(fileID, ncyvarID, coordinates); cdfAppendCoordinates(fileID, ncxvarID, coordinates); */ } else if (gridtype == GRID_UNSTRUCTURED || gridtype == GRID_CURVILINEAR) { - const int ncxvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X]; - const int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; - const int ncavarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_A]; + int ncxvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X]; + int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; + int ncavarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_A]; // CMOR order: coordinates = "lat lon" if (CDI_Coordinates_Lon_Lat) { @@ -614,17 +674,17 @@ cdfDefineCoordinates(const stream_t *streamptr, int ncvarID, int nczvarID, int g { if (gridInqXIsc(gridID)) { - const int ncxvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X]; + int ncxvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X]; cdfAppendCoordinates(fileID, ncxvarID, coordinates); } else if (gridInqYIsc(gridID)) { - const int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; + int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y]; cdfAppendCoordinates(fileID, ncyvarID, coordinates); } } - const size_t len = strlen(coordinates); + size_t len = strlen(coordinates); if (len) cdf_put_att_text(fileID, ncvarID, "coordinates", len, coordinates); } @@ -643,7 +703,7 @@ calc_chunksize(size_t chunkSizeLim, size_t size) } static const size_t chunkSizeMax = 65536; -static const size_t chunkSizeLim = 16777216; +static const size_t chunkSizeLim = 1048576; size_t calc_chunksize_y(int chunkType, size_t gridsize, size_t xsize, size_t ysize) @@ -667,8 +727,8 @@ static int cdfDefineDimsAndChunks(const stream_t *streamptr, int varID, int xid, int yid, int zid, size_t gridsize, const int dimorder[3], int dims[4], bool useChunks, size_t chunks[4], char axis[5], size_t *piax) { - const int fileID = streamptr->fileID; - const int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; size_t iax = *piax; int ndims = 0; @@ -679,10 +739,10 @@ cdfDefineDimsAndChunks(const stream_t *streamptr, int varID, int xid, int yid, i if (xid != CDI_UNDEFID) cdf_inq_dimlen(fileID, xid, &xsize); if (yid != CDI_UNDEFID) cdf_inq_dimlen(fileID, yid, &ysize); - const int timetype = vlistInqVarTimetype(vlistID, varID); + int timetype = vlistInqVarTimetype(vlistID, varID); if (vlistHasTime(vlistID) && timetype != TIME_CONSTANT) { - const int tid = streamptr->basetime.ncdimid; + int tid = streamptr->basetime.ncdimid; if (tid == CDI_UNDEFID) Error("Internal problem, time undefined!"); axis[iax++] = 'T'; chunks[ndims] = 1; @@ -777,7 +837,7 @@ cdfCheckVarname(int fileID, char name[CDI_MAX_NAME]) { int ncvarID; char varname[CDI_MAX_NAME]; - sprintf(varname, "%s", name); + snprintf(varname, sizeof(varname), "%s", name); char *varname2 = varname + strlen(varname); unsigned iz = 0; @@ -793,7 +853,7 @@ cdfCheckVarname(int fileID, char name[CDI_MAX_NAME]) if (iz > 99) Error("Variable name %s already exsist!", name); - if (strcmp(name, varname) != 0) + if (!str_is_equal(name, varname)) Warning("Changed %s entry of variable name '%s' to '%s'!", (iz == 1) ? "double" : "multiple", name, varname); strcpy(name, varname); @@ -810,9 +870,9 @@ cdfGenVarname(int fileID, char name[CDI_MAX_NAME], int pnum, int pcat, int *pdis if (pnum < 0) pnum = -pnum; if (*pdis == 255) - sprintf(varname, "var%d", code); + snprintf(varname, sizeof(varname), "var%d", code); else - sprintf(varname, "param%d.%d.%d", pnum, pcat, *pdis); + snprintf(varname, sizeof(varname), "param%d.%d.%d", pnum, pcat, *pdis); char *varname2 = varname + strlen(varname); int ncvarID; @@ -835,37 +895,37 @@ cdfGenVarname(int fileID, char name[CDI_MAX_NAME], int pnum, int pcat, int *pdis *pdis = 255; } -static int +int cdfDefVar(stream_t *streamptr, int varID) { if (streamptr->vars[varID].ncvarid != CDI_UNDEFID) return streamptr->vars[varID].ncvarid; - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; if (CDI_Debug) Message("streamID = %d, fileID = %d, varID = %d", streamptr->self, fileID, varID); - const int vlistID = streamptr->vlistID; - const int param = vlistInqVarParam(vlistID, varID); + int vlistID = streamptr->vlistID; + int param = vlistInqVarParam(vlistID, varID); int code = vlistInqVarCode(vlistID, varID); int pnum, pcat, pdis; cdiDecodeParam(param, &pnum, &pcat, &pdis); - const int gridID = vlistInqVarGrid(vlistID, varID); - const size_t gridsize = gridInqSize(gridID); - const int gridtype = gridInqType(gridID); - const int gridindex = nc_grid_index(streamptr, gridID); - const int xid = (gridtype != GRID_TRAJECTORY) ? streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X] : CDI_UNDEFID; - const int yid = (gridtype != GRID_TRAJECTORY && gridtype != GRID_GAUSSIAN_REDUCED) - ? streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y] - : CDI_UNDEFID; + int gridID = vlistInqVarGrid(vlistID, varID); + SizeType gridsize = gridInqSize(gridID); + int gridtype = gridInqType(gridID); + int gridindex = nc_grid_index(streamptr, gridID); + int xid = (gridtype != GRID_TRAJECTORY) ? streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X] : CDI_UNDEFID; + int yid = (gridtype != GRID_TRAJECTORY && gridtype != GRID_GAUSSIAN_REDUCED) ? streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y] + : CDI_UNDEFID; - const int zaxisID = vlistInqVarZaxis(vlistID, varID); - const int zaxistype = zaxisInqType(zaxisID); - const int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); - const int zid = streamptr->zaxisID[zaxisindex]; + int zaxisID = vlistInqVarZaxis(vlistID, varID); + int zaxistype = zaxisInqType(zaxisID); + int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); + int zid = streamptr->zaxisID[zaxisindex]; - int dimorder[3]; // ZYX and ZXY - vlistInqVarDimorder(vlistID, varID, &dimorder); - const bool useChunks = (dimorder[0] == 3) ? (gridsize >= 32) : false; + int dimorder[3]; // ZYX/321 and ZXY/312 + vlistInqVarDimorder(vlistID, varID, dimorder); + bool useChunks + = (gridsize >= 32) && ((dimorder[0] == 3) || (dimorder[1] == 3 && dimorder[2] == 1 && gridsize == gridInqXsize(gridID))); if (((dimorder[0] > 0) + (dimorder[1] > 0) + (dimorder[2] > 0)) < ((xid != CDI_UNDEFID) + (yid != CDI_UNDEFID) + (zid != CDI_UNDEFID))) @@ -894,16 +954,22 @@ cdfDefVar(stream_t *streamptr, int varID) length = CDI_MAX_NAME; cdiInqKeyString(vlistID, varID, CDI_KEY_STDNAME, stdname, &length); - const int tableID = vlistInqVarTable(vlistID, varID); + int tableID = vlistInqVarTable(vlistID, varID); if (!name[0]) tableInqEntry(tableID, code, -1, name, longname, units); if (name[0]) cdfCheckVarname(fileID, name); else cdfGenVarname(fileID, name, pnum, pcat, &pdis, &code); - const int dtype = vlistInqVarDatatype(vlistID, varID); + int dtype = vlistInqVarDatatype(vlistID, varID); const nc_type xtype = cdfDefDatatype(dtype, streamptr); + if (streamptr->ncmode == 2) + { + cdf_redef(fileID); + streamptr->ncmode = 1; + } + int ncvarID = -1; cdf_def_var(fileID, name, xtype, ndims, dims, &ncvarID); @@ -911,7 +977,7 @@ cdfDefVar(stream_t *streamptr, int varID) #ifdef NC_QUANTIZE_BITROUND if (xtype == NC_FLOAT || xtype == NC_DOUBLE) { - const int nsb = vlistInqVarNSB(vlistID, varID); + int nsb = vlistInqVarNSB(vlistID, varID); if (nsb > 0) nc_def_var_quantize(fileID, ncvarID, NC_QUANTIZE_BITROUND, nsb); // if (nsb > 0) nc_def_var_quantize(fileID, ncvarID, NC_QUANTIZE_GRANULARBR, nsb); } @@ -924,6 +990,7 @@ cdfDefVar(stream_t *streamptr, int varID) #endif if (useChunks) cdfDefVarCompression(streamptr, ncvarID, xtype); + if (useChunks) cdfDefVarFilter(streamptr, ncvarID); if (*stdname) cdf_put_att_text(fileID, ncvarID, "standard_name", strlen(stdname), stdname); if (*longname) cdf_put_att_text(fileID, ncvarID, "long_name", strlen(longname), longname); @@ -944,8 +1011,8 @@ cdfDefVar(stream_t *streamptr, int varID) if (tablenum > 0) cdf_put_att_int(fileID, ncvarID, "table", NC_INT, 1, &tablenum); } - const bool zaxisIsScalar = (zid == CDI_UNDEFID) ? (zaxisInqScalar(zaxisID) > 0) : false; - const int nczvarID = (zaxisIsScalar || zaxistype == ZAXIS_CHAR) ? streamptr->nczvarID[zaxisindex] : CDI_UNDEFID; + bool zaxisIsScalar = (zid == CDI_UNDEFID) ? (zaxisInqScalar(zaxisID) > 0) : false; + int nczvarID = (zaxisIsScalar || zaxistype == ZAXIS_CHAR) ? streamptr->nczvarID[zaxisindex] : CDI_UNDEFID; cdfDefineCoordinates(streamptr, ncvarID, nczvarID, gridtype, gridID, gridindex, xid, yid, gridsize, axis, iax); @@ -953,7 +1020,7 @@ cdfDefVar(stream_t *streamptr, int varID) if (dtype == CDI_DATATYPE_UINT8 && xtype == NC_BYTE) { - const int validrange[2] = { 0, 255 }; + int validrange[2] = { 0, 255 }; cdf_put_att_int(fileID, ncvarID, "valid_range", NC_SHORT, 2, validrange); cdf_put_att_text(fileID, ncvarID, "_Unsigned", 4, "true"); } @@ -985,18 +1052,23 @@ cdfEndDef(stream_t *streamptr) if (streamptr->accessmode == 0) { - const int fileID = streamptr->fileID; - if (streamptr->ncmode == 2) cdf_redef(fileID); + int fileID = streamptr->fileID; + if (streamptr->ncmode == 2) + { + cdf_redef(fileID); + streamptr->ncmode = 1; + } - const int nvars = streamptr->nvars; + int nvars = streamptr->nvars; for (int varID = 0; varID < nvars; ++varID) cdfDefVar(streamptr, varID); - if (streamptr->ncmode == 2) + if (streamptr->ncmode != 2) { if (CDI_Netcdf_Hdr_Pad == 0UL) - cdf_enddef(fileID); + cdf_enddef(fileID, streamptr->self); else - cdf__enddef(fileID, CDI_Netcdf_Hdr_Pad); + cdf__enddef(fileID, streamptr->self, CDI_Netcdf_Hdr_Pad); + streamptr->ncmode = 2; } streamptr->accessmode = 1; @@ -1006,13 +1078,13 @@ cdfEndDef(stream_t *streamptr) static void cdfWriteGridTraj(stream_t *streamptr, int gridID) { - const int gridindex = nc_grid_index(streamptr, gridID); - const int lonID = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X]; - const int latID = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y]; - const size_t index = (size_t) streamptr->curTsID; + int gridindex = nc_grid_index(streamptr, gridID); + int lonID = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X]; + int latID = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y]; + size_t index = (size_t) streamptr->curTsID; - const double xlon = gridInqXval(gridID, 0); - const double xlat = gridInqYval(gridID, 0); + double xlon = gridInqXval(gridID, 0); + double xlat = gridInqYval(gridID, 0); cdf_put_var1_double(streamptr->fileID, lonID, &index, &xlon); cdf_put_var1_double(streamptr->fileID, latID, &index, &xlat); @@ -1031,13 +1103,12 @@ cdf_write_var_data(int fileID, int vlistID, int varID, int ncvarID, int dtype, s /* if ( dtype == CDI_DATATYPE_INT8 || dtype == CDI_DATATYPE_INT16 || dtype == CDI_DATATYPE_INT32 ) */ { - const double missval = vlistInqVarMissval(vlistID, varID); - const double addoffset = vlistInqVarAddoffset(vlistID, varID); - const double scalefactor = vlistInqVarScalefactor(vlistID, varID); - const bool laddoffset = IS_NOT_EQUAL(addoffset, 0); - const bool lscalefactor = IS_NOT_EQUAL(scalefactor, 1); + double missval = vlistInqVarMissval(vlistID, varID); + double addoffset = 0.0, scalefactor = 1.0; + bool haveAddoffset = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_ADDOFFSET, &addoffset) == CDI_NOERR); + bool haveScalefactor = (cdiInqKeyFloat(vlistID, varID, CDI_KEY_SCALEFACTOR, &scalefactor) == CDI_NOERR); - if (laddoffset || lscalefactor) + if (haveAddoffset || haveScalefactor) { if (memtype == MEMTYPE_FLOAT) { @@ -1052,8 +1123,8 @@ cdf_write_var_data(int fileID, int vlistID, int varID, int ncvarID, int dtype, s double temp = mdata_sp[i]; if (!DBL_IS_EQUAL(temp, missval)) { - if (laddoffset) temp -= addoffset; - if (lscalefactor) temp /= scalefactor; + if (haveAddoffset) temp -= addoffset; + if (haveScalefactor) temp /= scalefactor; mdata_sp[i] = (float) temp; } } @@ -1063,8 +1134,8 @@ cdf_write_var_data(int fileID, int vlistID, int varID, int ncvarID, int dtype, s for (size_t i = 0; i < nvals; ++i) { double temp = mdata_sp[i]; - if (laddoffset) temp -= addoffset; - if (lscalefactor) temp /= scalefactor; + if (haveAddoffset) temp -= addoffset; + if (haveScalefactor) temp /= scalefactor; mdata_sp[i] = (float) temp; } } @@ -1081,8 +1152,8 @@ cdf_write_var_data(int fileID, int vlistID, int varID, int ncvarID, int dtype, s { if (!DBL_IS_EQUAL(mdata_dp[i], missval)) { - if (laddoffset) mdata_dp[i] -= addoffset; - if (lscalefactor) mdata_dp[i] /= scalefactor; + if (haveAddoffset) mdata_dp[i] -= addoffset; + if (haveScalefactor) mdata_dp[i] /= scalefactor; } } } @@ -1090,8 +1161,8 @@ cdf_write_var_data(int fileID, int vlistID, int varID, int ncvarID, int dtype, s { for (size_t i = 0; i < nvals; ++i) { - if (laddoffset) mdata_dp[i] -= addoffset; - if (lscalefactor) mdata_dp[i] /= scalefactor; + if (haveAddoffset) mdata_dp[i] -= addoffset; + if (haveScalefactor) mdata_dp[i] /= scalefactor; } } } @@ -1230,20 +1301,20 @@ cdfGetXYZid(stream_t *streamptr, int gridID, int zaxisID, int *xid, int *yid, in *xid = CDI_UNDEFID; *yid = CDI_UNDEFID; - const int gridtype = gridInqType(gridID); + int gridtype = gridInqType(gridID); if (gridtype == GRID_TRAJECTORY) { cdfWriteGridTraj(streamptr, gridID); } else { - const int gridindex = nc_grid_index(streamptr, gridID); + int gridindex = nc_grid_index(streamptr, gridID); *xid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X]; if (gridtype != GRID_GAUSSIAN_REDUCED) *yid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y]; } - const int vlistID = streamptr->vlistID; - const int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); + int vlistID = streamptr->vlistID; + int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); *zid = streamptr->zaxisID[zaxisindex]; } @@ -1255,13 +1326,13 @@ cdfDefineStartAndCount(stream_t *streamptr, int varID, int xid, int yid, int zid *xsize = 0; *ysize = 0; - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; const long ntsteps = streamptr->ntsteps; if (CDI_Debug) Message("ntsteps = %ld", ntsteps); - const int timetype = vlistInqVarTimetype(vlistID, varID); + int timetype = vlistInqVarTimetype(vlistID, varID); if (vlistHasTime(vlistID) && timetype != TIME_CONSTANT) { @@ -1272,7 +1343,7 @@ cdfDefineStartAndCount(stream_t *streamptr, int varID, int xid, int yid, int zid if (zid != CDI_UNDEFID) { - const int zaxisID = vlistInqVarZaxis(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); start[ndims] = 0; count[ndims] = (size_t) zaxisInqSize(zaxisID); ndims++; @@ -1309,13 +1380,13 @@ cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data, siz if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; - const int ncvarID = cdfDefVar(streamptr, varID); + int ncvarID = cdfDefVar(streamptr, varID); - const int gridID = vlistInqVarGrid(vlistID, varID); - const int zaxisID = vlistInqVarZaxis(vlistID, varID); + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); int xid, yid, zid; cdfGetXYZid(streamptr, gridID, zaxisID, &xid, &yid, &zid); @@ -1326,15 +1397,15 @@ cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data, siz if (streamptr->ncmode == 1) { - cdf_enddef(fileID); + cdf_enddef(fileID, streamptr->self); streamptr->ncmode = 2; } - const int dtype = vlistInqVarDatatype(vlistID, varID); + int dtype = vlistInqVarDatatype(vlistID, varID); if (nmiss > 0) cdfDefVarMissval(streamptr, varID, dtype, 1); - const size_t nvals = gridInqSize(gridID) * (size_t) (zaxisInqSize(zaxisID)); + size_t nvals = gridInqSize(gridID) * (size_t) (zaxisInqSize(zaxisID)); bool swapxy = false; cdf_write_var_data(fileID, vlistID, varID, ncvarID, dtype, nvals, xsize, ysize, swapxy, start, count, memtype, data, nmiss); @@ -1348,13 +1419,13 @@ cdfDefineStartAndCountChunk(stream_t *streamptr, const int rect[][2], int varID, *xsize = 0; *ysize = 0; - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; const long ntsteps = streamptr->ntsteps; if (CDI_Debug) Message("ntsteps = %ld", ntsteps); - const int timetype = vlistInqVarTimetype(vlistID, varID); + int timetype = vlistInqVarTimetype(vlistID, varID); if (vlistHasTime(vlistID) && timetype != TIME_CONSTANT) { @@ -1365,11 +1436,11 @@ cdfDefineStartAndCountChunk(stream_t *streamptr, const int rect[][2], int varID, if (zid != CDI_UNDEFID) { - const int zaxisID = vlistInqVarZaxis(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); int size = zaxisInqSize(zaxisID); - xassert(rect[2][0] >= 0 && rect[2][0] <= rect[2][1] && rect[2][1] <= size); + xassert(rect[2][0] >= 0 && rect[2][0] <= rect[2][1] + 1 && rect[2][1] <= size); start[ndims] = (size_t) rect[2][0]; - count[ndims] = (size_t) rect[2][1] - (size_t) rect[2][0] + 1; + count[ndims] = rect[2][1] < 0 ? (size_t) 0 : (size_t) rect[2][1] - (size_t) rect[2][0] + 1; ndims++; } @@ -1377,9 +1448,9 @@ cdfDefineStartAndCountChunk(stream_t *streamptr, const int rect[][2], int varID, { size_t size; cdf_inq_dimlen(fileID, yid, &size); - xassert(rect[1][0] >= 0 && rect[1][0] <= rect[1][1] && (size_t) rect[1][1] <= size); + xassert(rect[1][0] >= 0 && rect[1][0] <= rect[1][1] + 1 && (rect[1][1] < 0 || (size_t) rect[1][1] <= size)); start[ndims] = (size_t) rect[1][0]; - count[ndims] = (size_t) rect[1][1] - (size_t) rect[1][0] + 1; + count[ndims] = rect[1][1] < 0 ? (size_t) 0 : ((size_t) rect[1][1] - (size_t) rect[1][0] + 1); ndims++; } @@ -1387,9 +1458,9 @@ cdfDefineStartAndCountChunk(stream_t *streamptr, const int rect[][2], int varID, { size_t size; cdf_inq_dimlen(fileID, xid, &size); - xassert(rect[0][0] >= 0 && rect[0][0] <= rect[0][1] && (size_t) rect[0][1] <= size); + xassert(rect[0][0] >= 0 && rect[0][0] <= rect[0][1] + 1 && (rect[0][1] < 0 || (size_t) rect[0][1] <= size)); start[ndims] = (size_t) rect[0][0]; - count[ndims] = (size_t) rect[0][1] - (size_t) rect[0][0] + 1; + count[ndims] = rect[0][1] < 0 ? (size_t) 0 : (size_t) rect[0][1] - (size_t) rect[0][0] + 1; ndims++; } @@ -1402,17 +1473,17 @@ cdf_write_var_chunk(stream_t *streamptr, int varID, int memtype, const int rect[ { if (streamptr->accessmode == 0) cdfEndDef(streamptr); - const int streamID = streamptr->self; + int streamID = streamptr->self; if (CDI_Debug) Message("streamID = %d varID = %d", streamID, varID); - const int vlistID = streamInqVlist(streamID); - const int fileID = streamInqFileID(streamID); + int vlistID = streamInqVlist(streamID); + int fileID = streamInqFileID(streamID); - const int ncvarID = cdfDefVar(streamptr, varID); + int ncvarID = cdfDefVar(streamptr, varID); - const int gridID = vlistInqVarGrid(vlistID, varID); - const int zaxisID = vlistInqVarZaxis(vlistID, varID); + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); int xid, yid, zid; cdfGetXYZid(streamptr, gridID, zaxisID, &xid, &yid, &zid); @@ -1423,15 +1494,15 @@ cdf_write_var_chunk(stream_t *streamptr, int varID, int memtype, const int rect[ if (streamptr->ncmode == 1) { - cdf_enddef(fileID); + cdf_enddef(fileID, streamptr->self); streamptr->ncmode = 2; } - const int dtype = vlistInqVarDatatype(vlistID, varID); + int dtype = vlistInqVarDatatype(vlistID, varID); if (nmiss > 0) cdfDefVarMissval(streamptr, varID, dtype, 1); - const size_t nvals = gridInqSize(gridID) * (size_t) (zaxisInqSize(zaxisID)); + size_t nvals = gridInqSize(gridID) * (size_t) (zaxisInqSize(zaxisID)); bool swapxy = false; cdf_write_var_data(fileID, vlistID, varID, ncvarID, dtype, nvals, xsize, ysize, swapxy, start, count, memtype, data, nmiss); @@ -1445,13 +1516,13 @@ cdfDefineStartAndCountSlice(stream_t *streamptr, int varID, int levelID, int dim *xsize = 0; *ysize = 0; - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; const long ntsteps = streamptr->ntsteps; if (CDI_Debug) Message("ntsteps = %ld", ntsteps); - const int timetype = vlistInqVarTimetype(vlistID, varID); + int timetype = vlistInqVarTimetype(vlistID, varID); if (vlistHasTime(vlistID) && timetype != TIME_CONSTANT) { @@ -1495,30 +1566,30 @@ cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, co if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; - const int ncvarID = cdfDefVar(streamptr, varID); + int ncvarID = cdfDefVar(streamptr, varID); - const int gridID = vlistInqVarGrid(vlistID, varID); - const int zaxisID = vlistInqVarZaxis(vlistID, varID); + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); int xid, yid, zid; cdfGetXYZid(streamptr, gridID, zaxisID, &xid, &yid, &zid); int dimorder[3]; - vlistInqVarDimorder(vlistID, varID, &dimorder); - const bool swapxy = (dimorder[2] == 2 || dimorder[0] == 1) && xid != CDI_UNDEFID && yid != CDI_UNDEFID; + vlistInqVarDimorder(vlistID, varID, dimorder); + bool swapxy = (dimorder[2] == 2 || dimorder[0] == 1) && xid != CDI_UNDEFID && yid != CDI_UNDEFID; size_t xsize, ysize; size_t start[5], count[5]; cdfDefineStartAndCountSlice(streamptr, varID, levelID, dimorder, xid, yid, zid, start, count, &xsize, &ysize); - const int dtype = vlistInqVarDatatype(vlistID, varID); + int dtype = vlistInqVarDatatype(vlistID, varID); if (nmiss > 0) cdfDefVarMissval(streamptr, varID, dtype, 1); - const size_t nvals = gridInqSize(gridID); + size_t nvals = gridInqSize(gridID); cdf_write_var_data(fileID, vlistID, varID, ncvarID, dtype, nvals, xsize, ysize, swapxy, start, count, memtype, data, nmiss); } @@ -1526,8 +1597,8 @@ cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, co void cdf_write_record(stream_t *streamptr, int memtype, const void *data, size_t nmiss) { - const int varID = streamptr->record->varID; - const int levelID = streamptr->record->levelID; + int varID = streamptr->record->varID; + int levelID = streamptr->record->levelID; cdf_write_var_slice(streamptr, varID, levelID, memtype, data, nmiss); } diff --git a/src/cdi.h b/src/cdi.h index cda670f1d6105ffb1ba1e86800571f021066b0ee..4c48f4edd64aaa84f9969b38057605afdeb0058b 100644 --- a/src/cdi.h +++ b/src/cdi.h @@ -11,6 +11,7 @@ #include <stdio.h> #include <stdint.h> // int64_t +#include <stdbool.h> #include <sys/types.h> #ifndef CDI_SIZE_TYPE @@ -57,6 +58,8 @@ extern "C" { #define CDI_EUFSTRUCT -25 // Unsupported file structure #define CDI_EUNC4 -26 // Unsupported NetCDF4 structure #define CDI_EDIMSIZE -27 // Invalid dimension size +#define CDI_EQENF -50 // Query entries not found +#define CDI_EQNAVAIL -51 // Query not available for file type #define CDI_ELIMIT -99 // Internal limits exceeded // File types @@ -94,6 +97,7 @@ extern "C" { #define CDI_COMPRESS_AEC 2 #define CDI_COMPRESS_ZIP 3 #define CDI_COMPRESS_JPEG 4 +#define CDI_COMPRESS_FILTER 5 // external data types @@ -381,6 +385,8 @@ void streamDefByteorder(int streamID, int byteorder); // streamInqByteorder: Get the byteorder int streamInqByteorder(int streamID); +void streamDefFilter(int streamID, int filterId, int nparams, const int *params); + // streamDefCompType: Define compression type void streamDefCompType(int streamID, int comptype); @@ -429,7 +435,8 @@ void streamReadVarSlicePart(int streamID, int varID, int levelID, int varType void streamReadVarSlice(int streamID, int varID, int levelID, double data[], SizeType *nmiss); void streamReadVarSliceF(int streamID, int varID, int levelID, float data[], SizeType *nmiss); -void streamWriteVarChunk(int streamID, int varID, const int rect[3][2], const double data[], SizeType nmiss); +void streamWriteVarChunk(int streamID, int varID, const int rect[][2], const double data[], SizeType nmiss); +void streamWriteVarChunkF(int streamID, int varID, const int rect[][2], const float data[], SizeType nmiss); // STREAM record I/O routines (sequential access) @@ -672,17 +679,6 @@ void vlistDefVarMissval(int vlistID, int varID, double missval); // vlistInqVarMissval: Get the missing value of a Variable double vlistInqVarMissval(int vlistID, int varID); -// vlistDefVarExtra: Define extra information of a Variable -void vlistDefVarExtra(int vlistID, int varID, const char *extra); - -// vlistInqVarExtra: Get extra information of a Variable -void vlistInqVarExtra(int vlistID, int varID, char *extra); - -void vlistDefVarScalefactor(int vlistID, int varID, double scalefactor); -double vlistInqVarScalefactor(int vlistID, int varID); -void vlistDefVarAddoffset(int vlistID, int varID, double addoffset); -double vlistInqVarAddoffset(int vlistID, int varID); - SizeType vlistInqVarSize(int vlistID, int varID); void vlistDefIndex(int vlistID, int varID, int levID, int index); @@ -830,6 +826,7 @@ SizeType gridInqYCvals(int gridID, char *ycvals[]); #define CDI_KEY_UNITS 945 // Units of the variable #define CDI_KEY_DATATYPE 946 // Data type #define CDI_KEY_REFERENCEURI 947 // Reference URI to grid file +#define CDI_KEY_CHUNKS 948 // Chunks // Integer keys #define CDI_KEY_NUMBEROFGRIDUSED 961 // GRIB2 numberOfGridUsed @@ -841,6 +838,8 @@ SizeType gridInqYCvals(int gridID, char *ycvals[]); // Floating point keys #define CDI_KEY_MISSVAL 701 // Missing value +#define CDI_KEY_ADDOFFSET 702 // Add offset +#define CDI_KEY_SCALEFACTOR 703 // Scale factor // Byte array keys #define CDI_KEY_UUID 960 // UUID for grid/Z-axis reference [size: CDI_UUID_SIZE] @@ -1181,18 +1180,6 @@ int taxisInqRdate(int taxisID); // taxisInqRtime: Get the reference time int taxisInqRtime(int taxisID); -// taxisDefFdate: Define the forecast reference date -void taxisDefFdate(int taxisID, int date); - -// taxisDefFtime: Define the forecast reference time -void taxisDefFtime(int taxisID, int time); - -// taxisInqFdate: Get the forecast reference date -int taxisInqFdate(int taxisID); - -// taxisInqFtime: Get the forecast reference time -int taxisInqFtime(int taxisID); - int taxisHasBounds(int taxisID); void taxisWithBounds(int taxisID); @@ -1323,14 +1310,70 @@ void vlistDefVarProductDefinitionTemplate(int vlistID, int varID, int productDef extern "C" { #endif +// CDI query interface + +typedef struct +{ + int numEntries; + // Names + int numNames; + bool *namesFound; + char **names; + // Grid cell indices + int numCellidx; + bool *cellidxFound; + size_t *cellidx; + // Level indices + int numLevidx; + bool *levidxFound; + int *levidx; + // Time step indices + int numStepidx; + bool *stepidxFound; + int *stepidx; +} CdiQuery; + +CdiQuery *cdiQueryCreate(); +CdiQuery *cdiQueryClone(const CdiQuery *query); +void cdiQueryDelete(CdiQuery *query); +void cdiQuerySetNames(CdiQuery *query, int numNames, char **names); +void cdiQuerySetCellidx(CdiQuery *query, int numCellidx, size_t *cellidx); +void cdiQuerySetLevidx(CdiQuery *query, int numLevidx, int *levidx); +void cdiQuerySetStepidx(CdiQuery *query, int numStepidx, int *stepidx); +size_t cdiQueryGetCellidx(const CdiQuery *query, int index); +int cdiQueryName(CdiQuery *query, const char *name); +int cdiQueryCellidx(CdiQuery *query, size_t cellidx); +int cdiQueryLevidx(CdiQuery *query, int levidx); +int cdiQueryStepidx(CdiQuery *query, int stepidx); +int cdiQueryNumNames(const CdiQuery *query); +int cdiQueryNumCellidx(const CdiQuery *query); +int cdiQueryNumStepidx(const CdiQuery *query); +int cdiQueryNumEntries(const CdiQuery *query); +int cdiQueryNumEntriesFound(const CdiQuery *query); +void cdiQueryPrint(const CdiQuery *query); +void cdiQueryPrintEntriesNotFound(const CdiQuery *query); + +// streamOpenReadQuery: Open a dataset for reading and apply query +int streamOpenReadQuery(const char *path, CdiQuery *query); + +// CDI interface for paraview vtkCDIReader.cxx + #include "cdi_datetime.h" -void taxisDefRdatetime(int taxisID, CdiDateTime rdatetime); +// taxisDefRdatetime: Define the reference date/time +void taxisDefRdatetime(int taxisID, CdiDateTime rDateTime); +// taxisInqRdatetime: Get the reference date/time CdiDateTime taxisInqRdatetime(int taxisID); -void taxisDefVdatetime(int taxisID, CdiDateTime vdatetime); +// taxisDefFdatetime: Define the forecast reference date/time +void taxisDefFdatetime(int taxisID, CdiDateTime fDateTime); +// taxisInqFdatetime: Get the forecast reference date/time +CdiDateTime taxisInqFdatetime(int taxisID); +// taxisDefVdatetime: Define the verification date/time +void taxisDefVdatetime(int taxisID, CdiDateTime vDateTime); +// taxisInqVdatetime: Get the verification date/time CdiDateTime taxisInqVdatetime(int taxisID); -void taxisDefVdatetimeBounds(int taxisID, CdiDateTime vdatetime_lb, CdiDateTime vdatetime_ub); -void taxisInqVdatetimeBounds(int taxisID, CdiDateTime *vdatetime_lb, CdiDateTime *vdatetime_ub); +void taxisDefVdatetimeBounds(int taxisID, CdiDateTime vDateTime_lb, CdiDateTime vDateTime_ub); +void taxisInqVdatetimeBounds(int taxisID, CdiDateTime *vDateTime_lb, CdiDateTime *vDateTime_ub); // date format: YYYYMMDD // time format: hhmmss @@ -1341,6 +1384,7 @@ int64_t julday_to_date(int calendar, int64_t julday); int time_to_sec(int time); // Used in paraview vtkCDIReader.cxx int sec_to_time(int secofday); +// CDI projection parameter interface struct CDI_GridProjParams { diff --git a/src/cdi.inc b/src/cdi.inc deleted file mode 100644 index bb39740908daeb607545629efbbf85db16d503ce..0000000000000000000000000000000000000000 --- a/src/cdi.inc +++ /dev/null @@ -1,2645 +0,0 @@ -! This file was automatically generated, don't edit! -! -! Fortran interface for CDI library version 2.1.0 -! -! Author: -! ------- -! Uwe Schulzweida, MPI-MET, Hamburg, October 2022 -! - -! -! Start of fortran interface for the following routines (make_fint.c) -! - INTEGER CDI_MAX_NAME - PARAMETER (CDI_MAX_NAME = 256) - INTEGER CDI_UNDEFID - PARAMETER (CDI_UNDEFID = -1) - INTEGER CDI_GLOBAL - PARAMETER (CDI_GLOBAL = -1) - INTEGER CDI_XAXIS - PARAMETER (CDI_XAXIS = 1) - INTEGER CDI_YAXIS - PARAMETER (CDI_YAXIS = 2) -! -! Byte order -! - INTEGER CDI_BIGENDIAN - PARAMETER (CDI_BIGENDIAN = 0) - INTEGER CDI_LITTLEENDIAN - PARAMETER (CDI_LITTLEENDIAN = 1) - INTEGER CDI_PDPENDIAN - PARAMETER (CDI_PDPENDIAN = 2) - INTEGER CDI_REAL - PARAMETER (CDI_REAL = 1) - INTEGER CDI_COMP - PARAMETER (CDI_COMP = 2) - INTEGER CDI_BOTH - PARAMETER (CDI_BOTH = 3) -! -! Error identifier -! - INTEGER CDI_NOERR - PARAMETER (CDI_NOERR = 0) - INTEGER CDI_EEOF - PARAMETER (CDI_EEOF = -1) - INTEGER CDI_ETMOF - PARAMETER (CDI_ETMOF = -9) - INTEGER CDI_ESYSTEM - PARAMETER (CDI_ESYSTEM = -10) - INTEGER CDI_EINVAL - PARAMETER (CDI_EINVAL = -20) - INTEGER CDI_EISDIR - PARAMETER (CDI_EISDIR = -21) - INTEGER CDI_EISEMPTY - PARAMETER (CDI_EISEMPTY = -22) - INTEGER CDI_EUFTYPE - PARAMETER (CDI_EUFTYPE = -23) - INTEGER CDI_ELIBNAVAIL - PARAMETER (CDI_ELIBNAVAIL = -24) - INTEGER CDI_EUFSTRUCT - PARAMETER (CDI_EUFSTRUCT = -25) - INTEGER CDI_EUNC4 - PARAMETER (CDI_EUNC4 = -26) - INTEGER CDI_EDIMSIZE - PARAMETER (CDI_EDIMSIZE = -27) - INTEGER CDI_ELIMIT - PARAMETER (CDI_ELIMIT = -99) -! -! File types -! - INTEGER CDI_FILETYPE_GRB - PARAMETER (CDI_FILETYPE_GRB = 1) - INTEGER CDI_FILETYPE_GRB2 - PARAMETER (CDI_FILETYPE_GRB2 = 2) - INTEGER CDI_FILETYPE_NC - PARAMETER (CDI_FILETYPE_NC = 3) - INTEGER CDI_FILETYPE_NC2 - PARAMETER (CDI_FILETYPE_NC2 = 4) - INTEGER CDI_FILETYPE_NC4 - PARAMETER (CDI_FILETYPE_NC4 = 5) - INTEGER CDI_FILETYPE_NC4C - PARAMETER (CDI_FILETYPE_NC4C = 6) - INTEGER CDI_FILETYPE_NC5 - PARAMETER (CDI_FILETYPE_NC5 = 7) - INTEGER CDI_FILETYPE_SRV - PARAMETER (CDI_FILETYPE_SRV = 8) - INTEGER CDI_FILETYPE_EXT - PARAMETER (CDI_FILETYPE_EXT = 9) - INTEGER CDI_FILETYPE_IEG - PARAMETER (CDI_FILETYPE_IEG = 10) - INTEGER CDI_FILETYPE_NCZARR - PARAMETER (CDI_FILETYPE_NCZARR = 11) -! -! Compatibility defines for release 1.8.3 (obsolete defines) -! - INTEGER FILETYPE_GRB - PARAMETER (FILETYPE_GRB = 1) - INTEGER FILETYPE_GRB2 - PARAMETER (FILETYPE_GRB2 = 2) - INTEGER FILETYPE_NC - PARAMETER (FILETYPE_NC = 3) - INTEGER FILETYPE_NC2 - PARAMETER (FILETYPE_NC2 = 4) - INTEGER FILETYPE_NC4 - PARAMETER (FILETYPE_NC4 = 5) -! -! Protocols (in filename/URI) -! - INTEGER CDI_PROTOCOL_OTHER - PARAMETER (CDI_PROTOCOL_OTHER = 0) - INTEGER CDI_PROTOCOL_FILE - PARAMETER (CDI_PROTOCOL_FILE = 1) - INTEGER CDI_PROTOCOL_FDB - PARAMETER (CDI_PROTOCOL_FDB = 2) - INTEGER CDI_PROTOCOL_ACROSS - PARAMETER (CDI_PROTOCOL_ACROSS = 3) -! -! Compress types -! - INTEGER CDI_COMPRESS_NONE - PARAMETER (CDI_COMPRESS_NONE = 0) - INTEGER CDI_COMPRESS_SZIP - PARAMETER (CDI_COMPRESS_SZIP = 1) - INTEGER CDI_COMPRESS_AEC - PARAMETER (CDI_COMPRESS_AEC = 2) - INTEGER CDI_COMPRESS_ZIP - PARAMETER (CDI_COMPRESS_ZIP = 3) - INTEGER CDI_COMPRESS_JPEG - PARAMETER (CDI_COMPRESS_JPEG = 4) -! -! external data types -! -! -! Compatibility defines for release 1.8.3 (obsolete defines) -! - INTEGER DATATYPE_PACK16 - PARAMETER (DATATYPE_PACK16 = 16) - INTEGER DATATYPE_PACK24 - PARAMETER (DATATYPE_PACK24 = 24) - INTEGER DATATYPE_FLT32 - PARAMETER (DATATYPE_FLT32 = 132) - INTEGER DATATYPE_FLT64 - PARAMETER (DATATYPE_FLT64 = 164) - INTEGER DATATYPE_INT32 - PARAMETER (DATATYPE_INT32 = 232) - INTEGER DATATYPE_INT - PARAMETER (DATATYPE_INT = 251) - INTEGER CDI_DATATYPE_PACK - PARAMETER (CDI_DATATYPE_PACK = 0) - INTEGER CDI_DATATYPE_PACK1 - PARAMETER (CDI_DATATYPE_PACK1 = 1) - INTEGER CDI_DATATYPE_PACK2 - PARAMETER (CDI_DATATYPE_PACK2 = 2) - INTEGER CDI_DATATYPE_PACK3 - PARAMETER (CDI_DATATYPE_PACK3 = 3) - INTEGER CDI_DATATYPE_PACK4 - PARAMETER (CDI_DATATYPE_PACK4 = 4) - INTEGER CDI_DATATYPE_PACK5 - PARAMETER (CDI_DATATYPE_PACK5 = 5) - INTEGER CDI_DATATYPE_PACK6 - PARAMETER (CDI_DATATYPE_PACK6 = 6) - INTEGER CDI_DATATYPE_PACK7 - PARAMETER (CDI_DATATYPE_PACK7 = 7) - INTEGER CDI_DATATYPE_PACK8 - PARAMETER (CDI_DATATYPE_PACK8 = 8) - INTEGER CDI_DATATYPE_PACK9 - PARAMETER (CDI_DATATYPE_PACK9 = 9) - INTEGER CDI_DATATYPE_PACK10 - PARAMETER (CDI_DATATYPE_PACK10 = 10) - INTEGER CDI_DATATYPE_PACK11 - PARAMETER (CDI_DATATYPE_PACK11 = 11) - INTEGER CDI_DATATYPE_PACK12 - PARAMETER (CDI_DATATYPE_PACK12 = 12) - INTEGER CDI_DATATYPE_PACK13 - PARAMETER (CDI_DATATYPE_PACK13 = 13) - INTEGER CDI_DATATYPE_PACK14 - PARAMETER (CDI_DATATYPE_PACK14 = 14) - INTEGER CDI_DATATYPE_PACK15 - PARAMETER (CDI_DATATYPE_PACK15 = 15) - INTEGER CDI_DATATYPE_PACK16 - PARAMETER (CDI_DATATYPE_PACK16 = 16) - INTEGER CDI_DATATYPE_PACK17 - PARAMETER (CDI_DATATYPE_PACK17 = 17) - INTEGER CDI_DATATYPE_PACK18 - PARAMETER (CDI_DATATYPE_PACK18 = 18) - INTEGER CDI_DATATYPE_PACK19 - PARAMETER (CDI_DATATYPE_PACK19 = 19) - INTEGER CDI_DATATYPE_PACK20 - PARAMETER (CDI_DATATYPE_PACK20 = 20) - INTEGER CDI_DATATYPE_PACK21 - PARAMETER (CDI_DATATYPE_PACK21 = 21) - INTEGER CDI_DATATYPE_PACK22 - PARAMETER (CDI_DATATYPE_PACK22 = 22) - INTEGER CDI_DATATYPE_PACK23 - PARAMETER (CDI_DATATYPE_PACK23 = 23) - INTEGER CDI_DATATYPE_PACK24 - PARAMETER (CDI_DATATYPE_PACK24 = 24) - INTEGER CDI_DATATYPE_PACK25 - PARAMETER (CDI_DATATYPE_PACK25 = 25) - INTEGER CDI_DATATYPE_PACK26 - PARAMETER (CDI_DATATYPE_PACK26 = 26) - INTEGER CDI_DATATYPE_PACK27 - PARAMETER (CDI_DATATYPE_PACK27 = 27) - INTEGER CDI_DATATYPE_PACK28 - PARAMETER (CDI_DATATYPE_PACK28 = 28) - INTEGER CDI_DATATYPE_PACK29 - PARAMETER (CDI_DATATYPE_PACK29 = 29) - INTEGER CDI_DATATYPE_PACK30 - PARAMETER (CDI_DATATYPE_PACK30 = 30) - INTEGER CDI_DATATYPE_PACK31 - PARAMETER (CDI_DATATYPE_PACK31 = 31) - INTEGER CDI_DATATYPE_PACK32 - PARAMETER (CDI_DATATYPE_PACK32 = 32) - INTEGER CDI_DATATYPE_CPX32 - PARAMETER (CDI_DATATYPE_CPX32 = 64) - INTEGER CDI_DATATYPE_CPX64 - PARAMETER (CDI_DATATYPE_CPX64 = 128) - INTEGER CDI_DATATYPE_FLT32 - PARAMETER (CDI_DATATYPE_FLT32 = 132) - INTEGER CDI_DATATYPE_FLT64 - PARAMETER (CDI_DATATYPE_FLT64 = 164) - INTEGER CDI_DATATYPE_INT8 - PARAMETER (CDI_DATATYPE_INT8 = 208) - INTEGER CDI_DATATYPE_INT16 - PARAMETER (CDI_DATATYPE_INT16 = 216) - INTEGER CDI_DATATYPE_INT32 - PARAMETER (CDI_DATATYPE_INT32 = 232) - INTEGER CDI_DATATYPE_UINT8 - PARAMETER (CDI_DATATYPE_UINT8 = 308) - INTEGER CDI_DATATYPE_UINT16 - PARAMETER (CDI_DATATYPE_UINT16 = 316) - INTEGER CDI_DATATYPE_UINT32 - PARAMETER (CDI_DATATYPE_UINT32 = 332) -! -! internal data types -! - INTEGER CDI_DATATYPE_INT - PARAMETER (CDI_DATATYPE_INT = 251) - INTEGER CDI_DATATYPE_FLT - PARAMETER (CDI_DATATYPE_FLT = 252) - INTEGER CDI_DATATYPE_TXT - PARAMETER (CDI_DATATYPE_TXT = 253) - INTEGER CDI_DATATYPE_CPX - PARAMETER (CDI_DATATYPE_CPX = 254) - INTEGER CDI_DATATYPE_UCHAR - PARAMETER (CDI_DATATYPE_UCHAR = 255) - INTEGER CDI_DATATYPE_LONG - PARAMETER (CDI_DATATYPE_LONG = 256) - INTEGER CDI_DATATYPE_UINT - PARAMETER (CDI_DATATYPE_UINT = 257) -! -! Chunk types -! - INTEGER CDI_CHUNK_AUTO - PARAMETER (CDI_CHUNK_AUTO = 1) - INTEGER CDI_CHUNK_GRID - PARAMETER (CDI_CHUNK_GRID = 2) - INTEGER CDI_CHUNK_LINES - PARAMETER (CDI_CHUNK_LINES = 3) -! -! GRID types -! - INTEGER GRID_GENERIC - PARAMETER (GRID_GENERIC = 1) - INTEGER GRID_GAUSSIAN - PARAMETER (GRID_GAUSSIAN = 2) - INTEGER GRID_GAUSSIAN_REDUCED - PARAMETER (GRID_GAUSSIAN_REDUCED = 3) - INTEGER GRID_LONLAT - PARAMETER (GRID_LONLAT = 4) - INTEGER GRID_SPECTRAL - PARAMETER (GRID_SPECTRAL = 5) - INTEGER GRID_FOURIER - PARAMETER (GRID_FOURIER = 6) - INTEGER GRID_GME - PARAMETER (GRID_GME = 7) - INTEGER GRID_TRAJECTORY - PARAMETER (GRID_TRAJECTORY = 8) - INTEGER GRID_UNSTRUCTURED - PARAMETER (GRID_UNSTRUCTURED = 9) - INTEGER GRID_CURVILINEAR - PARAMETER (GRID_CURVILINEAR = 10) - INTEGER GRID_PROJECTION - PARAMETER (GRID_PROJECTION = 12) - INTEGER GRID_CHARXY - PARAMETER (GRID_CHARXY = 13) - INTEGER CDI_PROJ_RLL - PARAMETER (CDI_PROJ_RLL = 21) - INTEGER CDI_PROJ_LCC - PARAMETER (CDI_PROJ_LCC = 22) - INTEGER CDI_PROJ_LAEA - PARAMETER (CDI_PROJ_LAEA = 23) - INTEGER CDI_PROJ_SINU - PARAMETER (CDI_PROJ_SINU = 24) - INTEGER CDI_PROJ_STERE - PARAMETER (CDI_PROJ_STERE = 25) - INTEGER CDI_PROJ_HEALPIX - PARAMETER (CDI_PROJ_HEALPIX = 26) -! -! ZAXIS types -! - INTEGER ZAXIS_SURFACE - PARAMETER (ZAXIS_SURFACE = 0) - INTEGER ZAXIS_GENERIC - PARAMETER (ZAXIS_GENERIC = 1) - INTEGER ZAXIS_HYBRID - PARAMETER (ZAXIS_HYBRID = 2) - INTEGER ZAXIS_HYBRID_HALF - PARAMETER (ZAXIS_HYBRID_HALF = 3) - INTEGER ZAXIS_PRESSURE - PARAMETER (ZAXIS_PRESSURE = 4) - INTEGER ZAXIS_HEIGHT - PARAMETER (ZAXIS_HEIGHT = 5) - INTEGER ZAXIS_DEPTH_BELOW_SEA - PARAMETER (ZAXIS_DEPTH_BELOW_SEA = 6) - INTEGER ZAXIS_DEPTH_BELOW_LAND - PARAMETER (ZAXIS_DEPTH_BELOW_LAND = 7) - INTEGER ZAXIS_ISENTROPIC - PARAMETER (ZAXIS_ISENTROPIC = 8) - INTEGER ZAXIS_TRAJECTORY - PARAMETER (ZAXIS_TRAJECTORY = 9) - INTEGER ZAXIS_ALTITUDE - PARAMETER (ZAXIS_ALTITUDE = 10) - INTEGER ZAXIS_SIGMA - PARAMETER (ZAXIS_SIGMA = 11) - INTEGER ZAXIS_MEANSEA - PARAMETER (ZAXIS_MEANSEA = 12) - INTEGER ZAXIS_TOA - PARAMETER (ZAXIS_TOA = 13) - INTEGER ZAXIS_SEA_BOTTOM - PARAMETER (ZAXIS_SEA_BOTTOM = 14) - INTEGER ZAXIS_ATMOSPHERE - PARAMETER (ZAXIS_ATMOSPHERE = 15) - INTEGER ZAXIS_CLOUD_BASE - PARAMETER (ZAXIS_CLOUD_BASE = 16) - INTEGER ZAXIS_CLOUD_TOP - PARAMETER (ZAXIS_CLOUD_TOP = 17) - INTEGER ZAXIS_ISOTHERM_ZERO - PARAMETER (ZAXIS_ISOTHERM_ZERO = 18) - INTEGER ZAXIS_SNOW - PARAMETER (ZAXIS_SNOW = 19) - INTEGER ZAXIS_LAKE_BOTTOM - PARAMETER (ZAXIS_LAKE_BOTTOM = 20) - INTEGER ZAXIS_SEDIMENT_BOTTOM - PARAMETER (ZAXIS_SEDIMENT_BOTTOM = 21) - INTEGER ZAXIS_SEDIMENT_BOTTOM_TA - PARAMETER (ZAXIS_SEDIMENT_BOTTOM_TA = 22) - INTEGER ZAXIS_SEDIMENT_BOTTOM_TW - PARAMETER (ZAXIS_SEDIMENT_BOTTOM_TW = 23) - INTEGER ZAXIS_MIX_LAYER - PARAMETER (ZAXIS_MIX_LAYER = 24) - INTEGER ZAXIS_REFERENCE - PARAMETER (ZAXIS_REFERENCE = 25) - INTEGER ZAXIS_CHAR - PARAMETER (ZAXIS_CHAR = 26) - INTEGER ZAXIS_TROPOPAUSE - PARAMETER (ZAXIS_TROPOPAUSE = 27) -! -! SUBTYPE types -! - INTEGER MAX_KV_PAIRS_MATCH - PARAMETER (MAX_KV_PAIRS_MATCH = 10) -! -! Data structure defining a key-value search, possibly with multiple -! key-value pairs in combination. -! -! Currently, only multiple pairs combined by AND are supported. -! -! -! TIME types -! - INTEGER TIME_CONSTANT - PARAMETER (TIME_CONSTANT = 0) - INTEGER TIME_VARYING - PARAMETER (TIME_VARYING = 1) - INTEGER TIME_VARIABLE - PARAMETER (TIME_VARIABLE = 1) -! -! TSTEP types -! - INTEGER TSTEP_CONSTANT - PARAMETER (TSTEP_CONSTANT = 0) - INTEGER TSTEP_INSTANT - PARAMETER (TSTEP_INSTANT = 1) - INTEGER TSTEP_AVG - PARAMETER (TSTEP_AVG = 2) - INTEGER TSTEP_ACCUM - PARAMETER (TSTEP_ACCUM = 3) - INTEGER TSTEP_MAX - PARAMETER (TSTEP_MAX = 4) - INTEGER TSTEP_MIN - PARAMETER (TSTEP_MIN = 5) - INTEGER TSTEP_DIFF - PARAMETER (TSTEP_DIFF = 6) - INTEGER TSTEP_RMS - PARAMETER (TSTEP_RMS = 7) - INTEGER TSTEP_SD - PARAMETER (TSTEP_SD = 8) - INTEGER TSTEP_COV - PARAMETER (TSTEP_COV = 9) - INTEGER TSTEP_RATIO - PARAMETER (TSTEP_RATIO = 10) - INTEGER TSTEP_SUM - PARAMETER (TSTEP_SUM = 11) - INTEGER TSTEP_RANGE - PARAMETER (TSTEP_RANGE = 12) - INTEGER TSTEP_INSTANT2 - PARAMETER (TSTEP_INSTANT2 = 13) - INTEGER TSTEP_INSTANT3 - PARAMETER (TSTEP_INSTANT3 = 14) -! -! TAXIS types -! - INTEGER TAXIS_ABSOLUTE - PARAMETER (TAXIS_ABSOLUTE = 1) - INTEGER TAXIS_RELATIVE - PARAMETER (TAXIS_RELATIVE = 2) - INTEGER TAXIS_FORECAST - PARAMETER (TAXIS_FORECAST = 3) -! -! TUNIT types -! - INTEGER TUNIT_SECOND - PARAMETER (TUNIT_SECOND = 1) - INTEGER TUNIT_MINUTE - PARAMETER (TUNIT_MINUTE = 2) - INTEGER TUNIT_QUARTER - PARAMETER (TUNIT_QUARTER = 3) - INTEGER TUNIT_30MINUTES - PARAMETER (TUNIT_30MINUTES = 4) - INTEGER TUNIT_HOUR - PARAMETER (TUNIT_HOUR = 5) - INTEGER TUNIT_3HOURS - PARAMETER (TUNIT_3HOURS = 6) - INTEGER TUNIT_6HOURS - PARAMETER (TUNIT_6HOURS = 7) - INTEGER TUNIT_12HOURS - PARAMETER (TUNIT_12HOURS = 8) - INTEGER TUNIT_DAY - PARAMETER (TUNIT_DAY = 9) - INTEGER TUNIT_MONTH - PARAMETER (TUNIT_MONTH = 10) - INTEGER TUNIT_YEAR - PARAMETER (TUNIT_YEAR = 11) -! -! CALENDAR types -! - INTEGER CALENDAR_STANDARD - PARAMETER (CALENDAR_STANDARD = 0) - INTEGER CALENDAR_GREGORIAN - PARAMETER (CALENDAR_GREGORIAN = 1) - INTEGER CALENDAR_PROLEPTIC - PARAMETER (CALENDAR_PROLEPTIC = 2) - INTEGER CALENDAR_360DAYS - PARAMETER (CALENDAR_360DAYS = 3) - INTEGER CALENDAR_365DAYS - PARAMETER (CALENDAR_365DAYS = 4) - INTEGER CALENDAR_366DAYS - PARAMETER (CALENDAR_366DAYS = 5) - INTEGER CALENDAR_NONE - PARAMETER (CALENDAR_NONE = 6) -! -! number of unsigned char needed to store UUID -! - INTEGER CDI_UUID_SIZE - PARAMETER (CDI_UUID_SIZE = 16) -! -! Structs that are used to return data to the user -! -! -! Opaque types -! -! -! CDI control routines -! -! cdiReset - EXTERNAL cdiReset - - CHARACTER(80) cdiStringError -! (INTEGER cdiErrno) - EXTERNAL cdiStringError - -! cdiDebug -! (INTEGER debug) - EXTERNAL cdiDebug - - CHARACTER(80) cdiLibraryVersion - EXTERNAL cdiLibraryVersion - -! cdiPrintVersion - EXTERNAL cdiPrintVersion - - INTEGER cdiHaveFiletype -! (INTEGER filetype) - EXTERNAL cdiHaveFiletype - -! cdiDefMissval -! (DOUBLEPRECISION missval) - EXTERNAL cdiDefMissval - - DOUBLEPRECISION cdiInqMissval - EXTERNAL cdiInqMissval - -! cdiDefGlobal -! (CHARACTER*(*) string, -! INTEGER val) - EXTERNAL cdiDefGlobal - - INTEGER namespaceNew - EXTERNAL namespaceNew - -! namespaceSetActive -! (INTEGER namespaceID) - EXTERNAL namespaceSetActive - - INTEGER namespaceGetActive - EXTERNAL namespaceGetActive - -! namespaceDelete -! (INTEGER namespaceID) - EXTERNAL namespaceDelete - -! -! CDI converter routines -! -! -! parameter -! -! cdiParamToString -! (INTEGER param, -! CHARACTER*(*) paramstr, -! INTEGER maxlen) - EXTERNAL cdiParamToString - -! cdiDecodeParam -! (INTEGER param, -! INTEGER pnum, -! INTEGER pcat, -! INTEGER pdis) - EXTERNAL cdiDecodeParam - - INTEGER cdiEncodeParam -! (INTEGER pnum, -! INTEGER pcat, -! INTEGER pdis) - EXTERNAL cdiEncodeParam - -! -! date format: YYYYMMDD -! -! -! time format: hhmmss -! -! cdiDecodeDate -! (INTEGER date, -! INTEGER year, -! INTEGER month, -! INTEGER day) - EXTERNAL cdiDecodeDate - - INTEGER cdiEncodeDate -! (INTEGER year, -! INTEGER month, -! INTEGER day) - EXTERNAL cdiEncodeDate - -! cdiDecodeTime -! (INTEGER time, -! INTEGER hour, -! INTEGER minute, -! INTEGER second) - EXTERNAL cdiDecodeTime - - INTEGER cdiEncodeTime -! (INTEGER hour, -! INTEGER minute, -! INTEGER second) - EXTERNAL cdiEncodeTime - -! -! STREAM control routines -! - INTEGER cdiGetFiletype -! (CHARACTER*(*) uri, -! INTEGER byteorder) - EXTERNAL cdiGetFiletype - - INTEGER streamOpenRead -! (CHARACTER*(*) path) - EXTERNAL streamOpenRead - - INTEGER streamOpenWrite -! (CHARACTER*(*) path, -! INTEGER filetype) - EXTERNAL streamOpenWrite - - INTEGER streamOpenAppend -! (CHARACTER*(*) path) - EXTERNAL streamOpenAppend - -! streamClose -! (INTEGER streamID) - EXTERNAL streamClose - -! streamSync -! (INTEGER streamID) - EXTERNAL streamSync - -! streamDefMaxSteps -! (INTEGER streamID, -! INTEGER maxSteps) - EXTERNAL streamDefMaxSteps - -! streamDefNumWorker -! (INTEGER streamID, -! INTEGER numWorker) - EXTERNAL streamDefNumWorker - -! streamDefVlist -! (INTEGER streamID, -! INTEGER vlistID) - EXTERNAL streamDefVlist - - INTEGER streamInqVlist -! (INTEGER streamID) - EXTERNAL streamInqVlist - - INTEGER streamInqFiletype -! (INTEGER streamID) - EXTERNAL streamInqFiletype - -! streamDefByteorder -! (INTEGER streamID, -! INTEGER byteorder) - EXTERNAL streamDefByteorder - - INTEGER streamInqByteorder -! (INTEGER streamID) - EXTERNAL streamInqByteorder - -! streamDefCompType -! (INTEGER streamID, -! INTEGER comptype) - EXTERNAL streamDefCompType - - INTEGER streamInqCompType -! (INTEGER streamID) - EXTERNAL streamInqCompType - -! streamDefCompLevel -! (INTEGER streamID, -! INTEGER complevel) - EXTERNAL streamDefCompLevel - - INTEGER streamInqCompLevel -! (INTEGER streamID) - EXTERNAL streamInqCompLevel - - INTEGER streamDefTimestep -! (INTEGER streamID, -! INTEGER tsID) - EXTERNAL streamDefTimestep - - INTEGER streamInqTimestep -! (INTEGER streamID, -! INTEGER tsID) - EXTERNAL streamInqTimestep - - INTEGER streamInqCurTimestepID -! (INTEGER streamID) - EXTERNAL streamInqCurTimestepID - - CHARACTER(80) streamFilename -! (INTEGER streamID) - EXTERNAL streamFilename - - CHARACTER(80) streamFilesuffix -! (INTEGER filetype) - EXTERNAL streamFilesuffix - - INTEGER streamNvals -! (INTEGER streamID) - EXTERNAL streamNvals - - INTEGER streamInqNvars -! (INTEGER streamID) - EXTERNAL streamInqNvars - -! -! STREAM var I/O routines (random access) -! -! streamWriteVar -! (INTEGER streamID, -! INTEGER varID, -! DOUBLEPRECISION data(*), -! INTEGER nmiss) - EXTERNAL streamWriteVar - -! streamWriteVarF -! (INTEGER streamID, -! INTEGER varID, -! REAL data(*), -! INTEGER nmiss) - EXTERNAL streamWriteVarF - -! streamReadVar -! (INTEGER streamID, -! INTEGER varID, -! DOUBLEPRECISION data(*), -! INTEGER nmiss) - EXTERNAL streamReadVar - -! streamReadVarF -! (INTEGER streamID, -! INTEGER varID, -! REAL data(*), -! INTEGER nmiss) - EXTERNAL streamReadVarF - -! streamWriteVarSlice -! (INTEGER streamID, -! INTEGER varID, -! INTEGER levelID, -! DOUBLEPRECISION data(*), -! INTEGER nmiss) - EXTERNAL streamWriteVarSlice - -! streamWriteVarSliceF -! (INTEGER streamID, -! INTEGER varID, -! INTEGER levelID, -! REAL data(*), -! INTEGER nmiss) - EXTERNAL streamWriteVarSliceF - -! streamReadVarSlice -! (INTEGER streamID, -! INTEGER varID, -! INTEGER levelID, -! DOUBLEPRECISION data(*), -! INTEGER nmiss) - EXTERNAL streamReadVarSlice - -! streamReadVarSliceF -! (INTEGER streamID, -! INTEGER varID, -! INTEGER levelID, -! REAL data(*), -! INTEGER nmiss) - EXTERNAL streamReadVarSliceF - -! streamWriteVarChunk -! (INTEGER streamID, -! INTEGER varID, -! INTEGER rect(2,3), -! DOUBLEPRECISION data(*), -! INTEGER nmiss) - EXTERNAL streamWriteVarChunk - -! -! STREAM record I/O routines (sequential access) -! -! streamDefRecord -! (INTEGER streamID, -! INTEGER varID, -! INTEGER levelID) - EXTERNAL streamDefRecord - -! streamInqRecord -! (INTEGER streamID, -! INTEGER varID, -! INTEGER levelID) - EXTERNAL streamInqRecord - -! streamWriteRecord -! (INTEGER streamID, -! DOUBLEPRECISION data(*), -! INTEGER nmiss) - EXTERNAL streamWriteRecord - -! streamWriteRecordF -! (INTEGER streamID, -! REAL data(*), -! INTEGER nmiss) - EXTERNAL streamWriteRecordF - -! streamReadRecord -! (INTEGER streamID, -! DOUBLEPRECISION data(*), -! INTEGER nmiss) - EXTERNAL streamReadRecord - -! streamReadRecordF -! (INTEGER streamID, -! REAL data(*), -! INTEGER nmiss) - EXTERNAL streamReadRecordF - -! streamCopyRecord -! (INTEGER streamIDdest, -! INTEGER streamIDsrc) - EXTERNAL streamCopyRecord - -! -! File driven I/O (may yield better performance than using the streamXXX functions) -! -! -! Creation & Destruction -! -! -! Advancing an iterator -! -! -! Introspecting metadata -! -! -! All outXXX arguments to these functions may be NULL. -! -! -! Reading data -! -! -! TODO[NH]: Add functions to read partial fields. -! -! -! Direct access to grib fields -! -! -! Callthroughs to GRIB-API -! -! -! Convenience functions for accessing GRIB-API keys -! -! -! VLIST routines -! - INTEGER vlistCreate - EXTERNAL vlistCreate - -! vlistDestroy -! (INTEGER vlistID) - EXTERNAL vlistDestroy - - INTEGER vlistDuplicate -! (INTEGER vlistID) - EXTERNAL vlistDuplicate - -! vlistCopy -! (INTEGER vlistID2, -! INTEGER vlistID1) - EXTERNAL vlistCopy - -! vlistCopyFlag -! (INTEGER vlistID2, -! INTEGER vlistID1) - EXTERNAL vlistCopyFlag - -! vlistClearFlag -! (INTEGER vlistID) - EXTERNAL vlistClearFlag - -! vlistCat -! (INTEGER vlistID2, -! INTEGER vlistID1) - EXTERNAL vlistCat - -! vlistMerge -! (INTEGER vlistID2, -! INTEGER vlistID1) - EXTERNAL vlistMerge - -! vlistPrint -! (INTEGER vlistID) - EXTERNAL vlistPrint - - INTEGER vlistNumber -! (INTEGER vlistID) - EXTERNAL vlistNumber - - INTEGER vlistNvars -! (INTEGER vlistID) - EXTERNAL vlistNvars - - INTEGER vlistNgrids -! (INTEGER vlistID) - EXTERNAL vlistNgrids - - INTEGER vlistNzaxis -! (INTEGER vlistID) - EXTERNAL vlistNzaxis - - INTEGER vlistNsubtypes -! (INTEGER vlistID) - EXTERNAL vlistNsubtypes - -! vlistDefNtsteps -! (INTEGER vlistID, -! INTEGER nts) - EXTERNAL vlistDefNtsteps - - INTEGER vlistNtsteps -! (INTEGER vlistID) - EXTERNAL vlistNtsteps - - INTEGER vlistGridsizeMax -! (INTEGER vlistID) - EXTERNAL vlistGridsizeMax - - INTEGER vlistGrid -! (INTEGER vlistID, -! INTEGER index) - EXTERNAL vlistGrid - - INTEGER vlistGridIndex -! (INTEGER vlistID, -! INTEGER gridID) - EXTERNAL vlistGridIndex - -! vlistChangeGridIndex -! (INTEGER vlistID, -! INTEGER index, -! INTEGER gridID) - EXTERNAL vlistChangeGridIndex - -! vlistChangeGrid -! (INTEGER vlistID, -! INTEGER gridID1, -! INTEGER gridID2) - EXTERNAL vlistChangeGrid - - INTEGER vlistZaxis -! (INTEGER vlistID, -! INTEGER index) - EXTERNAL vlistZaxis - - INTEGER vlistZaxisIndex -! (INTEGER vlistID, -! INTEGER zaxisID) - EXTERNAL vlistZaxisIndex - -! vlistChangeZaxisIndex -! (INTEGER vlistID, -! INTEGER index, -! INTEGER zaxisID) - EXTERNAL vlistChangeZaxisIndex - -! vlistChangeZaxis -! (INTEGER vlistID, -! INTEGER zaxisID1, -! INTEGER zaxisID2) - EXTERNAL vlistChangeZaxis - - INTEGER vlistNrecs -! (INTEGER vlistID) - EXTERNAL vlistNrecs - - INTEGER vlistSubtype -! (INTEGER vlistID, -! INTEGER index) - EXTERNAL vlistSubtype - - INTEGER vlistSubtypeIndex -! (INTEGER vlistID, -! INTEGER subtypeID) - EXTERNAL vlistSubtypeIndex - -! vlistDefTaxis -! (INTEGER vlistID, -! INTEGER taxisID) - EXTERNAL vlistDefTaxis - - INTEGER vlistInqTaxis -! (INTEGER vlistID) - EXTERNAL vlistInqTaxis - -! vlistDefTable -! (INTEGER vlistID, -! INTEGER tableID) - EXTERNAL vlistDefTable - - INTEGER vlistInqTable -! (INTEGER vlistID) - EXTERNAL vlistInqTable - -! vlistDefInstitut -! (INTEGER vlistID, -! INTEGER instID) - EXTERNAL vlistDefInstitut - - INTEGER vlistInqInstitut -! (INTEGER vlistID) - EXTERNAL vlistInqInstitut - -! vlistDefModel -! (INTEGER vlistID, -! INTEGER modelID) - EXTERNAL vlistDefModel - - INTEGER vlistInqModel -! (INTEGER vlistID) - EXTERNAL vlistInqModel - -! -! VLIST VAR routines -! - INTEGER vlistDefVarTiles -! (INTEGER vlistID, -! INTEGER gridID, -! INTEGER zaxisID, -! INTEGER timetype, -! INTEGER tilesetID) - EXTERNAL vlistDefVarTiles - - INTEGER vlistDefVar -! (INTEGER vlistID, -! INTEGER gridID, -! INTEGER zaxisID, -! INTEGER timetype) - EXTERNAL vlistDefVar - -! vlistChangeVarGrid -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER gridID) - EXTERNAL vlistChangeVarGrid - -! vlistChangeVarZaxis -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER zaxisID) - EXTERNAL vlistChangeVarZaxis - -! vlistInqVar -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER gridID, -! INTEGER zaxisID, -! INTEGER timetype) - EXTERNAL vlistInqVar - - INTEGER vlistInqVarGrid -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarGrid - - INTEGER vlistInqVarZaxis -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarZaxis - -! -! used in MPIOM -! - INTEGER vlistInqVarID -! (INTEGER vlistID, -! INTEGER code) - EXTERNAL vlistInqVarID - -! vlistDefVarTimetype -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER timetype) - EXTERNAL vlistDefVarTimetype - - INTEGER vlistInqVarTimetype -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarTimetype - -! vlistDefVarTsteptype -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER tsteptype) - EXTERNAL vlistDefVarTsteptype - - INTEGER vlistInqVarTsteptype -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarTsteptype - -! vlistDefVarCompType -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER comptype) - EXTERNAL vlistDefVarCompType - - INTEGER vlistInqVarCompType -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarCompType - -! vlistDefVarCompLevel -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER complevel) - EXTERNAL vlistDefVarCompLevel - - INTEGER vlistInqVarCompLevel -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarCompLevel - -! vlistDefVarParam -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER param) - EXTERNAL vlistDefVarParam - - INTEGER vlistInqVarParam -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarParam - -! vlistDefVarCode -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER code) - EXTERNAL vlistDefVarCode - - INTEGER vlistInqVarCode -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarCode - -! vlistDefVarDatatype -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER datatype) - EXTERNAL vlistDefVarDatatype - - INTEGER vlistInqVarDatatype -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarDatatype - -! vlistDefVarXYZ -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER xyz) - EXTERNAL vlistDefVarXYZ - - INTEGER vlistInqVarXYZ -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarXYZ - -! vlistDefVarNSB -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER nsb) - EXTERNAL vlistDefVarNSB - - INTEGER vlistInqVarNSB -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarNSB - - INTEGER vlistInqVarNumber -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarNumber - -! vlistDefVarInstitut -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER instID) - EXTERNAL vlistDefVarInstitut - - INTEGER vlistInqVarInstitut -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarInstitut - -! vlistDefVarModel -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER modelID) - EXTERNAL vlistDefVarModel - - INTEGER vlistInqVarModel -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarModel - -! vlistDefVarTable -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER tableID) - EXTERNAL vlistDefVarTable - - INTEGER vlistInqVarTable -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarTable - -! vlistDefVarName -! (INTEGER vlistID, -! INTEGER varID, -! CHARACTER*(*) name) - EXTERNAL vlistDefVarName - -! vlistInqVarName -! (INTEGER vlistID, -! INTEGER varID, -! CHARACTER*(*) name) - EXTERNAL vlistInqVarName - - CHARACTER(80) vlistCopyVarName -! (INTEGER vlistId, -! INTEGER varId) - EXTERNAL vlistCopyVarName - -! vlistDefVarStdname -! (INTEGER vlistID, -! INTEGER varID, -! CHARACTER*(*) stdname) - EXTERNAL vlistDefVarStdname - -! vlistInqVarStdname -! (INTEGER vlistID, -! INTEGER varID, -! CHARACTER*(*) stdname) - EXTERNAL vlistInqVarStdname - -! vlistDefVarLongname -! (INTEGER vlistID, -! INTEGER varID, -! CHARACTER*(*) longname) - EXTERNAL vlistDefVarLongname - -! vlistInqVarLongname -! (INTEGER vlistID, -! INTEGER varID, -! CHARACTER*(*) longname) - EXTERNAL vlistInqVarLongname - -! vlistDefVarUnits -! (INTEGER vlistID, -! INTEGER varID, -! CHARACTER*(*) units) - EXTERNAL vlistDefVarUnits - -! vlistInqVarUnits -! (INTEGER vlistID, -! INTEGER varID, -! CHARACTER*(*) units) - EXTERNAL vlistInqVarUnits - -! vlistDefVarMissval -! (INTEGER vlistID, -! INTEGER varID, -! DOUBLEPRECISION missval) - EXTERNAL vlistDefVarMissval - - DOUBLEPRECISION vlistInqVarMissval -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarMissval - -! vlistDefVarExtra -! (INTEGER vlistID, -! INTEGER varID, -! CHARACTER*(*) extra) - EXTERNAL vlistDefVarExtra - -! vlistInqVarExtra -! (INTEGER vlistID, -! INTEGER varID, -! CHARACTER*(*) extra) - EXTERNAL vlistInqVarExtra - -! vlistDefVarScalefactor -! (INTEGER vlistID, -! INTEGER varID, -! DOUBLEPRECISION scalefactor) - EXTERNAL vlistDefVarScalefactor - - DOUBLEPRECISION vlistInqVarScalefactor -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarScalefactor - -! vlistDefVarAddoffset -! (INTEGER vlistID, -! INTEGER varID, -! DOUBLEPRECISION addoffset) - EXTERNAL vlistDefVarAddoffset - - DOUBLEPRECISION vlistInqVarAddoffset -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarAddoffset - - INTEGER vlistInqVarSize -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarSize - -! vlistDefIndex -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER levID, -! INTEGER index) - EXTERNAL vlistDefIndex - - INTEGER vlistInqIndex -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER levID) - EXTERNAL vlistInqIndex - -! vlistDefFlag -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER levID, -! INTEGER flag) - EXTERNAL vlistDefFlag - - INTEGER vlistInqFlag -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER levID) - EXTERNAL vlistInqFlag - - INTEGER vlistFindVar -! (INTEGER vlistID, -! INTEGER fvarID) - EXTERNAL vlistFindVar - - INTEGER vlistFindLevel -! (INTEGER vlistID, -! INTEGER fvarID, -! INTEGER flevelID) - EXTERNAL vlistFindLevel - - INTEGER vlistMergedVar -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistMergedVar - - INTEGER vlistMergedLevel -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER levelID) - EXTERNAL vlistMergedLevel - -! cdiClearAdditionalKeys - EXTERNAL cdiClearAdditionalKeys - -! cdiDefAdditionalKey -! (CHARACTER*(*) string) - EXTERNAL cdiDefAdditionalKey - -! vlistDefVarIntKey -! (INTEGER vlistID, -! INTEGER varID, -! CHARACTER*(*) name, -! INTEGER value) - EXTERNAL vlistDefVarIntKey - -! vlistDefVarDblKey -! (INTEGER vlistID, -! INTEGER varID, -! CHARACTER*(*) name, -! DOUBLEPRECISION value) - EXTERNAL vlistDefVarDblKey - - INTEGER vlistHasVarKey -! (INTEGER vlistID, -! INTEGER varID, -! CHARACTER*(*) name) - EXTERNAL vlistHasVarKey - - DOUBLEPRECISION vlistInqVarDblKey -! (INTEGER vlistID, -! INTEGER varID, -! CHARACTER*(*) name) - EXTERNAL vlistInqVarDblKey - - INTEGER vlistInqVarIntKey -! (INTEGER vlistID, -! INTEGER varID, -! CHARACTER*(*) name) - EXTERNAL vlistInqVarIntKey - -! -! CDI attributes -! - INTEGER cdiInqNatts -! (INTEGER cdiID, -! INTEGER varID, -! INTEGER nattsp) - EXTERNAL cdiInqNatts - - INTEGER cdiInqAtt -! (INTEGER cdiID, -! INTEGER varID, -! INTEGER attrnum, -! CHARACTER*(*) name, -! INTEGER typep, -! INTEGER lenp) - EXTERNAL cdiInqAtt - - INTEGER cdiInqAttLen -! (INTEGER cdiID, -! INTEGER varID, -! CHARACTER*(*) name) - EXTERNAL cdiInqAttLen - - INTEGER cdiInqAttType -! (INTEGER cdiID, -! INTEGER varID, -! CHARACTER*(*) name) - EXTERNAL cdiInqAttType - - INTEGER cdiDelAtt -! (INTEGER cdiID, -! INTEGER varID, -! CHARACTER*(*) name) - EXTERNAL cdiDelAtt - - INTEGER cdiCopyAtts -! (INTEGER cdiID1, -! INTEGER varID1, -! INTEGER cdiID2, -! INTEGER varID2) - EXTERNAL cdiCopyAtts - - INTEGER cdiDefAttInt -! (INTEGER cdiID, -! INTEGER varID, -! CHARACTER*(*) name, -! INTEGER type, -! INTEGER len, -! INTEGER ip(*)) - EXTERNAL cdiDefAttInt - - INTEGER cdiDefAttFlt -! (INTEGER cdiID, -! INTEGER varID, -! CHARACTER*(*) name, -! INTEGER type, -! INTEGER len, -! DOUBLEPRECISION dp(*)) - EXTERNAL cdiDefAttFlt - - INTEGER cdiDefAttTxt -! (INTEGER cdiID, -! INTEGER varID, -! CHARACTER*(*) name, -! INTEGER len, -! CHARACTER*(*) tp_cbuf) - EXTERNAL cdiDefAttTxt - - INTEGER cdiInqAttInt -! (INTEGER cdiID, -! INTEGER varID, -! CHARACTER*(*) name, -! INTEGER mlen, -! INTEGER ip(*)) - EXTERNAL cdiInqAttInt - - INTEGER cdiInqAttFlt -! (INTEGER cdiID, -! INTEGER varID, -! CHARACTER*(*) name, -! INTEGER mlen, -! DOUBLEPRECISION dp(*)) - EXTERNAL cdiInqAttFlt - - INTEGER cdiInqAttTxt -! (INTEGER cdiID, -! INTEGER varID, -! CHARACTER*(*) name, -! INTEGER mlen, -! CHARACTER*(*) tp_cbuf) - EXTERNAL cdiInqAttTxt - -! -! GRID routines -! -! gridName -! (INTEGER gridtype, -! CHARACTER*(*) gridname) - EXTERNAL gridName - - CHARACTER(80) gridNamePtr -! (INTEGER gridtype) - EXTERNAL gridNamePtr - -! gridCompress -! (INTEGER gridID) - EXTERNAL gridCompress - -! gridDefMaskGME -! (INTEGER gridID, -! INTEGER mask(*)) - EXTERNAL gridDefMaskGME - - INTEGER gridInqMaskGME -! (INTEGER gridID, -! INTEGER mask(*)) - EXTERNAL gridInqMaskGME - -! gridDefMask -! (INTEGER gridID, -! INTEGER mask(*)) - EXTERNAL gridDefMask - - INTEGER gridInqMask -! (INTEGER gridID, -! INTEGER mask(*)) - EXTERNAL gridInqMask - - INTEGER gridCreate -! (INTEGER gridtype, -! INTEGER size) - EXTERNAL gridCreate - -! gridDestroy -! (INTEGER gridID) - EXTERNAL gridDestroy - - INTEGER gridDuplicate -! (INTEGER gridID) - EXTERNAL gridDuplicate - -! gridDefProj -! (INTEGER gridID, -! INTEGER projID) - EXTERNAL gridDefProj - - INTEGER gridInqProj -! (INTEGER gridID) - EXTERNAL gridInqProj - - INTEGER gridInqProjType -! (INTEGER gridID) - EXTERNAL gridInqProjType - - INTEGER gridInqType -! (INTEGER gridID) - EXTERNAL gridInqType - - INTEGER gridInqSize -! (INTEGER gridID) - EXTERNAL gridInqSize - -! gridDefXsize -! (INTEGER gridID, -! INTEGER xsize) - EXTERNAL gridDefXsize - - INTEGER gridInqXsize -! (INTEGER gridID) - EXTERNAL gridInqXsize - -! gridDefYsize -! (INTEGER gridID, -! INTEGER ysize) - EXTERNAL gridDefYsize - - INTEGER gridInqYsize -! (INTEGER gridID) - EXTERNAL gridInqYsize - -! gridDefNP -! (INTEGER gridID, -! INTEGER np) - EXTERNAL gridDefNP - - INTEGER gridInqNP -! (INTEGER gridID) - EXTERNAL gridInqNP - -! gridDefXvals -! (INTEGER gridID, -! DOUBLEPRECISION xvals(*)) - EXTERNAL gridDefXvals - - INTEGER gridInqXvals -! (INTEGER gridID, -! DOUBLEPRECISION xvals(*)) - EXTERNAL gridInqXvals - - INTEGER gridInqXvalsPart -! (INTEGER gridID, -! INTEGER start, -! INTEGER size, -! DOUBLEPRECISION xvals(*)) - EXTERNAL gridInqXvalsPart - - INTEGER gridInqXIsc -! (INTEGER gridID) - EXTERNAL gridInqXIsc - -! gridDefYvals -! (INTEGER gridID, -! DOUBLEPRECISION yvals(*)) - EXTERNAL gridDefYvals - - INTEGER gridInqYvals -! (INTEGER gridID, -! DOUBLEPRECISION yvals(*)) - EXTERNAL gridInqYvals - - INTEGER gridInqYvalsPart -! (INTEGER gridID, -! INTEGER start, -! INTEGER size, -! DOUBLEPRECISION yvals(*)) - EXTERNAL gridInqYvalsPart - - INTEGER gridInqYIsc -! (INTEGER gridID) - EXTERNAL gridInqYIsc - -! -! CDI var keys -! -! -! String keys -! - INTEGER CDI_KEY_NAME - PARAMETER (CDI_KEY_NAME = 942) - INTEGER CDI_KEY_LONGNAME - PARAMETER (CDI_KEY_LONGNAME = 943) - INTEGER CDI_KEY_STDNAME - PARAMETER (CDI_KEY_STDNAME = 944) - INTEGER CDI_KEY_UNITS - PARAMETER (CDI_KEY_UNITS = 945) - INTEGER CDI_KEY_DATATYPE - PARAMETER (CDI_KEY_DATATYPE = 946) - INTEGER CDI_KEY_REFERENCEURI - PARAMETER (CDI_KEY_REFERENCEURI = 947) -! -! Integer keys -! - INTEGER CDI_KEY_NUMBEROFGRIDUSED - PARAMETER (CDI_KEY_NUMBEROFGRIDUSED = 961) - INTEGER CDI_KEY_NUMBEROFGRIDINREFERENCE - PARAMETER (CDI_KEY_NUMBEROFGRIDINREFERENCE = 962) - INTEGER CDI_KEY_NUMBEROFVGRIDUSED - PARAMETER (CDI_KEY_NUMBEROFVGRIDUSED = 963) - INTEGER CDI_KEY_NLEV - PARAMETER (CDI_KEY_NLEV = 964) - INTEGER CDI_KEY_CHUNKTYPE - PARAMETER (CDI_KEY_CHUNKTYPE = 965) - INTEGER CDI_KEY_CHUNKSIZE - PARAMETER (CDI_KEY_CHUNKSIZE = 966) -! -! Floating point keys -! - INTEGER CDI_KEY_MISSVAL - PARAMETER (CDI_KEY_MISSVAL = 701) -! -! Byte array keys -! - INTEGER CDI_KEY_UUID - PARAMETER (CDI_KEY_UUID = 960) - INTEGER CDI_KEY_DIMNAME - PARAMETER (CDI_KEY_DIMNAME = 941) - INTEGER CDI_KEY_PSNAME - PARAMETER (CDI_KEY_PSNAME = 950) - INTEGER CDI_KEY_P0NAME - PARAMETER (CDI_KEY_P0NAME = 951) - INTEGER CDI_KEY_P0VALUE - PARAMETER (CDI_KEY_P0VALUE = 952) - INTEGER CDI_KEY_TABLESVERSION - PARAMETER (CDI_KEY_TABLESVERSION = 801) - INTEGER CDI_KEY_LOCALTABLESVERSION - PARAMETER (CDI_KEY_LOCALTABLESVERSION = 802) - INTEGER CDI_KEY_TYPEOFGENERATINGPROCESS - PARAMETER (CDI_KEY_TYPEOFGENERATINGPROCESS = 803) - INTEGER CDI_KEY_PRODUCTDEFINITIONTEMPLATE - PARAMETER (CDI_KEY_PRODUCTDEFINITIONTEMPLATE = 804) - INTEGER CDI_KEY_TYPEOFPROCESSEDDATA - PARAMETER (CDI_KEY_TYPEOFPROCESSEDDATA = 805) - INTEGER CDI_KEY_SHAPEOFTHEEARTH - PARAMETER (CDI_KEY_SHAPEOFTHEEARTH = 806) - INTEGER CDI_KEY_BACKGROUNDPROCESS - PARAMETER (CDI_KEY_BACKGROUNDPROCESS = 807) - INTEGER CDI_KEY_TYPEOFENSEMBLEFORECAST - PARAMETER (CDI_KEY_TYPEOFENSEMBLEFORECAST = 808) - INTEGER CDI_KEY_NUMBEROFFORECASTSINENSEMBLE - PARAMETER (CDI_KEY_NUMBEROFFORECASTSINENSEMBLE = 809) - INTEGER CDI_KEY_PERTURBATIONNUMBER - PARAMETER (CDI_KEY_PERTURBATIONNUMBER = 810) - INTEGER CDI_KEY_CENTRE - PARAMETER (CDI_KEY_CENTRE = 811) - INTEGER CDI_KEY_SUBCENTRE - PARAMETER (CDI_KEY_SUBCENTRE = 812) - INTEGER CDI_KEY_MPIMTYPE - PARAMETER (CDI_KEY_MPIMTYPE = 813) - INTEGER CDI_KEY_MPIMCLASS - PARAMETER (CDI_KEY_MPIMCLASS = 814) - INTEGER CDI_KEY_MPIMUSER - PARAMETER (CDI_KEY_MPIMUSER = 815) - INTEGER CDI_KEY_REVSTATUS - PARAMETER (CDI_KEY_REVSTATUS = 816) - INTEGER CDI_KEY_REVNUMBER - PARAMETER (CDI_KEY_REVNUMBER = 817) - INTEGER CDI_KEY_GRIB2LOCALSECTIONNUMBER - PARAMETER (CDI_KEY_GRIB2LOCALSECTIONNUMBER = 818) - INTEGER CDI_KEY_SECTION2PADDINGLENGTH - PARAMETER (CDI_KEY_SECTION2PADDINGLENGTH = 819) - INTEGER CDI_KEY_SECTION2PADDING - PARAMETER (CDI_KEY_SECTION2PADDING = 820) - INTEGER CDI_KEY_CONSTITUENTTYPE - PARAMETER (CDI_KEY_CONSTITUENTTYPE = 821) - INTEGER CDI_KEY_TYPEOFTIMEINCREMENT - PARAMETER (CDI_KEY_TYPEOFTIMEINCREMENT = 822) - INTEGER CDI_KEY_TYPEOFFIRSTFIXEDSURFACE - PARAMETER (CDI_KEY_TYPEOFFIRSTFIXEDSURFACE = 823) - INTEGER CDI_KEY_TYPEOFSECONDFIXEDSURFACE - PARAMETER (CDI_KEY_TYPEOFSECONDFIXEDSURFACE = 824) - INTEGER CDI_KEY_UVRELATIVETOGRID - PARAMETER (CDI_KEY_UVRELATIVETOGRID = 825) - INTEGER CDI_KEY_SCANNINGMODE - PARAMETER (CDI_KEY_SCANNINGMODE = 826) - INTEGER CDI_KEY_VDIMNAME - PARAMETER (CDI_KEY_VDIMNAME = 920) - INTEGER CDI_KEY_GRIDMAP_VARTYPE - PARAMETER (CDI_KEY_GRIDMAP_VARTYPE = 921) - INTEGER CDI_KEY_GRIDMAP_VARNAME - PARAMETER (CDI_KEY_GRIDMAP_VARNAME = 922) - INTEGER CDI_KEY_GRIDMAP_NAME - PARAMETER (CDI_KEY_GRIDMAP_NAME = 923) - INTEGER cdiDefKeyInt -! (INTEGER cdiID, -! INTEGER varID, -! INTEGER key, -! INTEGER value) - EXTERNAL cdiDefKeyInt - - INTEGER cdiInqKeyInt -! (INTEGER cdiID, -! INTEGER varID, -! INTEGER key, -! INTEGER value) - EXTERNAL cdiInqKeyInt - - INTEGER cdiDefKeyFloat -! (INTEGER cdiID, -! INTEGER varID, -! INTEGER key, -! DOUBLEPRECISION value) - EXTERNAL cdiDefKeyFloat - -! -! cdiInqKeyFloat Get a float value from a key -! - INTEGER cdiInqKeyFloat -! (INTEGER cdiID, -! INTEGER varID, -! INTEGER key, -! DOUBLEPRECISION value) - EXTERNAL cdiInqKeyFloat - - INTEGER cdiDefKeyString -! (INTEGER cdiID, -! INTEGER varID, -! INTEGER key, -! CHARACTER*(*) string) - EXTERNAL cdiDefKeyString - - INTEGER cdiInqKeyString -! (INTEGER cdiID, -! INTEGER varID, -! INTEGER key, -! CHARACTER*(*) string, -! INTEGER length) - EXTERNAL cdiInqKeyString - - INTEGER cdiInqKeyLen -! (INTEGER cdiID, -! INTEGER varID, -! INTEGER key, -! INTEGER length) - EXTERNAL cdiInqKeyLen - - INTEGER cdiCopyKeys -! (INTEGER cdiID1, -! INTEGER varID1, -! INTEGER cdiID2, -! INTEGER varID2) - EXTERNAL cdiCopyKeys - - INTEGER cdiCopyKey -! (INTEGER cdiID1, -! INTEGER varID1, -! INTEGER key, -! INTEGER cdiID2) - EXTERNAL cdiCopyKey - - INTEGER cdiDeleteKey -! (INTEGER cdiID, -! INTEGER varID, -! INTEGER key) - EXTERNAL cdiDeleteKey - -! -! GRID routines -! -! gridDefXname -! (INTEGER gridID, -! CHARACTER*(*) xname) - EXTERNAL gridDefXname - -! gridInqXname -! (INTEGER gridID, -! CHARACTER*(*) xname) - EXTERNAL gridInqXname - -! gridDefXlongname -! (INTEGER gridID, -! CHARACTER*(*) xlongname) - EXTERNAL gridDefXlongname - -! gridInqXlongname -! (INTEGER gridID, -! CHARACTER*(*) xlongname) - EXTERNAL gridInqXlongname - -! gridDefXunits -! (INTEGER gridID, -! CHARACTER*(*) xunits) - EXTERNAL gridDefXunits - -! gridInqXunits -! (INTEGER gridID, -! CHARACTER*(*) xunits) - EXTERNAL gridInqXunits - -! gridDefYname -! (INTEGER gridID, -! CHARACTER*(*) yname) - EXTERNAL gridDefYname - -! gridInqYname -! (INTEGER gridID, -! CHARACTER*(*) yname) - EXTERNAL gridInqYname - -! gridDefYlongname -! (INTEGER gridID, -! CHARACTER*(*) ylongname) - EXTERNAL gridDefYlongname - -! gridInqYlongname -! (INTEGER gridID, -! CHARACTER*(*) ylongname) - EXTERNAL gridInqYlongname - -! gridDefYunits -! (INTEGER gridID, -! CHARACTER*(*) yunits) - EXTERNAL gridDefYunits - -! gridInqYunits -! (INTEGER gridID, -! CHARACTER*(*) yunits) - EXTERNAL gridInqYunits - -! gridDefDatatype -! (INTEGER gridID, -! INTEGER datatype) - EXTERNAL gridDefDatatype - - INTEGER gridInqDatatype -! (INTEGER gridID) - EXTERNAL gridInqDatatype - - DOUBLEPRECISION gridInqXval -! (INTEGER gridID, -! INTEGER index) - EXTERNAL gridInqXval - - DOUBLEPRECISION gridInqYval -! (INTEGER gridID, -! INTEGER index) - EXTERNAL gridInqYval - - DOUBLEPRECISION gridInqXinc -! (INTEGER gridID) - EXTERNAL gridInqXinc - - DOUBLEPRECISION gridInqYinc -! (INTEGER gridID) - EXTERNAL gridInqYinc - - INTEGER gridIsCircular -! (INTEGER gridID) - EXTERNAL gridIsCircular - - INTEGER gridInqTrunc -! (INTEGER gridID) - EXTERNAL gridInqTrunc - -! gridDefTrunc -! (INTEGER gridID, -! INTEGER trunc) - EXTERNAL gridDefTrunc - -! -! Reference of an unstructured grid -! -! gridDefNumber -! (INTEGER gridID, -! INTEGER number) - EXTERNAL gridDefNumber - - INTEGER gridInqNumber -! (INTEGER gridID) - EXTERNAL gridInqNumber - -! gridDefPosition -! (INTEGER gridID, -! INTEGER position) - EXTERNAL gridDefPosition - - INTEGER gridInqPosition -! (INTEGER gridID) - EXTERNAL gridInqPosition - -! gridDefReference -! (INTEGER gridID, -! CHARACTER*(*) reference) - EXTERNAL gridDefReference - - INTEGER gridInqReference -! (INTEGER gridID, -! CHARACTER*(*) reference) - EXTERNAL gridInqReference - -! gridDefUUID -! (INTEGER gridID, -! INTEGER*1(16) uuid) - EXTERNAL gridDefUUID - -! gridInqUUID -! (INTEGER gridID, -! INTEGER*1(16) uuid) - EXTERNAL gridInqUUID - -! -! Rotated Lon/Lat grid -! -! gridDefParamRLL -! (INTEGER gridID, -! DOUBLEPRECISION xpole, -! DOUBLEPRECISION ypole, -! DOUBLEPRECISION angle) - EXTERNAL gridDefParamRLL - -! gridInqParamRLL -! (INTEGER gridID, -! DOUBLEPRECISION xpole, -! DOUBLEPRECISION ypole, -! DOUBLEPRECISION angle) - EXTERNAL gridInqParamRLL - -! -! Hexagonal GME grid -! -! gridDefParamGME -! (INTEGER gridID, -! INTEGER nd, -! INTEGER ni, -! INTEGER ni2, -! INTEGER ni3) - EXTERNAL gridDefParamGME - -! gridInqParamGME -! (INTEGER gridID, -! INTEGER nd, -! INTEGER ni, -! INTEGER ni2, -! INTEGER ni3) - EXTERNAL gridInqParamGME - -! gridDefArea -! (INTEGER gridID, -! DOUBLEPRECISION area(*)) - EXTERNAL gridDefArea - -! gridInqArea -! (INTEGER gridID, -! DOUBLEPRECISION area(*)) - EXTERNAL gridInqArea - - INTEGER gridHasArea -! (INTEGER gridID) - EXTERNAL gridHasArea - -! gridDefNvertex -! (INTEGER gridID, -! INTEGER nvertex) - EXTERNAL gridDefNvertex - - INTEGER gridInqNvertex -! (INTEGER gridID) - EXTERNAL gridInqNvertex - -! gridDefXbounds -! (INTEGER gridID, -! DOUBLEPRECISION xbounds(*)) - EXTERNAL gridDefXbounds - - INTEGER gridInqXbounds -! (INTEGER gridID, -! DOUBLEPRECISION xbounds(*)) - EXTERNAL gridInqXbounds - - INTEGER gridInqXboundsPart -! (INTEGER gridID, -! INTEGER start, -! INTEGER size, -! DOUBLEPRECISION xbounds(*)) - EXTERNAL gridInqXboundsPart - -! gridDefYbounds -! (INTEGER gridID, -! DOUBLEPRECISION ybounds(*)) - EXTERNAL gridDefYbounds - - INTEGER gridInqYbounds -! (INTEGER gridID, -! DOUBLEPRECISION ybounds(*)) - EXTERNAL gridInqYbounds - - INTEGER gridInqYboundsPart -! (INTEGER gridID, -! INTEGER start, -! INTEGER size, -! DOUBLEPRECISION ybounds(*)) - EXTERNAL gridInqYboundsPart - -! gridDefReducedPoints -! (INTEGER gridID, -! INTEGER reducedPointsSize, -! INTEGER reducedPoints(*)) - EXTERNAL gridDefReducedPoints - -! gridInqReducedPoints -! (INTEGER gridID, -! INTEGER reducedPoints(*)) - EXTERNAL gridInqReducedPoints - -! gridChangeType -! (INTEGER gridID, -! INTEGER gridtype) - EXTERNAL gridChangeType - -! gridDefComplexPacking -! (INTEGER gridID, -! INTEGER lpack) - EXTERNAL gridDefComplexPacking - - INTEGER gridInqComplexPacking -! (INTEGER gridID) - EXTERNAL gridInqComplexPacking - -! -! ZAXIS routines -! -! zaxisName -! (INTEGER zaxistype, -! CHARACTER*(*) zaxisname) - EXTERNAL zaxisName - - CHARACTER(80) zaxisNamePtr -! (INTEGER leveltype) - EXTERNAL zaxisNamePtr - - INTEGER zaxisCreate -! (INTEGER zaxistype, -! INTEGER size) - EXTERNAL zaxisCreate - -! zaxisDestroy -! (INTEGER zaxisID) - EXTERNAL zaxisDestroy - - INTEGER zaxisInqType -! (INTEGER zaxisID) - EXTERNAL zaxisInqType - - INTEGER zaxisInqSize -! (INTEGER zaxisID) - EXTERNAL zaxisInqSize - - INTEGER zaxisDuplicate -! (INTEGER zaxisID) - EXTERNAL zaxisDuplicate - -! zaxisDefLevels -! (INTEGER zaxisID, -! DOUBLEPRECISION levels(*)) - EXTERNAL zaxisDefLevels - - INTEGER zaxisInqLevels -! (INTEGER zaxisID, -! DOUBLEPRECISION levels(*)) - EXTERNAL zaxisInqLevels - - INTEGER zaxisInqCLen -! (INTEGER zaxisID) - EXTERNAL zaxisInqCLen - -! zaxisDefLevel -! (INTEGER zaxisID, -! INTEGER levelID, -! DOUBLEPRECISION levels) - EXTERNAL zaxisDefLevel - - DOUBLEPRECISION zaxisInqLevel -! (INTEGER zaxisID, -! INTEGER levelID) - EXTERNAL zaxisInqLevel - -! zaxisDefNlevRef -! (INTEGER gridID, -! INTEGER nhlev) - EXTERNAL zaxisDefNlevRef - - INTEGER zaxisInqNlevRef -! (INTEGER gridID) - EXTERNAL zaxisInqNlevRef - -! zaxisDefNumber -! (INTEGER gridID, -! INTEGER number) - EXTERNAL zaxisDefNumber - - INTEGER zaxisInqNumber -! (INTEGER gridID) - EXTERNAL zaxisInqNumber - -! zaxisDefUUID -! (INTEGER zaxisID, -! INTEGER*1(16) uuid) - EXTERNAL zaxisDefUUID - -! zaxisInqUUID -! (INTEGER zaxisID, -! INTEGER*1(16) uuid) - EXTERNAL zaxisInqUUID - -! zaxisDefName -! (INTEGER zaxisID, -! CHARACTER*(*) name_optional) - EXTERNAL zaxisDefName - -! zaxisInqName -! (INTEGER zaxisID, -! CHARACTER*(*) name) - EXTERNAL zaxisInqName - -! zaxisDefLongname -! (INTEGER zaxisID, -! CHARACTER*(*) longname_optional) - EXTERNAL zaxisDefLongname - -! zaxisInqLongname -! (INTEGER zaxisID, -! CHARACTER*(*) longname) - EXTERNAL zaxisInqLongname - -! zaxisDefUnits -! (INTEGER zaxisID, -! CHARACTER*(*) units_optional) - EXTERNAL zaxisDefUnits - -! zaxisInqUnits -! (INTEGER zaxisID, -! CHARACTER*(*) units) - EXTERNAL zaxisInqUnits - -! zaxisInqStdname -! (INTEGER zaxisID, -! CHARACTER*(*) stdname) - EXTERNAL zaxisInqStdname - -! zaxisDefDatatype -! (INTEGER zaxisID, -! INTEGER datatype) - EXTERNAL zaxisDefDatatype - - INTEGER zaxisInqDatatype -! (INTEGER zaxisID) - EXTERNAL zaxisInqDatatype - -! zaxisDefPositive -! (INTEGER zaxisID, -! INTEGER positive) - EXTERNAL zaxisDefPositive - - INTEGER zaxisInqPositive -! (INTEGER zaxisID) - EXTERNAL zaxisInqPositive - -! zaxisDefScalar -! (INTEGER zaxisID) - EXTERNAL zaxisDefScalar - - INTEGER zaxisInqScalar -! (INTEGER zaxisID) - EXTERNAL zaxisInqScalar - -! zaxisDefVct -! (INTEGER zaxisID, -! INTEGER size, -! DOUBLEPRECISION vct(*)) - EXTERNAL zaxisDefVct - -! zaxisInqVct -! (INTEGER zaxisID, -! DOUBLEPRECISION vct(*)) - EXTERNAL zaxisInqVct - - INTEGER zaxisInqVctSize -! (INTEGER zaxisID) - EXTERNAL zaxisInqVctSize - -! zaxisDefLbounds -! (INTEGER zaxisID, -! DOUBLEPRECISION lbounds(*)) - EXTERNAL zaxisDefLbounds - - INTEGER zaxisInqLbounds -! (INTEGER zaxisID, -! DOUBLEPRECISION lbounds_optional(*)) - EXTERNAL zaxisInqLbounds - - DOUBLEPRECISION zaxisInqLbound -! (INTEGER zaxisID, -! INTEGER index) - EXTERNAL zaxisInqLbound - -! zaxisDefUbounds -! (INTEGER zaxisID, -! DOUBLEPRECISION ubounds(*)) - EXTERNAL zaxisDefUbounds - - INTEGER zaxisInqUbounds -! (INTEGER zaxisID, -! DOUBLEPRECISION ubounds_optional(*)) - EXTERNAL zaxisInqUbounds - - DOUBLEPRECISION zaxisInqUbound -! (INTEGER zaxisID, -! INTEGER index) - EXTERNAL zaxisInqUbound - -! zaxisDefWeights -! (INTEGER zaxisID, -! DOUBLEPRECISION weights(*)) - EXTERNAL zaxisDefWeights - - INTEGER zaxisInqWeights -! (INTEGER zaxisID, -! DOUBLEPRECISION weights_optional(*)) - EXTERNAL zaxisInqWeights - -! zaxisChangeType -! (INTEGER zaxisID, -! INTEGER zaxistype) - EXTERNAL zaxisChangeType - -! -! TAXIS routines -! - INTEGER taxisCreate -! (INTEGER taxistype) - EXTERNAL taxisCreate - -! taxisDestroy -! (INTEGER taxisID) - EXTERNAL taxisDestroy - - INTEGER taxisDuplicate -! (INTEGER taxisID) - EXTERNAL taxisDuplicate - -! taxisCopyTimestep -! (INTEGER taxisIDdes, -! INTEGER taxisIDsrc) - EXTERNAL taxisCopyTimestep - -! taxisDefType -! (INTEGER taxisID, -! INTEGER taxistype) - EXTERNAL taxisDefType - - INTEGER taxisInqType -! (INTEGER taxisID) - EXTERNAL taxisInqType - -! taxisDefVdate -! (INTEGER taxisID, -! INTEGER date) - EXTERNAL taxisDefVdate - -! taxisDefVtime -! (INTEGER taxisID, -! INTEGER time) - EXTERNAL taxisDefVtime - - INTEGER taxisInqVdate -! (INTEGER taxisID) - EXTERNAL taxisInqVdate - - INTEGER taxisInqVtime -! (INTEGER taxisID) - EXTERNAL taxisInqVtime - -! taxisDefRdate -! (INTEGER taxisID, -! INTEGER date) - EXTERNAL taxisDefRdate - -! taxisDefRtime -! (INTEGER taxisID, -! INTEGER time) - EXTERNAL taxisDefRtime - - INTEGER taxisInqRdate -! (INTEGER taxisID) - EXTERNAL taxisInqRdate - - INTEGER taxisInqRtime -! (INTEGER taxisID) - EXTERNAL taxisInqRtime - -! taxisDefFdate -! (INTEGER taxisID, -! INTEGER date) - EXTERNAL taxisDefFdate - -! taxisDefFtime -! (INTEGER taxisID, -! INTEGER time) - EXTERNAL taxisDefFtime - - INTEGER taxisInqFdate -! (INTEGER taxisID) - EXTERNAL taxisInqFdate - - INTEGER taxisInqFtime -! (INTEGER taxisID) - EXTERNAL taxisInqFtime - - INTEGER taxisHasBounds -! (INTEGER taxisID) - EXTERNAL taxisHasBounds - -! taxisWithBounds -! (INTEGER taxisID) - EXTERNAL taxisWithBounds - -! taxisDeleteBounds -! (INTEGER taxisID) - EXTERNAL taxisDeleteBounds - -! taxisDefVdateBounds -! (INTEGER taxisID, -! INTEGER vdate_lb, -! INTEGER vdate_ub) - EXTERNAL taxisDefVdateBounds - -! taxisDefVtimeBounds -! (INTEGER taxisID, -! INTEGER vtime_lb, -! INTEGER vtime_ub) - EXTERNAL taxisDefVtimeBounds - -! taxisInqVdateBounds -! (INTEGER taxisID, -! INTEGER vdate_lb, -! INTEGER vdate_ub) - EXTERNAL taxisInqVdateBounds - -! taxisInqVtimeBounds -! (INTEGER taxisID, -! INTEGER vtime_lb, -! INTEGER vtime_ub) - EXTERNAL taxisInqVtimeBounds - -! taxisDefCalendar -! (INTEGER taxisID, -! INTEGER calendar) - EXTERNAL taxisDefCalendar - - INTEGER taxisInqCalendar -! (INTEGER taxisID) - EXTERNAL taxisInqCalendar - -! taxisDefTunit -! (INTEGER taxisID, -! INTEGER tunit) - EXTERNAL taxisDefTunit - - INTEGER taxisInqTunit -! (INTEGER taxisID) - EXTERNAL taxisInqTunit - -! taxisDefForecastTunit -! (INTEGER taxisID, -! INTEGER tunit) - EXTERNAL taxisDefForecastTunit - - INTEGER taxisInqForecastTunit -! (INTEGER taxisID) - EXTERNAL taxisInqForecastTunit - -! taxisDefForecastPeriod -! (INTEGER taxisID, -! DOUBLEPRECISION fc_period) - EXTERNAL taxisDefForecastPeriod - - DOUBLEPRECISION taxisInqForecastPeriod -! (INTEGER taxisID) - EXTERNAL taxisInqForecastPeriod - -! taxisDefNumavg -! (INTEGER taxisID, -! INTEGER numavg) - EXTERNAL taxisDefNumavg - - INTEGER taxisInqNumavg -! (INTEGER taxisID) - EXTERNAL taxisInqNumavg - - CHARACTER(80) taxisNamePtr -! (INTEGER taxisID) - EXTERNAL taxisNamePtr - - CHARACTER(80) tunitNamePtr -! (INTEGER tunitID) - EXTERNAL tunitNamePtr - -! -! Institut routines -! - INTEGER institutDef -! (INTEGER center, -! INTEGER subcenter, -! CHARACTER*(*) name, -! CHARACTER*(*) longname) - EXTERNAL institutDef - - INTEGER institutInq -! (INTEGER center, -! INTEGER subcenter, -! CHARACTER*(*) name, -! CHARACTER*(*) longname) - EXTERNAL institutInq - - INTEGER institutInqNumber - EXTERNAL institutInqNumber - - INTEGER institutInqCenter -! (INTEGER instID) - EXTERNAL institutInqCenter - - INTEGER institutInqSubcenter -! (INTEGER instID) - EXTERNAL institutInqSubcenter - - CHARACTER(80) institutInqNamePtr -! (INTEGER instID) - EXTERNAL institutInqNamePtr - - CHARACTER(80) institutInqLongnamePtr -! (INTEGER instID) - EXTERNAL institutInqLongnamePtr - -! -! Model routines -! - INTEGER modelDef -! (INTEGER instID, -! INTEGER modelgribID, -! CHARACTER*(*) name) - EXTERNAL modelDef - - INTEGER modelInq -! (INTEGER instID, -! INTEGER modelgribID, -! CHARACTER*(*) name) - EXTERNAL modelInq - - INTEGER modelInqInstitut -! (INTEGER modelID) - EXTERNAL modelInqInstitut - - INTEGER modelInqGribID -! (INTEGER modelID) - EXTERNAL modelInqGribID - - CHARACTER(80) modelInqNamePtr -! (INTEGER modelID) - EXTERNAL modelInqNamePtr - -! -! Table routines -! -! tableWrite -! (CHARACTER*(*) filename, -! INTEGER tableID) - EXTERNAL tableWrite - - INTEGER tableRead -! (CHARACTER*(*) tablefile) - EXTERNAL tableRead - - INTEGER tableDef -! (INTEGER modelID, -! INTEGER tablenum, -! CHARACTER*(*) tablename) - EXTERNAL tableDef - - CHARACTER(80) tableInqNamePtr -! (INTEGER tableID) - EXTERNAL tableInqNamePtr - - INTEGER tableInq -! (INTEGER modelID, -! INTEGER tablenum, -! CHARACTER*(*) tablename) - EXTERNAL tableInq - - INTEGER tableInqNumber - EXTERNAL tableInqNumber - - INTEGER tableInqNum -! (INTEGER tableID) - EXTERNAL tableInqNum - - INTEGER tableInqModel -! (INTEGER tableID) - EXTERNAL tableInqModel - -! tableInqEntry -! (INTEGER tableID, -! INTEGER id, -! INTEGER ltype, -! CHARACTER*(*) name, -! CHARACTER*(*) longname, -! CHARACTER*(*) units) - EXTERNAL tableInqEntry - -! -! Subtype routines -! - INTEGER subtypeCreate -! (INTEGER subtype) - EXTERNAL subtypeCreate - -! -! Gives a textual summary of the variable subtype -! -! subtypePrint -! (INTEGER subtypeID) - EXTERNAL subtypePrint - -! -! Compares two subtype data structures -! - INTEGER subtypeCompare -! (INTEGER subtypeID1, -! INTEGER subtypeID2) - EXTERNAL subtypeCompare - - INTEGER subtypeInqSize -! (INTEGER subtypeID) - EXTERNAL subtypeInqSize - - INTEGER subtypeInqActiveIndex -! (INTEGER subtypeID) - EXTERNAL subtypeInqActiveIndex - -! subtypeDefActiveIndex -! (INTEGER subtypeID, -! INTEGER index) - EXTERNAL subtypeDefActiveIndex - -! -! Generate a "query object" out of a key-value pair -! -! -! Generate an AND-combined "query object" out of two previous query objects -! - INTEGER subtypeInqTile -! (INTEGER subtypeID, -! INTEGER tileindex, -! INTEGER attribute) - EXTERNAL subtypeInqTile - - INTEGER subtypeInqAttribute -! (INTEGER subtypeID, -! INTEGER index, -! CHARACTER*(*) key, -! INTEGER outValue) - EXTERNAL subtypeInqAttribute - - INTEGER vlistInqVarSubtype -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarSubtype - -! gribapiLibraryVersion -! (INTEGER major_version, -! INTEGER minor_version, -! INTEGER revision_version) - EXTERNAL gribapiLibraryVersion - -! -! Compatibility functions for release 1.8.3 (obsolete functions) -! -! zaxisDefLtype -! (INTEGER zaxisID, -! INTEGER ltype) - EXTERNAL zaxisDefLtype - - INTEGER vlistInqVarTypeOfGeneratingProcess -! (INTEGER vlistID, -! INTEGER varID) - EXTERNAL vlistInqVarTypeOfGeneratingProcess - -! vlistDefVarTypeOfGeneratingProcess -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER typeOfGeneratingProcess) - EXTERNAL vlistDefVarTypeOfGeneratingProcess - -! vlistDefVarProductDefinitionTemplate -! (INTEGER vlistID, -! INTEGER varID, -! INTEGER productDefinitionTemplate) - EXTERNAL vlistDefVarProductDefinitionTemplate - -! -! End of fortran interface -! diff --git a/src/cdiFortran.c b/src/cdiFortran.c deleted file mode 100644 index 0fef6d6777d51e9f71f771cc996e97224d36d7a1..0000000000000000000000000000000000000000 --- a/src/cdiFortran.c +++ /dev/null @@ -1,812 +0,0 @@ -// Automatically generated by make_fint.c, don't edit! - -// clang-format off - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifndef CDI_H_ -#include "cdi.h" -#endif - -#ifdef HAVE_CF_INTERFACE - -#include <limits.h> -#include <assert.h> - -#ifndef __CFORTRAN_LOADED -# if defined __clang__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wreserved-id-macro" -# endif -# include "cfortran.h" -# if defined __clang__ -# pragma GCC diagnostic pop -# endif -#endif -/* These functions are meant to be called from Fortran and don't - * need an interface declaration in a C header. */ -#ifdef __clang__ -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -#endif - -static inline -int SizeType_c2f(SizeType value_SizeType) -{ - assert(value_SizeType < INT_MAX); - return (int) value_SizeType; -} - - -/* Start of fortran interface for the following routines (make_fint.c) */ - - -/* Byte order */ - - -/* Error identifier */ - - -/* File types */ - - -/* Compatibility defines for release 1.8.3 (obsolete defines) */ - - -/* Protocols (in filename/URI) */ - - -/* Compress types */ - - -/* external data types */ - - -/* Compatibility defines for release 1.8.3 (obsolete defines) */ - - -/* internal data types */ - - -/* Chunk types */ - - -/* GRID types */ - - -/* ZAXIS types */ - - -/* SUBTYPE types */ - - -/* Data structure defining a key-value search, possibly with multiple - key-value pairs in combination. - - Currently, only multiple pairs combined by AND are supported. */ - - -/* TIME types */ - - -/* TSTEP types */ - - -/* TAXIS types */ - - -/* TUNIT types */ - - -/* CALENDAR types */ - - -/* number of unsigned char needed to store UUID */ - - -/* Structs that are used to return data to the user */ - - -/* Opaque types */ - - -/* CDI control routines */ - -FCALLSCSUB0 (cdiReset, CDIRESET, cdireset) -FCALLSCFUN1 (STRING, cdiStringError, CDISTRINGERROR, cdistringerror, INT) -FCALLSCSUB1 (cdiDebug, CDIDEBUG, cdidebug, INT) -FCALLSCFUN0 (STRING, cdiLibraryVersion, CDILIBRARYVERSION, cdilibraryversion) -FCALLSCSUB0 (cdiPrintVersion, CDIPRINTVERSION, cdiprintversion) -FCALLSCFUN1 (INT, cdiHaveFiletype, CDIHAVEFILETYPE, cdihavefiletype, INT) -FCALLSCSUB1 (cdiDefMissval, CDIDEFMISSVAL, cdidefmissval, DOUBLE) -FCALLSCFUN0 (DOUBLE, cdiInqMissval, CDIINQMISSVAL, cdiinqmissval) -FCALLSCSUB2 (cdiDefGlobal, CDIDEFGLOBAL, cdidefglobal, STRING, INT) -FCALLSCFUN0 (INT, namespaceNew, NAMESPACENEW, namespacenew) -FCALLSCSUB1 (namespaceSetActive, NAMESPACESETACTIVE, namespacesetactive, INT) -FCALLSCFUN0 (INT, namespaceGetActive, NAMESPACEGETACTIVE, namespacegetactive) -FCALLSCSUB1 (namespaceDelete, NAMESPACEDELETE, namespacedelete, INT) - -/* CDI converter routines */ - - -/* parameter */ - -FCALLSCSUB3 (cdiParamToString, CDIPARAMTOSTRING, cdiparamtostring, INT, PSTRING, INT) -FCALLSCSUB4 (cdiDecodeParam, CDIDECODEPARAM, cdidecodeparam, INT, PINT, PINT, PINT) -FCALLSCFUN3 (INT, cdiEncodeParam, CDIENCODEPARAM, cdiencodeparam, INT, INT, INT) - -/* date format: YYYYMMDD */ - - -/* time format: hhmmss */ - -FCALLSCSUB4 (cdiDecodeDate, CDIDECODEDATE, cdidecodedate, INT, PINT, PINT, PINT) -FCALLSCFUN3 (INT, cdiEncodeDate, CDIENCODEDATE, cdiencodedate, INT, INT, INT) -FCALLSCSUB4 (cdiDecodeTime, CDIDECODETIME, cdidecodetime, INT, PINT, PINT, PINT) -FCALLSCFUN3 (INT, cdiEncodeTime, CDIENCODETIME, cdiencodetime, INT, INT, INT) - -/* STREAM control routines */ - -FCALLSCFUN2 (INT, cdiGetFiletype, CDIGETFILETYPE, cdigetfiletype, STRING, PINT) -FCALLSCFUN1 (INT, streamOpenRead, STREAMOPENREAD, streamopenread, STRING) -FCALLSCFUN2 (INT, streamOpenWrite, STREAMOPENWRITE, streamopenwrite, STRING, INT) -FCALLSCFUN1 (INT, streamOpenAppend, STREAMOPENAPPEND, streamopenappend, STRING) -FCALLSCSUB1 (streamClose, STREAMCLOSE, streamclose, INT) -FCALLSCSUB1 (streamSync, STREAMSYNC, streamsync, INT) -FCALLSCSUB2 (streamDefMaxSteps, STREAMDEFMAXSTEPS, streamdefmaxsteps, INT, INT) -FCALLSCSUB2 (streamDefNumWorker, STREAMDEFNUMWORKER, streamdefnumworker, INT, INT) -FCALLSCSUB2 (streamDefVlist, STREAMDEFVLIST, streamdefvlist, INT, INT) -FCALLSCFUN1 (INT, streamInqVlist, STREAMINQVLIST, streaminqvlist, INT) -FCALLSCFUN1 (INT, streamInqFiletype, STREAMINQFILETYPE, streaminqfiletype, INT) -FCALLSCSUB2 (streamDefByteorder, STREAMDEFBYTEORDER, streamdefbyteorder, INT, INT) -FCALLSCFUN1 (INT, streamInqByteorder, STREAMINQBYTEORDER, streaminqbyteorder, INT) -FCALLSCSUB2 (streamDefCompType, STREAMDEFCOMPTYPE, streamdefcomptype, INT, INT) -FCALLSCFUN1 (INT, streamInqCompType, STREAMINQCOMPTYPE, streaminqcomptype, INT) -FCALLSCSUB2 (streamDefCompLevel, STREAMDEFCOMPLEVEL, streamdefcomplevel, INT, INT) -FCALLSCFUN1 (INT, streamInqCompLevel, STREAMINQCOMPLEVEL, streaminqcomplevel, INT) -FCALLSCFUN2 (INT, streamDefTimestep, STREAMDEFTIMESTEP, streamdeftimestep, INT, INT) -FCALLSCFUN2 (INT, streamInqTimestep, STREAMINQTIMESTEP, streaminqtimestep, INT, INT) -FCALLSCFUN1 (INT, streamInqCurTimestepID, STREAMINQCURTIMESTEPID, streaminqcurtimestepid, INT) -FCALLSCFUN1 (STRING, streamFilename, STREAMFILENAME, streamfilename, INT) -FCALLSCFUN1 (STRING, streamFilesuffix, STREAMFILESUFFIX, streamfilesuffix, INT) -static int streamNvals_fwrap(int streamID) -{ - SizeType v; - v = streamNvals(streamID); - return SizeType_c2f(v); -} -FCALLSCFUN1 (INT, streamNvals_fwrap, STREAMNVALS, streamnvals, INT) -FCALLSCFUN1 (INT, streamInqNvars, STREAMINQNVARS, streaminqnvars, INT) - -/* STREAM var I/O routines (random access) */ - -static void streamWriteVar_fwrap(int streamID, int varID, const double data[], int nmiss) -{ - streamWriteVar(streamID, varID, data, (SizeType)nmiss); -} -FCALLSCSUB4 (streamWriteVar_fwrap, STREAMWRITEVAR, streamwritevar, INT, INT, DOUBLEV, INT) -static void streamWriteVarF_fwrap(int streamID, int varID, const float data[], int nmiss) -{ - streamWriteVarF(streamID, varID, data, (SizeType)nmiss); -} -FCALLSCSUB4 (streamWriteVarF_fwrap, STREAMWRITEVARF, streamwritevarf, INT, INT, FLOATV, INT) -static void streamReadVar_fwrap(int streamID, int varID, double data[], int *nmiss) -{ - SizeType nmiss_SizeType; - streamReadVar(streamID, varID, data, &nmiss_SizeType); - assert(nmiss_SizeType < INT_MAX); - *nmiss = nmiss_SizeType; -} -FCALLSCSUB4 (streamReadVar_fwrap, STREAMREADVAR, streamreadvar, INT, INT, DOUBLEV, PINT) -static void streamReadVarF_fwrap(int streamID, int varID, float data[], int *nmiss) -{ - SizeType nmiss_SizeType; - streamReadVarF(streamID, varID, data, &nmiss_SizeType); - assert(nmiss_SizeType < INT_MAX); - *nmiss = nmiss_SizeType; -} -FCALLSCSUB4 (streamReadVarF_fwrap, STREAMREADVARF, streamreadvarf, INT, INT, FLOATV, PINT) -static void streamWriteVarSlice_fwrap(int streamID, int varID, int levelID, const double data[], int nmiss) -{ - streamWriteVarSlice(streamID, varID, levelID, data, (SizeType)nmiss); -} -FCALLSCSUB5 (streamWriteVarSlice_fwrap, STREAMWRITEVARSLICE, streamwritevarslice, INT, INT, INT, DOUBLEV, INT) -static void streamWriteVarSliceF_fwrap(int streamID, int varID, int levelID, const float data[], int nmiss) -{ - streamWriteVarSliceF(streamID, varID, levelID, data, (SizeType)nmiss); -} -FCALLSCSUB5 (streamWriteVarSliceF_fwrap, STREAMWRITEVARSLICEF, streamwritevarslicef, INT, INT, INT, FLOATV, INT) -static void streamReadVarSlice_fwrap(int streamID, int varID, int levelID, double data[], int *nmiss) -{ - SizeType nmiss_SizeType; - streamReadVarSlice(streamID, varID, levelID, data, &nmiss_SizeType); - assert(nmiss_SizeType < INT_MAX); - *nmiss = nmiss_SizeType; -} -FCALLSCSUB5 (streamReadVarSlice_fwrap, STREAMREADVARSLICE, streamreadvarslice, INT, INT, INT, DOUBLEV, PINT) -static void streamReadVarSliceF_fwrap(int streamID, int varID, int levelID, float data[], int *nmiss) -{ - SizeType nmiss_SizeType; - streamReadVarSliceF(streamID, varID, levelID, data, &nmiss_SizeType); - assert(nmiss_SizeType < INT_MAX); - *nmiss = nmiss_SizeType; -} -FCALLSCSUB5 (streamReadVarSliceF_fwrap, STREAMREADVARSLICEF, streamreadvarslicef, INT, INT, INT, FLOATV, PINT) -static void streamWriteVarChunk_fwrap(int streamID, int varID, const int rect[3][2], const double data[], int nmiss) -{ - streamWriteVarChunk(streamID, varID, rect, data, (SizeType)nmiss); -} -FCALLSCSUB5 (streamWriteVarChunk_fwrap, STREAMWRITEVARCHUNK, streamwritevarchunk, INT, INT, INTVV, DOUBLEV, INT) - -/* STREAM record I/O routines (sequential access) */ - -FCALLSCSUB3 (streamDefRecord, STREAMDEFRECORD, streamdefrecord, INT, INT, INT) -FCALLSCSUB3 (streamInqRecord, STREAMINQRECORD, streaminqrecord, INT, PINT, PINT) -static void streamWriteRecord_fwrap(int streamID, const double data[], int nmiss) -{ - streamWriteRecord(streamID, data, (SizeType)nmiss); -} -FCALLSCSUB3 (streamWriteRecord_fwrap, STREAMWRITERECORD, streamwriterecord, INT, DOUBLEV, INT) -static void streamWriteRecordF_fwrap(int streamID, const float data[], int nmiss) -{ - streamWriteRecordF(streamID, data, (SizeType)nmiss); -} -FCALLSCSUB3 (streamWriteRecordF_fwrap, STREAMWRITERECORDF, streamwriterecordf, INT, FLOATV, INT) -static void streamReadRecord_fwrap(int streamID, double data[], int *nmiss) -{ - SizeType nmiss_SizeType; - streamReadRecord(streamID, data, &nmiss_SizeType); - assert(nmiss_SizeType < INT_MAX); - *nmiss = nmiss_SizeType; -} -FCALLSCSUB3 (streamReadRecord_fwrap, STREAMREADRECORD, streamreadrecord, INT, DOUBLEV, PINT) -static void streamReadRecordF_fwrap(int streamID, float data[], int *nmiss) -{ - SizeType nmiss_SizeType; - streamReadRecordF(streamID, data, &nmiss_SizeType); - assert(nmiss_SizeType < INT_MAX); - *nmiss = nmiss_SizeType; -} -FCALLSCSUB3 (streamReadRecordF_fwrap, STREAMREADRECORDF, streamreadrecordf, INT, FLOATV, PINT) -FCALLSCSUB2 (streamCopyRecord, STREAMCOPYRECORD, streamcopyrecord, INT, INT) - -/* File driven I/O (may yield better performance than using the streamXXX functions) */ - - -/* Creation & Destruction */ - - -/* Advancing an iterator */ - - -/* Introspecting metadata */ - - -/* All outXXX arguments to these functions may be NULL. */ - - -/* Reading data */ - - -/* TODO[NH]: Add functions to read partial fields. */ - - -/* Direct access to grib fields */ - - -/* Callthroughs to GRIB-API */ - - -/* Convenience functions for accessing GRIB-API keys */ - - -/* VLIST routines */ - -FCALLSCFUN0 (INT, vlistCreate, VLISTCREATE, vlistcreate) -FCALLSCSUB1 (vlistDestroy, VLISTDESTROY, vlistdestroy, INT) -FCALLSCFUN1 (INT, vlistDuplicate, VLISTDUPLICATE, vlistduplicate, INT) -FCALLSCSUB2 (vlistCopy, VLISTCOPY, vlistcopy, INT, INT) -FCALLSCSUB2 (vlistCopyFlag, VLISTCOPYFLAG, vlistcopyflag, INT, INT) -FCALLSCSUB1 (vlistClearFlag, VLISTCLEARFLAG, vlistclearflag, INT) -FCALLSCSUB2 (vlistCat, VLISTCAT, vlistcat, INT, INT) -FCALLSCSUB2 (vlistMerge, VLISTMERGE, vlistmerge, INT, INT) -FCALLSCSUB1 (vlistPrint, VLISTPRINT, vlistprint, INT) -FCALLSCFUN1 (INT, vlistNumber, VLISTNUMBER, vlistnumber, INT) -FCALLSCFUN1 (INT, vlistNvars, VLISTNVARS, vlistnvars, INT) -FCALLSCFUN1 (INT, vlistNgrids, VLISTNGRIDS, vlistngrids, INT) -FCALLSCFUN1 (INT, vlistNzaxis, VLISTNZAXIS, vlistnzaxis, INT) -FCALLSCFUN1 (INT, vlistNsubtypes, VLISTNSUBTYPES, vlistnsubtypes, INT) -FCALLSCSUB2 (vlistDefNtsteps, VLISTDEFNTSTEPS, vlistdefntsteps, INT, INT) -FCALLSCFUN1 (INT, vlistNtsteps, VLISTNTSTEPS, vlistntsteps, INT) -static int vlistGridsizeMax_fwrap(int vlistID) -{ - SizeType v; - v = vlistGridsizeMax(vlistID); - return SizeType_c2f(v); -} -FCALLSCFUN1 (INT, vlistGridsizeMax_fwrap, VLISTGRIDSIZEMAX, vlistgridsizemax, INT) -FCALLSCFUN2 (INT, vlistGrid, VLISTGRID, vlistgrid, INT, INT) -FCALLSCFUN2 (INT, vlistGridIndex, VLISTGRIDINDEX, vlistgridindex, INT, INT) -FCALLSCSUB3 (vlistChangeGridIndex, VLISTCHANGEGRIDINDEX, vlistchangegridindex, INT, INT, INT) -FCALLSCSUB3 (vlistChangeGrid, VLISTCHANGEGRID, vlistchangegrid, INT, INT, INT) -FCALLSCFUN2 (INT, vlistZaxis, VLISTZAXIS, vlistzaxis, INT, INT) -FCALLSCFUN2 (INT, vlistZaxisIndex, VLISTZAXISINDEX, vlistzaxisindex, INT, INT) -FCALLSCSUB3 (vlistChangeZaxisIndex, VLISTCHANGEZAXISINDEX, vlistchangezaxisindex, INT, INT, INT) -FCALLSCSUB3 (vlistChangeZaxis, VLISTCHANGEZAXIS, vlistchangezaxis, INT, INT, INT) -FCALLSCFUN1 (INT, vlistNrecs, VLISTNRECS, vlistnrecs, INT) -FCALLSCFUN2 (INT, vlistSubtype, VLISTSUBTYPE, vlistsubtype, INT, INT) -FCALLSCFUN2 (INT, vlistSubtypeIndex, VLISTSUBTYPEINDEX, vlistsubtypeindex, INT, INT) -FCALLSCSUB2 (vlistDefTaxis, VLISTDEFTAXIS, vlistdeftaxis, INT, INT) -FCALLSCFUN1 (INT, vlistInqTaxis, VLISTINQTAXIS, vlistinqtaxis, INT) -FCALLSCSUB2 (vlistDefTable, VLISTDEFTABLE, vlistdeftable, INT, INT) -FCALLSCFUN1 (INT, vlistInqTable, VLISTINQTABLE, vlistinqtable, INT) -FCALLSCSUB2 (vlistDefInstitut, VLISTDEFINSTITUT, vlistdefinstitut, INT, INT) -FCALLSCFUN1 (INT, vlistInqInstitut, VLISTINQINSTITUT, vlistinqinstitut, INT) -FCALLSCSUB2 (vlistDefModel, VLISTDEFMODEL, vlistdefmodel, INT, INT) -FCALLSCFUN1 (INT, vlistInqModel, VLISTINQMODEL, vlistinqmodel, INT) - -/* VLIST VAR routines */ - -FCALLSCFUN5 (INT, vlistDefVarTiles, VLISTDEFVARTILES, vlistdefvartiles, INT, INT, INT, INT, INT) -FCALLSCFUN4 (INT, vlistDefVar, VLISTDEFVAR, vlistdefvar, INT, INT, INT, INT) -FCALLSCSUB3 (vlistChangeVarGrid, VLISTCHANGEVARGRID, vlistchangevargrid, INT, INT, INT) -FCALLSCSUB3 (vlistChangeVarZaxis, VLISTCHANGEVARZAXIS, vlistchangevarzaxis, INT, INT, INT) -FCALLSCSUB5 (vlistInqVar, VLISTINQVAR, vlistinqvar, INT, INT, PINT, PINT, PINT) -FCALLSCFUN2 (INT, vlistInqVarGrid, VLISTINQVARGRID, vlistinqvargrid, INT, INT) -FCALLSCFUN2 (INT, vlistInqVarZaxis, VLISTINQVARZAXIS, vlistinqvarzaxis, INT, INT) - -/* used in MPIOM */ - -FCALLSCFUN2 (INT, vlistInqVarID, VLISTINQVARID, vlistinqvarid, INT, INT) -FCALLSCSUB3 (vlistDefVarTimetype, VLISTDEFVARTIMETYPE, vlistdefvartimetype, INT, INT, INT) -FCALLSCFUN2 (INT, vlistInqVarTimetype, VLISTINQVARTIMETYPE, vlistinqvartimetype, INT, INT) -FCALLSCSUB3 (vlistDefVarTsteptype, VLISTDEFVARTSTEPTYPE, vlistdefvartsteptype, INT, INT, INT) -FCALLSCFUN2 (INT, vlistInqVarTsteptype, VLISTINQVARTSTEPTYPE, vlistinqvartsteptype, INT, INT) -FCALLSCSUB3 (vlistDefVarCompType, VLISTDEFVARCOMPTYPE, vlistdefvarcomptype, INT, INT, INT) -FCALLSCFUN2 (INT, vlistInqVarCompType, VLISTINQVARCOMPTYPE, vlistinqvarcomptype, INT, INT) -FCALLSCSUB3 (vlistDefVarCompLevel, VLISTDEFVARCOMPLEVEL, vlistdefvarcomplevel, INT, INT, INT) -FCALLSCFUN2 (INT, vlistInqVarCompLevel, VLISTINQVARCOMPLEVEL, vlistinqvarcomplevel, INT, INT) -FCALLSCSUB3 (vlistDefVarParam, VLISTDEFVARPARAM, vlistdefvarparam, INT, INT, INT) -FCALLSCFUN2 (INT, vlistInqVarParam, VLISTINQVARPARAM, vlistinqvarparam, INT, INT) -FCALLSCSUB3 (vlistDefVarCode, VLISTDEFVARCODE, vlistdefvarcode, INT, INT, INT) -FCALLSCFUN2 (INT, vlistInqVarCode, VLISTINQVARCODE, vlistinqvarcode, INT, INT) -FCALLSCSUB3 (vlistDefVarDatatype, VLISTDEFVARDATATYPE, vlistdefvardatatype, INT, INT, INT) -FCALLSCFUN2 (INT, vlistInqVarDatatype, VLISTINQVARDATATYPE, vlistinqvardatatype, INT, INT) -FCALLSCSUB3 (vlistDefVarXYZ, VLISTDEFVARXYZ, vlistdefvarxyz, INT, INT, INT) -FCALLSCFUN2 (INT, vlistInqVarXYZ, VLISTINQVARXYZ, vlistinqvarxyz, INT, INT) -FCALLSCSUB3 (vlistDefVarNSB, VLISTDEFVARNSB, vlistdefvarnsb, INT, INT, INT) -FCALLSCFUN2 (INT, vlistInqVarNSB, VLISTINQVARNSB, vlistinqvarnsb, INT, INT) -FCALLSCFUN2 (INT, vlistInqVarNumber, VLISTINQVARNUMBER, vlistinqvarnumber, INT, INT) -FCALLSCSUB3 (vlistDefVarInstitut, VLISTDEFVARINSTITUT, vlistdefvarinstitut, INT, INT, INT) -FCALLSCFUN2 (INT, vlistInqVarInstitut, VLISTINQVARINSTITUT, vlistinqvarinstitut, INT, INT) -FCALLSCSUB3 (vlistDefVarModel, VLISTDEFVARMODEL, vlistdefvarmodel, INT, INT, INT) -FCALLSCFUN2 (INT, vlistInqVarModel, VLISTINQVARMODEL, vlistinqvarmodel, INT, INT) -FCALLSCSUB3 (vlistDefVarTable, VLISTDEFVARTABLE, vlistdefvartable, INT, INT, INT) -FCALLSCFUN2 (INT, vlistInqVarTable, VLISTINQVARTABLE, vlistinqvartable, INT, INT) -FCALLSCSUB3 (vlistDefVarName, VLISTDEFVARNAME, vlistdefvarname, INT, INT, STRING) -FCALLSCSUB3 (vlistInqVarName, VLISTINQVARNAME, vlistinqvarname, INT, INT, PSTRING) -FCALLSCFUN2 (STRING, vlistCopyVarName, VLISTCOPYVARNAME, vlistcopyvarname, INT, INT) -FCALLSCSUB3 (vlistDefVarStdname, VLISTDEFVARSTDNAME, vlistdefvarstdname, INT, INT, STRING) -FCALLSCSUB3 (vlistInqVarStdname, VLISTINQVARSTDNAME, vlistinqvarstdname, INT, INT, PSTRING) -FCALLSCSUB3 (vlistDefVarLongname, VLISTDEFVARLONGNAME, vlistdefvarlongname, INT, INT, STRING) -FCALLSCSUB3 (vlistInqVarLongname, VLISTINQVARLONGNAME, vlistinqvarlongname, INT, INT, PSTRING) -FCALLSCSUB3 (vlistDefVarUnits, VLISTDEFVARUNITS, vlistdefvarunits, INT, INT, STRING) -FCALLSCSUB3 (vlistInqVarUnits, VLISTINQVARUNITS, vlistinqvarunits, INT, INT, PSTRING) -FCALLSCSUB3 (vlistDefVarMissval, VLISTDEFVARMISSVAL, vlistdefvarmissval, INT, INT, DOUBLE) -FCALLSCFUN2 (DOUBLE, vlistInqVarMissval, VLISTINQVARMISSVAL, vlistinqvarmissval, INT, INT) -FCALLSCSUB3 (vlistDefVarExtra, VLISTDEFVAREXTRA, vlistdefvarextra, INT, INT, STRING) -FCALLSCSUB3 (vlistInqVarExtra, VLISTINQVAREXTRA, vlistinqvarextra, INT, INT, PSTRING) -FCALLSCSUB3 (vlistDefVarScalefactor, VLISTDEFVARSCALEFACTOR, vlistdefvarscalefactor, INT, INT, DOUBLE) -FCALLSCFUN2 (DOUBLE, vlistInqVarScalefactor, VLISTINQVARSCALEFACTOR, vlistinqvarscalefactor, INT, INT) -FCALLSCSUB3 (vlistDefVarAddoffset, VLISTDEFVARADDOFFSET, vlistdefvaraddoffset, INT, INT, DOUBLE) -FCALLSCFUN2 (DOUBLE, vlistInqVarAddoffset, VLISTINQVARADDOFFSET, vlistinqvaraddoffset, INT, INT) -static int vlistInqVarSize_fwrap(int vlistID, int varID) -{ - SizeType v; - v = vlistInqVarSize(vlistID, varID); - return SizeType_c2f(v); -} -FCALLSCFUN2 (INT, vlistInqVarSize_fwrap, VLISTINQVARSIZE, vlistinqvarsize, INT, INT) -FCALLSCSUB4 (vlistDefIndex, VLISTDEFINDEX, vlistdefindex, INT, INT, INT, INT) -FCALLSCFUN3 (INT, vlistInqIndex, VLISTINQINDEX, vlistinqindex, INT, INT, INT) -FCALLSCSUB4 (vlistDefFlag, VLISTDEFFLAG, vlistdefflag, INT, INT, INT, INT) -FCALLSCFUN3 (INT, vlistInqFlag, VLISTINQFLAG, vlistinqflag, INT, INT, INT) -FCALLSCFUN2 (INT, vlistFindVar, VLISTFINDVAR, vlistfindvar, INT, INT) -FCALLSCFUN3 (INT, vlistFindLevel, VLISTFINDLEVEL, vlistfindlevel, INT, INT, INT) -FCALLSCFUN2 (INT, vlistMergedVar, VLISTMERGEDVAR, vlistmergedvar, INT, INT) -FCALLSCFUN3 (INT, vlistMergedLevel, VLISTMERGEDLEVEL, vlistmergedlevel, INT, INT, INT) -FCALLSCSUB0 (cdiClearAdditionalKeys, CDICLEARADDITIONALKEYS, cdiclearadditionalkeys) -FCALLSCSUB1 (cdiDefAdditionalKey, CDIDEFADDITIONALKEY, cdidefadditionalkey, STRING) -FCALLSCSUB4 (vlistDefVarIntKey, VLISTDEFVARINTKEY, vlistdefvarintkey, INT, INT, STRING, INT) -FCALLSCSUB4 (vlistDefVarDblKey, VLISTDEFVARDBLKEY, vlistdefvardblkey, INT, INT, STRING, DOUBLE) -FCALLSCFUN3 (INT, vlistHasVarKey, VLISTHASVARKEY, vlisthasvarkey, INT, INT, STRING) -FCALLSCFUN3 (DOUBLE, vlistInqVarDblKey, VLISTINQVARDBLKEY, vlistinqvardblkey, INT, INT, STRING) -FCALLSCFUN3 (INT, vlistInqVarIntKey, VLISTINQVARINTKEY, vlistinqvarintkey, INT, INT, STRING) - -/* CDI attributes */ - -FCALLSCFUN3 (INT, cdiInqNatts, CDIINQNATTS, cdiinqnatts, INT, INT, PINT) -FCALLSCFUN6 (INT, cdiInqAtt, CDIINQATT, cdiinqatt, INT, INT, INT, PSTRING, PINT, PINT) -FCALLSCFUN3 (INT, cdiInqAttLen, CDIINQATTLEN, cdiinqattlen, INT, INT, STRING) -FCALLSCFUN3 (INT, cdiInqAttType, CDIINQATTTYPE, cdiinqatttype, INT, INT, STRING) -FCALLSCFUN3 (INT, cdiDelAtt, CDIDELATT, cdidelatt, INT, INT, STRING) -FCALLSCFUN4 (INT, cdiCopyAtts, CDICOPYATTS, cdicopyatts, INT, INT, INT, INT) -FCALLSCFUN6 (INT, cdiDefAttInt, CDIDEFATTINT, cdidefattint, INT, INT, STRING, INT, INT, INTV) -FCALLSCFUN6 (INT, cdiDefAttFlt, CDIDEFATTFLT, cdidefattflt, INT, INT, STRING, INT, INT, DOUBLEV) -FCALLSCFUN5 (INT, cdiDefAttTxt, CDIDEFATTTXT, cdidefatttxt, INT, INT, STRING, INT, PPSTRING) -FCALLSCFUN5 (INT, cdiInqAttInt, CDIINQATTINT, cdiinqattint, INT, INT, STRING, INT, INTV) -FCALLSCFUN5 (INT, cdiInqAttFlt, CDIINQATTFLT, cdiinqattflt, INT, INT, STRING, INT, DOUBLEV) -FCALLSCFUN5 (INT, cdiInqAttTxt, CDIINQATTTXT, cdiinqatttxt, INT, INT, STRING, INT, PPSTRING) - -/* GRID routines */ - -FCALLSCSUB2 (gridName, GRIDNAME, gridname, INT, PSTRING) -FCALLSCFUN1 (STRING, gridNamePtr, GRIDNAMEPTR, gridnameptr, INT) -FCALLSCSUB1 (gridCompress, GRIDCOMPRESS, gridcompress, INT) -FCALLSCSUB2 (gridDefMaskGME, GRIDDEFMASKGME, griddefmaskgme, INT, INTV) -FCALLSCFUN2 (INT, gridInqMaskGME, GRIDINQMASKGME, gridinqmaskgme, INT, INTV) -FCALLSCSUB2 (gridDefMask, GRIDDEFMASK, griddefmask, INT, INTV) -FCALLSCFUN2 (INT, gridInqMask, GRIDINQMASK, gridinqmask, INT, INTV) -static int gridCreate_fwrap(int gridtype, int size) -{ - int v; - v = gridCreate(gridtype, (SizeType)size); - return v; -} -FCALLSCFUN2 (INT, gridCreate_fwrap, GRIDCREATE, gridcreate, INT, INT) -FCALLSCSUB1 (gridDestroy, GRIDDESTROY, griddestroy, INT) -FCALLSCFUN1 (INT, gridDuplicate, GRIDDUPLICATE, gridduplicate, INT) -FCALLSCSUB2 (gridDefProj, GRIDDEFPROJ, griddefproj, INT, INT) -FCALLSCFUN1 (INT, gridInqProj, GRIDINQPROJ, gridinqproj, INT) -FCALLSCFUN1 (INT, gridInqProjType, GRIDINQPROJTYPE, gridinqprojtype, INT) -FCALLSCFUN1 (INT, gridInqType, GRIDINQTYPE, gridinqtype, INT) -static int gridInqSize_fwrap(int gridID) -{ - SizeType v; - v = gridInqSize(gridID); - return SizeType_c2f(v); -} -FCALLSCFUN1 (INT, gridInqSize_fwrap, GRIDINQSIZE, gridinqsize, INT) -static void gridDefXsize_fwrap(int gridID, int xsize) -{ - gridDefXsize(gridID, (SizeType)xsize); -} -FCALLSCSUB2 (gridDefXsize_fwrap, GRIDDEFXSIZE, griddefxsize, INT, INT) -static int gridInqXsize_fwrap(int gridID) -{ - SizeType v; - v = gridInqXsize(gridID); - return SizeType_c2f(v); -} -FCALLSCFUN1 (INT, gridInqXsize_fwrap, GRIDINQXSIZE, gridinqxsize, INT) -static void gridDefYsize_fwrap(int gridID, int ysize) -{ - gridDefYsize(gridID, (SizeType)ysize); -} -FCALLSCSUB2 (gridDefYsize_fwrap, GRIDDEFYSIZE, griddefysize, INT, INT) -static int gridInqYsize_fwrap(int gridID) -{ - SizeType v; - v = gridInqYsize(gridID); - return SizeType_c2f(v); -} -FCALLSCFUN1 (INT, gridInqYsize_fwrap, GRIDINQYSIZE, gridinqysize, INT) -FCALLSCSUB2 (gridDefNP, GRIDDEFNP, griddefnp, INT, INT) -FCALLSCFUN1 (INT, gridInqNP, GRIDINQNP, gridinqnp, INT) -FCALLSCSUB2 (gridDefXvals, GRIDDEFXVALS, griddefxvals, INT, DOUBLEV) -static int gridInqXvals_fwrap(int gridID, double xvals[]) -{ - SizeType v; - v = gridInqXvals(gridID, xvals); - return SizeType_c2f(v); -} -FCALLSCFUN2 (INT, gridInqXvals_fwrap, GRIDINQXVALS, gridinqxvals, INT, DOUBLEV) -static int gridInqXvalsPart_fwrap(int gridID, int start, int size, double xvals[]) -{ - SizeType v; - v = gridInqXvalsPart(gridID, start, (SizeType)size, xvals); - return SizeType_c2f(v); -} -FCALLSCFUN4 (INT, gridInqXvalsPart_fwrap, GRIDINQXVALSPART, gridinqxvalspart, INT, INT, INT, DOUBLEV) -FCALLSCFUN1 (INT, gridInqXIsc, GRIDINQXISC, gridinqxisc, INT) -FCALLSCSUB2 (gridDefYvals, GRIDDEFYVALS, griddefyvals, INT, DOUBLEV) -static int gridInqYvals_fwrap(int gridID, double yvals[]) -{ - SizeType v; - v = gridInqYvals(gridID, yvals); - return SizeType_c2f(v); -} -FCALLSCFUN2 (INT, gridInqYvals_fwrap, GRIDINQYVALS, gridinqyvals, INT, DOUBLEV) -static int gridInqYvalsPart_fwrap(int gridID, int start, int size, double yvals[]) -{ - SizeType v; - v = gridInqYvalsPart(gridID, start, (SizeType)size, yvals); - return SizeType_c2f(v); -} -FCALLSCFUN4 (INT, gridInqYvalsPart_fwrap, GRIDINQYVALSPART, gridinqyvalspart, INT, INT, INT, DOUBLEV) -FCALLSCFUN1 (INT, gridInqYIsc, GRIDINQYISC, gridinqyisc, INT) - -/* CDI var keys */ - - -/* String keys */ - - -/* Integer keys */ - - -/* Floating point keys */ - - -/* Byte array keys */ - -FCALLSCFUN4 (INT, cdiDefKeyInt, CDIDEFKEYINT, cdidefkeyint, INT, INT, INT, INT) -FCALLSCFUN4 (INT, cdiInqKeyInt, CDIINQKEYINT, cdiinqkeyint, INT, INT, INT, PINT) -FCALLSCFUN4 (INT, cdiDefKeyFloat, CDIDEFKEYFLOAT, cdidefkeyfloat, INT, INT, INT, DOUBLE) - -/* cdiInqKeyFloat Get a float value from a key */ - -FCALLSCFUN4 (INT, cdiInqKeyFloat, CDIINQKEYFLOAT, cdiinqkeyfloat, INT, INT, INT, PDOUBLE) -FCALLSCFUN4 (INT, cdiDefKeyString, CDIDEFKEYSTRING, cdidefkeystring, INT, INT, INT, STRING) -FCALLSCFUN5 (INT, cdiInqKeyString, CDIINQKEYSTRING, cdiinqkeystring, INT, INT, INT, PSTRING, PINT) -FCALLSCFUN4 (INT, cdiInqKeyLen, CDIINQKEYLEN, cdiinqkeylen, INT, INT, INT, PINT) -FCALLSCFUN4 (INT, cdiCopyKeys, CDICOPYKEYS, cdicopykeys, INT, INT, INT, INT) -FCALLSCFUN4 (INT, cdiCopyKey, CDICOPYKEY, cdicopykey, INT, INT, INT, INT) -FCALLSCFUN3 (INT, cdiDeleteKey, CDIDELETEKEY, cdideletekey, INT, INT, INT) - -/* GRID routines */ - -FCALLSCSUB2 (gridDefXname, GRIDDEFXNAME, griddefxname, INT, STRING) -FCALLSCSUB2 (gridInqXname, GRIDINQXNAME, gridinqxname, INT, PSTRING) -FCALLSCSUB2 (gridDefXlongname, GRIDDEFXLONGNAME, griddefxlongname, INT, STRING) -FCALLSCSUB2 (gridInqXlongname, GRIDINQXLONGNAME, gridinqxlongname, INT, PSTRING) -FCALLSCSUB2 (gridDefXunits, GRIDDEFXUNITS, griddefxunits, INT, STRING) -FCALLSCSUB2 (gridInqXunits, GRIDINQXUNITS, gridinqxunits, INT, PSTRING) -FCALLSCSUB2 (gridDefYname, GRIDDEFYNAME, griddefyname, INT, STRING) -FCALLSCSUB2 (gridInqYname, GRIDINQYNAME, gridinqyname, INT, PSTRING) -FCALLSCSUB2 (gridDefYlongname, GRIDDEFYLONGNAME, griddefylongname, INT, STRING) -FCALLSCSUB2 (gridInqYlongname, GRIDINQYLONGNAME, gridinqylongname, INT, PSTRING) -FCALLSCSUB2 (gridDefYunits, GRIDDEFYUNITS, griddefyunits, INT, STRING) -FCALLSCSUB2 (gridInqYunits, GRIDINQYUNITS, gridinqyunits, INT, PSTRING) -FCALLSCSUB2 (gridDefDatatype, GRIDDEFDATATYPE, griddefdatatype, INT, INT) -FCALLSCFUN1 (INT, gridInqDatatype, GRIDINQDATATYPE, gridinqdatatype, INT) -static double gridInqXval_fwrap(int gridID, int index) -{ - double v; - v = gridInqXval(gridID, (SizeType)index); - return v; -} -FCALLSCFUN2 (DOUBLE, gridInqXval_fwrap, GRIDINQXVAL, gridinqxval, INT, INT) -static double gridInqYval_fwrap(int gridID, int index) -{ - double v; - v = gridInqYval(gridID, (SizeType)index); - return v; -} -FCALLSCFUN2 (DOUBLE, gridInqYval_fwrap, GRIDINQYVAL, gridinqyval, INT, INT) -FCALLSCFUN1 (DOUBLE, gridInqXinc, GRIDINQXINC, gridinqxinc, INT) -FCALLSCFUN1 (DOUBLE, gridInqYinc, GRIDINQYINC, gridinqyinc, INT) -FCALLSCFUN1 (INT, gridIsCircular, GRIDISCIRCULAR, gridiscircular, INT) -FCALLSCFUN1 (INT, gridInqTrunc, GRIDINQTRUNC, gridinqtrunc, INT) -FCALLSCSUB2 (gridDefTrunc, GRIDDEFTRUNC, griddeftrunc, INT, INT) - -/* Reference of an unstructured grid */ - -FCALLSCSUB2 (gridDefNumber, GRIDDEFNUMBER, griddefnumber, INT, INT) -FCALLSCFUN1 (INT, gridInqNumber, GRIDINQNUMBER, gridinqnumber, INT) -FCALLSCSUB2 (gridDefPosition, GRIDDEFPOSITION, griddefposition, INT, INT) -FCALLSCFUN1 (INT, gridInqPosition, GRIDINQPOSITION, gridinqposition, INT) -FCALLSCSUB2 (gridDefReference, GRIDDEFREFERENCE, griddefreference, INT, STRING) -FCALLSCFUN2 (INT, gridInqReference, GRIDINQREFERENCE, gridinqreference, INT, PSTRING) -FCALLSCSUB2 (gridDefUUID, GRIDDEFUUID, griddefuuid, INT, PVOID) -FCALLSCSUB2 (gridInqUUID, GRIDINQUUID, gridinquuid, INT, PVOID) - -/* Rotated Lon/Lat grid */ - -FCALLSCSUB4 (gridDefParamRLL, GRIDDEFPARAMRLL, griddefparamrll, INT, DOUBLE, DOUBLE, DOUBLE) -FCALLSCSUB4 (gridInqParamRLL, GRIDINQPARAMRLL, gridinqparamrll, INT, PDOUBLE, PDOUBLE, PDOUBLE) - -/* Hexagonal GME grid */ - -FCALLSCSUB5 (gridDefParamGME, GRIDDEFPARAMGME, griddefparamgme, INT, INT, INT, INT, INT) -FCALLSCSUB5 (gridInqParamGME, GRIDINQPARAMGME, gridinqparamgme, INT, PINT, PINT, PINT, PINT) -FCALLSCSUB2 (gridDefArea, GRIDDEFAREA, griddefarea, INT, DOUBLEV) -FCALLSCSUB2 (gridInqArea, GRIDINQAREA, gridinqarea, INT, DOUBLEV) -FCALLSCFUN1 (INT, gridHasArea, GRIDHASAREA, gridhasarea, INT) -FCALLSCSUB2 (gridDefNvertex, GRIDDEFNVERTEX, griddefnvertex, INT, INT) -FCALLSCFUN1 (INT, gridInqNvertex, GRIDINQNVERTEX, gridinqnvertex, INT) -FCALLSCSUB2 (gridDefXbounds, GRIDDEFXBOUNDS, griddefxbounds, INT, DOUBLEV) -static int gridInqXbounds_fwrap(int gridID, double xbounds[]) -{ - SizeType v; - v = gridInqXbounds(gridID, xbounds); - return SizeType_c2f(v); -} -FCALLSCFUN2 (INT, gridInqXbounds_fwrap, GRIDINQXBOUNDS, gridinqxbounds, INT, DOUBLEV) -static int gridInqXboundsPart_fwrap(int gridID, int start, int size, double xbounds[]) -{ - SizeType v; - v = gridInqXboundsPart(gridID, start, (SizeType)size, xbounds); - return SizeType_c2f(v); -} -FCALLSCFUN4 (INT, gridInqXboundsPart_fwrap, GRIDINQXBOUNDSPART, gridinqxboundspart, INT, INT, INT, DOUBLEV) -FCALLSCSUB2 (gridDefYbounds, GRIDDEFYBOUNDS, griddefybounds, INT, DOUBLEV) -static int gridInqYbounds_fwrap(int gridID, double ybounds[]) -{ - SizeType v; - v = gridInqYbounds(gridID, ybounds); - return SizeType_c2f(v); -} -FCALLSCFUN2 (INT, gridInqYbounds_fwrap, GRIDINQYBOUNDS, gridinqybounds, INT, DOUBLEV) -static int gridInqYboundsPart_fwrap(int gridID, int start, int size, double ybounds[]) -{ - SizeType v; - v = gridInqYboundsPart(gridID, start, (SizeType)size, ybounds); - return SizeType_c2f(v); -} -FCALLSCFUN4 (INT, gridInqYboundsPart_fwrap, GRIDINQYBOUNDSPART, gridinqyboundspart, INT, INT, INT, DOUBLEV) -FCALLSCSUB3 (gridDefReducedPoints, GRIDDEFREDUCEDPOINTS, griddefreducedpoints, INT, INT, INTV) -FCALLSCSUB2 (gridInqReducedPoints, GRIDINQREDUCEDPOINTS, gridinqreducedpoints, INT, INTV) -FCALLSCSUB2 (gridChangeType, GRIDCHANGETYPE, gridchangetype, INT, INT) -FCALLSCSUB2 (gridDefComplexPacking, GRIDDEFCOMPLEXPACKING, griddefcomplexpacking, INT, INT) -FCALLSCFUN1 (INT, gridInqComplexPacking, GRIDINQCOMPLEXPACKING, gridinqcomplexpacking, INT) - -/* ZAXIS routines */ - -FCALLSCSUB2 (zaxisName, ZAXISNAME, zaxisname, INT, PSTRING) -FCALLSCFUN1 (STRING, zaxisNamePtr, ZAXISNAMEPTR, zaxisnameptr, INT) -FCALLSCFUN2 (INT, zaxisCreate, ZAXISCREATE, zaxiscreate, INT, INT) -FCALLSCSUB1 (zaxisDestroy, ZAXISDESTROY, zaxisdestroy, INT) -FCALLSCFUN1 (INT, zaxisInqType, ZAXISINQTYPE, zaxisinqtype, INT) -FCALLSCFUN1 (INT, zaxisInqSize, ZAXISINQSIZE, zaxisinqsize, INT) -FCALLSCFUN1 (INT, zaxisDuplicate, ZAXISDUPLICATE, zaxisduplicate, INT) -FCALLSCSUB2 (zaxisDefLevels, ZAXISDEFLEVELS, zaxisdeflevels, INT, DOUBLEV) -FCALLSCFUN2 (INT, zaxisInqLevels, ZAXISINQLEVELS, zaxisinqlevels, INT, DOUBLEV) -FCALLSCFUN1 (INT, zaxisInqCLen, ZAXISINQCLEN, zaxisinqclen, INT) -FCALLSCSUB3 (zaxisDefLevel, ZAXISDEFLEVEL, zaxisdeflevel, INT, INT, DOUBLE) -FCALLSCFUN2 (DOUBLE, zaxisInqLevel, ZAXISINQLEVEL, zaxisinqlevel, INT, INT) -FCALLSCSUB2 (zaxisDefNlevRef, ZAXISDEFNLEVREF, zaxisdefnlevref, INT, INT) -FCALLSCFUN1 (INT, zaxisInqNlevRef, ZAXISINQNLEVREF, zaxisinqnlevref, INT) -FCALLSCSUB2 (zaxisDefNumber, ZAXISDEFNUMBER, zaxisdefnumber, INT, INT) -FCALLSCFUN1 (INT, zaxisInqNumber, ZAXISINQNUMBER, zaxisinqnumber, INT) -FCALLSCSUB2 (zaxisDefUUID, ZAXISDEFUUID, zaxisdefuuid, INT, PVOID) -FCALLSCSUB2 (zaxisInqUUID, ZAXISINQUUID, zaxisinquuid, INT, PVOID) -FCALLSCSUB2 (zaxisDefName, ZAXISDEFNAME, zaxisdefname, INT, STRING) -FCALLSCSUB2 (zaxisInqName, ZAXISINQNAME, zaxisinqname, INT, PSTRING) -FCALLSCSUB2 (zaxisDefLongname, ZAXISDEFLONGNAME, zaxisdeflongname, INT, STRING) -FCALLSCSUB2 (zaxisInqLongname, ZAXISINQLONGNAME, zaxisinqlongname, INT, PSTRING) -FCALLSCSUB2 (zaxisDefUnits, ZAXISDEFUNITS, zaxisdefunits, INT, STRING) -FCALLSCSUB2 (zaxisInqUnits, ZAXISINQUNITS, zaxisinqunits, INT, PSTRING) -FCALLSCSUB2 (zaxisInqStdname, ZAXISINQSTDNAME, zaxisinqstdname, INT, PSTRING) -FCALLSCSUB2 (zaxisDefDatatype, ZAXISDEFDATATYPE, zaxisdefdatatype, INT, INT) -FCALLSCFUN1 (INT, zaxisInqDatatype, ZAXISINQDATATYPE, zaxisinqdatatype, INT) -FCALLSCSUB2 (zaxisDefPositive, ZAXISDEFPOSITIVE, zaxisdefpositive, INT, INT) -FCALLSCFUN1 (INT, zaxisInqPositive, ZAXISINQPOSITIVE, zaxisinqpositive, INT) -FCALLSCSUB1 (zaxisDefScalar, ZAXISDEFSCALAR, zaxisdefscalar, INT) -FCALLSCFUN1 (INT, zaxisInqScalar, ZAXISINQSCALAR, zaxisinqscalar, INT) -FCALLSCSUB3 (zaxisDefVct, ZAXISDEFVCT, zaxisdefvct, INT, INT, DOUBLEV) -FCALLSCSUB2 (zaxisInqVct, ZAXISINQVCT, zaxisinqvct, INT, DOUBLEV) -FCALLSCFUN1 (INT, zaxisInqVctSize, ZAXISINQVCTSIZE, zaxisinqvctsize, INT) -FCALLSCSUB2 (zaxisDefLbounds, ZAXISDEFLBOUNDS, zaxisdeflbounds, INT, DOUBLEV) -FCALLSCFUN2 (INT, zaxisInqLbounds, ZAXISINQLBOUNDS, zaxisinqlbounds, INT, DOUBLEV) -FCALLSCFUN2 (DOUBLE, zaxisInqLbound, ZAXISINQLBOUND, zaxisinqlbound, INT, INT) -FCALLSCSUB2 (zaxisDefUbounds, ZAXISDEFUBOUNDS, zaxisdefubounds, INT, DOUBLEV) -FCALLSCFUN2 (INT, zaxisInqUbounds, ZAXISINQUBOUNDS, zaxisinqubounds, INT, DOUBLEV) -FCALLSCFUN2 (DOUBLE, zaxisInqUbound, ZAXISINQUBOUND, zaxisinqubound, INT, INT) -FCALLSCSUB2 (zaxisDefWeights, ZAXISDEFWEIGHTS, zaxisdefweights, INT, DOUBLEV) -FCALLSCFUN2 (INT, zaxisInqWeights, ZAXISINQWEIGHTS, zaxisinqweights, INT, DOUBLEV) -FCALLSCSUB2 (zaxisChangeType, ZAXISCHANGETYPE, zaxischangetype, INT, INT) - -/* TAXIS routines */ - -FCALLSCFUN1 (INT, taxisCreate, TAXISCREATE, taxiscreate, INT) -FCALLSCSUB1 (taxisDestroy, TAXISDESTROY, taxisdestroy, INT) -FCALLSCFUN1 (INT, taxisDuplicate, TAXISDUPLICATE, taxisduplicate, INT) -FCALLSCSUB2 (taxisCopyTimestep, TAXISCOPYTIMESTEP, taxiscopytimestep, INT, INT) -FCALLSCSUB2 (taxisDefType, TAXISDEFTYPE, taxisdeftype, INT, INT) -FCALLSCFUN1 (INT, taxisInqType, TAXISINQTYPE, taxisinqtype, INT) -FCALLSCSUB2 (taxisDefVdate, TAXISDEFVDATE, taxisdefvdate, INT, INT) -FCALLSCSUB2 (taxisDefVtime, TAXISDEFVTIME, taxisdefvtime, INT, INT) -FCALLSCFUN1 (INT, taxisInqVdate, TAXISINQVDATE, taxisinqvdate, INT) -FCALLSCFUN1 (INT, taxisInqVtime, TAXISINQVTIME, taxisinqvtime, INT) -FCALLSCSUB2 (taxisDefRdate, TAXISDEFRDATE, taxisdefrdate, INT, INT) -FCALLSCSUB2 (taxisDefRtime, TAXISDEFRTIME, taxisdefrtime, INT, INT) -FCALLSCFUN1 (INT, taxisInqRdate, TAXISINQRDATE, taxisinqrdate, INT) -FCALLSCFUN1 (INT, taxisInqRtime, TAXISINQRTIME, taxisinqrtime, INT) -FCALLSCSUB2 (taxisDefFdate, TAXISDEFFDATE, taxisdeffdate, INT, INT) -FCALLSCSUB2 (taxisDefFtime, TAXISDEFFTIME, taxisdefftime, INT, INT) -FCALLSCFUN1 (INT, taxisInqFdate, TAXISINQFDATE, taxisinqfdate, INT) -FCALLSCFUN1 (INT, taxisInqFtime, TAXISINQFTIME, taxisinqftime, INT) -FCALLSCFUN1 (INT, taxisHasBounds, TAXISHASBOUNDS, taxishasbounds, INT) -FCALLSCSUB1 (taxisWithBounds, TAXISWITHBOUNDS, taxiswithbounds, INT) -FCALLSCSUB1 (taxisDeleteBounds, TAXISDELETEBOUNDS, taxisdeletebounds, INT) -FCALLSCSUB3 (taxisDefVdateBounds, TAXISDEFVDATEBOUNDS, taxisdefvdatebounds, INT, INT, INT) -FCALLSCSUB3 (taxisDefVtimeBounds, TAXISDEFVTIMEBOUNDS, taxisdefvtimebounds, INT, INT, INT) -FCALLSCSUB3 (taxisInqVdateBounds, TAXISINQVDATEBOUNDS, taxisinqvdatebounds, INT, PINT, PINT) -FCALLSCSUB3 (taxisInqVtimeBounds, TAXISINQVTIMEBOUNDS, taxisinqvtimebounds, INT, PINT, PINT) -FCALLSCSUB2 (taxisDefCalendar, TAXISDEFCALENDAR, taxisdefcalendar, INT, INT) -FCALLSCFUN1 (INT, taxisInqCalendar, TAXISINQCALENDAR, taxisinqcalendar, INT) -FCALLSCSUB2 (taxisDefTunit, TAXISDEFTUNIT, taxisdeftunit, INT, INT) -FCALLSCFUN1 (INT, taxisInqTunit, TAXISINQTUNIT, taxisinqtunit, INT) -FCALLSCSUB2 (taxisDefForecastTunit, TAXISDEFFORECASTTUNIT, taxisdefforecasttunit, INT, INT) -FCALLSCFUN1 (INT, taxisInqForecastTunit, TAXISINQFORECASTTUNIT, taxisinqforecasttunit, INT) -FCALLSCSUB2 (taxisDefForecastPeriod, TAXISDEFFORECASTPERIOD, taxisdefforecastperiod, INT, DOUBLE) -FCALLSCFUN1 (DOUBLE, taxisInqForecastPeriod, TAXISINQFORECASTPERIOD, taxisinqforecastperiod, INT) -FCALLSCSUB2 (taxisDefNumavg, TAXISDEFNUMAVG, taxisdefnumavg, INT, INT) -FCALLSCFUN1 (INT, taxisInqNumavg, TAXISINQNUMAVG, taxisinqnumavg, INT) -FCALLSCFUN1 (STRING, taxisNamePtr, TAXISNAMEPTR, taxisnameptr, INT) -FCALLSCFUN1 (STRING, tunitNamePtr, TUNITNAMEPTR, tunitnameptr, INT) - -/* Institut routines */ - -FCALLSCFUN4 (INT, institutDef, INSTITUTDEF, institutdef, INT, INT, STRING, STRING) -FCALLSCFUN4 (INT, institutInq, INSTITUTINQ, institutinq, INT, INT, STRING, STRING) -FCALLSCFUN0 (INT, institutInqNumber, INSTITUTINQNUMBER, institutinqnumber) -FCALLSCFUN1 (INT, institutInqCenter, INSTITUTINQCENTER, institutinqcenter, INT) -FCALLSCFUN1 (INT, institutInqSubcenter, INSTITUTINQSUBCENTER, institutinqsubcenter, INT) -FCALLSCFUN1 (STRING, institutInqNamePtr, INSTITUTINQNAMEPTR, institutinqnameptr, INT) -FCALLSCFUN1 (STRING, institutInqLongnamePtr, INSTITUTINQLONGNAMEPTR, institutinqlongnameptr, INT) - -/* Model routines */ - -FCALLSCFUN3 (INT, modelDef, MODELDEF, modeldef, INT, INT, STRING) -FCALLSCFUN3 (INT, modelInq, MODELINQ, modelinq, INT, INT, STRING) -FCALLSCFUN1 (INT, modelInqInstitut, MODELINQINSTITUT, modelinqinstitut, INT) -FCALLSCFUN1 (INT, modelInqGribID, MODELINQGRIBID, modelinqgribid, INT) -FCALLSCFUN1 (STRING, modelInqNamePtr, MODELINQNAMEPTR, modelinqnameptr, INT) - -/* Table routines */ - -FCALLSCSUB2 (tableWrite, TABLEWRITE, tablewrite, STRING, INT) -FCALLSCFUN1 (INT, tableRead, TABLEREAD, tableread, STRING) -FCALLSCFUN3 (INT, tableDef, TABLEDEF, tabledef, INT, INT, STRING) -FCALLSCFUN1 (STRING, tableInqNamePtr, TABLEINQNAMEPTR, tableinqnameptr, INT) -FCALLSCFUN3 (INT, tableInq, TABLEINQ, tableinq, INT, INT, STRING) -FCALLSCFUN0 (INT, tableInqNumber, TABLEINQNUMBER, tableinqnumber) -FCALLSCFUN1 (INT, tableInqNum, TABLEINQNUM, tableinqnum, INT) -FCALLSCFUN1 (INT, tableInqModel, TABLEINQMODEL, tableinqmodel, INT) -FCALLSCSUB6 (tableInqEntry, TABLEINQENTRY, tableinqentry, INT, INT, INT, PSTRING, PSTRING, PSTRING) - -/* Subtype routines */ - -FCALLSCFUN1 (INT, subtypeCreate, SUBTYPECREATE, subtypecreate, INT) - -/* Gives a textual summary of the variable subtype */ - -FCALLSCSUB1 (subtypePrint, SUBTYPEPRINT, subtypeprint, INT) - -/* Compares two subtype data structures */ - -FCALLSCFUN2 (INT, subtypeCompare, SUBTYPECOMPARE, subtypecompare, INT, INT) -FCALLSCFUN1 (INT, subtypeInqSize, SUBTYPEINQSIZE, subtypeinqsize, INT) -FCALLSCFUN1 (INT, subtypeInqActiveIndex, SUBTYPEINQACTIVEINDEX, subtypeinqactiveindex, INT) -FCALLSCSUB2 (subtypeDefActiveIndex, SUBTYPEDEFACTIVEINDEX, subtypedefactiveindex, INT, INT) - -/* Generate a "query object" out of a key-value pair */ - - -/* Generate an AND-combined "query object" out of two previous query objects */ - -FCALLSCFUN3 (INT, subtypeInqTile, SUBTYPEINQTILE, subtypeinqtile, INT, INT, INT) -FCALLSCFUN4 (INT, subtypeInqAttribute, SUBTYPEINQATTRIBUTE, subtypeinqattribute, INT, INT, STRING, PINT) -FCALLSCFUN2 (INT, vlistInqVarSubtype, VLISTINQVARSUBTYPE, vlistinqvarsubtype, INT, INT) -FCALLSCSUB3 (gribapiLibraryVersion, GRIBAPILIBRARYVERSION, gribapilibraryversion, PINT, PINT, PINT) - -/* Compatibility functions for release 1.8.3 (obsolete functions) */ - -FCALLSCSUB2 (zaxisDefLtype, ZAXISDEFLTYPE, zaxisdefltype, INT, INT) -FCALLSCFUN2 (INT, vlistInqVarTypeOfGeneratingProcess, VLISTINQVARTYPEOFGENERATINGPROCESS, vlistinqvartypeofgeneratingprocess, INT, INT) -FCALLSCSUB3 (vlistDefVarTypeOfGeneratingProcess, VLISTDEFVARTYPEOFGENERATINGPROCESS, vlistdefvartypeofgeneratingprocess, INT, INT, INT) -FCALLSCSUB3 (vlistDefVarProductDefinitionTemplate, VLISTDEFVARPRODUCTDEFINITIONTEMPLATE, vlistdefvarproductdefinitiontemplate, INT, INT, INT) - -/* End of fortran interface */ - - -#if defined __clang__ -# pragma GCC diagnostic pop -#endif - -// clang-format on - -#endif diff --git a/src/cdi_across.c b/src/cdi_across.c index bd4ce479e09c3e9c04144539634ca3e2ca4521d5..f8c9c6eb8af4392f99d880afa700fc42ebd01ab5 100644 --- a/src/cdi_across.c +++ b/src/cdi_across.c @@ -21,8 +21,8 @@ static uint16_t swap_endianness16(uint16_t v) { // clang-format off - return ((v>>8) & 0xff) - | ((v<<8) & 0xff00); + return ((v >> 8) & 0xff) + | ((v << 8) & 0xff00); // clang-format on } @@ -30,10 +30,10 @@ static uint32_t swap_endianness32(uint32_t v) { // clang-format off - return ((v>>24) & 0xff) - | ((v<<8) & 0xff0000) - | ((v>>8) & 0xff00) - | ((v<<24) & 0xff000000); + return ((v >> 24) & 0xff) + | ((v << 8) & 0xff0000) + | ((v >> 8) & 0xff00) + | ((v << 24) & 0xff000000); // clang-format on } @@ -42,13 +42,13 @@ swap_endianness64(uint64_t v) { // clang-format off return ((v >> 56) & 0xff) - | ((v >> 40) & 0xff00) - | ((v >> 24) & 0xff0000) - | ((v >> 8) & 0xff000000) - | ((v << 8) & 0xff00000000) - | ((v << 24) & 0xff0000000000) - | ((v << 40) & 0xff000000000000) - | ((v << 56) & 0xff00000000000000); + | ((v >> 40) & 0xff00) + | ((v >> 24) & 0xff0000) + | ((v >> 8) & 0xff000000) + | ((v << 8) & 0xff00000000) + | ((v << 24) & 0xff0000000000) + | ((v << 40) & 0xff000000000000) + | ((v << 56) & 0xff00000000000000); // clang-format on } @@ -114,11 +114,11 @@ fletcher8_check2(uint8_t sum1, uint8_t sum2) static int across_write_buf(int sock, const void *buf, size_t nbytes) { - const void *bufpos = buf; + const char *bufpos = (const char *) buf; size_t nbytes_left = nbytes; while (nbytes_left > 0) { - size_t nbytes_written = write(sock, bufpos, nbytes_left); + ssize_t nbytes_written = write(sock, bufpos, nbytes_left); if (nbytes_written < 0) { perror(__func__); @@ -137,7 +137,7 @@ across_write_grib_message(stream_t *streamptr, const void *gribbuffer, size_t nb const size_t section0_len = sizeof(section0); uint32_t section1_len; - const unsigned char *section1 = gribbuffer + section0_len; + const unsigned char *section1 = (unsigned char *) gribbuffer + section0_len; if (nbytes < section0_len + sizeof(section1_len) + 1) { Error("GRIB2 stream is too short"); diff --git a/src/cdi_att.c b/src/cdi_att.c index 6ed595ed839b66d54523cb9361895ae93670fe67..b6bbe6e5d2066393acb19bb2b46ecb7cdbe4d830 100644 --- a/src/cdi_att.c +++ b/src/cdi_att.c @@ -200,7 +200,7 @@ cdiInqAttLen(int cdiID, int varID, const char *name) for (int attid = 0; attid < (int) attsp->nelems; attid++) { cdi_att_t *attp = &(attsp->value[attid]); - if (attp->name && strcmp(attp->name, name) == 0) length = (int) attp->nelems; + if (attp->name && str_is_equal(attp->name, name)) length = (int) attp->nelems; } return length; @@ -219,12 +219,28 @@ cdiInqAttType(int cdiID, int varID, const char *name) for (int attid = 0; attid < (int) attsp->nelems; attid++) { cdi_att_t *attp = &(attsp->value[attid]); - if (attp->name && strcmp(attp->name, name) == 0) type = attp->exdtype; + if (attp->name && str_is_equal(attp->name, name)) type = attp->exdtype; } return type; } +static void +cdi_attribute_free(cdi_att_t *attp) +{ + if (attp->name) + { + Free(attp->name); + attp->name = NULL; + attp->namesz = 0; + } + if (attp->xvalue) + { + Free(attp->xvalue); + attp->xvalue = NULL; + } +} + int cdiDeleteAtts(int cdiID, int varID) { @@ -236,13 +252,7 @@ cdiDeleteAtts(int cdiID, int varID) for (int attid = 0; attid < (int) attsp->nelems; attid++) { cdi_att_t *attp = &(attsp->value[attid]); - if (attp->name) - { - Free(attp->name); - attp->name = NULL; - attp->namesz = 0; - } - if (attp->xvalue) Free(attp->xvalue); + cdi_attribute_free(attp); } attsp->nelems = 0; @@ -261,17 +271,11 @@ cdiDelAtt(int cdiID, int varID, const char *name) for (int attid = 0; attid < (int) attsp->nelems; attid++) { cdi_att_t *attp = &(attsp->value[attid]); - if (attp->name && strcmp(attp->name, name) == 0) + if (attp->name && str_is_equal(attp->name, name)) { + cdi_attribute_free(attp); status = CDI_NOERR; - Free(attp->name); - attp->name = NULL; - attp->namesz = 0; - if (attp->xvalue) - { - Free(attp->xvalue); - attp->xvalue = NULL; - } + break; } } diff --git a/src/cdi_cksum.c b/src/cdi_cksum.c index f14275a03edb912fea28f8dfea5159710ce803db..d482c937d99e6d6b1e5cf31917b897c86e0850b2 100644 --- a/src/cdi_cksum.c +++ b/src/cdi_cksum.c @@ -18,6 +18,27 @@ cdiCheckSum(int type, int count, const void *buffer) return s; } +void +cdiCheckSumRStart(struct cdiCheckSumState *state) +{ + state->sum = 0U; + state->len = 0; +} + +void +cdiCheckSumRAdd(struct cdiCheckSumState *state, int type, int count, const void *buffer) +{ + size_t elemSize = (size_t) serializeGetSizeInCore(1, type, NULL); + memcrc_r_eswap(&state->sum, (const unsigned char *) buffer, (size_t) count, elemSize); + state->len += (off_t) (elemSize * (size_t) count); +} + +uint32_t +cdiCheckSumRValue(struct cdiCheckSumState state) +{ + return memcrc_finish(&state.sum, state.len); +} + /* * Local Variables: * c-file-style: "Java" diff --git a/src/cdi_cksum.h b/src/cdi_cksum.h index 99fa6b138a7ec1d86e3b972e7e0e263cac989dd0..e43e1087b6adce6370788bb4b29a0f28a36a020e 100644 --- a/src/cdi_cksum.h +++ b/src/cdi_cksum.h @@ -3,8 +3,25 @@ #include <inttypes.h> +/* single checksum computation over one array */ uint32_t cdiCheckSum(int type, int count, const void *data); +/* composable check-sum computation, + * 0. datatype, + * 1. init, + * 2. partial, appendable computation, and + * 3. final checksum-computation + */ +struct cdiCheckSumState +{ + uint32_t sum; + off_t len; +}; + +void cdiCheckSumRStart(struct cdiCheckSumState *state); +void cdiCheckSumRAdd(struct cdiCheckSumState *state, int type, int count, const void *data); +uint32_t cdiCheckSumRValue(struct cdiCheckSumState state); + #endif /* diff --git a/src/cdi_datetime.c b/src/cdi_datetime.c index 187c1a95ec5d29dc2fda47a22e58e4eb589d1c44..e5d08a4e7a6a39a9050236d2d46da2ac7267ee2b 100644 --- a/src/cdi_datetime.c +++ b/src/cdi_datetime.c @@ -1,7 +1,14 @@ #include "cdi_datetime.h" +#include <stdio.h> #include <stdlib.h> // ================================================================== +#ifdef __cplusplus +extern "C" +{ +#endif + + // clang-format off void cdiDecodeDate(int date, int *year, int *month, int *day) { @@ -38,6 +45,11 @@ cdiEncodeTime(int hour, int minute, int second) { return hour * 10000 + minute * 100 + second; } + // clang-format on + +#ifdef __cplusplus +} +#endif // ================================================================== CdiDate @@ -205,6 +217,16 @@ cdiDateTime_isNE(const CdiDateTime cdiDateTime1, const CdiDateTime cdiDateTime2) return !cdiDateTime_isEQ(cdiDateTime1, cdiDateTime2); } +bool +cdiDateTime_isLT(const CdiDateTime cdiDateTime1, const CdiDateTime cdiDateTime2) +{ + const int64_t date1 = cdiDate_get(cdiDateTime1.date); + const int64_t date2 = cdiDate_get(cdiDateTime2.date); + const int time1 = cdiTime_get(cdiDateTime1.time); + const int time2 = cdiTime_get(cdiDateTime2.time); + return (date1 < date2 || (date1 == date2 && time1 < time2)); +} + bool cdiDateTime_isNull(const CdiDateTime cdiDateTime) { @@ -218,3 +240,20 @@ cdiDateTime_isNull(const CdiDateTime cdiDateTime) && cdiDateTime.time.ms == 0); // clang-format on } + +#define DATE_FORMAT "%5.4d-%2.2d-%2.2d" +#define TIME_FORMAT "%2.2d:%2.2d:%2.2d" + +const char * +CdiDateTime_string(CdiDateTime cdiDateTime) +{ + int year, month, day; + cdiDate_decode(cdiDateTime.date, &year, &month, &day); + int hour, minute, second, ms; + cdiTime_decode(cdiDateTime.time, &hour, &minute, &second, &ms); + + static char datetimeString[64]; + snprintf(datetimeString, sizeof(datetimeString), DATE_FORMAT "T" TIME_FORMAT, year, month, day, hour, minute, second); + + return datetimeString; +} diff --git a/src/cdi_datetime.h b/src/cdi_datetime.h index 400edc69ae320931aa07ff8fb3a90d89b6c4dfa2..450ebd0f01184c43576d5b615b0afde561eaf8cb 100644 --- a/src/cdi_datetime.h +++ b/src/cdi_datetime.h @@ -50,8 +50,11 @@ bool cdiDate_isEQ(CdiDate cdiDate1, CdiDate cdiDate2); bool cdiTime_isEQ(CdiTime cdiTime1, CdiTime cdiTime2); bool cdiDateTime_isEQ(CdiDateTime cdiDateTime1, CdiDateTime cdiDateTime2); bool cdiDateTime_isNE(CdiDateTime cdiDateTime1, CdiDateTime cdiDateTime2); +bool cdiDateTime_isLT(CdiDateTime cdiDateTime1, CdiDateTime cdiDateTime2); bool cdiDateTime_isNull(CdiDateTime cdiDateTime); +const char *CdiDateTime_string(CdiDateTime cdiDateTime); + #ifdef __cplusplus } #endif diff --git a/src/cdi_error.c b/src/cdi_error.c index 31291c01de28e009b5c5c68f0211842b654cfb8f..9ebc0cb58079977d3eb21b77003bb89602091e31 100644 --- a/src/cdi_error.c +++ b/src/cdi_error.c @@ -9,6 +9,7 @@ cdiStringError(int cdiErrno) // clang-format off static const char UnknownError[] = "Unknown Error"; static const char _ETMOF[] = "Too many open files"; + static const char _EINVAL[] = "Invalid argument"; static const char _EISDIR[] = "Is a directory"; static const char _EISEMPTY[] = "File is empty"; static const char _EUFTYPE[] = "Unsupported file type"; @@ -16,8 +17,9 @@ cdiStringError(int cdiErrno) static const char _EUFSTRUCT[] = "Unsupported file structure"; static const char _EUNC4[] = "Unsupported NetCDF4 structure"; static const char _EDIMSIZE[] = "Invalid dimension size"; + static const char _EQENF[] = "Query entries not found"; + static const char _EQNAVAIL[] = "Query not available for file type"; static const char _ELIMIT[] = "Internal limits exceeded"; - static const char _EINVAL[] = "Invalid argument"; switch (cdiErrno) { case CDI_ESYSTEM: @@ -27,6 +29,7 @@ cdiStringError(int cdiErrno) return cp; } case CDI_ETMOF: return _ETMOF; + case CDI_EINVAL: return _EINVAL; case CDI_EISDIR: return _EISDIR; case CDI_EISEMPTY: return _EISEMPTY; case CDI_EUFTYPE: return _EUFTYPE; @@ -34,8 +37,9 @@ cdiStringError(int cdiErrno) case CDI_EUFSTRUCT: return _EUFSTRUCT; case CDI_EUNC4: return _EUNC4; case CDI_EDIMSIZE: return _EDIMSIZE; + case CDI_EQENF: return _EQENF; + case CDI_EQNAVAIL: return _EQNAVAIL; case CDI_ELIMIT: return _ELIMIT; - case CDI_EINVAL: return _EINVAL; } // clang-format on return UnknownError; diff --git a/src/cdi_fdb.c b/src/cdi_fdb.c index 32ee4d4631aa2f08e5baa32c8479bbe7e0001f6d..6e0180316b1f1287a00bebb668b8f529035b5197 100644 --- a/src/cdi_fdb.c +++ b/src/cdi_fdb.c @@ -195,7 +195,7 @@ check_keyvalueList(int numItems, KeyValueEntry *keyValueList) for (int j = 0; j < numKeys; j++) { - if (strcmp(itemKeys[j], searchKeys[k]) == 0) + if (str_is_equal(itemKeys[j], searchKeys[k])) { searchKeysCount[k]++; break; @@ -297,9 +297,9 @@ get_ilevtype(const char *levtype) int ilevtype = levTypeUndef; // clang-format off - if (strcmp(levtype, "sfc") == 0) ilevtype = levTypeSFC; - else if (strcmp(levtype, "ml") == 0) ilevtype = levTypeML; - else if (strcmp(levtype, "pl") == 0) ilevtype = levTypeML; + if (str_is_equal(levtype, "sfc")) ilevtype = levTypeSFC; + else if (str_is_equal(levtype, "ml")) ilevtype = levTypeML; + else if (str_is_equal(levtype, "pl")) ilevtype = levTypeML; // clang-format on return ilevtype; @@ -315,11 +315,11 @@ decode_keyvalue(KeyValueEntry *keyValue, RecordInfoEntry *recordInfo) { // printf("key <%s> value <%s>\n", itemKeys[i], itemValues[i]); // clang-format off - if (strcmp(itemKeys[i], "date") == 0) recordInfo->date = atoi(itemValues[i]); - else if (strcmp(itemKeys[i], "time") == 0) recordInfo->time = atoi(itemValues[i]); - else if (strcmp(itemKeys[i], "param") == 0) recordInfo->param = atoi(itemValues[i]); - else if (strcmp(itemKeys[i], "levtype") == 0) recordInfo->levtype = get_ilevtype(itemValues[i]); - else if (strcmp(itemKeys[i], "levelist") == 0) recordInfo->ilevel = atoi(itemValues[i]); + if (str_is_equal(itemKeys[i], "date")) recordInfo->date = atoi(itemValues[i]); + else if (str_is_equal(itemKeys[i], "time")) recordInfo->time = atoi(itemValues[i]); + else if (str_is_equal(itemKeys[i], "param")) recordInfo->param = atoi(itemValues[i]); + else if (str_is_equal(itemKeys[i], "levtype")) recordInfo->levtype = get_ilevtype(itemValues[i]); + else if (str_is_equal(itemKeys[i], "levelist")) recordInfo->ilevel = atoi(itemValues[i]); // clang-format on } } @@ -348,7 +348,7 @@ remove_duplicate_timesteps(RecordInfoEntry *recordInfoList, int numRecords, int int n = k; for (k = 0; k < n; k++) { - Message("Skip timestep %d", i + k + 1); + Warning("Skip timestep %d", i + k + 1); numTimestepsNew--; for (int j = i; j < numTimestepsNew; j++) timestepRecordOffset[j] = timestepRecordOffset[j + 1]; } @@ -383,13 +383,10 @@ create_fdb_request(const char *filename) bool expverDefined = false; for (int i = 0; i < keyValue.numKeys; i++) { - // clang-format offxs - if (strcmp(keyValue.keys[i], "class") == 0) - classDefined = true; - else if (strcmp(keyValue.keys[i], "stream") == 0) - streamDefined = true; - else if (strcmp(keyValue.keys[i], "expver") == 0) - expverDefined = true; + // clang-format off + if (str_is_equal(keyValue.keys[i], "class")) classDefined = true; + else if (str_is_equal(keyValue.keys[i], "stream")) streamDefined = true; + else if (str_is_equal(keyValue.keys[i], "expver")) expverDefined = true; // clang-format on fdb_request_add1(request, keyValue.keys[i], keyValue.values[i]); diff --git a/src/cdi_int.c b/src/cdi_int.c index c1d5dd42739b92805d3d4c18ff097841e9d163d0..70459872b617d98a45be178cab66ed8b7a360c23 100644 --- a/src/cdi_int.c +++ b/src/cdi_int.c @@ -34,11 +34,15 @@ const char *CDI_GRIB2_Template = NULL; int CDI_Convention = CDI_CONVENTION_ECHAM; int CDI_Inventory_Mode = 1; int CDI_Version_Info = 1; +int CDI_Query_Abort = 1; int CDI_Convert_Cubesphere = 1; int CDI_Read_Cell_Corners = 1; int CDI_CMOR_Mode = 0; int CDI_Reduce_Dim = 0; +int CDI_Shuffle = 0; size_t CDI_Netcdf_Hdr_Pad = 0UL; +size_t CDI_Chunk_Cache = 0UL; +size_t CDI_Chunk_Cache_Max = 0UL; bool CDI_Netcdf_Lazy_Grid_Load = false; char *cdiPartabPath = NULL; @@ -77,7 +81,7 @@ int cdiSortParam = 0; int cdiHaveMissval = 0; static long -cdiGetenvInt(const char *envName) +cdi_getenv_int(const char *envName) { long envValue = -1; @@ -97,7 +101,7 @@ cdiGetenvInt(const char *envName) case 'g': fact = 1073741824; break; default: fact = 0; - Message("Invalid number string in %s: %s", envName, envString); + Warning("Invalid number string in %s: %s", envName, envString); Warning("%s must comprise only digits [0-9].", envName); break; } @@ -142,7 +146,7 @@ cdiPrintVersion(void) fprintf(stdout, " NetCDF library version : %s\n", cdfLibraryVersion()); #endif #ifdef HAVE_NC4HDF5 - fprintf(stdout, " HDF5 library version : %s\n", hdfLibraryVersion()); + // fprintf(stdout, " HDF5 library version : %s\n", hdfLibraryVersion()); #endif #ifdef HAVE_LIBSERVICE fprintf(stdout, " exse library version : %s\n", srvLibraryVersion()); @@ -205,6 +209,7 @@ cdiPrintDatatypes(void) void cdiDebug(int level) { + if (level < 0) return; unsigned ulevel = (unsigned) level; if (ulevel == 1 || (ulevel & 2)) CDI_Debug = 1; @@ -327,48 +332,57 @@ cdiInitialize(void) grib_multi_support_off(NULL); #endif - value = cdiGetenvInt("CDI_DEBUG"); + value = cdi_getenv_int("CDI_DEBUG"); if (value >= 0) CDI_Debug = (int) value; - value = cdiGetenvInt("CDI_GRIBAPI_DEBUG"); + value = cdi_getenv_int("CDI_GRIBAPI_DEBUG"); if (value >= 0) CDI_gribapi_debug = (bool) value; - value = cdiGetenvInt("CDI_ECCODES_DEBUG"); + value = cdi_getenv_int("CDI_ECCODES_DEBUG"); if (value >= 0) CDI_gribapi_debug = (bool) value; - value = cdiGetenvInt("CDI_ECCODES_GRIB1"); + value = cdi_getenv_int("CDI_ECCODES_GRIB1"); if (value >= 0) cdiSetEccodesGrib1((bool) value); - value = cdiGetenvInt("CDI_READ_CELL_CORNERS"); + value = cdi_getenv_int("CDI_READ_CELL_CORNERS"); if (value >= 0) CDI_Read_Cell_Corners = (int) value; - value = cdiGetenvInt("CDI_RECOPT"); + value = cdi_getenv_int("CDI_RECOPT"); if (value >= 0) CDI_Recopt = (int) value; - value = cdiGetenvInt("CDI_REGULARGRID"); + value = cdi_getenv_int("CDI_REGULARGRID"); if (value >= 0) cdiDataUnreduced = (int) value; - value = cdiGetenvInt("CDI_SORTNAME"); + value = cdi_getenv_int("CDI_SORTNAME"); if (value >= 0) cdiSortName = (int) value; - value = cdiGetenvInt("CDI_SORTPARAM"); + value = cdi_getenv_int("CDI_SORTPARAM"); if (value >= 0) cdiSortParam = (int) value; - value = cdiGetenvInt("CDI_HAVE_MISSVAL"); + value = cdi_getenv_int("CDI_HAVE_MISSVAL"); if (value >= 0) cdiHaveMissval = (int) value; - value = cdiGetenvInt("CDI_LEVELTYPE"); + value = cdi_getenv_int("CDI_LEVELTYPE"); if (value >= 0) cdiDefaultLeveltype = (int) value; - value = cdiGetenvInt("CDI_NETCDF_HDR_PAD"); + value = cdi_getenv_int("CDI_NETCDF_HDR_PAD"); if (value >= 0) CDI_Netcdf_Hdr_Pad = (size_t) value; + value = cdi_getenv_int("CDI_CHUNK_CACHE"); + if (value >= 0) CDI_Chunk_Cache = (size_t) value; + + value = cdi_getenv_int("CDI_CHUNK_CACHE_MAX"); + if (value >= 0) CDI_Chunk_Cache_Max = (size_t) value; + envstr = getenv("CDI_GRIB1_TEMPLATE"); if (envstr) CDI_GRIB1_Template = envstr; envstr = getenv("CDI_GRIB2_TEMPLATE"); if (envstr) CDI_GRIB2_Template = envstr; + envstr = getenv("CDI_SHUFFLE"); + if (envstr) CDI_Shuffle = atoi(envstr); + envstr = getenv("CDI_MISSVAL"); if (envstr) CDI_Default_Missval = atof(envstr); /* @@ -400,7 +414,7 @@ cdiInitialize(void) envstr = getenv("CDI_CONVENTION"); if (envstr) { - if (strcmp(envstr, "CF") == 0 || strcmp(envstr, "cf") == 0) + if (str_is_equal(envstr, "CF") || str_is_equal(envstr, "cf")) { CDI_Convention = CDI_CONVENTION_CF; if (CDI_Debug) Message("CDI convention was set to CF!"); @@ -417,6 +431,17 @@ cdiInitialize(void) } } + envstr = getenv("CDI_QUERY_ABORT"); + if (envstr) + { + const int ival = atoi(envstr); + if (ival == 0 || ival == 1) + { + CDI_Query_Abort = ival; + if (CDI_Debug) Message("CDI_Query_Abort = %s", envstr); + } + } + envstr = getenv("CDI_VERSION_INFO"); if (envstr) { @@ -476,18 +501,18 @@ void cdiDefGlobal(const char *string, int value) { // clang-format off - if (strIsEqual(string, "REGULARGRID") ) cdiDataUnreduced = value; - else if (strIsEqual(string, "ECCODES_DEBUG") ) CDI_gribapi_debug = (bool) value; - else if (strIsEqual(string, "ECCODES_GRIB1") ) cdiSetEccodesGrib1((bool) value); - else if (strIsEqual(string, "SORTNAME") ) cdiSortName = value; - else if (strIsEqual(string, "SORTPARAM") ) cdiSortParam = value; - else if (strIsEqual(string, "HAVE_MISSVAL") ) cdiHaveMissval = value; - else if (strIsEqual(string, "NC_CHUNKSIZEHINT") ) CDI_Netcdf_Chunksizehint = value; - else if (strIsEqual(string, "READ_CELL_CORNERS") ) CDI_Read_Cell_Corners = value; - else if (strIsEqual(string, "CMOR_MODE") ) CDI_CMOR_Mode = value; - else if (strIsEqual(string, "REDUCE_DIM") ) CDI_Reduce_Dim = value; - else if (strIsEqual(string, "NETCDF_HDR_PAD") ) CDI_Netcdf_Hdr_Pad = (size_t) value; - else if (strIsEqual(string, "NETCDF_LAZY_GRID_LOAD")) CDI_Netcdf_Lazy_Grid_Load = (bool) value; + if (str_is_equal(string, "REGULARGRID") ) cdiDataUnreduced = value; + else if (str_is_equal(string, "ECCODES_DEBUG") ) CDI_gribapi_debug = (bool) value; + else if (str_is_equal(string, "ECCODES_GRIB1") ) cdiSetEccodesGrib1((bool) value); + else if (str_is_equal(string, "SORTNAME") ) cdiSortName = value; + else if (str_is_equal(string, "SORTPARAM") ) cdiSortParam = value; + else if (str_is_equal(string, "HAVE_MISSVAL") ) cdiHaveMissval = value; + else if (str_is_equal(string, "NC_CHUNKSIZEHINT") ) CDI_Netcdf_Chunksizehint = value; + else if (str_is_equal(string, "READ_CELL_CORNERS") ) CDI_Read_Cell_Corners = value; + else if (str_is_equal(string, "CMOR_MODE") ) CDI_CMOR_Mode = value; + else if (str_is_equal(string, "REDUCE_DIM") ) CDI_Reduce_Dim = value; + else if (str_is_equal(string, "NETCDF_HDR_PAD") ) CDI_Netcdf_Hdr_Pad = (size_t) value; + else if (str_is_equal(string, "NETCDF_LAZY_GRID_LOAD")) CDI_Netcdf_Lazy_Grid_Load = (bool) value; else Warning("Unsupported global key: %s", string); // clang-format on } @@ -525,7 +550,6 @@ cdiBaseFiletype(int filetype) case CDI_FILETYPE_NC4C: case CDI_FILETYPE_NCZARR: case CDI_FILETYPE_NC5: return CDI_FILETYPE_NETCDF; - default: return filetype; } return filetype; diff --git a/src/cdi_int.h b/src/cdi_int.h index 429cb315ad87b9b76c82872f4d76d6e33832b442..e430405334f631b72ca0fba146506788670ea9a2 100644 --- a/src/cdi_int.h +++ b/src/cdi_int.h @@ -43,11 +43,11 @@ char *strdup(const char *s); */ #endif -char *strToLower(char *str); +char *str_to_lower(char *str); bool strStartsWith(const char *vstr, const char *cstr); static inline bool -strIsEqual(const char *x, const char *y) +str_is_equal(const char *x, const char *y) { return (*x == *y) && strcmp(x, y) == 0; } @@ -189,17 +189,18 @@ typedef struct typedef struct { + int *recIDs; // IDs of non constant records record_t *records; - int *recIDs; // IDs of non constant records - int recordSize; // number of allocated records - int nrecs; // number of used records - // tsID=0 nallrecs - // tsID>0 number of non constant records - int nallrecs; // number of all records - int curRecID; // current record ID - bool next; - off_t position; // timestep file position + int recordSize; // number of allocated records + int nrecs; // number of used records + // tsID=0 nallrecs + // tsID>0 number of non constant records + int nallrecs; // number of all records + int curRecID; // current record ID + int ncStepIndex; // NetCDF timestep index + off_t position; // timestep file position taxis_t taxis; + bool next; } tsteps_t; typedef struct @@ -250,6 +251,8 @@ typedef struct { int ncIDs[CDF_SIZE_ncIDs]; int gridID; + long start; + long count; } ncgrid_t; #endif @@ -266,6 +269,7 @@ typedef struct SizeType numvals; char *filename; Record *record; + CdiQuery *query; svarinfo_t *vars; int nvars; // number of variables int varsAllocated; @@ -285,12 +289,21 @@ typedef struct ncgrid_t ncgrid[MAX_GRIDS_PS]; int zaxisID[MAX_ZAXES_PS]; // Warning: synchronous array to vlist_to_pointer(vlistID)->zaxisIDs int nczvarID[MAX_ZAXES_PS]; + int ncNumDims; + int ncDimID[MAX_DIMS_PS]; + size_t ncDimLen[MAX_DIMS_PS]; VCT vct; #endif int globalatts; int localatts; int unreduced; int have_missval; + // netcdf4/HDF5 filter + unsigned int filterId; + size_t numParams; + size_t maxParams; + unsigned int params[8]; + int comptype; // compression type int complevel; // compression level bool sortname; @@ -298,7 +311,7 @@ typedef struct void *gribContainers; int numWorker; - int nextRecID; + int nextGlobalRecId; int cachedTsID; void *jobs; void *jobManager; @@ -372,12 +385,16 @@ extern const char *CDI_GRIB1_Template; extern const char *CDI_GRIB2_Template; extern int CDI_Convention; extern int CDI_Inventory_Mode; +extern int CDI_Query_Abort; extern int CDI_Version_Info; extern int CDI_Convert_Cubesphere; extern int CDI_Read_Cell_Corners; extern int CDI_CMOR_Mode; extern int CDI_Reduce_Dim; +extern int CDI_Shuffle; extern size_t CDI_Netcdf_Hdr_Pad; +extern size_t CDI_Chunk_Cache; +extern size_t CDI_Chunk_Cache_Max; extern bool CDI_Netcdf_Lazy_Grid_Load; extern int STREAM_Debug; @@ -428,7 +445,7 @@ void streamFCopyRecord(stream_t *streamptr2, stream_t *streamptr1, const char *c int recordNewEntry(stream_t *streamptr, int tsID); -void cdiCreateTimesteps(stream_t *streamptr); +void cdi_create_timesteps(int numTimesteps, stream_t *streamptr); void recordInitEntry(record_t *record); diff --git a/src/cdi_key.c b/src/cdi_key.c index c5ce9a0fa7b50526c5a0947aefd36d6870db77df..fd7f66b8b015beaef43d517931886989a52f0be3 100644 --- a/src/cdi_key.c +++ b/src/cdi_key.c @@ -8,10 +8,8 @@ static cdi_keys_t * vlist_get_keysp(vlist_t *vlistptr, int varID) { - if (varID == CDI_GLOBAL) - return &vlistptr->keys; - else if (varID >= 0 && varID < vlistptr->nvars) - return &(vlistptr->vars[varID].keys); + if (varID == CDI_GLOBAL) return &vlistptr->keys; + if (varID >= 0 && varID < vlistptr->nvars) return &(vlistptr->vars[varID].keys); return NULL; } @@ -19,12 +17,9 @@ vlist_get_keysp(vlist_t *vlistptr, int varID) static cdi_keys_t * grid_get_keysp(grid_t *gridptr, int varID) { - if (varID == CDI_GLOBAL) - return &gridptr->keys; - else if (varID == CDI_XAXIS) - return &gridptr->x.keys; - else if (varID == CDI_YAXIS) - return &gridptr->y.keys; + if (varID == CDI_GLOBAL) return &gridptr->keys; + if (varID == CDI_XAXIS) return &gridptr->x.keys; + if (varID == CDI_YAXIS) return &gridptr->y.keys; return NULL; } @@ -32,9 +27,7 @@ grid_get_keysp(grid_t *gridptr, int varID) static cdi_keys_t * zaxis_get_keysp(zaxis_t *zaxisptr, int varID) { - if (varID == CDI_GLOBAL) return &zaxisptr->keys; - - return NULL; + return (varID == CDI_GLOBAL) ? &zaxisptr->keys : NULL; } static cdi_key_t * @@ -48,8 +41,8 @@ new_key(cdi_keys_t *keysp, int key) keysp->nelems++; keyp->key = key; - keyp->length = 0; keyp->type = 0; + keyp->length = 0; keyp->v.s = NULL; return keyp; @@ -90,12 +83,10 @@ find_key_const(const cdi_keys_t *keysp, int key) static cdi_keys_t * cdi_get_keysp(int objID, int varID) { - if (reshGetTxCode(objID) == GRID) - return grid_get_keysp(grid_to_pointer(objID), varID); - else if (reshGetTxCode(objID) == ZAXIS) - return zaxis_get_keysp(zaxis_to_pointer(objID), varID); - else if (reshGetTxCode(objID) == VLIST) - return vlist_get_keysp(vlist_to_pointer(objID), varID); + if (reshGetTxCode(objID) == GRID) return grid_get_keysp(grid_to_pointer(objID), varID); + if (reshGetTxCode(objID) == DIST_GRID) return grid_get_keysp(grid_to_pointer(objID), varID); + if (reshGetTxCode(objID) == ZAXIS) return zaxis_get_keysp(zaxis_to_pointer(objID), varID); + if (reshGetTxCode(objID) == VLIST) return vlist_get_keysp(vlist_to_pointer(objID), varID); return NULL; } @@ -107,39 +98,45 @@ cdi_key_compare(cdi_keys_t *keyspa, cdi_keys_t *keyspb, int keynum) cdi_key_t *keypa = keyspa->value + keynum, *keypb = keyspb->value + keynum; if (keypa->key != keypb->key) return 1; - if (keypa->type != keypb->type) return 1; + if (keypa->length != keypb->length) return 1; - if (keypa->type == KEY_BYTES) - { - if (keypa->length != keypb->length) return 1; - return memcmp(keypa->v.s, keypb->v.s, keypa->length); - } - else if (keypa->type == KEY_FLOAT) - { - if (IS_NOT_EQUAL(keypa->v.d, keypb->v.d)) return 1; - } - else if (keypa->type == KEY_INT) - { - if (keypa->v.i != keypb->v.i) return 1; - } + if (keypa->type == KEY_BYTES) return (memcmp(keypa->v.s, keypb->v.s, keypa->length) != 0); + if (keypa->type == KEY_FLOAT) return (IS_NOT_EQUAL(keypa->v.d, keypb->v.d)); + if (keypa->type == KEY_INT) return (keypa->v.i != keypb->v.i); return 0; } -void -cdiDeleteVarKeys(cdi_keys_t *keysp) +static void +cdi_delete_key(cdi_key_t *keyp) { - const int nelems = keysp ? (int) keysp->nelems : 0; - for (int keyid = 0; keyid < nelems; keyid++) + if (keyp != NULL && keyp->length) // key in use { - cdi_key_t *keyp = &(keysp->value[keyid]); - if (keyp->length) + keyp->length = 0; + if (keyp->type == KEY_BYTES) { - free(keyp->v.s); + if (keyp->v.s) free(keyp->v.s); keyp->v.s = NULL; - keyp->length = 0; } + else if (keyp->type == KEY_FLOAT) + { + keyp->v.d = 0.0; + } + else if (keyp->type == KEY_INT) + { + keyp->v.i = 0; + } + } +} + +void +cdiDeleteVarKeys(cdi_keys_t *keysp) +{ + int nelems = keysp ? (int) keysp->nelems : 0; + for (int keyid = 0; keyid < nelems; keyid++) + { + cdi_delete_key(&(keysp->value[keyid])); } keysp->nelems = 0; @@ -157,21 +154,22 @@ cdiDeleteKeys(int cdiID, int varID) void cdiPrintVarKeys(cdi_keys_t *keysp) { - const int nelems = keysp ? (int) keysp->nelems : 0; + int nelems = keysp ? (int) keysp->nelems : 0; for (int keyid = 0; keyid < nelems; keyid++) { cdi_key_t *keyp = &(keysp->value[keyid]); + if (keyp->length == 0) continue; if (keyp->type == KEY_BYTES) { - printf("%d key %d length %d value %s\n", keyid + 1, keyp->key, keyp->length, keyp->v.s); + fprintf(stdout, "%d key %d length %d value %s\n", keyid + 1, keyp->key, keyp->length, keyp->v.s); } else if (keyp->type == KEY_FLOAT) { - printf("%d key %d value %g\n", keyid + 1, keyp->key, keyp->v.d); + fprintf(stdout, "%d key %d value %g\n", keyid + 1, keyp->key, keyp->v.d); } else if (keyp->type == KEY_INT) { - printf("%d key %d value %d\n", keyid + 1, keyp->key, keyp->v.i); + fprintf(stdout, "%d key %d value %d\n", keyid + 1, keyp->key, keyp->v.i); } } } @@ -195,10 +193,9 @@ cdiInqKeyLen(int cdiID, int varID, int key, int *length) xassert(keysp != NULL); const cdi_key_t *keyp = find_key_const(keysp, key); - if (keyp != NULL) + if (keyp != NULL && keyp->length > 0) { *length = keyp->length; - if (*length == 0) *length = 1; status = CDI_NOERR; } @@ -208,12 +205,11 @@ cdiInqKeyLen(int cdiID, int varID, int key, int *length) static void cdi_define_key(const cdi_key_t *keyp, cdi_keys_t *keysp) { - if (keyp->type == KEY_INT) - cdiDefVarKeyInt(keysp, keyp->key, keyp->v.i); - else if (keyp->type == KEY_FLOAT) - cdiDefVarKeyFloat(keysp, keyp->key, keyp->v.d); - else if (keyp->type == KEY_BYTES) - cdiDefVarKeyBytes(keysp, keyp->key, keyp->v.s, keyp->length); + // clang-format off + if (keyp->type == KEY_INT) cdiDefVarKeyInt(keysp, keyp->key, keyp->v.i); + else if (keyp->type == KEY_FLOAT) cdiDefVarKeyFloat(keysp, keyp->key, keyp->v.d); + else if (keyp->type == KEY_BYTES) cdiDefVarKeyBytes(keysp, keyp->key, keyp->v.s, keyp->length); + // clang-format on } int @@ -224,16 +220,7 @@ cdiDeleteKey(int cdiID, int varID, int key) cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID); xassert(keysp != NULL); - cdi_key_t *keyp = find_key(keysp, key); - if (keyp != NULL) // key in use - { - if (keyp->length) - { - free(keyp->v.s); - keyp->v.s = NULL; - keyp->length = 0; - } - } + cdi_delete_key(find_key(keysp, key)); return status; } @@ -244,7 +231,7 @@ cdiCopyVarKeys(const cdi_keys_t *keysp1, cdi_keys_t *keysp2) for (size_t keyid = 0; keyid < keysp1->nelems; keyid++) { const cdi_key_t *keyp = &(keysp1->value[keyid]); - cdi_define_key(keyp, keysp2); + if (keyp->length > 0) cdi_define_key(keyp, keysp2); } } @@ -272,7 +259,7 @@ cdiCopyVarKey(const cdi_keys_t *keysp1, int key, cdi_keys_t *keysp2) const cdi_key_t *keyp = find_key_const(keysp1, key); if (keyp == NULL) return -1; - cdi_define_key(keyp, keysp2); + if (keyp->length > 0) cdi_define_key(keyp, keysp2); return status; } @@ -301,6 +288,7 @@ cdiDefVarKeyInt(cdi_keys_t *keysp, int key, int value) { keyp->type = KEY_INT; keyp->v.i = value; + keyp->length = 1; } } } @@ -367,7 +355,7 @@ cdiInqKeyInt(int cdiID, int varID, int key, int *value) xassert(keysp != NULL); const cdi_key_t *keyp = find_key_const(keysp, key); - if (keyp != NULL) // key in use + if (keyp != NULL && keyp->length == 1) // key in use { if (keyp->type == KEY_INT) { @@ -398,11 +386,9 @@ cdiDefVarKeyFloat(cdi_keys_t *keysp, int key, double value) if (keyp != NULL) { - // if ( keyp->v.i != value ) - { - keyp->type = KEY_INT; - keyp->v.d = value; - } + keyp->type = KEY_FLOAT; + keyp->v.d = value; + keyp->length = 1; } } @@ -462,13 +448,13 @@ cdiInqKeyFloat(int cdiID, int varID, int key, double *value) { int status = -1; - // if ( varID != CDI_GLOBAL ) status = cdiInqKeyFloat(cdiID, CDI_GLOBAL, key, value); + // if (varID != CDI_GLOBAL) status = cdiInqKeyFloat(cdiID, CDI_GLOBAL, key, value); const cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID); xassert(keysp != NULL); const cdi_key_t *keyp = find_key_const(keysp, key); - if (keyp != NULL) // key in use + if (keyp != NULL && keyp->length == 1) // key in use { if (keyp->type == KEY_FLOAT) { @@ -490,7 +476,7 @@ cdiDefVarKeyBytes(cdi_keys_t *keysp, int key, const unsigned char *bytes, int le { if (keyp->length != 0 && keyp->length != length) { - free(keyp->v.s); + if (keyp->v.s) free(keyp->v.s); keyp->length = 0; } if (keyp->length == 0) @@ -543,7 +529,7 @@ cdiInqVarKeyBytes(const cdi_keys_t *keysp, int key, unsigned char *bytes, int *l int status = -1; const cdi_key_t *keyp = find_key_const(keysp, key); - if (keyp != NULL) // key in use + if (keyp != NULL && keyp->length > 0) // key in use { if (keyp->type == KEY_BYTES) { @@ -583,7 +569,7 @@ cdiInqKeyBytes(int cdiID, int varID, int key, unsigned char *bytes, int *length) xassert(bytes != NULL); xassert(length != NULL); - // if ( varID != CDI_GLOBAL ) status = cdiInqKeyBytes(cdiID, CDI_GLOBAL, key, bytes, length); + // if (varID != CDI_GLOBAL) status = cdiInqKeyBytes(cdiID, CDI_GLOBAL, key, bytes, length); const cdi_keys_t *keysp = cdi_get_keysp(cdiID, varID); xassert(keysp != NULL); @@ -684,10 +670,10 @@ cdiInqKeyString(int cdiID, int varID, int key, char *string, int *length) if (maxlength > 0) string[0] = '\0'; int status = cdiInqKeyBytes(cdiID, varID, key, (unsigned char *) string, length); - if (status != CDI_NOERR) - *length = 0; - else + if (CDI_NOERR == status) string[maxlength - 1] = '\0'; + else + *length = 0; return status; } diff --git a/src/cdi_limits.h b/src/cdi_limits.h index 4c5314375130eec7f808cb99f6b7f25ed5d9e098..be7035cb301360dd1631b280580320ad674b9ab7 100644 --- a/src/cdi_limits.h +++ b/src/cdi_limits.h @@ -2,6 +2,7 @@ #define CDI_LIMITS_H #define MAX_DIMENSIONS 5 // maximum number of dimensions per variable +#define MAX_DIMS_PS 16 // maximum number of dimensions per stream #define MAX_GRIDS_PS 128 // maximum number of different grids per stream #define MAX_ZAXES_PS 128 // maximum number of different zaxes per stream #define MAX_ATTRIBUTES 256 // maximum number of attributes per variable diff --git a/src/cdi_query.c b/src/cdi_query.c new file mode 100644 index 0000000000000000000000000000000000000000..48a7a20ec7703b5811dd95b74fd0888f7ed3b11e --- /dev/null +++ b/src/cdi_query.c @@ -0,0 +1,350 @@ +#include <string.h> +#include <stdlib.h> +#include "cdi.h" + +static int +sum_found(int listSize, bool *listFound) +{ + int numFound = 0; + for (int i = 0; i < listSize; ++i) numFound += listFound[i]; + return numFound; +} + +static int +sum_not_found(int listSize, bool *listFound) +{ + return listSize - sum_found(listSize, listFound); +} + +void +cdiQueryInit(CdiQuery *query) +{ + query->numEntries = 0; + + query->numNames = 0; + query->names = NULL; + query->namesFound = NULL; + + query->numCellidx = 0; + query->cellidx = NULL; + query->cellidxFound = NULL; + + query->numLevidx = 0; + query->levidx = NULL; + query->levidxFound = NULL; + + query->numStepidx = 0; + query->stepidx = NULL; + query->stepidxFound = NULL; +} + +CdiQuery * +cdiQueryCreate() +{ + CdiQuery *query = (CdiQuery *) malloc(sizeof(CdiQuery)); + cdiQueryInit(query); + return query; +} + +void +cdiQueryDelete(CdiQuery *query) +{ + if (query) + { + if (query->numNames) + { + for (int i = 0; i < query->numNames; ++i) free(query->names[i]); + free(query->names); + free(query->namesFound); + } + + if (query->numCellidx) + { + free(query->cellidx); + free(query->cellidxFound); + } + + if (query->numLevidx) + { + free(query->levidx); + free(query->levidxFound); + } + + if (query->numStepidx) + { + free(query->stepidx); + free(query->stepidxFound); + } + + cdiQueryInit(query); + free(query); + } +} + +int +cdiQueryNumNames(const CdiQuery *query) +{ + return query ? query->numNames : 0; +} + +int +cdiQueryNumCellidx(const CdiQuery *query) +{ + return query ? query->numCellidx : 0; +} + +int +cdiQueryNumStepidx(const CdiQuery *query) +{ + return query ? query->numStepidx : 0; +} + +int +cdiQueryNumEntries(const CdiQuery *query) +{ + return query ? query->numEntries : 0; +} + +void +cdiQuerySetNames(CdiQuery *query, int numEntries, char **names) +{ + if (numEntries) + { + query->numEntries += numEntries; + query->numNames = numEntries; + query->namesFound = (bool *) calloc(numEntries, sizeof(bool)); + query->names = (char **) malloc(numEntries * sizeof(char *)); + for (int i = 0; i < numEntries; ++i) query->names[i] = strdup(names[i]); + } +} + +void +cdiQuerySetCellidx(CdiQuery *query, int numEntries, size_t *cellidx) +{ + if (numEntries) + { + query->numEntries += numEntries; + query->numCellidx = numEntries; + query->cellidxFound = (bool *) calloc(numEntries, sizeof(bool)); + query->cellidx = (size_t *) malloc(numEntries * sizeof(size_t)); + for (int i = 0; i < numEntries; ++i) query->cellidx[i] = cellidx[i]; + } +} + +void +cdiQuerySetLevidx(CdiQuery *query, int numEntries, int *levidx) +{ + if (numEntries) + { + query->numEntries += numEntries; + query->numLevidx = numEntries; + query->levidxFound = (bool *) calloc(numEntries, sizeof(bool)); + query->levidx = (int *) malloc(numEntries * sizeof(int)); + for (int i = 0; i < numEntries; ++i) query->levidx[i] = levidx[i]; + } +} + +void +cdiQuerySetStepidx(CdiQuery *query, int numEntries, int *stepidx) +{ + if (numEntries) + { + query->numEntries += numEntries; + query->numStepidx = numEntries; + query->stepidxFound = (bool *) calloc(numEntries, sizeof(bool)); + query->stepidx = (int *) malloc(numEntries * sizeof(int)); + for (int i = 0; i < numEntries; ++i) query->stepidx[i] = stepidx[i]; + } +} + +size_t +cdiQueryGetCellidx(const CdiQuery *query, int index) +{ + return (index >= 0 && index < query->numCellidx) ? query->cellidx[index] : (size_t) -1; +} + +CdiQuery * +cdiQueryClone(const CdiQuery *query) +{ + CdiQuery *queryOut = cdiQueryCreate(); + + if (query) + { + cdiQuerySetNames(queryOut, query->numNames, query->names); + cdiQuerySetCellidx(queryOut, query->numCellidx, query->cellidx); + cdiQuerySetLevidx(queryOut, query->numLevidx, query->levidx); + cdiQuerySetStepidx(queryOut, query->numStepidx, query->stepidx); + } + + return queryOut; +} + +void +cdiQueryPrint(const CdiQuery *query) +{ + if (query) + { + if (query->numNames) + { + printf("Names:"); + for (int i = 0; i < query->numNames; ++i) printf(" %s", query->names[i]); + printf("\n"); + } + + if (query->numCellidx) + { + printf("Cellidx:"); + for (int i = 0; i < query->numCellidx; ++i) printf(" %zu", query->cellidx[i]); + printf("\n"); + } + + if (query->numLevidx) + { + printf("Levidx:"); + for (int i = 0; i < query->numLevidx; ++i) printf(" %d", query->levidx[i]); + printf("\n"); + } + + if (query->numStepidx) + { + printf("Stepidx:"); + for (int i = 0; i < query->numStepidx; ++i) printf(" %d", query->stepidx[i]); + printf("\n"); + } + } +} + +int +cdiQueryNumEntriesFound(const CdiQuery *query) +{ + int numEntriesFound = 0; + + if (query) + { + if (query->numNames) numEntriesFound += sum_found(query->numNames, query->namesFound); + if (query->numCellidx) numEntriesFound += sum_found(query->numCellidx, query->cellidxFound); + if (query->numLevidx) numEntriesFound += sum_found(query->numLevidx, query->levidxFound); + if (query->numStepidx) numEntriesFound += sum_found(query->numStepidx, query->stepidxFound); + } + + return numEntriesFound; +} + +void +cdiQueryPrintEntriesNotFound(const CdiQuery *query) +{ + if (query) + { + int numEntriesNotFound = cdiQueryNumEntries(query) - cdiQueryNumEntriesFound(query); + if (numEntriesNotFound > 0) + { + if (query->numNames) + { + if (sum_not_found(query->numNames, query->namesFound) > 0) + { + printf("Name not found:"); + for (int i = 0; i < query->numNames; ++i) + if (!query->namesFound[i]) printf(" %s", query->names[i]); + printf("\n"); + } + } + + if (query->numCellidx) + { + if (sum_not_found(query->numCellidx, query->cellidxFound) > 0) + { + printf("Grid cell index not found:"); + for (int i = 0; i < query->numCellidx; ++i) + if (!query->cellidxFound[i]) printf(" %zu", query->cellidx[i]); + printf("\n"); + } + } + + if (query->numLevidx) + { + if (sum_not_found(query->numLevidx, query->levidxFound) > 0) + { + printf("Level index not found:"); + for (int i = 0; i < query->numLevidx; ++i) + if (!query->levidxFound[i]) printf(" %d", query->levidx[i]); + printf("\n"); + } + } + + if (query->numStepidx) + { + if (sum_not_found(query->numStepidx, query->stepidxFound) > 0) + { + printf("Step index not found:"); + for (int i = 0; i < query->numStepidx; ++i) + if (!query->stepidxFound[i]) printf(" %d", query->stepidx[i]); + printf("\n"); + } + } + } + } +} + +int +cdiQueryName(CdiQuery *query, const char *name) +{ + if (query && query->numNames && name && *name) + { + for (int i = 0; i < query->numNames; ++i) + if (strcmp(name, query->names[i]) == 0) + { + query->namesFound[i] = true; + return 0; + } + } + + return -1; +} + +int +cdiQueryCellidx(CdiQuery *query, size_t cellidx) +{ + if (query && query->numCellidx) + { + for (int i = 0; i < query->numCellidx; ++i) + if (query->cellidx[i] == cellidx) + { + query->cellidxFound[i] = true; + return 0; + } + } + + return -1; +} + +int +cdiQueryLevidx(CdiQuery *query, int levidx) +{ + if (query && query->numLevidx) + { + for (int i = 0; i < query->numLevidx; ++i) + if (query->levidx[i] == levidx) + { + query->levidxFound[i] = true; + return 0; + } + } + + return -1; +} + +int +cdiQueryStepidx(CdiQuery *query, int stepidx) +{ + if (query && query->numStepidx) + { + for (int i = 0; i < query->numStepidx; ++i) + if (query->stepidx[i] == stepidx) + { + query->stepidxFound[i] = true; + return 0; + } + } + + return -1; +} diff --git a/src/cdipio.h b/src/cdipio.h index 4b0d82357e45e073aba4be4827658aa27db67fcb..72a5f9ac9a77531a532eac94e920239e74340f69 100644 --- a/src/cdipio.h +++ b/src/cdipio.h @@ -8,6 +8,11 @@ #ifndef CDIPIO_H_ #define CDIPIO_H_ +// clang-format off + +//FINT_ON <--- don't change or remove this line!!! +// Start of fortran interface for the following routines (make_fint.c) + #include <mpi.h> /* parallel IO IOMode */ @@ -36,20 +41,71 @@ void pioEndDef(void); void pioEndTimestepping(void); void pioFinalize(void); -/* cdiPioNoPostCommSetup: Dummy function to use as argument to pioInit +/* cdiPioNoPostCommSetup: Dummy default function to use as argument to + * cdiPioConfSetCallBackActions or pioInit * if no actions are necessary after I/O servers initialize communication */ void cdiPioNoPostCommSetup(void); -/* pioInit: initialize I/O server processes and communication */ +/* pioInit: initialize I/O server processes and communication + * Deprecated, use cdiPioInit instead! */ MPI_Comm pioInit(MPI_Comm commSuper, int nProcsIO, int IOMode, int *pioNamespace, float partInflate, void (*postCommSetupActions)(void)); /* cdiPioInit: initialize I/O server processes and communication */ MPI_Comm cdiPioInit(MPI_Comm commSuper, int confResH, int *pioNamespace); +/* pioWriteTimestep: flush data from all client RMA buffers to server */ void pioWriteTimestep(void); +/* cdiPioRDMAProgress: devote some resources to make RMA progress This + * call is meant for systems where the hardware and/or MPI make + * insufficient progress when only calling + * MPI_Win_post/MPI_Win_wait+MPI_Win_start/MPI_Win_get/MPI_Win_complete */ void cdiPioRDMAProgress(void); -void streamWriteVarPart(int streamID, int varID, const void *data, size_t nmiss, Xt_idxlist partDesc); -void streamWriteScatteredVarPart(int streamID, int varID, const void *data, int numBlocks, const int blocklengths[], - const int displacements[], size_t nmiss, Xt_idxlist partDesc); +/* cdiPioStreamDefDecomposedVlist: collectively define the vlist assigned to a + * stream together with a fixed decomposition where for each variable + * an entry of partDesc specifies the local part at the caller, and + * an entry of conversion specifies if data will be written with + * streamWriteVar (i.e. as double) with + * conversion[varID] == CDI_DATATYPE_FLT64 or with streamWriteVarF + * (i.e. as float) with conversion[varID] == CDI_DATATYPE_FLT32 + */ +void cdiPioStreamDefDecomposedVlist(int streamID, int vlistID, const Xt_idxlist partDesc[], const int conversion[]); + +/* streamWriteVarPart: Write part of the data making up variable varID + * of stream streamID. + * + * The processes in the communicator returned from cdiPioInit or + * pioInit must call this routine collectively and data must point to + * M items, where partDesc is a YAXT index list describing with M + * indices in 0 to N-1 the data items stored as doubles. N is the + * number of values per time step in the variable, i.e. the size of + * the corresponding array passed to streamWriteVar in the serial version. + * The group of processes collectively calling streamWriteVarPart + * must provide data for all indices or the behaviour is undefined. */ +void streamWriteVarPart(int streamID, int varID, const double *data, int nmiss, Xt_idxlist partDesc); + +/* streamWriteVarPartF: Write part of the data making up variable + * varID of stream streamID. + * + * Single-precision version of streamWriteVarPart. + */ +void streamWriteVarPartF(int streamID, int varID, const float *data, int nmiss, Xt_idxlist partDesc); + +/* streamWriteScatteredVarPart: Write part of the data making up + * variable varID of stream streamID. + * + * In contrast to streamWriteVarPart, the data is not read from data as one + * contiguous sequence but instead the numBlocks chunks of length + * blocklengths[i] and starting displacements[i] each for i in [0,numBlocks) + */ +void streamWriteScatteredVarPart(int streamID, int varID, const double *data, int numBlocks, const int blocklengths[], + const int displacements[], int nmiss, Xt_idxlist partDesc); + +/* streamWriteScatteredVarPartF: Write part of the data making up + * variable varID of stream streamID. + * + * Single-precision version of streamWriteScatteredVarPart. + */ +void streamWriteScatteredVarPartF(int streamID, int varID, const float *data, int numBlocks, const int blocklengths[], + const int displacements[], int nmiss, Xt_idxlist partDesc); /* cdiPioCSRLastN: return role codes appropriate to use the last \textit{nProcsIO} tasks as I/O servers */ int cdiPioCSRLastN(MPI_Comm commSuper, int IOMode, int nProcsIO); @@ -97,13 +153,42 @@ void cdiPioConfSetCSRole(int confResH, int CSRole); int cdiPioConfGetCSRole(int confResH); /* cdiPioConfSetPostCommSetupActions: set function to be called after - * setup of client/server communications of configuration object */ + * setup of client/server communications of configuration object. + * Deprecated: use cdiPioConfSetCallBackActions with + * trigger == CDIPIO_CALLBACK_POSTCOMMSETUP in new programs! */ void cdiPioConfSetPostCommSetupActions(int confResH, void (*postCommSetupActions)(void)); /* cdiPioConfGetPostCommSetupActions: get function to be called after - * setup of client/server communications from configuration object */ + * setup of client/server communications from configuration object. + * Deprecated: use cdiPioConfGetCallBackActions with + * trigger == CDIPIO_CALLBACK_POSTCOMMSETUP in new programs. */ void (*cdiPioConfGetPostCommSetupActions(int confResH))(void); +/* CDIPIO_CALLBACK_POSTCOMMSETUP: trigger number of the hook called + * after communication has been established. This is the same hook + * previously setup with cdiPioConfSetPostCommSetupActions, takes no + * argument */ +#define CDIPIO_CALLBACK_POSTCOMMSETUP 0 +/* CDIPIO_CALLBACK_POSTSTREAMCLOSE: trigger number for callback + * invoked after each streamClose on the collector side. + * Accepts the streamID as int parameter, i.e. use INTEGER, VALUE and + * BIND(C) on Fortran side + */ +#define CDIPIO_CALLBACK_POSTSTREAMCLOSE 1 +/* CDIPIO_CALLBACK_POSTWRITEBATCH: trigger number for callback called + * on server side after the processing for all operations initiated by + * a client-side pioWriteTimestep have completed */ +#define CDIPIO_CALLBACK_POSTWRITEBATCH 2 + +/* cdiPioConfSetCallBack: set function to be called at + * indicated trigger of configuration object, action will be cast to + * the appropriate type as indicated for the respective trigger */ +void cdiPioConfSetCallBackActions(int confResH, int trigger, void (*action)(void)); + +/* cdiPioConfGetCallBack: query function to be called at + * indicated trigger of configuration object */ +void (*cdiPioConfGetCallBackActions(int confResH, int trigger))(void); + /* cdiPioConfSetLargePageAlign should block buffer be aligned to * large pages instead of normal pages? */ void cdiPioConfSetLargePageAlign(int confResH, int largePageAlign); @@ -112,6 +197,51 @@ void cdiPioConfSetLargePageAlign(int confResH, int largePageAlign); * large pages instead of normal pages? */ int cdiPioConfGetLargePageAlign(int confResH); +/* cdiPioConfSetRecordAggBufLim: Set limit to pre-encoding step + * aggregation of data in Mebibyte. Increasing this value trades fewer + * communication operations between I/O servers for higher packet + * sizes by transposing more data at once but increases total memory + * consumed by I/O server processes. Default size is 128MiB. */ +void cdiPioConfSetRecordAggBufLim(int confResH, int lim_mb); + +/* cdiPioConfGetRecordAggBufLim: Query size of pre-encoding + * aggregation buffer in MiB */ +int cdiPioConfGetRecordAggBufLim(int confResH); + +/* cdiPioConfSetWriteAggBufLim: Set limit for write buffer aggregation + * (default: 16MiB or value of BUFSIZE environment variable (whichever + * is larger)). Before writing encoded data records to disk, data + * up to this size is concatenated. For this reason this must be at + * least equal in size to the largest GRIB record written. Increasing + * this size increases memory consumed by I/O server ranks + * proportionally and can reduce the number of write operations. This + * value is rounded to the next (large) page size in many implementations. */ +void cdiPioConfSetWriteAggBufLim(int confResH, int lim_mb); + +/* cdiPioConfGetWriteAggBufLim: Query the size of write + * aggregation buffers. */ +int cdiPioConfGetWriteAggBufLim(int confResH); + +/* cdiPioConfSetAioQueueDepth: Set number of concurrent async I/O + * requests to create. Depending on implementation, this might + * increase throughput by increasing the number of concurrent + * operations but also increases buffer size requirements. + * (Default value: 4) */ +void cdiPioConfSetAioQueueDepth(int confResH, int queue_depth); + +/* cdiPioConfGetAioQueueDepth: Query depth of AIO queue. */ +int cdiPioConfGetAioQueueDepth(int confResH); + +/* cdiPioConfSetMaxPathLen: Set maximal path length allowed in RPC + * operations. This defaults to 2*PATH_MAX and therefore should be + * safe in almost any environment. In case of deeply nested directory + * structures it might be necessary to adjust this value. */ +void cdiPioConfSetMaxPathLen(int confResH, int max_path_len); + +/* cdiPioConfGetMaxPathLen: Query maximal path length supported in + * streamOpen operations by some paths of parallel I/O. */ +int cdiPioConfGetMaxPathLen(int confResH); + /* cdiPioConfSetRedistCache: set doCache to anything non-zero if data * for internal data exchanges is to be cached. This makes sense when * the data passed via streamWriteVarPart or streamWriteScatteredVarPart @@ -125,18 +255,89 @@ void cdiPioConfSetRedistCache(int confResH, int doCache); * be cached? */ int cdiPioConfGetRedistCache(int confResH); +/* cdiPioConfSetXmapCache: set doCache to any non-zero value if data + * for internal data exchange maps is to be cached. This is helpful + * when the different variables of a file are decomposed identically + * and is active by default. Set doCache to 0 if decompositions are + * dynamic in both variables and time */ +void cdiPioConfSetXmapCache(int confResH, int doCache); + +/* cdiPioConfGetXmapCache: query xmap caching status */ +int cdiPioConfGetXmapCache(int confResH); + /* cdiPioConfSetXmapNew: set method to compute part intersections, * defaults to xt_xmap_dist_dir_new */ void cdiPioConfSetXmapNew(int confResH, Xt_xmap (*xmap_new)(Xt_idxlist src_idxlist, Xt_idxlist dst_idxlist, MPI_Comm comm)); /* cdiPioConfSetXmapNew: get method to compute part intersections */ Xt_xmap (*cdiPioConfGetXmapNew(int confResH))(Xt_idxlist src_idxlist, Xt_idxlist dst_idxlist, MPI_Comm comm); -/* convert index lists to stripes prior to intersection computation, - * defaults to true */ +/* cdiPioConfSetStripeConversion: Convert index lists to stripes prior + * to intersection computation, defaults to true. Only if parts are + * strictly sections, it can be beneficial to set this to 0, i.e. false */ void cdiPioConfSetStripeConversion(int confResH, int doStripify); -/* are index lists of parts converted stripes before being passed - * to the xmap constructor? */ +/* cdiPioConfGetStripeConversion: Are index lists of parts converted + * into stripes before being passed to the xmap constructor? */ int cdiPioConfGetStripeConversion(int confResH); +/* cdiPioConfSetBatchedRMA: (de-)activate batched transfer of data + * for all streams before any data is written to disk, i.e. if + * doBatchedRMA is set to 0, data is written as soon as it can be + * retrieved from client ranks, any other value results in all RMA + * transfers occurring immediately. doBatchedRMA == 0 implies less + * memory used on server ranks at the cost of distributing + * disturbances over a longer time */ +void cdiPioConfSetBatchedRMA(int confResH, int doBatchedRMA); + +/* cdiPioConfGetBatchedRMA: query if batched RMA is active, see + * cdiPioConfSetBatchedRMA */ +int cdiPioConfGetBatchedRMA(int confResH); + +/* cdiPioDistGridCreate: create a grid data structure where the + * per-coordinate data is distributed over the client tasks + * chunk_decomposition specifies how to distribute the data of each of + * the following arrays: + * x-values, y-values, x-bounds, y-bounds, area, mask and gme mask + * + * for 2D grids (all but gridtype == GRID_UNSTRUCTURED), four values specifiy the start and size of each dimension + * where e.g. chunk_decomposition[1][0] would + * specify the part size of the y-dimension and chunk_decomposition[0][0] the x dimension start + * index. For unstructured grids only the x-dimension applies. + */ +int cdiPioDistGridCreate(int gridtype, int size, int xsize, int ysize, int nvertex, const int xy_decomposition_optional[][2], + Xt_idxlist partDesc2D, Xt_idxlist partDescX, Xt_idxlist partDescY); + +/* cdiPioDistGridEnableIndividualQueries: for the provided gridID, the + * queries + * gridInqXval, gridInqYval, gridInqXinc, and gridInqYinc + * + * must not be called for a distributed grid before that has been + * enabled with this routine, also + * + * gridInqXvals, gridInqYvals, gridInqXbounds, gridInqYbounds, + * gridInqArea, gridInqMaskGME and gridInqMask + * + * can only be called collectively before this routine was + * called */ +void cdiPioDistGridEnableIndividualQueries(int gridID); + +/* cdiPioDistGridDisableIndividualQueries: inverse of + * cdiPioDistGridEnableIndividualQueries, i.e. after calling this + * routine, inidividual grid queries must not be made for gridID */ +void cdiPioDistGridDisableIndividualQueries(int gridID); + +/* cdiPioDistGridIndividualQueriesEnabled: determine if the inquiries + * listed for cdiPioDistGridEnableIndividualQueries can be issued for + * gridID */ +bool cdiPioDistGridIndividualQueriesEnabled(int gridID); + +/* cdiPioInqInterComm: query the intercommunicator of active CDI-PIO + * namespace */ +MPI_Comm cdiPioInqInterComm(void); + +// End of fortran interface +//FINT_OFF <--- don't change or remove this line!!! + +// clang-format on + #endif diff --git a/src/cdipio.inc b/src/cdipio.inc deleted file mode 100644 index 15ec51f3575dd97695f8d874981a8990bd7dfa77..0000000000000000000000000000000000000000 --- a/src/cdipio.inc +++ /dev/null @@ -1,197 +0,0 @@ -! This file was automatically generated, don't edit! -! -! Fortran interface for CDI library version 1.9.4rc1 -! -! Author: -! ------- -! Uwe Schulzweida, MPI-MET, Hamburg, February 2018 -! - -! -! parallel IO IOMode -! - INTEGER PIO_NONE - PARAMETER (PIO_NONE = 0) - INTEGER PIO_MPI - PARAMETER (PIO_MPI = 1) - INTEGER PIO_WRITER - PARAMETER (PIO_WRITER = 2) - INTEGER PIO_ASYNCH - PARAMETER (PIO_ASYNCH = 3) - INTEGER PIO_FPGUARD - PARAMETER (PIO_FPGUARD = 4) - INTEGER PIO_MPI_FW_ORDERED - PARAMETER (PIO_MPI_FW_ORDERED = 5) - INTEGER PIO_MPI_FW_AT_ALL - PARAMETER (PIO_MPI_FW_AT_ALL = 6) - INTEGER PIO_MPI_FW_AT_REBLOCK - PARAMETER (PIO_MPI_FW_AT_REBLOCK = 7) - INTEGER PIO_MINIOMODE - PARAMETER (PIO_MINIOMODE = PIO_NONE) - INTEGER PIO_MAXIOMODE - PARAMETER (PIO_MAXIOMODE = PIO_MPI_FW_AT_REBLOCK) - INTEGER PIO_ROLE_CLIENT - PARAMETER (PIO_ROLE_CLIENT = 0) - INTEGER PIO_ROLE_COLLECTOR - PARAMETER (PIO_ROLE_COLLECTOR = 1) - INTEGER PIO_ROLE_WRITER - PARAMETER (PIO_ROLE_WRITER = 2) - INTEGER PIO_ROLE_WRITER_COLLECTOR - PARAMETER (PIO_ROLE_WRITER_COLLECTOR = 3) - INTEGER PIO_ROLE_FPGUARD - PARAMETER (PIO_ROLE_FPGUARD = 4) -! -! parallel IO routines -! -! pioEndDef - EXTERNAL pioEndDef - -! pioEndTimestepping - EXTERNAL pioEndTimestepping - -! pioFinalize - EXTERNAL pioFinalize - -! cdiPioNoPostCommSetup - EXTERNAL cdiPioNoPostCommSetup - - INTEGER pioInit -! (INTEGER commSuper, -! INTEGER nProcsIO, -! INTEGER IOMode, -! INTEGER pioNamespace, -! REAL partInflate, -! PROCEDURE postCommSetupActions) - EXTERNAL pioInit - - INTEGER cdiPioInit -! (INTEGER commSuper, -! INTEGER confResH, -! INTEGER pioNamespace) - EXTERNAL cdiPioInit - -! pioWriteTimestep - EXTERNAL pioWriteTimestep - -! cdiPioRDMAProgress - EXTERNAL cdiPioRDMAProgress - -! streamWriteVarPart -! (INTEGER streamID, -! INTEGER varID, -! CHOICE data, -! INTEGER nmiss, -! TYPE(XT_IDXLIST)partDesc) - EXTERNAL streamWriteVarPart - -! streamWriteScatteredVarPart -! (INTEGER streamID, -! INTEGER varID, -! CHOICE data, -! INTEGER numBlocks, -! INTEGER blocklengths(*), -! INTEGER displacements(*), -! INTEGER nmiss, -! TYPE(XT_IDXLIST)partDesc) - EXTERNAL streamWriteScatteredVarPart - - INTEGER cdiPioCSRLastN -! (INTEGER commSuper, -! INTEGER IOMode, -! INTEGER nProcsIO) - EXTERNAL cdiPioCSRLastN - - INTEGER cdiPioCSRFirstN -! (INTEGER commSuper, -! INTEGER IOMode, -! INTEGER nProcsIO) - EXTERNAL cdiPioCSRFirstN - - INTEGER cdiPioCSRBalanced -! (INTEGER commSuper, -! INTEGER IOMode, -! INTEGER nProcsIO) - EXTERNAL cdiPioCSRBalanced - - INTEGER cdiPioStr2IOMode -! (CHARACTER*(*) modeStr) - EXTERNAL cdiPioStr2IOMode - - INTEGER cdiPioConfCreate - EXTERNAL cdiPioConfCreate - -! cdiPioConfDestroy -! (INTEGER confResH) - EXTERNAL cdiPioConfDestroy - -! cdiPioConfSetPartInflate -! (INTEGER confResH, -! REAL partInflate) - EXTERNAL cdiPioConfSetPartInflate - - REAL cdiPioConfGetPartInflate -! (INTEGER confResH) - EXTERNAL cdiPioConfGetPartInflate - -! cdiPioConfSetIOMode -! (INTEGER confResH, -! INTEGER IOMode) - EXTERNAL cdiPioConfSetIOMode - - INTEGER cdiPioConfGetIOMode -! (INTEGER confResH) - EXTERNAL cdiPioConfGetIOMode - -! cdiPioConfSetCSRole -! (INTEGER confResH, -! INTEGER CSRole) - EXTERNAL cdiPioConfSetCSRole - - INTEGER cdiPioConfGetCSRole -! (INTEGER confResH) - EXTERNAL cdiPioConfGetCSRole - -! cdiPioConfSetPostCommSetupActions -! (INTEGER confResH, -! PROCEDURE postCommSetupActions) - EXTERNAL cdiPioConfSetPostCommSetupActions - -! -! cdiPioConfSetLargePageAlign should block buffer be aligned to -! large pages instead of normal pages? -! -! cdiPioConfSetLargePageAlign -! (INTEGER confResH, -! INTEGER largePageAlign) - EXTERNAL cdiPioConfSetLargePageAlign - - INTEGER cdiPioConfGetLargePageAlign -! (INTEGER confResH) - EXTERNAL cdiPioConfGetLargePageAlign - -! cdiPioConfSetRedistCache -! (INTEGER confResH, -! INTEGER doCache) - EXTERNAL cdiPioConfSetRedistCache - - INTEGER cdiPioConfGetRedistCache -! (INTEGER confResH) - EXTERNAL cdiPioConfGetRedistCache - -! -! convert index lists to stripes prior to intersection computation, -! defaults to true -! -! cdiPioConfSetStripeConversion -! (INTEGER confResH, -! INTEGER doStripify) - EXTERNAL cdiPioConfSetStripeConversion - -! -! are index lists of parts converted stripes before being passed -! to the xmap constructor? -! - INTEGER cdiPioConfGetStripeConversion -! (INTEGER confResH) - EXTERNAL cdiPioConfGetStripeConversion - diff --git a/src/cdipioFortran.c b/src/cdipioFortran.c deleted file mode 100644 index 6521d21d5a6882af216be7fbe470bcac0fd84078..0000000000000000000000000000000000000000 --- a/src/cdipioFortran.c +++ /dev/null @@ -1,142 +0,0 @@ -/* Automatically generated by make_fint.c, don't edit! */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#if !defined(CDIPIO_H_) -#include "cdipio.h" -#endif - -#if defined(HAVE_CF_INTERFACE) - -#include <limits.h> -#include <assert.h> - -#if !defined(__CFORTRAN_LOADED) -#if defined __clang__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wreserved-id-macro" -#endif -#include "cfortran.h" -#if defined __clang__ -#pragma GCC diagnostic pop -#endif -#endif -/* These functions are meant to be called from Fortran and don't - * need an interface declaration in a C header. */ -#if defined __clang__ -#pragma GCC diagnostic ignored "-Wmissing-prototypes" -#endif - -static inline int -size_t_c2f(size_t value_size_t) -{ - assert(value_size_t < INT_MAX); - return (int) value_size_t; -} - -/* parallel IO IOMode */ - -/* parallel IO routines */ - -FCALLSCSUB0(pioEndDef, PIOENDDEF, pioenddef) -FCALLSCSUB0(pioEndTimestepping, PIOENDTIMESTEPPING, pioendtimestepping) -FCALLSCSUB0(pioFinalize, PIOFINALIZE, piofinalize) -FCALLSCSUB0(cdiPioNoPostCommSetup, CDIPIONOPOSTCOMMSETUP, cdipionopostcommsetup) - -#undef ROUTINE_6 -#define ROUTINE_6 (void (*)(void)) -static int -pioInit_fwrap(int commSuper, int nProcsIO, int IOMode, int *pioNamespace, float partInflate, void (*postCommSetupActions)(void)) -{ - MPI_Comm v; - v = pioInit(MPI_Comm_f2c(commSuper), nProcsIO, IOMode, pioNamespace, partInflate, postCommSetupActions); - return MPI_Comm_c2f(v); -} -FCALLSCFUN6(INT, pioInit_fwrap, PIOINIT, pioinit, INT, INT, INT, PINT, FLOAT, ROUTINE) -static int -cdiPioInit_fwrap(int commSuper, int confResH, int *pioNamespace) -{ - MPI_Comm v; - v = cdiPioInit(MPI_Comm_f2c(commSuper), confResH, pioNamespace); - return MPI_Comm_c2f(v); -} -FCALLSCFUN3(INT, cdiPioInit_fwrap, CDIPIOINIT, cdipioinit, INT, INT, PINT) -FCALLSCSUB0(pioWriteTimestep, PIOWRITETIMESTEP, piowritetimestep) -FCALLSCSUB0(cdiPioRDMAProgress, CDIPIORDMAPROGRESS, cdipiordmaprogress) -static void -streamWriteVarPart_fwrap(int streamID, int varID, const void *data, int nmiss, void *partDesc) -{ - streamWriteVarPart(streamID, varID, data, (size_t) nmiss, (*(Xt_idxlist *) partDesc)); -} -FCALLSCSUB5(streamWriteVarPart_fwrap, STREAMWRITEVARPART, streamwritevarpart, INT, INT, PVOID, INT, PVOID) -static void -streamWriteScatteredVarPart_fwrap(int streamID, int varID, const void *data, int numBlocks, const int blocklengths[], - const int displacements[], int nmiss, void *partDesc) -{ - streamWriteScatteredVarPart(streamID, varID, data, numBlocks, blocklengths, displacements, (size_t) nmiss, - (*(Xt_idxlist *) partDesc)); -} -FCALLSCSUB8(streamWriteScatteredVarPart_fwrap, STREAMWRITESCATTEREDVARPART, streamwritescatteredvarpart, INT, INT, PVOID, INT, INTV, - INTV, INT, PVOID) -static int -cdiPioCSRLastN_fwrap(int commSuper, int IOMode, int nProcsIO) -{ - int v; - v = cdiPioCSRLastN(MPI_Comm_f2c(commSuper), IOMode, nProcsIO); - return v; -} -FCALLSCFUN3(INT, cdiPioCSRLastN_fwrap, CDIPIOCSRLASTN, cdipiocsrlastn, INT, INT, INT) -static int -cdiPioCSRFirstN_fwrap(int commSuper, int IOMode, int nProcsIO) -{ - int v; - v = cdiPioCSRFirstN(MPI_Comm_f2c(commSuper), IOMode, nProcsIO); - return v; -} -FCALLSCFUN3(INT, cdiPioCSRFirstN_fwrap, CDIPIOCSRFIRSTN, cdipiocsrfirstn, INT, INT, INT) -static int -cdiPioCSRBalanced_fwrap(int commSuper, int IOMode, int nProcsIO) -{ - int v; - v = cdiPioCSRBalanced(MPI_Comm_f2c(commSuper), IOMode, nProcsIO); - return v; -} -FCALLSCFUN3(INT, cdiPioCSRBalanced_fwrap, CDIPIOCSRBALANCED, cdipiocsrbalanced, INT, INT, INT) -FCALLSCFUN1(INT, cdiPioStr2IOMode, CDIPIOSTR2IOMODE, cdipiostr2iomode, STRING) -FCALLSCFUN0(INT, cdiPioConfCreate, CDIPIOCONFCREATE, cdipioconfcreate) -FCALLSCSUB1(cdiPioConfDestroy, CDIPIOCONFDESTROY, cdipioconfdestroy, INT) -FCALLSCSUB2(cdiPioConfSetPartInflate, CDIPIOCONFSETPARTINFLATE, cdipioconfsetpartinflate, INT, FLOAT) -FCALLSCFUN1(FLOAT, cdiPioConfGetPartInflate, CDIPIOCONFGETPARTINFLATE, cdipioconfgetpartinflate, INT) -FCALLSCSUB2(cdiPioConfSetIOMode, CDIPIOCONFSETIOMODE, cdipioconfsetiomode, INT, INT) -FCALLSCFUN1(INT, cdiPioConfGetIOMode, CDIPIOCONFGETIOMODE, cdipioconfgetiomode, INT) -FCALLSCSUB2(cdiPioConfSetCSRole, CDIPIOCONFSETCSROLE, cdipioconfsetcsrole, INT, INT) -FCALLSCFUN1(INT, cdiPioConfGetCSRole, CDIPIOCONFGETCSROLE, cdipioconfgetcsrole, INT) - -#undef ROUTINE_2 -#define ROUTINE_2 (void (*)(void)) -FCALLSCSUB2(cdiPioConfSetPostCommSetupActions, CDIPIOCONFSETPOSTCOMMSETUPACTIONS, cdipioconfsetpostcommsetupactions, INT, ROUTINE) - -/* cdiPioConfSetLargePageAlign should block buffer be aligned to - * large pages instead of normal pages? */ - -FCALLSCSUB2(cdiPioConfSetLargePageAlign, CDIPIOCONFSETLARGEPAGEALIGN, cdipioconfsetlargepagealign, INT, INT) -FCALLSCFUN1(INT, cdiPioConfGetLargePageAlign, CDIPIOCONFGETLARGEPAGEALIGN, cdipioconfgetlargepagealign, INT) -FCALLSCSUB2(cdiPioConfSetRedistCache, CDIPIOCONFSETREDISTCACHE, cdipioconfsetredistcache, INT, INT) -FCALLSCFUN1(INT, cdiPioConfGetRedistCache, CDIPIOCONFGETREDISTCACHE, cdipioconfgetredistcache, INT) - -/* convert index lists to stripes prior to intersection computation, - * defaults to true */ - -FCALLSCSUB2(cdiPioConfSetStripeConversion, CDIPIOCONFSETSTRIPECONVERSION, cdipioconfsetstripeconversion, INT, INT) - -/* are index lists of parts converted stripes before being passed - * to the xmap constructor? */ - -FCALLSCFUN1(INT, cdiPioConfGetStripeConversion, CDIPIOCONFGETSTRIPECONVERSION, cdipioconfgetstripeconversion, INT) - -#if defined __clang__ -#pragma GCC diagnostic pop -#endif -#endif diff --git a/src/cgribexlib.c b/src/cgribexlib.c index cc48e1921d55a5d8ff5dc74cfe07c01d3ae6f43d..5c3631e594fdee987d19852f2e90b632ba59c3a8 100644 --- a/src/cgribexlib.c +++ b/src/cgribexlib.c @@ -1,7 +1,7 @@ -// Automatically generated by m214003 at 2022-04-22, do not edit +// Automatically generated by m214003 at 2023-02-08, do not edit -// CGRIBEXLIB_VERSION="2.0.2" +// CGRIBEXLIB_VERSION="2.1.0" // clang-format off @@ -100,7 +100,6 @@ static const uint32_t HOST_ENDIANNESS_temp[1] = { UINT32_C(0x00030201) }; #endif #endif -#define U_BYTEORDER #define IS_BIGENDIAN() (HOST_ENDIANNESS == 0) #if defined (__xlC__) /* performance problems on IBM */ @@ -1224,7 +1223,6 @@ static const uint32_t HOST_ENDIANNESS_temp[1] = { UINT32_C(0x00030201) }; #endif #endif -#define U_BYTEORDER #define IS_BIGENDIAN() (HOST_ENDIANNESS == 0) #define Error(x,y) #endif @@ -1672,8 +1670,8 @@ int main(void) #undef _ENABLE_AVX #undef _ENABLE_SSE4_1 - -void confp3(double pval, int *kexp, int *kmant, int kbits, int kround) +void +confp3(double pval, int *kexp, int *kmant, int kbits, int kround) { /* @@ -1725,7 +1723,7 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround) Author: ------- - + John Hennessy ECMWF 18.06.91 Modifications: @@ -1750,12 +1748,12 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround) // Check conversion type parameter. int iround = kround; - if ( iround != 0 && iround != 1 ) + if (iround != 0 && iround != 1) { Error("Invalid conversion type = %d", iround); // If not aborting, arbitrarily set rounding to 'up'. - iround = 1; + iround = 1; } /* ----------------------------------------------------------------- */ @@ -1764,7 +1762,7 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround) if (fabs(pval) <= 0) { - *kexp = 0; + *kexp = 0; *kmant = 0; goto LABEL900; } @@ -1781,77 +1779,77 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround) zref = fabs(zref); // Exponent. - int iexp = (int) (log(zref)/log(16.0) + 65.0 + zeps); + int iexp = (int) (log(zref) / log(16.0) + 65.0 + zeps); // only ANSI C99 has log2 // iexp = (int) (log2(zref) * 0.25 + 65.0 + zeps); - if ( iexp < 0 ) iexp = 0; - if ( iexp > 127 ) iexp = 127; + if (iexp < 0) iexp = 0; + if (iexp > 127) iexp = 127; // double rpowref = zref / pow(16.0, (double)(iexp - 70)); double rpowref = ldexp(zref, 4 * -(iexp - 70)); // Mantissa. - if ( iround == 0 ) - { - /* Closest number in GRIB format less than original number. */ - /* Truncate for positive numbers. */ - /* Round up for negative numbers. */ - *kmant = (isign == 0) ? (int)rpowref : (int)lround(rpowref + 0.5); - } + if (iround == 0) + { + /* Closest number in GRIB format less than original number. */ + /* Truncate for positive numbers. */ + /* Round up for negative numbers. */ + *kmant = (isign == 0) ? (int) rpowref : (int) lround(rpowref + 0.5); + } else - { - /* Closest number in GRIB format to the original number */ - /* (equal to, greater than or less than original number). */ - *kmant = (int)lround(rpowref); - } + { + /* Closest number in GRIB format to the original number */ + /* (equal to, greater than or less than original number). */ + *kmant = (int) lround(rpowref); + } /* Check that mantissa value does not exceed 24 bits. */ /* If it does, adjust the exponent upwards and recalculate the mantissa. */ /* 16777215 = 2**24 - 1 */ - if ( *kmant > 16777215 ) - { + if (*kmant > 16777215) + { - LABEL350: + LABEL350: - ++iexp; + ++iexp; - // Check for exponent overflow during adjustment - if ( iexp > 127 ) - { - Message("Exponent overflow"); - Message("Original number = %30.20f", pval); - Message("Sign = %3d, Exponent = %3d, Mantissa = %12d", isign, iexp, *kmant); + // Check for exponent overflow during adjustment + if (iexp > 127) + { + Message("Exponent overflow"); + Message("Original number = %30.20f", pval); + Message("Sign = %3d, Exponent = %3d, Mantissa = %12d", isign, iexp, *kmant); - Error("Exponent overflow"); + Error("Exponent overflow"); - // If not aborting, arbitrarily set value to zero - Message("Value arbitrarily set to zero."); - *kexp = 0; - *kmant = 0; - goto LABEL900; - } + // If not aborting, arbitrarily set value to zero + Message("Value arbitrarily set to zero."); + *kexp = 0; + *kmant = 0; + goto LABEL900; + } - rpowref = ldexp(zref, 4 * -(iexp - 70)); + rpowref = ldexp(zref, 4 * -(iexp - 70)); - if ( iround == 0 ) - { - /* Closest number in GRIB format less than original number. */ - /* Truncate for positive numbers. */ - /* Round up for negative numbers. */ - *kmant = (isign == 0) ? (int)rpowref : (int)lround(rpowref + 0.5); - } - else - { - /* Closest number in GRIB format to the original number */ - /* (equal to, greater or less than original number). */ - *kmant = (int)lround(rpowref); - } + if (iround == 0) + { + /* Closest number in GRIB format less than original number. */ + /* Truncate for positive numbers. */ + /* Round up for negative numbers. */ + *kmant = (isign == 0) ? (int) rpowref : (int) lround(rpowref + 0.5); + } + else + { + /* Closest number in GRIB format to the original number */ + /* (equal to, greater or less than original number). */ + *kmant = (int) lround(rpowref); + } - // Repeat calculation (with modified exponent) if still have mantissa overflow. - if ( *kmant > 16777215 ) goto LABEL350; - } + // Repeat calculation (with modified exponent) if still have mantissa overflow. + if (*kmant > 16777215) goto LABEL350; + } // Add sign bit to exponent. *kexp = iexp + isign; @@ -2215,56 +2213,54 @@ gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2, int *isec3, } } -int CGRIBEX_Fix_ZSE = 0; /* 1: Fix ZeroShiftError of simple packed spherical harmonics */ -int CGRIBEX_Const = 0; /* 1: Don't pack constant fields on regular grids */ -int CGRIBEX_Debug = 0; /* 1: Debugging */ +int CGRIBEX_Fix_ZSE = 0; /* 1: Fix ZeroShiftError of simple packed spherical harmonics */ +int CGRIBEX_Const = 0; /* 1: Don't pack constant fields on regular grids */ +int CGRIBEX_Debug = 0; /* 1: Debugging */ -void gribSetDebug(int debug) +void +gribSetDebug(int debug) { CGRIBEX_Debug = debug; - if ( CGRIBEX_Debug ) - Message("debug level %d", debug); + if (CGRIBEX_Debug) Message("debug level %d", debug); } - -void gribFixZSE(int flag) +void +gribFixZSE(int flag) { CGRIBEX_Fix_ZSE = flag; - if ( CGRIBEX_Debug ) - Message("Fix ZeroShiftError set to %d", flag); + if (CGRIBEX_Debug) Message("Fix ZeroShiftError set to %d", flag); } - -void gribSetConst(int flag) +void +gribSetConst(int flag) { CGRIBEX_Const = flag; - if ( CGRIBEX_Debug ) - Message("Const set to %d", flag); + if (CGRIBEX_Debug) Message("Const set to %d", flag); } - -void gribSetRound(int round) +void +gribSetRound(int round) { UNUSED(round); } - -void gribSetRefDP(double refval) +void +gribSetRefDP(double refval) { UNUSED(refval); } - -void gribSetRefSP(float refval) +void +gribSetRefSP(float refval) { gribSetRefDP((double) refval); } - -void gribSetValueCheck(int vcheck) +void +gribSetValueCheck(int vcheck) { UNUSED(vcheck); } @@ -4194,7 +4190,6 @@ long packInt64(unsigned INT64 *up, unsigned char *cp, long bc, long tc) #if defined (CRAY) (void) _pack(up, cp, bc, tc); #else - U_BYTEORDER; unsigned char *cp0; unsigned INT64 upi, *up0, *ip0, *ip1, *ip2, *ip3, *ip4, *ip5, *ip6, *ip7; long ipack = sizeof(INT64); @@ -4299,7 +4294,6 @@ long packInt64(unsigned INT64 *up, unsigned char *cp, long bc, long tc) long unpackInt64(const unsigned char *cp, unsigned INT64 *up, long bc, long tc) { - U_BYTEORDER; const unsigned char *cp0; unsigned INT64 *ip0, *ip1, *ip2, *ip3, *ip4, *ip5, *ip6, *ip7; long offset; @@ -4405,7 +4399,6 @@ long unpackInt64(const unsigned char *cp, unsigned INT64 *up, long bc, long tc) #ifdef INT32 long packInt32(unsigned INT32 *up, unsigned char *cp, long bc, long tc) { - U_BYTEORDER; unsigned char *cp0; unsigned INT32 *up0, *ip0, *ip1, *ip2, *ip3; long ipack = sizeof(INT32); @@ -4500,7 +4493,6 @@ long packInt32(unsigned INT32 *up, unsigned char *cp, long bc, long tc) #ifdef INT32 long unpackInt32(const unsigned char *cp, unsigned INT32 *up, long bc, long tc) { - U_BYTEORDER; const unsigned char *cp0; unsigned INT32 *ip0, *ip1, *ip2, *ip3; long offset; @@ -4661,8 +4653,8 @@ void prtbin(int kin, int knbit, int *kout, int *kerr) return; } - -void ref2ibm(double *pref, int kbits) +void +ref2ibm(double *pref, int kbits) { /* @@ -4685,7 +4677,7 @@ void ref2ibm(double *pref, int kbits) Method: ------- - Codes in IBM format, then decides to ensure that reference + Codes in IBM format, then decides to ensure that reference value used for packing is not different from that stored because of packing differences. @@ -4734,7 +4726,7 @@ void ref2ibm(double *pref, int kbits) zdumm = ztemp = *pref; confp3(zdumm, &kexp, &kmant, kbits, itrnd); - if ( kexp == 0 && kmant == 0 ) return; + if (kexp == 0 && kmant == 0) return; /* Set reference value to that actually stored in the GRIB code. */ @@ -4745,7 +4737,7 @@ void ref2ibm(double *pref, int kbits) /* find the nearest number in GRIB format lower */ /* than the reference value. */ - if ( ztemp < *pref ) + if (ztemp < *pref) { /* Convert floating point to GRIB representation */ /* using truncation to ensure that the converted */ @@ -4759,17 +4751,17 @@ void ref2ibm(double *pref, int kbits) *pref = decfp2(kexp, kmant); - if ( ztemp < *pref ) - { - if ( CGRIBEX_Debug ) - { - Message("Reference value error."); - Message("Notify Met.Applications Section."); - Message("ZTEMP = ", ztemp); - Message("PREF = ", pref); - } - *pref = ztemp; - } + if (ztemp < *pref) + { + if (CGRIBEX_Debug) + { + Message("Reference value error."); + Message("Notify Met.Applications Section."); + Message("ZTEMP = ", ztemp); + Message("PREF = ", pref); + } + *pref = ztemp; + } } return; @@ -8377,7 +8369,6 @@ static void TEMPLATE(decode_array_2byte,T)(size_t jlend, const unsigned char *restrict igrib, T *fpdata, T fmin, T zscale) { - U_BYTEORDER; const uint16_t *restrict sgrib = (const uint16_t *)(const void *)(igrib); if ( IS_BIGENDIAN() ) @@ -8607,7 +8598,6 @@ static void TEMPLATE(decode_array_2byte,T)(size_t jlend, const unsigned char *restrict igrib, T *fpdata, T fmin, T zscale) { - U_BYTEORDER; const uint16_t *restrict sgrib = (const uint16_t *)(const void *)(igrib); if ( IS_BIGENDIAN() ) @@ -10736,7 +10726,6 @@ static void TEMPLATE(encode_array_2byte,T)(size_t datasize, GRIBPACK *restrict lGrib, const T *restrict data, T zref, T factor, size_t *gz) { - U_BYTEORDER; uint16_t *restrict sgrib = (uint16_t *)(void *)(lGrib+*gz); if (IS_BIGENDIAN()) @@ -10827,7 +10816,6 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat const T *restrict data, T zref, T factor, size_t *gz) { - U_BYTEORDER; size_t z = *gz; #ifdef _ARCH_PWR6 enum { CGRIBEX__UNROLL_DEPTH_2 = 8 }; @@ -11158,7 +11146,6 @@ static void TEMPLATE(encode_array_2byte,T)(size_t datasize, GRIBPACK *restrict lGrib, const T *restrict data, T zref, T factor, size_t *gz) { - U_BYTEORDER; uint16_t *restrict sgrib = (uint16_t *)(void *)(lGrib+*gz); if (IS_BIGENDIAN()) @@ -11249,7 +11236,6 @@ void TEMPLATE(encode_array_unrolled,T)(int numBits, size_t packStart, size_t dat const T *restrict data, T zref, T factor, size_t *gz) { - U_BYTEORDER; size_t z = *gz; #ifdef _ARCH_PWR6 enum { CGRIBEX__UNROLL_DEPTH_2 = 8 }; @@ -12667,7 +12653,7 @@ void encode_dummy(void) (void) encode_array_unrolled_double(0, 0, 0, NULL, NULL, 0, 0, NULL); (void) encode_array_unrolled_float(0, 0, 0, NULL, NULL, 0, 0, NULL); } -static const char grb_libvers[] = "2.0.2"; +static const char grb_libvers[] = "2.1.0"; const char * cgribexLibraryVersion(void) { diff --git a/src/datetime.h b/src/datetime.h deleted file mode 100644 index 13eb51ee9b9f66ebffa32d624b44406875a0c63f..0000000000000000000000000000000000000000 --- a/src/datetime.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef DATETIME_H -#define DATETIME_H - -typedef struct -{ - int date; - int time; -} CmpDateTime; - -static inline int -datetime_differ(CmpDateTime dt1, CmpDateTime dt2) -{ - return ((2 * ((dt1.date > dt2.date) - (dt1.date < dt2.date)) + (dt1.time > dt2.time) - (dt1.time < dt2.time)) != 0); -} - -#endif -/* - * Local Variables: - * c-file-style: "Java" - * c-basic-offset: 2 - * indent-tabs-mode: nil - * show-trailing-whitespace: t - * require-trailing-newline: t - * End: - */ diff --git a/src/error.c b/src/error.c index 42fa122ac8dca62d680ae7e0b08389e123677bb6..07cb3b1a84c5db2ccf173ede1247f4924166a779 100644 --- a/src/error.c +++ b/src/error.c @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdio.h> #include <stdlib.h> #include <stdarg.h> @@ -8,9 +12,9 @@ #endif #include "error.h" -int _ExitOnError = 1; /* If set to 1, exit on error */ -int _Verbose = 1; /* If set to 1, errors are reported */ -int _Debug = 0; /* If set to 1, debugging */ +int _ExitOnError = 1; // If set to 1, exit on error +int _Verbose = 1; // If set to 1, errors are reported +int _Debug = 0; // If set to 1, debugging /* If we're not using GNU C, elide __attribute__ */ #if !defined __GNUC__ && !defined __attribute__ @@ -28,7 +32,7 @@ SysError_(const char *caller, const char *fmt, ...) va_start(args, fmt); printf("\n"); - fprintf(stderr, "Error (%s): ", caller); + fprintf(stderr, "%s error (%s): ", PACKAGE_NAME, caller); vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); @@ -51,7 +55,7 @@ Error_(const char *caller, const char *fmt, ...) va_start(args, fmt); printf("\n"); - fprintf(stderr, "Error (%s): ", caller); + fprintf(stderr, "%s error (%s): ", PACKAGE_NAME, caller); vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); @@ -80,8 +84,8 @@ cdiAbortC(const char *caller, const char *filename, const char *functionname, in void cdiAbortC_serial(const char *caller, const char *filename, const char *functionname, int line, const char *errorString, va_list ap) { - fprintf(stderr, "ERROR, %s, %s, line %d%s%s\nerrorString: \"", functionname, filename, line, caller ? ", called from " : "", - caller ? caller : ""); + fprintf(stderr, "%s error, %s, %s, line %d%s%s\nerrorString: \"", PACKAGE_NAME, functionname, filename, line, + caller ? ", called from " : "", caller ? caller : ""); vfprintf(stderr, errorString, ap); fputs("\"\n", stderr); exit(EXIT_FAILURE); @@ -108,7 +112,7 @@ Warning_(const char *caller, const char *fmt, ...) void cdiWarning(const char *caller, const char *fmt, va_list ap) { - fprintf(stderr, "Warning (%s): ", caller); + fprintf(stderr, "%s warning (%s): ", PACKAGE_NAME, caller); vfprintf(stderr, fmt, ap); fputc('\n', stderr); } @@ -120,7 +124,7 @@ Message_(const char *caller, const char *fmt, ...) va_start(args, fmt); - fprintf(stdout, "%-18s: ", caller); + fprintf(stdout, "%s %-18s: ", PACKAGE_NAME, caller); vfprintf(stdout, fmt, args); fprintf(stdout, "\n"); @@ -130,8 +134,8 @@ Message_(const char *caller, const char *fmt, ...) bool cdiObsoleteInfo(const char *oldFunction, const char *newFunction) { - fprintf(stdout, "CDI info: Function %s() is deprecated and might be removed in the future versions of CDI.\n", oldFunction); - fprintf(stdout, "CDI info: Consider switching to the new function %s() as soon as possible.\n", newFunction); + fprintf(stdout, "cdi info: Function %s() is deprecated and might be removed in the future versions of CDI.\n", oldFunction); + fprintf(stdout, "cdi info: Consider switching to the new function %s() as soon as possible.\n", newFunction); return false; } diff --git a/src/error.h b/src/error.h index 53c1ed8e4d2524139a9b5b0545554bf52acc4246..73202ae954aa4e66b14b929dfba10223866e478c 100644 --- a/src/error.h +++ b/src/error.h @@ -1,5 +1,5 @@ -#ifndef ERROR_H -#define ERROR_H +#ifndef _ERROR_H_ +#define _ERROR_H_ // clang-format off @@ -15,9 +15,9 @@ extern "C" { #endif -extern int _ExitOnError; /* If set to 1, exit on error (default 1) */ -extern int _Verbose; /* If set to 1, errors are reported (default 1) */ -extern int _Debug; /* If set to 1, debuggig (default 0) */ +extern int _ExitOnError; // If set to 1, exit on error (default 1) +extern int _Verbose; // If set to 1, errors are reported (default 1) +extern int _Debug; // If set to 1, debuggig (default 0) void SysError_(const char *caller, const char *fmt, ...); void Error_(const char *caller, const char *fmt, ...); @@ -26,7 +26,7 @@ void Warning_(const char *caller, const char *fmt, ...); void cdiWarning(const char *caller, const char *fmt, va_list ap); void Message_(const char *caller, const char *fmt, ...); -#if defined WITH_CALLER_NAME +#ifdef WITH_CALLER_NAME # define SysError(...) SysError_(__func__, __VA_ARGS__) # define Errorc(...) Error_( caller, __VA_ARGS__) # define Error(...) Error_(__func__, __VA_ARGS__) @@ -78,13 +78,4 @@ bool cdiObsoleteInfo(const char *oldFunction, const char *newFunction); // clang-format on -#endif /* ERROR_H */ -/* - * Local Variables: - * c-file-style: "Java" - * c-basic-offset: 2 - * indent-tabs-mode: nil - * show-trailing-whitespace: t - * require-trailing-newline: t - * End: - */ +#endif /* _ERROR_H_ */ diff --git a/src/extralib.c b/src/extralib.c index f7b5726c25dbfa00d154f75a6cb1a8eae9f4c12b..3ab39cdd4fe76a7abbc882e4ac3b48f908575875 100644 --- a/src/extralib.c +++ b/src/extralib.c @@ -28,7 +28,7 @@ static int extDefaultNumber = EXT_REAL; // A version string. #undef LIBVERSION -#define LIBVERSION 1.4.2 +#define LIBVERSION 1.5.0 #define XSTRING(x) #x #define STRING(x) XSTRING(x) static const char ext_libvers[] = STRING(LIBVERSION); @@ -67,7 +67,7 @@ extLibInit() { case '4': extDefaultPrec = EXSE_SINGLE_PRECISION; break; case '8': extDefaultPrec = EXSE_DOUBLE_PRECISION; break; - default: Message("Invalid digit in %s: %s", envName, envString); + default: Warning("Invalid digit in %s: %s", envName, envString); } break; } @@ -78,13 +78,13 @@ extLibInit() { case '4': extDefaultPrec = EXSE_SINGLE_PRECISION; break; case '8': extDefaultPrec = EXSE_DOUBLE_PRECISION; break; - default: Message("Invalid digit in %s: %s", envName, envString); + default: Warning("Invalid digit in %s: %s", envName, envString); } break; } default: { - Message("Invalid character in %s: %s", envName, envString); + Warning("Invalid character in %s: %s", envName, envString); break; } } @@ -140,41 +140,41 @@ extCheckFiletype(int fileID, int *swap) if (fileRead(fileID, buffer, 4) != 4) return 0; - const size_t blocklen = (size_t) get_UINT32(buffer); - const size_t sblocklen = (size_t) get_SUINT32(buffer); + size_t blocklen = (size_t) get_UINT32(buffer); + size_t sblocklen = (size_t) get_SUINT32(buffer); if (EXT_Debug) Message("blocklen = %d sblocklen = %d", blocklen, sblocklen); // clang-format off - if ( blocklen == 16 ) + if (blocklen == 16) { *swap = 0; fact = blocklen/4; - if ( fileRead(fileID, buffer, blocklen+8) != blocklen+8 ) return 0; + if (fileRead(fileID, buffer, blocklen+8) != blocklen+8) return 0; pbuf = buffer+3*fact; dimxy = (size_t) get_UINT32(pbuf); pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf); } - else if ( blocklen == 32 ) + else if (blocklen == 32) { *swap = 0; fact = blocklen/4; - if ( fileRead(fileID, buffer, blocklen+8) != blocklen+8 ) return 0; + if (fileRead(fileID, buffer, blocklen+8) != blocklen+8) return 0; pbuf = buffer+3*fact; dimxy = (size_t) get_UINT64(pbuf); pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf); } - else if ( sblocklen == 16 ) + else if (sblocklen == 16) { *swap = 1; fact = sblocklen/4; - if ( fileRead(fileID, buffer, sblocklen+8) != sblocklen+8 ) return 0; + if (fileRead(fileID, buffer, sblocklen+8) != sblocklen+8) return 0; pbuf = buffer+3*fact; dimxy = (size_t) get_SUINT32(pbuf); pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf); } - else if ( sblocklen == 32 ) + else if (sblocklen == 32) { *swap = 1; fact = sblocklen/4; - if ( fileRead(fileID, buffer, sblocklen+8) != sblocklen+8 ) return 0; + if (fileRead(fileID, buffer, sblocklen+8) != sblocklen+8) return 0; pbuf = buffer+3*fact; dimxy = (size_t) get_SUINT64(pbuf); pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf); } @@ -182,13 +182,10 @@ extCheckFiletype(int fileID, int *swap) fileRewind(fileID); - if (EXT_Debug) - { - Message("swap = %d fact = %d", *swap, fact); - Message("dimxy = %lu data = %lu", dimxy, data); - } + if (EXT_Debug) Message("swap = %d fact = %d", *swap, fact); + if (EXT_Debug) Message("dimxy = %lu data = %lu", dimxy, data); - const int found = data && (dimxy * fact == data || dimxy * fact * 2 == data); + int found = data && (dimxy * fact == data || dimxy * fact * 2 == data); return found; } @@ -223,10 +220,10 @@ static int extInqData(extrec_t *extp, int prec, void *data) { int ierr = 0; - const int byteswap = extp->byteswap; - const size_t datasize = extp->datasize; + int byteswap = extp->byteswap; + size_t datasize = extp->datasize; void *buffer = extp->buffer; - const int rprec = extp->prec; + int rprec = extp->prec; switch (rprec) { @@ -289,14 +286,14 @@ extDefData(void *ext, int prec, const void *data) { extrec_t *extp = (extrec_t *) ext; - const int rprec = extDefaultPrec ? extDefaultPrec : extp->prec; + int rprec = extDefaultPrec ? extDefaultPrec : extp->prec; extp->prec = rprec ? rprec : prec; int *header = extp->header; size_t datasize = (size_t) header[3]; if (extp->number == EXT_COMP) datasize *= 2; - const size_t blocklen = datasize * (size_t) rprec; + size_t blocklen = datasize * (size_t) rprec; extp->datasize = datasize; @@ -360,7 +357,7 @@ extRead(int fileID, void *ext) extp->checked = 1; } - const int byteswap = extp->byteswap; + int byteswap = extp->byteswap; // read header record size_t blocklen = binReadF77Block(fileID, byteswap); @@ -369,7 +366,7 @@ extRead(int fileID, void *ext) if (EXT_Debug) Message("blocklen = %lu", blocklen); - const size_t hprec = blocklen / EXT_HEADER_LEN; + size_t hprec = blocklen / EXT_HEADER_LEN; extp->prec = (int) hprec; @@ -452,8 +449,8 @@ extWrite(int fileID, void *ext) { extrec_t *extp = (extrec_t *) ext; union EXT_HEADER tempheader; - const int byteswap = extp->byteswap; - const int rprec = extp->prec; + int byteswap = extp->byteswap; + int rprec = extp->prec; int number = extp->number; int *header = extp->header; diff --git a/src/file.c b/src/file.c index 3225040adc9224b2c350e440ca324976c195d6cb..70dca1d82c886c165cdf3271d3171f091a196e08 100644 --- a/src/file.c +++ b/src/file.c @@ -284,7 +284,7 @@ file_new_entry(void) static void file_delete_entry(bfile_t *fileptr) { - const int idx = fileptr->self; + int idx = fileptr->self; FILE_LOCK(); @@ -380,8 +380,17 @@ fileSetBufferType(int fileID, int type) int fileFlush(int fileID) { + int retval = 0; bfile_t *fileptr = file_to_pointer(fileID); - return fileptr ? fflush(fileptr->fp) : 0; + if (fileptr) + { + FILE *fp = fileptr->fp; + retval = fflush(fp); + if (retval == 0) retval = fsync(fileno(fp)); + if (retval != 0) retval = errno; + } + + return retval; } void @@ -437,7 +446,7 @@ fileGetPos(int fileID) static int file_set_buffer_pos(bfile_t *fileptr) { - const off_t position = fileptr->position; + off_t position = fileptr->position; if (position < fileptr->bufferStart || position > fileptr->bufferEnd) { if (fileptr->bufferType == FILE_BUFTYPE_STD) @@ -593,7 +602,7 @@ file_getenv(const char *envName) case 'g': fact = 1073741824; break; default: fact = 0; - Message("Invalid number string in %s: %s", envName, envString); + Warning("Invalid number string in %s: %s", envName, envString); Warning("%s must comprise only digits [0-9].", envName); } break; @@ -794,7 +803,7 @@ file_fill_buffer(bfile_t *fileptr) if (fileptr->bufferSize == 0) return EOF; - const int fd = fileptr->fd; + int fd = fileptr->fd; #ifdef HAVE_MMAP if (fileptr->bufferType == FILE_BUFTYPE_MMAP) @@ -813,7 +822,7 @@ file_fill_buffer(bfile_t *fileptr) if (fileptr->buffer) { - const int ret = munmap(fileptr->buffer, fileptr->mappedSize); + int ret = munmap(fileptr->buffer, fileptr->mappedSize); if (ret == -1) SysError("munmap error for read %s", fileptr->name); fileptr->buffer = NULL; } @@ -830,7 +839,7 @@ file_fill_buffer(bfile_t *fileptr) else #endif { - const off_t retseek = lseek(fileptr->fd, fileptr->bufferPos, SEEK_SET); + off_t retseek = lseek(fileptr->fd, fileptr->bufferPos, SEEK_SET); if (retseek == (off_t) -1) SysError("lseek error at pos %ld file %s", (long) fileptr->bufferPos, fileptr->name); nread = read(fd, fileptr->buffer, fileptr->bufferSize); @@ -964,7 +973,7 @@ fileOpen_serial(const char *filename, const char *mode) FILE_INIT(); - const int fmode = tolower((int) mode[0]); + int fmode = tolower((int) mode[0]); switch (fmode) { @@ -985,8 +994,7 @@ fileOpen_serial(const char *filename, const char *mode) default: Error("Mode %c unexpected!", fmode); } - if (FileDebug) - if (fp == NULL && fd == -1) Message("Open failed on %s mode %c errno %d", filename, fmode, errno); + if (FileDebug && fp == NULL && fd == -1) Message("Open failed on %s mode %c errno %d", filename, fmode, errno); if (fp) { diff --git a/src/grb_read.c b/src/grb_read.c index 453474ef089d20e1e447421c0033cba42177ffa5..ad4b71c3fc4f11acbe34e8c09d5683c765c5dc57 100644 --- a/src/grb_read.c +++ b/src/grb_read.c @@ -19,8 +19,8 @@ #include "cgribex.h" /* gribZip gribGetZip gribGinfo */ static int -grbDecode(int filetype, int memtype, void *cgribexp, void *gribbuffer, size_t gribsize, void *data, size_t datasize, int unreduced, - size_t *nmiss, double missval) +grb_decode(int filetype, int memtype, void *cgribexp, void *gribbuffer, size_t gribsize, void *data, size_t datasize, int unreduced, + size_t *nmiss, double missval) { int status = 0; @@ -60,11 +60,11 @@ grbDecode(int filetype, int memtype, void *cgribexp, void *gribbuffer, size_t gr // Decompresses the grib data in gribbuffer. static int -grbUnzipRecord(void *gribbuffer, size_t *gribsize) +grib1_unzip_record(void *gribbuffer, size_t *gribsize) { int zip = 0; - const size_t igribsize = *gribsize; + size_t igribsize = *gribsize; size_t ogribsize = *gribsize; int izip; @@ -72,7 +72,7 @@ grbUnzipRecord(void *gribbuffer, size_t *gribsize) if ((izip = gribGetZip(igribsize, (unsigned char *) gribbuffer, &unzipsize)) > 0) { zip = izip; - if (izip == 128) /* szip */ + if (izip == 128) // szip { if (unzipsize < igribsize) { @@ -80,7 +80,7 @@ grbUnzipRecord(void *gribbuffer, size_t *gribsize) return 0; } - unzipsize += 100; /* need 0 to 1 bytes for rounding of bds */ + unzipsize += 100; // need 0 to 1 bytes for rounding of bds void *buffer = Malloc(igribsize); memcpy(buffer, gribbuffer, igribsize); @@ -105,7 +105,7 @@ grbUnzipRecord(void *gribbuffer, size_t *gribsize) typedef struct DecodeArgs { - int recID, *outZip, filetype, memtype, unreduced; + int recID, tsID, *outZip, filetype, memtype, unreduced; void *cgribexp, *gribbuffer, *data; size_t recsize, gridsize, nmiss; double missval; @@ -115,27 +115,26 @@ static int grb_decode_record(void *untypedArgs) { DecodeArgs *args = (DecodeArgs *) untypedArgs; - *args->outZip = grbUnzipRecord(args->gribbuffer, &args->recsize); - grbDecode(args->filetype, args->memtype, args->cgribexp, args->gribbuffer, args->recsize, args->data, args->gridsize, - args->unreduced, &args->nmiss, args->missval); + *args->outZip = grib1_unzip_record(args->gribbuffer, &args->recsize); + grb_decode(args->filetype, args->memtype, args->cgribexp, args->gribbuffer, args->recsize, args->data, args->gridsize, + args->unreduced, &args->nmiss, args->missval); return 0; } static DecodeArgs -grb_read_raw_data(stream_t *streamptr, int recID, int memtype, void *gribbuffer, void *data, bool resetFilePos) +grb_read_raw_data(stream_t *streamptr, int tsID, int recID, int memtype, void *gribbuffer, void *data, bool resetFilePos) { - const int vlistID = streamptr->vlistID; - const int tsID = streamptr->curTsID; // FIXME: This should be looked up from the given recID - const int varID = streamptr->tsteps[tsID].records[recID].varID; + int vlistID = streamptr->vlistID; + int varID = streamptr->tsteps[tsID].records[recID].varID; size_t recsize = streamptr->tsteps[tsID].records[recID].size; - const int gridID = vlistInqVarGrid(vlistID, varID); - const size_t gridsize = gridInqSize(gridID); + int gridID = vlistInqVarGrid(vlistID, varID); + size_t gridsize = gridInqSize(gridID); if (CDI_Debug) Message("gridID = %d gridsize = %zu", gridID, gridsize); void *cgribexp = (gribbuffer && streamptr->record->objectp) ? streamptr->record->objectp : NULL; if (!gribbuffer) gribbuffer = Malloc(streamptr->record->buffersize); - if (!data) data = Malloc(gridsize * (memtype == MEMTYPE_FLOAT ? sizeof(float) : sizeof(double))); + if (!data) data = Malloc(gridsize * ((memtype == MEMTYPE_FLOAT) ? sizeof(float) : sizeof(double))); if (streamptr->protocol == CDI_PROTOCOL_FDB) { @@ -148,42 +147,44 @@ grb_read_raw_data(stream_t *streamptr, int recID, int memtype, void *gribbuffer, } else { - const int fileID = streamptr->fileID; - const off_t recpos = streamptr->tsteps[tsID].records[recID].position; - if (recsize == 0) Error("Internal problem! Recordsize is zero for record %d at timestep %d", recID + 1, tsID + 1); - if (resetFilePos) - { - const off_t currentfilepos = fileGetPos(fileID); - fileSetPos(fileID, recpos, SEEK_SET); - if (fileRead(fileID, gribbuffer, recsize) != recsize) Error("Failed to read GRIB record!"); - fileSetPos(fileID, currentfilepos, SEEK_SET); - } - else - { - fileSetPos(fileID, recpos, SEEK_SET); - if (fileRead(fileID, gribbuffer, recsize) != recsize) Error("Failed to read GRIB record!"); - streamptr->numvals += gridsize; - } + int fileID = streamptr->fileID; + off_t recpos = streamptr->tsteps[tsID].records[recID].position; + off_t currentfilepos = (resetFilePos ? fileGetPos(fileID) : 0); + + fileSetPos(fileID, recpos, SEEK_SET); + if (fileRead(fileID, gribbuffer, recsize) != recsize) Error("Failed to read GRIB record!"); + + if (resetFilePos) fileSetPos(fileID, currentfilepos, SEEK_SET); + if (!resetFilePos) streamptr->numvals += gridsize; } return (DecodeArgs){ .recID = recID, + .tsID = tsID, .outZip = &streamptr->tsteps[tsID].records[recID].zip, .filetype = streamptr->filetype, .memtype = memtype, + .unreduced = streamptr->unreduced, .cgribexp = cgribexp, .gribbuffer = gribbuffer, - .recsize = recsize, .data = data, + .recsize = recsize, .gridsize = gridsize, - .unreduced = streamptr->unreduced, .nmiss = 0, .missval = vlistInqVarMissval(vlistID, varID), }; } +static size_t +grb_read_and_decode_record(stream_t *streamptr, int recID, int memtype, void *data, bool resetFilePos) +{ + DecodeArgs args = grb_read_raw_data(streamptr, streamptr->curTsID, recID, memtype, streamptr->record->buffer, data, resetFilePos); + grb_decode_record(&args); + return args.nmiss; +} + typedef struct JobDescriptor { DecodeArgs args; @@ -191,9 +192,9 @@ typedef struct JobDescriptor } JobDescriptor; static void -JobDescriptor_startJob(AsyncManager *jobManager, JobDescriptor *me, stream_t *streamptr, int recID, int memtype, bool resetFilePos) +JobDescriptor_startJob(AsyncManager *jobManager, JobDescriptor *me, stream_t *streamptr, int tsID, int recID, int memtype) { - me->args = grb_read_raw_data(streamptr, recID, memtype, NULL, NULL, resetFilePos); + me->args = grb_read_raw_data(streamptr, tsID, recID, memtype, NULL, NULL, false); me->job = AsyncWorker_requestWork(jobManager, grb_decode_record, &me->args); if (!me->job) xabort("error while trying to send job to worker thread"); } @@ -202,132 +203,167 @@ static void JobDescriptor_finishJob(AsyncManager *jobManager, JobDescriptor *me, void *data, size_t *nmiss) { if (AsyncWorker_wait(jobManager, me->job)) xabort("error executing job in worker thread"); - memcpy(data, me->args.data, me->args.gridsize * (me->args.memtype == MEMTYPE_FLOAT ? sizeof(float) : sizeof(double))); + memcpy(data, me->args.data, me->args.gridsize * ((me->args.memtype == MEMTYPE_FLOAT) ? sizeof(float) : sizeof(double))); *nmiss = me->args.nmiss; Free(me->args.gribbuffer); Free(me->args.data); me->args.recID = -1; // mark as inactive + me->args.tsID = -1; // mark as inactive +} +/* +static long +get_global_recId(stream_t *streamptr, int tsID, int recID) +{ + const tsteps_t *tsteps = streamptr->tsteps; + long globalRecId = recID; + if (tsID > 0) globalRecId += tsteps[0].nrecs; + if (tsID > 1) globalRecId += tsteps[1].nrecs * (tsID - 1); + return globalRecId; +} +*/ +static long +get_max_global_recs(stream_t *streamptr) +{ + long maxGlobalRecs = -1; + long numSteps = streamptr->ntsteps; + if (numSteps > 0) + { + const tsteps_t *tsteps = streamptr->tsteps; + maxGlobalRecs = tsteps[0].nrecs; + if (numSteps > 1) maxGlobalRecs += tsteps[1].nrecs * (numSteps - 1); + } + return maxGlobalRecs; } static void -grb_read_next_record(stream_t *streamptr, int recID, int memtype, void *data, size_t *nmiss, bool resetFilePos) +get_local_step_and_recId(stream_t *streamptr, long globalRecId, int *tsID, int *recID) +{ + int localTsId = 0; + long numSteps = streamptr->ntsteps; + const tsteps_t *tsteps = streamptr->tsteps; + if (numSteps > 0 && globalRecId >= tsteps[0].nrecs) + { + localTsId++; + globalRecId -= tsteps[0].nrecs; + } + while (globalRecId >= tsteps[1].nrecs) + { + localTsId++; + globalRecId -= tsteps[1].nrecs; + } + + *tsID = localTsId; + *recID = globalRecId; +} + +static void +read_next_record(AsyncManager *jobManager, JobDescriptor *jd, stream_t *streamptr, int memtype) +{ + int tsId = -1, recId = -1; + get_local_step_and_recId(streamptr, streamptr->nextGlobalRecId, &tsId, &recId); + int xRecId = streamptr->tsteps[tsId].recIDs[recId]; + JobDescriptor_startJob(jobManager, jd, streamptr, tsId, xRecId, memtype); + streamptr->nextGlobalRecId++; +} + +static void +grb_read_next_record(stream_t *streamptr, int recID, int memtype, void *data, size_t *nmiss) { bool jobFound = false; int workerCount = streamptr->numWorker; if (workerCount > 0) { - if (workerCount > streamptr->tsteps[0].nrecs) workerCount = streamptr->tsteps[0].nrecs; + int tsID = streamptr->curTsID; + long maxGlobalRecs = get_max_global_recs(streamptr); + // long globalRecId = get_global_recId(streamptr, streamptr->curTsID, recID); + if (maxGlobalRecs == -1) xabort("Internal error: number of timesteps missing!"); + + if (workerCount > maxGlobalRecs) workerCount = maxGlobalRecs; AsyncManager *jobManager = (AsyncManager *) streamptr->jobManager; JobDescriptor *jobs = (JobDescriptor *) streamptr->jobs; // if this is the first call, init and start worker threads - tsteps_t *timestep = &streamptr->tsteps[streamptr->curTsID]; if (!jobs) { - jobs = (JobDescriptor *) malloc(workerCount * sizeof *jobs); + jobs = (JobDescriptor *) malloc(workerCount * sizeof(*jobs)); streamptr->jobs = jobs; for (int i = 0; i < workerCount; i++) jobs[i].args.recID = -1; + for (int i = 0; i < workerCount; i++) jobs[i].args.tsID = -1; if (AsyncWorker_init(&jobManager, workerCount)) xabort("error while trying to start worker threads"); streamptr->jobManager = jobManager; - } - - if (recID == 0) streamptr->nextRecID = 0; - if (recID == 0) - streamptr->cachedTsID = streamptr->curTsID; // no active workers -> we may start processing records of a new timestep - if (streamptr->cachedTsID == streamptr->curTsID) - { // Start as many new jobs as possible. - for (int i = 0; streamptr->nextRecID < timestep->nrecs && i < workerCount; i++) + for (int i = 0; streamptr->nextGlobalRecId < maxGlobalRecs && i < workerCount; i++) { JobDescriptor *jd = &jobs[i]; - if (jd->args.recID < 0) - { - JobDescriptor_startJob(jobManager, jd, streamptr, timestep->recIDs[streamptr->nextRecID++], memtype, - resetFilePos); - } + if (jd->args.recID < 0 && jd->args.tsID < 0) read_next_record(jobManager, jd, streamptr, memtype); } + } - // search for a job descriptor with the given recID, and use its results if it exists - for (int i = 0; !jobFound && i < workerCount; i++) + // search for a job descriptor with the given tsID and recID, and use its results if it exists + for (int i = 0; !jobFound && i < workerCount; i++) + { + JobDescriptor *jd = &jobs[i]; + if (jd->args.recID == recID && jd->args.tsID == tsID) { - JobDescriptor *jd = &jobs[i]; - if (jd->args.recID == recID) - { - jobFound = true; - JobDescriptor_finishJob(jobManager, jd, data, nmiss); - if (streamptr->nextRecID < timestep->nrecs) - { - JobDescriptor_startJob(jobManager, jd, streamptr, timestep->recIDs[streamptr->nextRecID++], memtype, - resetFilePos); - } - } + jobFound = true; + JobDescriptor_finishJob(jobManager, jd, data, nmiss); + if (streamptr->nextGlobalRecId < maxGlobalRecs) read_next_record(jobManager, jd, streamptr, memtype); } } } // perform the work synchronously if we didn't start a job for it yet - if (!jobFound) - { - DecodeArgs args = grb_read_raw_data(streamptr, recID, memtype, streamptr->record->buffer, data, resetFilePos); - grb_decode_record(&args); - *nmiss = args.nmiss; - } + if (!jobFound) *nmiss = grb_read_and_decode_record(streamptr, recID, memtype, data, false); } void grb_read_record(stream_t *streamptr, int memtype, void *data, size_t *nmiss) { - const int tsID = streamptr->curTsID; - const int vrecID = streamptr->tsteps[tsID].curRecID; - const int recID = streamptr->tsteps[tsID].recIDs[vrecID]; + int tsID = streamptr->curTsID; + int vrecID = streamptr->tsteps[tsID].curRecID; + int recID = streamptr->tsteps[tsID].recIDs[vrecID]; - grb_read_next_record(streamptr, recID, memtype, data, nmiss, false); + grb_read_next_record(streamptr, recID, memtype, data, nmiss); } void grb_read_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, void *data, size_t *nmiss) { - const int isub = subtypeInqActiveIndex(streamptr->vars[varID].subtypeID); - const int recID = streamptr->vars[varID].recordTable[isub].recordID[levelID]; + int isub = subtypeInqActiveIndex(streamptr->vars[varID].subtypeID); + int recID = streamptr->vars[varID].recordTable[isub].recordID[levelID]; - grb_read_next_record(streamptr, recID, memtype, data, nmiss, true); + *nmiss = grb_read_and_decode_record(streamptr, recID, memtype, data, true); } void grb_read_var(stream_t *streamptr, int varID, int memtype, void *data, size_t *nmiss) { - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; - const int gridID = vlistInqVarGrid(vlistID, varID); - const size_t gridsize = gridInqSize(gridID); + int gridID = vlistInqVarGrid(vlistID, varID); + size_t gridsize = gridInqSize(gridID); - const off_t currentfilepos = fileGetPos(fileID); + off_t currentfilepos = fileGetPos(fileID); - const int isub = subtypeInqActiveIndex(streamptr->vars[varID].subtypeID); - const int nlevs = streamptr->vars[varID].recordTable[0].nlevs; + int isub = subtypeInqActiveIndex(streamptr->vars[varID].subtypeID); + int nlevs = streamptr->vars[varID].recordTable[0].nlevs; if (CDI_Debug) Message("nlevs = %d gridID = %d gridsize = %zu", nlevs, gridID, gridsize); *nmiss = 0; for (int levelID = 0; levelID < nlevs; levelID++) { - const int recID = streamptr->vars[varID].recordTable[isub].recordID[levelID]; - - void *datap = NULL; - if (memtype == MEMTYPE_FLOAT) - datap = (float *) data + levelID * gridsize; - else - datap = (double *) data + levelID * gridsize; + int recID = streamptr->vars[varID].recordTable[isub].recordID[levelID]; + size_t offset = levelID * gridsize; + void *datap = (memtype == MEMTYPE_FLOAT) ? (void *) ((float *) data + offset) : (void *) ((double *) data + offset); - size_t imiss; - grb_read_next_record(streamptr, recID, memtype, datap, &imiss, false); - *nmiss += imiss; + *nmiss += grb_read_and_decode_record(streamptr, recID, memtype, datap, false); } fileSetPos(fileID, currentfilepos, SEEK_SET); diff --git a/src/grb_write.c b/src/grb_write.c index acb48774bc53cb5a825a7986cbe7faaad2991f60..433e693ccdcad6b4af540eb9c6717d2beecd3bcd 100644 --- a/src/grb_write.c +++ b/src/grb_write.c @@ -24,7 +24,7 @@ #include "namespace.h" static size_t -grbEncode(int filetype, int memtype, int varID, int levelID, int vlistID, int gridID, int zaxisID, int date, int time, +grbEncode(int filetype, int memtype, int varID, int levelID, int vlistID, int gridID, int zaxisID, CdiDateTime vDateTime, int tsteptype, int numavg, size_t datasize, const void *data, size_t nmiss, void **gribbuffer, int comptype, void *gribContainers) { @@ -36,8 +36,8 @@ grbEncode(int filetype, int memtype, int varID, int levelID, int vlistID, int gr size_t gribbuffersize = datasize * 4 + 3000; *gribbuffer = Malloc(gribbuffersize); - nbytes = cgribexEncode(memtype, varID, levelID, vlistID, gridID, zaxisID, date, time, tsteptype, numavg, datasize, data, - nmiss, *gribbuffer, gribbuffersize); + nbytes = cgribexEncode(memtype, varID, levelID, vlistID, gridID, zaxisID, vDateTime, tsteptype, numavg, datasize, data, nmiss, + *gribbuffer, gribbuffersize); } else #endif @@ -58,7 +58,7 @@ grbEncode(int filetype, int memtype, int varID, int levelID, int vlistID, int gr } size_t gribbuffersize; - nbytes = gribapiEncode(varID, levelID, vlistID, gridID, zaxisID, date, time, tsteptype, numavg, (long) datasize, datap, nmiss, + nbytes = gribapiEncode(varID, levelID, vlistID, gridID, zaxisID, vDateTime, tsteptype, numavg, (long) datasize, datap, nmiss, gribbuffer, &gribbuffersize, comptype, gribContainer); if (memtype == MEMTYPE_FLOAT) Free((void *) datap); @@ -128,9 +128,9 @@ cdi_fdb_store(void *fdbHandle, const char *filename, void *gribbuffer, size_t nb for (int i = 0; i < keyValue.numKeys; i++) { // clang-format off - if (strcmp(keyValue.keys[i], "class") == 0) class = keyValue.values[i]; - else if (strcmp(keyValue.keys[i], "stream") == 0) stream = keyValue.values[i]; - else if (strcmp(keyValue.keys[i], "expver") == 0) expver = keyValue.values[i]; + if (str_is_equal(keyValue.keys[i], "class")) class = keyValue.values[i]; + else if (str_is_equal(keyValue.keys[i], "stream")) stream = keyValue.values[i]; + else if (str_is_equal(keyValue.keys[i], "expver")) expver = keyValue.values[i]; else Error("Unsupported FDB parameter: %s=%s", keyValue.keys[i], keyValue.values[i]); // clang-format on } @@ -210,14 +210,14 @@ fillup_gribbuffer(size_t nbytes, unsigned char *gribbuffer) void grbCopyRecord(stream_t *streamptr2, stream_t *streamptr1) { - const int filetype = streamptr1->filetype; - const int fileID1 = streamptr1->fileID; - const int fileID2 = streamptr2->fileID; - const int tsID = streamptr1->curTsID; - const int vrecID = streamptr1->tsteps[tsID].curRecID; - const int recID = streamptr1->tsteps[tsID].recIDs[vrecID]; + int filetype = streamptr1->filetype; + int fileID1 = streamptr1->fileID; + int fileID2 = streamptr2->fileID; + int tsID = streamptr1->curTsID; + int vrecID = streamptr1->tsteps[tsID].curRecID; + int recID = streamptr1->tsteps[tsID].recIDs[vrecID]; const record_t *record = &streamptr1->tsteps[tsID].records[recID]; - const off_t recpos = record->position; + off_t recpos = record->position; size_t recsize = record->size; void *gribbuffer = NULL; @@ -232,7 +232,7 @@ grbCopyRecord(stream_t *streamptr2, stream_t *streamptr1) recsize = fdb_read_record(streamptr1->protocolData, fdbItem, &buffersize, &gribbuffer); // round up recsize to next multiple of 8 - const size_t gribbuffersize = ((recsize + 7U) & ~7U); + size_t gribbuffersize = ((recsize + 7U) & ~7U); gribbuffer = (unsigned char *) Realloc(gribbuffer, gribbuffersize); #endif @@ -242,7 +242,7 @@ grbCopyRecord(stream_t *streamptr2, stream_t *streamptr1) fileSetPos(fileID1, recpos, SEEK_SET); // round up recsize to next multiple of 8 - const size_t gribbuffersize = ((recsize + 7U) & ~7U); + size_t gribbuffersize = ((recsize + 7U) & ~7U); gribbuffer = (unsigned char *) Malloc(gribbuffersize); @@ -294,7 +294,7 @@ grbCopyRecord(stream_t *streamptr2, stream_t *streamptr1) { grib_handle *gh = grib_handle_new_from_message(NULL, (void *) gribbuffer, recsize); - const int scanModeIN = gribapiGetScanningMode(gh); + int scanModeIN = gribapiGetScanningMode(gh); grib_handle_delete(gh); @@ -305,14 +305,14 @@ grbCopyRecord(stream_t *streamptr2, stream_t *streamptr1) { size_t nmiss = 0; - const int vlistID = streamptr1->vlistID; - const int varID = record->varID; - const int levelID = record->levelID; - const int gridID = vlistInqVarGrid(vlistID, varID); + int vlistID = streamptr1->vlistID; + int varID = record->varID; + int levelID = record->levelID; + int gridID = vlistInqVarGrid(vlistID, varID); size_t gridsize = gridInqSize(gridID); if (vlistNumber(vlistID) != CDI_REAL) gridsize *= 2; - double *data = (double *) malloc(gridsize * sizeof(double)); + double *data = (double *) Malloc(gridsize * sizeof(double)); if (cdiDebugExt >= 20) Message(" processing varID %d; levelID %d", varID, levelID); @@ -327,26 +327,27 @@ grbCopyRecord(stream_t *streamptr2, stream_t *streamptr1) if (filetype == CDI_FILETYPE_GRB) { size_t unzipsize; - const int izip = gribGetZip(recsize, gribbuffer, &unzipsize); + int izip = gribGetZip(recsize, (unsigned char *) gribbuffer, &unzipsize); if (izip == 0 && (streamptr2->comptype == CDI_COMPRESS_SZIP || streamptr2->comptype == CDI_COMPRESS_AEC)) nbytes = grbSzip(filetype, gribbuffer, nbytes); } - fillup_gribbuffer(nbytes, gribbuffer); + fillup_gribbuffer(nbytes, (unsigned char *) gribbuffer); if (streamptr2->protocol == CDI_PROTOCOL_FDB) { - const int vlistID = streamptr1->vlistID; - const int varID = record->varID; - const int zaxisID = vlistInqVarZaxis(vlistID, varID); - const int zaxisType = zaxisInqType(zaxisID); + int vlistID = streamptr1->vlistID; + int varID = record->varID; + int zaxisID = vlistInqVarZaxis(vlistID, varID); + int zaxisType = zaxisInqType(zaxisID); + CdiDateTime vDateTime = streamptr1->tsteps[tsID].taxis.vDateTime; FDB_Keys fdbKeys; - snprintf(fdbKeys.date, sizeof(fdbKeys.date), "%d", (int) cdiDate_get(streamptr1->tsteps[tsID].taxis.vdatetime.date)); - snprintf(fdbKeys.time, sizeof(fdbKeys.time), "%04d", cdiTime_get(streamptr1->tsteps[tsID].taxis.vdatetime.time) / 100); + snprintf(fdbKeys.date, sizeof(fdbKeys.date), "%d", (int) cdiDate_get(vDateTime.date)); + snprintf(fdbKeys.time, sizeof(fdbKeys.time), "%04d", (short) (cdiTime_get(vDateTime.time) / 100)); snprintf(fdbKeys.param, sizeof(fdbKeys.param), "%d", get_fdb_param(record->param)); - const bool isML = (zaxisType == ZAXIS_HYBRID || zaxisType == ZAXIS_HYBRID_HALF); + bool isML = (zaxisType == ZAXIS_HYBRID || zaxisType == ZAXIS_HYBRID_HALF); snprintf(fdbKeys.levtype, sizeof(fdbKeys.levtype), "%s", isML ? "ml" : "sfc"); fdbKeys.levelist[0] = 0; if (isML) snprintf(fdbKeys.levelist, sizeof(fdbKeys.levelist), "%d", isML ? record->ilevel : 0); @@ -357,12 +358,8 @@ grbCopyRecord(stream_t *streamptr2, stream_t *streamptr1) } else { - const size_t nwrite = fileWrite(fileID2, gribbuffer, nbytes); - if (nwrite != nbytes) - { - perror(__func__); - Error("Could not write record for copying!"); - } + size_t nwrite = fileWrite(fileID2, gribbuffer, nbytes); + if (nwrite != nbytes) SysError("Could not write record for copying!"); } Free(gribbuffer); @@ -371,21 +368,20 @@ grbCopyRecord(stream_t *streamptr2, stream_t *streamptr1) void grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, const void *data, size_t nmiss) { - const int filetype = streamptr->filetype; - const int fileID = streamptr->fileID; - const int vlistID = streamptr->vlistID; - const int gridID = vlistInqVarGrid(vlistID, varID); - const int zaxisID = vlistInqVarZaxis(vlistID, varID); - const int tsteptype = vlistInqVarTsteptype(vlistID, varID); - const int tsID = streamptr->curTsID; - const int date = (int) cdiDate_get(streamptr->tsteps[tsID].taxis.vdatetime.date); - const int time = cdiTime_get(streamptr->tsteps[tsID].taxis.vdatetime.time); - const int numavg = (tsteptype == TSTEP_AVG) ? streamptr->tsteps[tsID].taxis.numavg : 0; + int filetype = streamptr->filetype; + int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); + int tsteptype = vlistInqVarTsteptype(vlistID, varID); + int tsID = streamptr->curTsID; + CdiDateTime vDateTime = streamptr->tsteps[tsID].taxis.vDateTime; + int numavg = (tsteptype == TSTEP_AVG) ? streamptr->tsteps[tsID].taxis.numavg : 0; int comptype = streamptr->comptype; if (CDI_Debug) Message("gridID = %d zaxisID = %d", gridID, zaxisID); - const size_t datasize = gridInqSize(gridID); + size_t datasize = gridInqSize(gridID); if (comptype != CDI_COMPRESS_JPEG && comptype != CDI_COMPRESS_SZIP && comptype != CDI_COMPRESS_AEC) comptype = CDI_COMPRESS_NONE; @@ -397,7 +393,7 @@ grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, co } void *gribbuffer = NULL; - size_t nbytes = grbEncode(filetype, memtype, varID, levelID, vlistID, gridID, zaxisID, date, time, tsteptype, numavg, datasize, + size_t nbytes = grbEncode(filetype, memtype, varID, levelID, vlistID, gridID, zaxisID, vDateTime, tsteptype, numavg, datasize, data, nmiss, &gribbuffer, comptype, streamptr->gribContainers); if (filetype == CDI_FILETYPE_GRB && (comptype == CDI_COMPRESS_SZIP || comptype == CDI_COMPRESS_AEC)) @@ -408,11 +404,7 @@ grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, co case CDI_PROTOCOL_ACROSS: { #ifdef HAVE_ACROSS - if (across_write_grib_message(streamptr, gribbuffer, nbytes)) - { - Error("Failed to write GRIB slice!"); - break; - } + if (across_write_grib_message(streamptr, gribbuffer, nbytes)) SysError("Failed to write GRIB slice!"); #endif } break; @@ -420,14 +412,14 @@ grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, co case CDI_PROTOCOL_FDB: { #ifdef HAVE_LIBFDB5 - const int zaxisType = zaxisInqType(zaxisID); - const double level = zaxisInqLevel(zaxisID, levelID); + int zaxisType = zaxisInqType(zaxisID); + double level = zaxisInqLevel(zaxisID, levelID); FDB_Keys fdbKeys; - snprintf(fdbKeys.date, sizeof(fdbKeys.date), "%d", (int) cdiDate_get(streamptr->tsteps[tsID].taxis.vdatetime.date)); - snprintf(fdbKeys.time, sizeof(fdbKeys.time), "%04d", cdiTime_get(streamptr->tsteps[tsID].taxis.vdatetime.time) / 100); + snprintf(fdbKeys.date, sizeof(fdbKeys.date), "%d", (int) cdiDate_get(vDateTime.date)); + snprintf(fdbKeys.time, sizeof(fdbKeys.time), "%04d", (short) (cdiTime_get(vDateTime.time) / 100)); snprintf(fdbKeys.param, sizeof(fdbKeys.param), "%d", get_fdb_param(vlistInqVarParam(vlistID, varID))); - const bool isML = (zaxisType == ZAXIS_HYBRID || zaxisType == ZAXIS_HYBRID_HALF); + bool isML = (zaxisType == ZAXIS_HYBRID || zaxisType == ZAXIS_HYBRID_HALF); snprintf(fdbKeys.levtype, sizeof(fdbKeys.levtype), "%s", isML ? "ml" : "sfc"); fdbKeys.levelist[0] = 0; int ilevel = (isML) ? (int) level : 0; @@ -444,12 +436,8 @@ grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, co size_t (*myFileWrite)(int fileID, const void *restrict buffer, size_t len) = (size_t(*)(int, const void *restrict, size_t)) namespaceSwitchGet(NSSWITCH_FILE_WRITE).func; - const size_t nwrite = myFileWrite(fileID, gribbuffer, nbytes); - if (nwrite != nbytes) - { - perror(__func__); - Error("Failed to write GRIB slice!"); - } + size_t nwrite = myFileWrite(fileID, gribbuffer, nbytes); + if (nwrite != nbytes) SysError("Failed to write GRIB slice!"); } break; } @@ -460,12 +448,12 @@ grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype, co void grb_write_var(stream_t *streamptr, int varID, int memtype, const void *data, size_t nmiss) { - const int vlistID = streamptr->vlistID, gridID = vlistInqVarGrid(vlistID, varID), zaxisID = vlistInqVarZaxis(vlistID, varID), - nlevs = zaxisInqSize(zaxisID); - const size_t gridsize = gridInqSize(gridID); - const double missval = vlistInqVarMissval(vlistID, varID); + int vlistID = streamptr->vlistID, gridID = vlistInqVarGrid(vlistID, varID), zaxisID = vlistInqVarZaxis(vlistID, varID), + nlevs = zaxisInqSize(zaxisID); + size_t gridsize = gridInqSize(gridID); + double missval = vlistInqVarMissval(vlistID, varID); - const size_t chunkLen = gridsize; + size_t chunkLen = gridsize; if (memtype == MEMTYPE_FLOAT) for (int levelID = 0; levelID < nlevs; levelID++) { @@ -493,8 +481,8 @@ grb_write_var(stream_t *streamptr, int varID, int memtype, const void *data, siz void grb_write_record(stream_t *streamptr, int memtype, const void *data, size_t nmiss) { - const int varID = streamptr->record->varID; - const int levelID = streamptr->record->levelID; + int varID = streamptr->record->varID; + int levelID = streamptr->record->levelID; grb_write_var_slice(streamptr, varID, levelID, memtype, data, nmiss); } diff --git a/src/gribapi.c b/src/gribapi.c index 7336e13d6203e6f578927488028fc2c0a4df5cd4..c063ac5abc545da111cf31147a03259fecb63a30 100644 --- a/src/gribapi.c +++ b/src/gribapi.c @@ -42,7 +42,7 @@ gribapiLibraryVersionString(void) int major_version, minor_version, revision_version; gribapiLibraryVersion(&major_version, &minor_version, &revision_version); - sprintf(gribapi_libvers, "%d.%d.%d", major_version, minor_version, revision_version); + snprintf(gribapi_libvers, sizeof(gribapi_libvers), "%d.%d.%d", major_version, minor_version, revision_version); gribapi_libvers_init = true; } #endif diff --git a/src/gribapi.h b/src/gribapi.h index 3bed5483f1166b49ca3e9772954429b101e8a891..34561b7f65c39d1d1ed8ce3a2bf693b6a2fb5b6c 100644 --- a/src/gribapi.h +++ b/src/gribapi.h @@ -67,10 +67,10 @@ static inline int my_grib_set_double(grib_handle* h, const char* key, double val if (CDI_gribapi_debug) fprintf(stderr, "grib_set_double(\tgrib_handle* h, \"%s\", %f)\n", key, val); - int ret_val = grib_set_double(h, key, val); - if (ret_val != 0) + const int retVal = grib_set_double(h, key, val); + if (retVal != 0) fprintf(stderr, "!!! failed call to grib_set_double(\tgrib_handle* h, \"%s\", %f) !!!\n", key, val); - return ret_val; + return retVal; } static inline int my_grib_set_long(grib_handle* h, const char* key, long val) @@ -78,10 +78,10 @@ static inline int my_grib_set_long(grib_handle* h, const char* key, long val) if (CDI_gribapi_debug) fprintf(stderr, "grib_set_long( \tgrib_handle* h, \"%s\", %ld)\n", key, val); - int ret_val = grib_set_long(h, key, val); - if (ret_val != 0) + const int retVal = grib_set_long(h, key, val); + if (retVal != 0) fprintf(stderr, "!!! failed call to grib_set_long( \tgrib_handle* h, \"%s\", %ld) !!!\n", key, val); - return ret_val; + return retVal; } static inline int my_grib_set_string(grib_handle* h, const char* key, const char* val, size_t* length) diff --git a/src/gribapi_utilities.c b/src/gribapi_utilities.c index 5d149cbb03aa5580981e96ff2a9d028a8da228d3..7a3153a96d79633242a2b3e3cc7f1c1364f863bb 100644 --- a/src/gribapi_utilities.c +++ b/src/gribapi_utilities.c @@ -88,11 +88,11 @@ gribCheckString(grib_handle *gribHandle, const char *key, const char *expectedVa if (length != expectedLength) return false; char *value = (char *) Malloc(length); if (grib_get_string(gribHandle, key, value, &length)) return false; - int rc = !strcmp(value, expectedValue); + int rc = str_is_equal(value, expectedValue); Free(value); #else char *value = gribCopyString(gribHandle, key); - int rc = value ? (strlen(value) + 1 == expectedLength ? !strcmp(value, expectedValue) : false) : false; + int rc = value ? (strlen(value) + 1 == expectedLength ? str_is_equal(value, expectedValue) : false) : false; Free(value); #endif return rc; @@ -271,9 +271,10 @@ addToDate(struct tm *me, long long amount, long unit) static char * makeDateString(struct tm *me) { - char *result = (char *) Malloc(4 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 4 + 1); - sprintf(result, "%04d-%02d-%02dT%02d:%02d:%02d.000", me->tm_year + 1900, me->tm_mon + 1, me->tm_mday, me->tm_hour, me->tm_min, - me->tm_sec); + const size_t length = 4 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 4 + 1; + char *result = (char *) Malloc(length); + snprintf(result, length, "%04d-%02d-%02dT%02d:%02d:%02d.000", me->tm_year + 1900, me->tm_mon + 1, me->tm_mday, me->tm_hour, + me->tm_min, me->tm_sec); return result; } @@ -941,7 +942,7 @@ gribapiGetGrid(grib_handle *gh, grid_t *grid) Default / implicit scanning mode is 64: i and j scan positively, i points are consecutive (row-major) */ #ifdef HIRLAM_EXTENSIONS - if (cdiDebugExt >= 30) + if (cdiDebugExt >= 30 && gribEditionNumber(gh) <= 1) { // indicatorOfParameter=33,indicatorOfTypeOfLevel=105,level long paramId, levelTypeId, levelId; diff --git a/src/grid.c b/src/grid.c index a459c1b5d9fc5c8826edc67bf76b51473c4a0268..bb3ab3de8fddf5d69b6ac8d5e38c0e0b9f300e14 100644 --- a/src/grid.c +++ b/src/grid.c @@ -22,8 +22,7 @@ int (*proj_lcc_to_lonlat_func)(struct CDI_GridProjParams gpp, double, double, si int (*proj_lonlat_to_stere_func)(struct CDI_GridProjParams gpp, size_t, double *, double *) = NULL; int (*proj_stere_to_lonlat_func)(struct CDI_GridProjParams gpp, double, double, size_t, double *, double *) = NULL; -/* the value in the second pair of brackets must match the length of - * the longest string (including terminating NUL) */ +// the value in the second pair of brackets must match the length of the longest string (including terminating NUL) static const char Grids[][17] = { /* 0 */ "undefined", /* 1 */ "generic", @@ -41,7 +40,7 @@ static const char Grids[][17] = { /* 13 */ "characterXY", }; -/* must match table below */ +// must match table below enum xystdname_idx { grid_xystdname_grid_latlon, @@ -61,12 +60,10 @@ static void gridDestroyP(void *gridptr); static void gridPrintP(void *gridptr, FILE *fp); static int gridGetPackSize(void *gridptr, void *context); static void gridPack(void *gridptr, void *buff, int size, int *position, void *context); -static int gridTxCode(void); +static int gridTxCode(void *gridptr); static const resOps gridOps = { gridCompareP, gridDestroyP, gridPrintP, gridGetPackSize, gridPack, gridTxCode }; -static int GRID_Debug = 0; /* If set to 1, debugging */ - grid_t * grid_to_pointer(int gridID) { @@ -75,6 +72,12 @@ grid_to_pointer(int gridID) #define gridMark4Update(gridID) reshSetStatus(gridID, &gridOps, RESH_DESYNC_IN_USE) +static inline bool +grid_is_irregular(int gridType) +{ + return (gridType == GRID_UNSTRUCTURED || gridType == GRID_CURVILINEAR); +} + static bool cdiInqAttConvertedToFloat(int gridID, int atttype, const char *attname, int attlen, double *attflt) { @@ -117,6 +120,12 @@ grid_axis_init(struct gridaxis_t *axisptr) cdiInitKeys(&axisptr->keys); } +enum cdiApplyRet +cdiGridApply(enum cdiApplyRet (*func)(int id, void *res, void *data), void *data) +{ + return cdiResHFilterApply(&gridOps, func, data); +} + void grid_init(grid_t *gridptr) { @@ -156,7 +165,8 @@ grid_init(grid_t *gridptr) gridptr->atts.nelems = 0; cdiDefVarKeyInt(&gridptr->keys, CDI_KEY_DATATYPE, CDI_DATATYPE_FLT64); - cdiDefVarKeyInt(&gridptr->keys, CDI_KEY_SCANNINGMODE, 64); + + gridptr->extraData = NULL; } static void @@ -171,12 +181,12 @@ grid_free_components(grid_t *gridptr) for (size_t i = 0; i < sizeof(p2free) / sizeof(p2free[0]); ++i) if (p2free[i]) Free(p2free[i]); + cdiDeleteVarKeys(&(gridptr->x.keys)); + cdiDeleteVarKeys(&(gridptr->y.keys)); + cdiDeleteVarKeys(&(gridptr->keys)); /* int gridID = gridptr->self; - cdiDeleteKeys(gridID, CDI_XAXIS); - cdiDeleteKeys(gridID, CDI_YAXIS); - cdiDeleteKeys(gridID, CDI_GLOBAL); - cdiDeleteAtts(gridID, CDI_GLOBAL); + if (gridID != CDI_UNDEFID) cdiDeleteAtts(gridID, CDI_GLOBAL); */ } @@ -213,9 +223,6 @@ gridInit(void) static bool gridInitialized = false; if (gridInitialized) return; gridInitialized = true; - - const char *env = getenv("GRID_DEBUG"); - if (env) GRID_Debug = atoi(env); } static void @@ -260,11 +267,11 @@ cdiGridTypeInit(grid_t *gridptr, int gridtype, size_t size) gridptr->size = size; // clang-format off - if ( gridtype == GRID_LONLAT ) gridptr->nvertex = 2; - else if ( gridtype == GRID_GAUSSIAN ) gridptr->nvertex = 2; - else if ( gridtype == GRID_GAUSSIAN_REDUCED ) gridptr->nvertex = 2; - else if ( gridtype == GRID_CURVILINEAR ) gridptr->nvertex = 4; - else if ( gridtype == GRID_UNSTRUCTURED ) gridptr->x.size = size; + if (gridtype == GRID_LONLAT) gridptr->nvertex = 2; + else if (gridtype == GRID_GAUSSIAN) gridptr->nvertex = 2; + else if (gridtype == GRID_GAUSSIAN_REDUCED) gridptr->nvertex = 2; + else if (gridtype == GRID_CURVILINEAR) gridptr->nvertex = 4; + else if (gridtype == GRID_UNSTRUCTURED) gridptr->x.size = size; // clang-format on switch (gridtype) @@ -355,7 +362,7 @@ calc_gaussgrid(double *restrict yvals, int ysize, double yfirst, double ylast) if (yfirst < ylast && yfirst > -90.0 && ylast < 90.0) { - const int yhsize = ysize / 2; + int yhsize = ysize / 2; for (int i = 0; i < yhsize; i++) { const double ytmp = yvals[i]; @@ -516,7 +523,7 @@ gridCreate(int gridtype, SizeType size) grid_t *gridptr = gridNewEntry(CDI_UNDEFID); if (!gridptr) Error("No memory"); - const int gridID = gridptr->self; + int gridID = gridptr->self; if (CDI_Debug) Message("gridID: %d", gridID); @@ -530,12 +537,8 @@ gridDestroyKernel(grid_t *gridptr) { xassert(gridptr); - const int id = gridptr->self; - grid_free_components(gridptr); Free(gridptr); - - reshRemove(id, &gridOps); } /* @@ -551,11 +554,9 @@ gridDestroyKernel(grid_t *gridptr) void gridDestroy(int gridID) { - // cdiDeleteKeys(gridID, CDI_GLOBAL); - // cdiDeleteAtts(gridID, CDI_GLOBAL); - grid_t *gridptr = grid_to_pointer(gridID); gridptr->vtable->destroy(gridptr); + reshRemove(gridID, &gridOps); } static void @@ -567,7 +568,7 @@ gridDestroyP(void *gridptr) const char * gridNamePtr(int gridtype) { - const int size = (int) (sizeof(Grids) / sizeof(Grids[0])); + int size = (int) (sizeof(Grids) / sizeof(Grids[0])); const char *name = (gridtype >= 0 && gridtype < size) ? Grids[gridtype] : Grids[GRID_GENERIC]; @@ -893,12 +894,12 @@ gridInqProjType(int gridID) if (gmapname[0]) { // clang-format off - if (strIsEqual(gmapname, "rotated_latitude_longitude")) projtype = CDI_PROJ_RLL; - else if (strIsEqual(gmapname, "lambert_azimuthal_equal_area")) projtype = CDI_PROJ_LAEA; - else if (strIsEqual(gmapname, "lambert_conformal_conic")) projtype = CDI_PROJ_LCC; - else if (strIsEqual(gmapname, "sinusoidal")) projtype = CDI_PROJ_SINU; - else if (strIsEqual(gmapname, "polar_stereographic")) projtype = CDI_PROJ_STERE; - else if (strIsEqual(gmapname, "healpix")) projtype = CDI_PROJ_HEALPIX; + if (str_is_equal(gmapname, "rotated_latitude_longitude")) projtype = CDI_PROJ_RLL; + else if (str_is_equal(gmapname, "lambert_azimuthal_equal_area")) projtype = CDI_PROJ_LAEA; + else if (str_is_equal(gmapname, "lambert_conformal_conic")) projtype = CDI_PROJ_LCC; + else if (str_is_equal(gmapname, "sinusoidal")) projtype = CDI_PROJ_SINU; + else if (str_is_equal(gmapname, "polar_stereographic")) projtype = CDI_PROJ_STERE; + else if (str_is_equal(gmapname, "healpix")) projtype = CDI_PROJ_HEALPIX; // clang-format on gridptr->projtype = projtype; } @@ -912,7 +913,7 @@ gridVerifyProj(int gridID) { grid_t *gridptr = grid_to_pointer(gridID); - const int projtype = gridInqProjType(gridID); + int projtype = gridInqProjType(gridID); if (projtype == CDI_PROJ_RLL) { gridaxisSetKey(&gridptr->x, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_grid_latlon][0]); @@ -1052,10 +1053,10 @@ gridDefXsize(int gridID, SizeType xsize) { grid_t *gridptr = grid_to_pointer(gridID); - const size_t gridSize = gridInqSize(gridID); + size_t gridSize = gridInqSize(gridID); if ((size_t) xsize > gridSize) Error("xsize %zu is greater then gridsize %zu", (size_t) xsize, gridSize); - const int gridType = gridInqType(gridID); + int gridType = gridInqType(gridID); if (gridType == GRID_UNSTRUCTURED && (size_t) xsize != gridSize) Error("xsize %zu must be equal to gridsize %zu for gridtype: %s", (size_t) xsize, gridSize, gridNamePtr(gridType)); if (gridType == GRID_GAUSSIAN_REDUCED && xsize != 2 && (size_t) xsize != gridSize) @@ -1069,7 +1070,7 @@ gridDefXsize(int gridID, SizeType xsize) if (gridType != GRID_UNSTRUCTURED && gridType != GRID_GAUSSIAN_REDUCED && gridType != GRID_PROJECTION) { - const size_t axisproduct = gridptr->x.size * gridptr->y.size; + size_t axisproduct = gridptr->x.size * gridptr->y.size; if (axisproduct > 0 && axisproduct != gridSize) Error("Inconsistent grid declaration! (xsize=%zu ysize=%zu gridsize=%zu)", gridptr->x.size, gridptr->y.size, gridSize); } @@ -1131,11 +1132,11 @@ gridDefYsize(int gridID, SizeType ysize) { grid_t *gridptr = grid_to_pointer(gridID); - const size_t gridSize = gridInqSize(gridID); + size_t gridSize = gridInqSize(gridID); if ((size_t) ysize > gridSize) Error("ysize %zu is greater then gridsize %zu", (size_t) ysize, gridSize); - const int gridType = gridInqType(gridID); + int gridType = gridInqType(gridID); if (gridType == GRID_UNSTRUCTURED && (size_t) ysize != gridSize) Error("ysize %zu must be equal gridsize %zu for gridtype: %s", gridNamePtr(gridType), (size_t) ysize, gridSize); @@ -1147,7 +1148,7 @@ gridDefYsize(int gridID, SizeType ysize) if (gridType != GRID_UNSTRUCTURED && gridType != GRID_GAUSSIAN_REDUCED && gridType != GRID_PROJECTION) { - const size_t axisproduct = gridptr->x.size * gridptr->y.size; + size_t axisproduct = gridptr->x.size * gridptr->y.size; if (axisproduct > 0 && axisproduct != gridSize) Error("Inconsistent grid declaration! (xsize=%zu ysize=%zu gridsize=%zu)", gridptr->x.size, gridptr->y.size, gridSize); } @@ -1303,7 +1304,7 @@ gridInqMask(int gridID, int *mask) static void gridDefMaskSerial(grid_t *gridptr, const int *mask) { - const size_t size = gridptr->size; + size_t size = gridptr->size; if (size == 0) Error("Size undefined for gridID = %d", gridptr->self); if (mask == NULL) @@ -1349,7 +1350,7 @@ gridInqMaskGME(int gridID, int *mask) static void gridDefMaskGMESerial(grid_t *gridptr, const int *mask) { - const size_t size = gridptr->size; + size_t size = gridptr->size; if (size == 0) Error("Size undefined for gridID = %d", gridptr->self); if (gridptr->mask_gme == NULL) @@ -1380,8 +1381,8 @@ copy_darray(size_t n, const double *restrict in, double *restrict out) static SizeType gridInqXValsSerial(grid_t *gridptr, double *xvals) { - const int gridtype = gridptr->type; - size_t size = (gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED) ? gridptr->size : gridptr->x.size; + int gridtype = gridptr->type; + size_t size = grid_is_irregular(gridtype) ? gridptr->size : gridptr->x.size; if (CDI_Debug && size == 0) Warning("size undefined for gridID = %d", gridptr->self); @@ -1402,8 +1403,8 @@ gridInqXValsSerial(grid_t *gridptr, double *xvals) static SizeType gridInqXValsPartSerial(grid_t *gridptr, int start, SizeType length, double *xvals) { - const int gridtype = gridptr->type; - size_t size = (gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED) ? gridptr->size : gridptr->x.size; + int gridtype = gridptr->type; + size_t size = grid_is_irregular(gridtype) ? gridptr->size : gridptr->x.size; if (CDI_Debug && size == 0) Warning("size undefined for gridID = %d", gridptr->self); @@ -1427,7 +1428,7 @@ gridInqXCvalsSerial(grid_t *gridptr, char **xcvals) { if (gridptr->type != GRID_CHARXY) Error("Function only valid for grid type 'GRID_CHARXY'."); - const size_t size = gridptr->x.size; + size_t size = gridptr->x.size; size_t maxclength = 0; const char **gridptr_xcvals = gridptr->vtable->inqXCvalsPtr(gridptr); @@ -1510,8 +1511,8 @@ gridInqXIsc(int gridID) static void gridDefXValsSerial(grid_t *gridptr, const double *xvals) { - const int gridtype = gridptr->type; - const size_t size = (gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED) ? gridptr->size : gridptr->x.size; + int gridtype = gridptr->type; + size_t size = grid_is_irregular(gridtype) ? gridptr->size : gridptr->x.size; if (size == 0) Error("Size undefined for gridID = %d", gridptr->self); @@ -1526,7 +1527,7 @@ gridInqYCvalsSerial(grid_t *gridptr, char **ycvals) { if (gridptr->type != GRID_CHARXY) Error("Function only valid for grid type 'GRID_CHARXY'."); - const size_t size = gridptr->y.size; + size_t size = gridptr->y.size; size_t maxclength = 0; const char **gridptr_ycvals = gridptr->vtable->inqYCvalsPtr(gridptr); @@ -1572,8 +1573,8 @@ gridDefXvals(int gridID, const double *xvals) static SizeType gridInqYValsSerial(grid_t *gridptr, double *yvals) { - const int gridtype = gridptr->type; - size_t size = (gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED) ? gridptr->size : gridptr->y.size; + int gridtype = gridptr->type; + size_t size = grid_is_irregular(gridtype) ? gridptr->size : gridptr->y.size; if (CDI_Debug && size == 0) Warning("size undefined for gridID = %d!", gridptr->self); @@ -1594,8 +1595,8 @@ gridInqYValsSerial(grid_t *gridptr, double *yvals) static SizeType gridInqYValsPartSerial(grid_t *gridptr, int start, SizeType length, double *yvals) { - const int gridtype = gridptr->type; - size_t size = (gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED) ? gridptr->size : gridptr->y.size; + int gridtype = gridptr->type; + size_t size = grid_is_irregular(gridtype) ? gridptr->size : gridptr->y.size; if (CDI_Debug && size == 0) Warning("size undefined for gridID = %d!", gridptr->self); @@ -1672,8 +1673,8 @@ gridInqYIsc(int gridID) static void gridDefYValsSerial(grid_t *gridptr, const double *yvals) { - const int gridtype = gridptr->type; - const size_t size = (gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED) ? gridptr->size : gridptr->y.size; + int gridtype = gridptr->type; + size_t size = grid_is_irregular(gridtype) ? gridptr->size : gridptr->y.size; if (size == 0) Error("Size undefined for gridID = %d!", gridptr->self); @@ -1775,26 +1776,17 @@ grid_calc_increment_in_meter(SizeType size, const double *vals) return 0.0; } -/* -@Function -@Title - -@Prototype -@Parameter - @Item Grid identifier - -@EndFunction -*/ -double -gridInqXinc(int gridID) +static double +gridInqXIncBase(grid_t *gridptr) { - grid_t *gridptr = grid_to_pointer(gridID); - const double *xvals = gridptr->vtable->inqXValsPtr(gridptr); - - if (fabs(gridptr->x.inc) <= 0 && xvals) + if (fabs(gridptr->x.inc) <= 0 && gridptr->x.vals) { - const size_t xsize = gridptr->x.size; - if (xsize > 1) gridptr->x.inc = grid_calc_increment(xsize, xvals); + size_t xsize = gridptr->x.size; + if (xsize > 1) + { + const double *xvals = gridptr->vtable->inqXValsPtr(gridptr); + gridptr->x.inc = grid_calc_increment(xsize, xvals); + } } return gridptr->x.inc; @@ -1808,7 +1800,7 @@ gridInqXincInMeter(int gridID) if (fabs(gridptr->x.inc) <= 0 && xvals) { - const size_t xsize = gridptr->x.size; + size_t xsize = gridptr->x.size; if (xsize > 1) gridptr->x.inc = grid_calc_increment_in_meter(xsize, xvals); } @@ -1826,15 +1818,23 @@ gridInqXincInMeter(int gridID) @EndFunction */ double -gridInqYinc(int gridID) +gridInqXinc(int gridID) { grid_t *gridptr = grid_to_pointer(gridID); - const double *yvals = gridptr->vtable->inqYValsPtr(gridptr); + return gridptr->vtable->inqXInc(gridptr); +} - if (fabs(gridptr->y.inc) <= 0 && yvals) +static double +gridInqYIncBase(grid_t *gridptr) +{ + if (fabs(gridptr->y.inc) <= 0 && gridptr->y.vals) { - const size_t ysize = gridptr->y.size; - if (ysize > 1) gridptr->y.inc = grid_calc_increment(ysize, yvals); + size_t ysize = gridptr->y.size; + if (ysize > 1) + { + const double *yvals = gridptr->vtable->inqYValsPtr(gridptr); + gridptr->y.inc = grid_calc_increment(ysize, yvals); + } } return gridptr->y.inc; @@ -1848,7 +1848,7 @@ gridInqYincInMeter(int gridID) if (fabs(gridptr->y.inc) <= 0 && yvals) { - const size_t ysize = gridptr->y.size; + size_t ysize = gridptr->y.size; if (ysize > 1) gridptr->y.inc = grid_calc_increment_in_meter(ysize, yvals); } @@ -1859,6 +1859,23 @@ gridInqYincInMeter(int gridID) @Function @Title +@Prototype +@Parameter + @Item Grid identifier + +@EndFunction +*/ +double +gridInqYinc(int gridID) +{ + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqYInc(gridptr); +} + +/* +@Function +@Title + @Prototype @Parameter @Item Grid identifier @@ -1872,31 +1889,31 @@ gridInqParamRLL(int gridID, double *xpole, double *ypole, double *angle) *ypole = 0; *angle = 0; - const char *projection = "rotated_latitude_longitude"; - char gmapname[CDI_MAX_NAME]; + static const char projection[] = "rotated_latitude_longitude"; + char name[CDI_MAX_NAME + 1]; int length = CDI_MAX_NAME; - cdiInqKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_NAME, gmapname, &length); - if (gmapname[0] && strIsEqual(gmapname, projection)) + cdiInqKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_NAME, name, &length); + if (name[0] && str_is_equal(name, projection)) { int atttype, attlen; - char attname[CDI_MAX_NAME + 1]; - int natts; + int natts, nfound = 0; cdiInqNatts(gridID, CDI_GLOBAL, &natts); for (int iatt = 0; iatt < natts; ++iatt) { - cdiInqAtt(gridID, CDI_GLOBAL, iatt, attname, &atttype, &attlen); - if (attlen != 1) continue; - - double attflt; - if (cdiInqAttConvertedToFloat(gridID, atttype, attname, attlen, &attflt)) + cdiInqAtt(gridID, CDI_GLOBAL, iatt, name, &atttype, &attlen); + if (attlen == 1) { + double *attflt; // clang-format off - if (strIsEqual(attname, "grid_north_pole_longitude")) *xpole = attflt; - else if (strIsEqual(attname, "grid_north_pole_latitude") ) *ypole = attflt; - else if (strIsEqual(attname, "north_pole_grid_longitude")) *angle = attflt; + if (str_is_equal(name, "grid_north_pole_longitude")) attflt = xpole; + else if (str_is_equal(name, "grid_north_pole_latitude") ) attflt = ypole; + else if (str_is_equal(name, "north_pole_grid_longitude")) attflt = angle; + else continue; // clang-format on + bool valid = cdiInqAttConvertedToFloat(gridID, atttype, name, attlen, attflt); + if ((nfound += valid) == 3) return; } } } @@ -2119,10 +2136,10 @@ static bool compareXYvals(grid_t *gridRef, grid_t *gridTest) { bool differ = false; - const int gridtype = gridTest->type; + int gridtype = gridTest->type; - const size_t xsizeTest = (gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED) ? gridTest->size : gridTest->x.size; - const size_t xsizeRef = (size_t) gridRef->vtable->inqXVals(gridRef, NULL); + size_t xsizeTest = grid_is_irregular(gridtype) ? gridTest->size : gridTest->x.size; + size_t xsizeRef = (size_t) gridRef->vtable->inqXVals(gridRef, NULL); if (xsizeTest != xsizeRef) return true; if (xsizeTest > 0) @@ -2135,8 +2152,8 @@ compareXYvals(grid_t *gridRef, grid_t *gridTest) if (fabs(xvalsTest[i] - xvalsRef[i]) > 1.e-10) return true; } - const size_t ysizeTest = (gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED) ? gridTest->size : gridTest->y.size; - const size_t ysizeRef = (size_t) gridRef->vtable->inqYVals(gridRef, NULL); + size_t ysizeTest = grid_is_irregular(gridtype) ? gridTest->size : gridTest->y.size; + size_t ysizeRef = (size_t) gridRef->vtable->inqYVals(gridRef, NULL); if (ysizeTest != ysizeRef) return true; if (ysizeTest > 0) @@ -2155,7 +2172,7 @@ compareXYvals(grid_t *gridRef, grid_t *gridTest) static bool compareXYvals2(grid_t *gridRef, grid_t *gridTest) { - const size_t gridsize = gridTest->size; + size_t gridsize = gridTest->size; bool differ = ((gridTest->x.vals == NULL) ^ (gridRef->x.vals == NULL)) || ((gridTest->y.vals == NULL) ^ (gridRef->y.vals == NULL)) || ((gridTest->x.bounds == NULL) ^ (gridRef->x.bounds == NULL)) || ((gridTest->y.bounds == NULL) ^ (gridRef->y.bounds == NULL)); @@ -2249,8 +2266,8 @@ compare_projection(int gridID, const grid_t *grid, const grid_t *gridRef) // printf(">%s< >%s<\n", cdiInqVarKeyString(&grid->keys, CDI_KEY_GRIDMAP_VARNAME), cdiInqVarKeyString(&gridRef->keys, // CDI_KEY_GRIDMAP_VARNAME)); printf(">%s< >%s<\n", cdiInqVarKeyString(&grid->keys, CDI_KEY_GRIDMAP_NAME), // cdiInqVarKeyString(&gridRef->keys, CDI_KEY_GRIDMAP_NAME)); - // if (strcmp(cdiInqVarKeyString(&grid->keys, CDI_KEY_GRIDMAP_VARNAME), cdiInqVarKeyString(&gridRef->keys, - // CDI_KEY_GRIDMAP_VARNAME))) return true; if (strcmp(cdiInqVarKeyString(&grid->keys, CDI_KEY_GRIDMAP_NAME), + // if (!str_is_equal(cdiInqVarKeyString(&grid->keys, CDI_KEY_GRIDMAP_VARNAME), cdiInqVarKeyString(&gridRef->keys, + // CDI_KEY_GRIDMAP_VARNAME))) return true; if (!str_is_equal(cdiInqVarKeyString(&grid->keys, CDI_KEY_GRIDMAP_NAME), // cdiInqVarKeyString(&gridRef->keys, CDI_KEY_GRIDMAP_NAME))) return true; } @@ -2345,10 +2362,10 @@ compare_unstructured(const grid_t *grid, const grid_t *gridRef, bool compareCoor differ = ((!cdiUUIDIsNull(uuid1) || !cdiUUIDIsNull(uuid2)) && memcmp(uuid1, uuid2, CDI_UUID_SIZE)); if (!differ) { - const int numberA = cdiInqVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDUSED); - const int numberB = cdiInqVarKeyInt(&gridRef->keys, CDI_KEY_NUMBEROFGRIDUSED); - const int positionA = cdiInqVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDINREFERENCE); - const int positionB = cdiInqVarKeyInt(&gridRef->keys, CDI_KEY_NUMBEROFGRIDINREFERENCE); + int numberA = cdiInqVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDUSED); + int numberB = cdiInqVarKeyInt(&gridRef->keys, CDI_KEY_NUMBEROFGRIDUSED); + int positionA = cdiInqVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDINREFERENCE); + int positionB = cdiInqVarKeyInt(&gridRef->keys, CDI_KEY_NUMBEROFGRIDINREFERENCE); if (compareCoord) { differ = (grid->nvertex != gridRef->nvertex || (numberA > 0 && positionA != positionB) @@ -2358,7 +2375,7 @@ compare_unstructured(const grid_t *grid, const grid_t *gridRef, bool compareCoor { if (((grid->x.vals == NULL) ^ (gridRef->x.vals == NULL)) && ((grid->y.vals == NULL) ^ (gridRef->y.vals == NULL))) { - const int nvertexA = grid->nvertex, nvertexB = gridRef->nvertex; + int nvertexA = grid->nvertex, nvertexB = gridRef->nvertex; differ = (nvertexA && nvertexB && (nvertexA != nvertexB)) || ((numberA && numberB && (numberA != numberB)) || (numberA && numberB && positionA != positionB)); } @@ -2411,8 +2428,8 @@ gridCompare(int gridID, const grid_t *grid, bool compareCoord) } } - const int scanningModeA = cdiInqVarKeyInt(&grid->keys, CDI_KEY_SCANNINGMODE); - const int scanningModeB = cdiInqVarKeyInt(&gridRef->keys, CDI_KEY_SCANNINGMODE); + int scanningModeA = cdiInqVarKeyInt(&grid->keys, CDI_KEY_SCANNINGMODE); + int scanningModeB = cdiInqVarKeyInt(&gridRef->keys, CDI_KEY_SCANNINGMODE); if (scanningModeA != scanningModeB) { // often grid definition may differ in UV-relativeToGrid @@ -2430,8 +2447,8 @@ gridCompare(int gridID, const grid_t *grid, bool compareCoord) int cmp_key_int(const cdi_keys_t *keysp1, const cdi_keys_t *keysp2, int key) { - const int v1 = cdiInqVarKeyInt(keysp1, key); - const int v2 = cdiInqVarKeyInt(keysp2, key); + int v1 = cdiInqVarKeyInt(keysp1, key); + int v2 = cdiInqVarKeyInt(keysp2, key); return (v1 != v2); } @@ -2445,7 +2462,6 @@ gridCompareP(void *gridptr1, void *gridptr2) equal = 0, differ = -1 }; - size_t size; xassert(g1); xassert(g2); @@ -2477,91 +2493,86 @@ gridCompareP(void *gridptr1, void *gridptr2) if (IS_NOT_EQUAL(g1->y.inc, g2->y.inc)) return differ; if (cmp_key_int(&g1->keys, &g2->keys, CDI_KEY_SCANNINGMODE)) return differ; - const double *restrict g1_xvals = g1->vtable->inqXValsPtr(g1), *restrict g2_xvals = g2->vtable->inqXValsPtr(g2); - if (g1_xvals) - { - size = (g1->type == GRID_UNSTRUCTURED || g1->type == GRID_CURVILINEAR) ? g1->size : g1->x.size; - xassert(size); - - if (!g2_xvals) return differ; - - for (size_t i = 0; i < size; ++i) - if (IS_NOT_EQUAL(g1_xvals[i], g2_xvals[i])) return differ; - } - else if (g2_xvals) - return differ; - - const double *restrict g1_yvals = g1->vtable->inqYValsPtr(g1), *restrict g2_yvals = g2->vtable->inqYValsPtr(g2); - if (g1_yvals) - { - size = (g1->type == GRID_UNSTRUCTURED || g1->type == GRID_CURVILINEAR) ? g1->size : g1->y.size; - xassert(size); - - if (!g2_yvals) return differ; - - for (size_t i = 0; i < size; ++i) - if (IS_NOT_EQUAL(g1_yvals[i], g2_yvals[i])) return differ; - } - else if (g2_yvals) - return differ; + bool isIrregular = grid_is_irregular(g1->type); + { + const double *restrict g1_xvals = g1->vtable->inqXValsPtr(g1), *restrict g2_xvals = g2->vtable->inqXValsPtr(g2); + if ((g1_xvals != NULL) ^ (g2_xvals != NULL)) return differ; + if (g1_xvals) + { + size_t size = isIrregular ? g1->size : g1->x.size; + xassert(size); + for (size_t i = 0; i < size; i++) + if (IS_NOT_EQUAL(g1_xvals[i], g2_xvals[i])) return differ; + } + } - const double *restrict g1_area = g1->vtable->inqAreaPtr(g1), *restrict g2_area = g2->vtable->inqAreaPtr(g2); - if (g1_area) - { - xassert(g1->size); + { + const double *restrict g1_yvals = g1->vtable->inqYValsPtr(g1), *restrict g2_yvals = g2->vtable->inqYValsPtr(g2); + if ((g1_yvals != NULL) ^ (g2_yvals != NULL)) return differ; + if (g1_yvals) + { + size_t size = isIrregular ? g1->size : g1->y.size; + xassert(size); + for (size_t i = 0; i < size; i++) + if (IS_NOT_EQUAL(g1_yvals[i], g2_yvals[i])) return differ; + } + } - if (!g2_area) return differ; + { + const double *restrict g1_area = g1->vtable->inqAreaPtr(g1), *restrict g2_area = g2->vtable->inqAreaPtr(g2); + if ((g1_area != NULL) ^ (g2_area != NULL)) return differ; + if (g1_area) + { + size_t size = g1->size; + xassert(size); - for (size_t i = 0; i < g1->size; ++i) - if (IS_NOT_EQUAL(g1_area[i], g2_area[i])) return differ; - } - else if (g2_area) - return differ; + for (size_t i = 0; i < size; i++) + if (IS_NOT_EQUAL(g1_area[i], g2_area[i])) return differ; + } + } { - const double *restrict g1_xbounds, *restrict g2_xbounds; - if ((g1_xbounds = g1->vtable->inqXBoundsPtr(g1))) + const double *restrict g1_xbounds = g1->vtable->inqXBoundsPtr(g1), *restrict g2_xbounds = g2->vtable->inqXBoundsPtr(g2); + if ((g1_xbounds != NULL) ^ (g2_xbounds != NULL)) return differ; + if (g1_xbounds) { xassert(g1->nvertex); - size = (g1->type == GRID_CURVILINEAR || g1->type == GRID_UNSTRUCTURED) ? g1->nvertex * g1->size : g1->nvertex * g1->x.size; + size_t size = g1->nvertex * (isIrregular ? g1->size : g1->x.size); xassert(size); - if (!(g2_xbounds = g2->vtable->inqXBoundsPtr(g2))) return differ; - - for (size_t i = 0; i < size; ++i) + for (size_t i = 0; i < size; i++) if (IS_NOT_EQUAL(g1_xbounds[i], g2_xbounds[i])) return differ; } - else if (g2->vtable->inqXBoundsPtr(g2)) - return differ; } { - const double *restrict g1_ybounds, *restrict g2_ybounds; - if ((g1_ybounds = g1->vtable->inqYBoundsPtr(g1))) + const double *restrict g1_ybounds = g1->vtable->inqYBoundsPtr(g1), *restrict g2_ybounds = g2->vtable->inqYBoundsPtr(g2); + if ((g1_ybounds != NULL) ^ (g2_ybounds != NULL)) return differ; + if (g1_ybounds) { xassert(g1->nvertex); - size = (g1->type == GRID_CURVILINEAR || g1->type == GRID_UNSTRUCTURED) ? g1->nvertex * g1->size : g1->nvertex * g1->y.size; + size_t size = g1->nvertex * (isIrregular ? g1->size : g1->y.size); xassert(size); - if (!(g2_ybounds = g2->vtable->inqYBoundsPtr(g2))) return differ; - - for (size_t i = 0; i < size; ++i) - if (IS_NOT_EQUAL(g1->y.bounds[i], g2->y.bounds[i])) return differ; + for (size_t i = 0; i < size; i++) + if (IS_NOT_EQUAL(g1_ybounds[i], g2_ybounds[i])) return differ; } - else if (g2->vtable->inqYBoundsPtr(g2)) - return differ; } - if (strcmp(cdiInqVarKeyString(&g1->x.keys, CDI_KEY_NAME), cdiInqVarKeyString(&g2->x.keys, CDI_KEY_NAME))) return differ; - if (strcmp(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_NAME), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_NAME))) return differ; - if (strcmp(cdiInqVarKeyString(&g1->x.keys, CDI_KEY_LONGNAME), cdiInqVarKeyString(&g2->x.keys, CDI_KEY_LONGNAME))) return differ; - if (strcmp(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_LONGNAME), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_LONGNAME))) return differ; - if (strcmp(cdiInqVarKeyString(&g1->x.keys, CDI_KEY_UNITS), cdiInqVarKeyString(&g2->x.keys, CDI_KEY_UNITS))) return differ; - if (strcmp(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_UNITS), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_UNITS))) return differ; - if (strcmp(cdiInqVarKeyString(&g1->x.keys, CDI_KEY_STDNAME), cdiInqVarKeyString(&g2->x.keys, CDI_KEY_STDNAME))) return differ; - if (strcmp(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_STDNAME), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_STDNAME))) return differ; + if (!str_is_equal(cdiInqVarKeyString(&g1->x.keys, CDI_KEY_NAME), cdiInqVarKeyString(&g2->x.keys, CDI_KEY_NAME))) return differ; + if (!str_is_equal(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_NAME), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_NAME))) return differ; + if (!str_is_equal(cdiInqVarKeyString(&g1->x.keys, CDI_KEY_LONGNAME), cdiInqVarKeyString(&g2->x.keys, CDI_KEY_LONGNAME))) + return differ; + if (!str_is_equal(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_LONGNAME), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_LONGNAME))) + return differ; + if (!str_is_equal(cdiInqVarKeyString(&g1->x.keys, CDI_KEY_UNITS), cdiInqVarKeyString(&g2->x.keys, CDI_KEY_UNITS))) return differ; + if (!str_is_equal(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_UNITS), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_UNITS))) return differ; + if (!str_is_equal(cdiInqVarKeyString(&g1->x.keys, CDI_KEY_STDNAME), cdiInqVarKeyString(&g2->x.keys, CDI_KEY_STDNAME))) + return differ; + if (!str_is_equal(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_STDNAME), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_STDNAME))) + return differ; - if (strcmp(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_REFERENCEURI), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_REFERENCEURI))) + if (!str_is_equal(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_REFERENCEURI), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_REFERENCEURI))) return differ; if (g1->mask) @@ -2596,11 +2607,11 @@ gridCompareP(void *gridptr1, void *gridptr2) static void grid_complete(grid_t *grid) { - const int gridID = grid->self; + int gridID = grid->self; if (grid->datatype != CDI_UNDEFID) cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_DATATYPE, grid->datatype); - const int gridtype = grid->type; + int gridtype = grid->type; switch (gridtype) { case GRID_LONLAT: @@ -2795,7 +2806,7 @@ grid_copy_base_array_fields(grid_t *gridptrOrig, grid_t *gridptrDup) size_t reducedPointsSize = (SizeType) gridptrOrig->reducedPointsSize; size_t gridsize = gridptrOrig->size; int gridtype = gridptrOrig->type; - int irregular = gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED; + bool isIrregular = grid_is_irregular(gridtype); if (reducedPointsSize) { gridptrDup->reducedPoints = (int *) Malloc(reducedPointsSize * sizeof(int)); @@ -2804,28 +2815,28 @@ grid_copy_base_array_fields(grid_t *gridptrOrig, grid_t *gridptrDup) if (gridptrOrig->x.vals != NULL) { - size_t size = irregular ? gridsize : gridptrOrig->x.size; + size_t size = isIrregular ? gridsize : gridptrOrig->x.size; gridptrDup->x.vals = (double *) Malloc(size * sizeof(double)); memcpy(gridptrDup->x.vals, gridptrOrig->x.vals, size * sizeof(double)); } if (gridptrOrig->y.vals != NULL) { - size_t size = irregular ? gridsize : gridptrOrig->y.size; + size_t size = isIrregular ? gridsize : gridptrOrig->y.size; gridptrDup->y.vals = (double *) Malloc(size * sizeof(double)); memcpy(gridptrDup->y.vals, gridptrOrig->y.vals, size * sizeof(double)); } if (gridptrOrig->x.bounds != NULL) { - size_t size = (irregular ? gridsize : gridptrOrig->x.size) * gridptrOrig->nvertex; + size_t size = (isIrregular ? gridsize : gridptrOrig->x.size) * gridptrOrig->nvertex; gridptrDup->x.bounds = (double *) Malloc(size * sizeof(double)); memcpy(gridptrDup->x.bounds, gridptrOrig->x.bounds, size * sizeof(double)); } if (gridptrOrig->y.bounds != NULL) { - size_t size = (irregular ? gridsize : gridptrOrig->y.size) * gridptrOrig->nvertex; + size_t size = (isIrregular ? gridsize : gridptrOrig->y.size) * gridptrOrig->nvertex; gridptrDup->y.bounds = (double *) Malloc(size * sizeof(double)); memcpy(gridptrDup->y.bounds, gridptrOrig->y.bounds, size * sizeof(double)); } @@ -2978,16 +2989,34 @@ gridInqArea(int gridID, double *area) } static int -gridHasAreaBase(grid_t *gridptr) +gridInqPropPresenceBase(grid_t *gridptr, enum gridPropInq inq) +{ + bool present = false; + switch (inq) + { + case GRID_PROP_MASK: present = gridptr->mask != NULL; break; + case GRID_PROP_MASK_GME: present = gridptr->mask != NULL; break; + case GRID_PROP_AREA: present = gridptr->area != NULL; break; + case GRID_PROP_XVALS: present = gridptr->x.vals != NULL; break; + case GRID_PROP_YVALS: present = gridptr->y.vals != NULL; break; + case GRID_PROP_XBOUNDS: present = gridptr->x.bounds != NULL; break; + case GRID_PROP_YBOUNDS: present = gridptr->y.bounds != NULL; break; + } + return present; +} + +int +gridInqPropPresence(int gridID, enum gridPropInq inq) { - return gridptr->area != NULL; + grid_t *gridptr = grid_to_pointer(gridID); + return gridptr->vtable->inqPropPresence(gridptr, inq); } int gridHasArea(int gridID) { grid_t *gridptr = grid_to_pointer(gridID); - return gridptr->vtable->hasArea(gridptr); + return gridptr->vtable->inqPropPresence(gridptr, GRID_PROP_AREA); } static const double * @@ -3024,15 +3053,15 @@ gridInqNvertex(int gridID) static void gridDefBoundsGeneric(grid_t *gridptr, const double *bounds, size_t regularSize, double **field) { - const int irregular = gridptr->type == GRID_CURVILINEAR || gridptr->type == GRID_UNSTRUCTURED; - const size_t nvertex = (size_t) gridptr->nvertex; + bool isIrregular = grid_is_irregular(gridptr->type); + size_t nvertex = (size_t) gridptr->nvertex; if (nvertex == 0) { Warning("nvertex undefined for gridID = %d. Cannot define bounds!", gridptr->self); return; } - const size_t size = nvertex * (irregular ? gridptr->size : regularSize); + size_t size = nvertex * (isIrregular ? gridptr->size : regularSize); if (size == 0) Error("size undefined for gridID = %d", gridptr->self); if (*field == NULL && size) @@ -3074,15 +3103,18 @@ gridDefXbounds(int gridID, const double *xbounds) static SizeType gridInqXBoundsSerial(grid_t *gridptr, double *xbounds) { - const size_t nvertex = (size_t) gridptr->nvertex; + size_t nvertex = (size_t) gridptr->nvertex; - const int irregular = (gridptr->type == GRID_CURVILINEAR || gridptr->type == GRID_UNSTRUCTURED); - size_t size = nvertex * (irregular ? gridptr->size : gridptr->x.size); + bool isIrregular = grid_is_irregular(gridptr->type); + size_t size = nvertex * (isIrregular ? gridptr->size : gridptr->x.size); - const double *gridptr_xbounds = gridptr->vtable->inqXBoundsPtr(gridptr); - if (gridptr_xbounds) + if (gridptr->x.bounds) { - if (size && xbounds) copy_darray(size, gridptr_xbounds, xbounds); + if (size && xbounds) + { + const double *gridptr_xbounds = gridptr->vtable->inqXBoundsPtr(gridptr); + copy_darray(size, gridptr_xbounds, xbounds); + } } else size = 0; @@ -3185,15 +3217,18 @@ gridDefYbounds(int gridID, const double *ybounds) static SizeType gridInqYBoundsSerial(grid_t *gridptr, double *ybounds) { - const size_t nvertex = (size_t) gridptr->nvertex; + size_t nvertex = (size_t) gridptr->nvertex; - const int irregular = (gridptr->type == GRID_CURVILINEAR || gridptr->type == GRID_UNSTRUCTURED); - size_t size = nvertex * (irregular ? gridptr->size : gridptr->y.size); + bool isIrregular = grid_is_irregular(gridptr->type); + size_t size = nvertex * (isIrregular ? gridptr->size : gridptr->y.size); - const double *gridptr_ybounds = gridptr->vtable->inqYBoundsPtr(gridptr); - if (gridptr_ybounds) + if (gridptr->y.bounds) { - if (size && ybounds) copy_darray(size, gridptr_ybounds, ybounds); + if (size && ybounds) + { + const double *gridptr_ybounds = gridptr->vtable->inqYBoundsPtr(gridptr); + copy_darray(size, gridptr_ybounds, ybounds); + } } else size = 0; @@ -3365,7 +3400,7 @@ gridPrintKernel(int gridID, int opt, FILE *fp) if (attstr[0]) fprintf(fp, "xname = %s\n", attstr); length = CDI_MAX_NAME; cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_DIMNAME, attstr2, &length); - if (attstr2[0] && strcmp(attstr, attstr2)) fprintf(fp, "xdimname = %s\n", attstr2); + if (attstr2[0] && !str_is_equal(attstr, attstr2)) fprintf(fp, "xdimname = %s\n", attstr2); length = CDI_MAX_NAME; cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_LONGNAME, attstr, &length); if (attstr[0]) fprintf(fp, "xlongname = %s\n", attstr); @@ -3381,7 +3416,7 @@ gridPrintKernel(int gridID, int opt, FILE *fp) if (attstr[0]) fprintf(fp, "yname = %s\n", attstr); length = CDI_MAX_NAME; cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_DIMNAME, attstr2, &length); - if (attstr2[0] && strcmp(attstr, attstr2)) fprintf(fp, "ydimname = %s\n", attstr2); + if (attstr2[0] && !str_is_equal(attstr, attstr2)) fprintf(fp, "ydimname = %s\n", attstr2); length = CDI_MAX_NAME; cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_LONGNAME, attstr, &length); if (attstr[0]) fprintf(fp, "ylongname = %s\n", attstr); @@ -3710,7 +3745,7 @@ gridInqParamsLCC(int gridID, struct CDI_GridProjParams *gpp) char gmapname[CDI_MAX_NAME]; int length = CDI_MAX_NAME; cdiInqKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_NAME, gmapname, &length); - if (gmapname[0] && strIsEqual(gmapname, projection)) + if (gmapname[0] && str_is_equal(gmapname, projection)) { char attname[CDI_MAX_NAME + 1]; @@ -3729,17 +3764,17 @@ gridInqParamsLCC(int gridID, struct CDI_GridProjParams *gpp) if (cdiInqAttConvertedToFloat(gridID, atttype, attname, attlen, attflt)) { // clang-format off - if (strIsEqual(attname, "earth_radius")) gpp->a = attflt[0]; - else if (strIsEqual(attname, "semi_major_axis")) gpp->a = attflt[0]; - else if (strIsEqual(attname, "semi_minor_axis")) gpp->b = attflt[0]; - else if (strIsEqual(attname, "inverse_flattening")) gpp->rf = attflt[0]; - else if (strIsEqual(attname, "longitude_of_central_meridian")) gpp->lon_0 = attflt[0]; - else if (strIsEqual(attname, "latitude_of_projection_origin")) gpp->lat_0 = attflt[0]; - else if (strIsEqual(attname, "false_easting")) gpp->x_0 = attflt[0]; - else if (strIsEqual(attname, "false_northing")) gpp->y_0 = attflt[0]; - else if (strIsEqual(attname, "longitudeOfFirstGridPointInDegrees")) gpp->xval_0 = attflt[0]; - else if (strIsEqual(attname, "latitudeOfFirstGridPointInDegrees")) gpp->yval_0 = attflt[0]; - else if (strIsEqual(attname, "standard_parallel")) + if (str_is_equal(attname, "earth_radius")) gpp->a = attflt[0]; + else if (str_is_equal(attname, "semi_major_axis")) gpp->a = attflt[0]; + else if (str_is_equal(attname, "semi_minor_axis")) gpp->b = attflt[0]; + else if (str_is_equal(attname, "inverse_flattening")) gpp->rf = attflt[0]; + else if (str_is_equal(attname, "longitude_of_central_meridian")) gpp->lon_0 = attflt[0]; + else if (str_is_equal(attname, "latitude_of_projection_origin")) gpp->lat_0 = attflt[0]; + else if (str_is_equal(attname, "false_easting")) gpp->x_0 = attflt[0]; + else if (str_is_equal(attname, "false_northing")) gpp->y_0 = attflt[0]; + else if (str_is_equal(attname, "longitudeOfFirstGridPointInDegrees")) gpp->xval_0 = attflt[0]; + else if (str_is_equal(attname, "latitudeOfFirstGridPointInDegrees")) gpp->yval_0 = attflt[0]; + else if (str_is_equal(attname, "standard_parallel")) { gpp->lat_1 = attflt[0]; gpp->lat_2 = (attlen == 2) ? attflt[1] : attflt[0]; @@ -3874,7 +3909,7 @@ gridInqParamsSTERE(int gridID, struct CDI_GridProjParams *gpp) char gmapname[CDI_MAX_NAME]; int length = CDI_MAX_NAME; cdiInqKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_NAME, gmapname, &length); - if (gmapname[0] && strIsEqual(gmapname, projection)) + if (gmapname[0] && str_is_equal(gmapname, projection)) { int atttype, attlen; char attname[CDI_MAX_NAME + 1]; @@ -3893,17 +3928,17 @@ gridInqParamsSTERE(int gridID, struct CDI_GridProjParams *gpp) if (cdiInqAttConvertedToFloat(gridID, atttype, attname, attlen, attflt)) { // clang-format off - if (strIsEqual(attname, "earth_radius")) gpp->a = attflt[0]; - else if (strIsEqual(attname, "semi_major_axis")) gpp->a = attflt[0]; - else if (strIsEqual(attname, "semi_minor_axis")) gpp->b = attflt[0]; - else if (strIsEqual(attname, "inverse_flattening")) gpp->rf = attflt[0]; - else if (strIsEqual(attname, "standard_parallel")) gpp->lat_1 = attflt[0]; - else if (strIsEqual(attname, "straight_vertical_longitude_from_pole")) gpp->lon_0 = attflt[0]; - else if (strIsEqual(attname, "latitude_of_projection_origin")) gpp->lat_0 = attflt[0]; - else if (strIsEqual(attname, "false_easting")) gpp->x_0 = attflt[0]; - else if (strIsEqual(attname, "false_northing")) gpp->y_0 = attflt[0]; - else if (strIsEqual(attname, "longitudeOfFirstGridPointInDegrees")) gpp->xval_0 = attflt[0]; - else if (strIsEqual(attname, "latitudeOfFirstGridPointInDegrees")) gpp->yval_0 = attflt[0]; + if (str_is_equal(attname, "earth_radius")) gpp->a = attflt[0]; + else if (str_is_equal(attname, "semi_major_axis")) gpp->a = attflt[0]; + else if (str_is_equal(attname, "semi_minor_axis")) gpp->b = attflt[0]; + else if (str_is_equal(attname, "inverse_flattening")) gpp->rf = attflt[0]; + else if (str_is_equal(attname, "standard_parallel")) gpp->lat_1 = attflt[0]; + else if (str_is_equal(attname, "straight_vertical_longitude_from_pole")) gpp->lon_0 = attflt[0]; + else if (str_is_equal(attname, "latitude_of_projection_origin")) gpp->lat_0 = attflt[0]; + else if (str_is_equal(attname, "false_easting")) gpp->x_0 = attflt[0]; + else if (str_is_equal(attname, "false_northing")) gpp->y_0 = attflt[0]; + else if (str_is_equal(attname, "longitudeOfFirstGridPointInDegrees")) gpp->xval_0 = attflt[0]; + else if (str_is_equal(attname, "latitudeOfFirstGridPointInDegrees")) gpp->yval_0 = attflt[0]; // clang-format on } } @@ -3956,7 +3991,7 @@ gridInqHasDims(int gridID) @Function gridDefNumber @Title Define the reference number for an unstructured grid -@Prototype void gridDefNumber(int gridID, const int number) +@Prototype void gridDefNumber(int gridID, int number) @Parameter @Item gridID Grid ID, from a previous call to @fref{gridCreate}. @Item number Reference number for an unstructured grid. @@ -3999,7 +4034,7 @@ gridInqNumber(int gridID) @Function gridDefPosition @Title Define the position of grid in the reference file -@Prototype void gridDefPosition(int gridID, const int position) +@Prototype void gridDefPosition(int gridID, int position) @Parameter @Item gridID Grid ID, from a previous call to @fref{gridCreate}. @Item position Position of grid in the reference file. @@ -4141,9 +4176,10 @@ cdiGridGetIndexList(unsigned ngrids, int *gridIndexList) } static int -gridTxCode() +gridTxCode(void *voidP) { - return GRID; + grid_t *gridptr = (grid_t *) voidP; + return gridptr->vtable->txCode; } enum @@ -4159,15 +4195,15 @@ enum GRID_PACK_INT_IDX_GME_NI3, GRID_PACK_INT_IDX_TRUNC, GRID_PACK_INT_IDX_NVERTEX, - REDUCEDPOINTSSIZE, + GRID_PACK_INT_IDX_REDUCED_POINTS_SIZE, GRID_PACK_INT_IDX_SIZE, GRID_PACK_INT_IDX_X_SIZE, GRID_PACK_INT_IDX_Y_SIZE, GRID_PACK_INT_IDX_LCOMPLEX, GRID_PACK_INT_IDX_MEMBERMASK, + /* GRID_PACK_INT_IDX_XTSTDNNAME, GRID_PACK_INT_IDX_YTSTDNNAME, - /* GRID_PACK_INT_IDX_ISCANSNEGATIVELY, GRID_PACK_INT_IDX_JSCANSPOSITIVELY, GRID_PACK_INT_IDX_JPOINTSARECONSECUTIVE, @@ -4201,14 +4237,10 @@ enum static int gridGetComponentFlags(const grid_t *gridP) { - int flags = (gridHasMaskFlag & (int) ((unsigned) (gridP->mask == NULL) - 1U)) - | (gridHasGMEMaskFlag & (int) ((unsigned) (gridP->mask_gme == NULL) - 1U)) - | (gridHasXValsFlag & (int) ((unsigned) (gridP->vtable->inqXValsPtr((grid_t *) gridP) == NULL) - 1U)) - | (gridHasYValsFlag & (int) ((unsigned) (gridP->vtable->inqYValsPtr((grid_t *) gridP) == NULL) - 1U)) - | (gridHasAreaFlag & (int) ((unsigned) (gridP->vtable->inqAreaPtr((grid_t *) gridP) == NULL) - 1U)) - | (gridHasXBoundsFlag & (int) ((unsigned) (gridP->x.bounds == NULL) - 1U)) - | (gridHasYBoundsFlag & (int) ((unsigned) (gridP->y.bounds == NULL) - 1U)) - | (gridHasReducedPointsFlag & (int) ((unsigned) (gridP->reducedPoints == NULL) - 1U)); + int flags = 0; + for (int prop = 0; prop < GRID_PROP_YBOUNDS + 1; ++prop) + flags |= (gridP->vtable->inqPropPresence((grid_t *) gridP, (enum gridPropInq) prop) << prop); + flags |= (gridHasReducedPointsFlag & (int) ((unsigned) (gridP->reducedPoints == NULL) - 1U)); return flags; } @@ -4216,19 +4248,46 @@ static int gridGetPackSize(void *voidP, void *context) { grid_t *gridP = (grid_t *) voidP; - int packBuffSize = 0, count; + return gridP->vtable->getPackSize(gridP, context); +} + +static int gridGetPackSizeScalars(grid_t *gridP, void *context); - packBuffSize += serializeGetSize(gridNint, CDI_DATATYPE_INT, context) + serializeGetSize(1, CDI_DATATYPE_UINT32, context); +static int gridGetPackSizeArrays(grid_t *gridP, void *context); + +static int +gridGetPackSizeBase(grid_t *gridP, void *context) +{ + return gridP->vtable->getPackSizeScalars(gridP, context) + gridP->vtable->getPackSizeArrays(gridP, context); +} + +static int +gridGetPackSizeScalars(grid_t *gridP, void *context) +{ + int packBuffSize = 0, ui32PackSize = serializeGetSize(1, CDI_DATATYPE_UINT32, context); + + packBuffSize += serializeGetSize(gridNint, CDI_DATATYPE_INT, context) + ui32PackSize; + + packBuffSize += serializeGetSize(gridNdouble, CDI_DATATYPE_FLT64, context) + ui32PackSize; + + packBuffSize += serializeKeysGetPackSize(&gridP->keys, context); + packBuffSize += serializeKeysGetPackSize(&gridP->x.keys, context); + packBuffSize += serializeKeysGetPackSize(&gridP->y.keys, context); + + return packBuffSize; +} + +static int +gridGetPackSizeArrays(grid_t *gridP, void *context) +{ + int packBuffSize = 0, count, ui32PackSize = serializeGetSize(1, CDI_DATATYPE_UINT32, context); if (gridP->reducedPoints) { xassert(gridP->reducedPointsSize); - packBuffSize += serializeGetSize(gridP->reducedPointsSize, CDI_DATATYPE_INT, context) - + serializeGetSize(1, CDI_DATATYPE_UINT32, context); + packBuffSize += serializeGetSize(gridP->reducedPointsSize, CDI_DATATYPE_INT, context) + ui32PackSize; } - packBuffSize += serializeGetSize(gridNdouble, CDI_DATATYPE_FLT64, context); - if (gridP->vtable->inqXValsPtr(gridP)) { if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR) @@ -4236,7 +4295,7 @@ gridGetPackSize(void *voidP, void *context) else count = gridP->x.size; xassert(count); - packBuffSize += serializeGetSize(count, CDI_DATATYPE_FLT64, context) + serializeGetSize(1, CDI_DATATYPE_UINT32, context); + packBuffSize += serializeGetSize(count, CDI_DATATYPE_FLT64, context) + ui32PackSize; } if (gridP->vtable->inqYValsPtr(gridP)) @@ -4246,70 +4305,71 @@ gridGetPackSize(void *voidP, void *context) else count = gridP->y.size; xassert(count); - packBuffSize += serializeGetSize(count, CDI_DATATYPE_FLT64, context) + serializeGetSize(1, CDI_DATATYPE_UINT32, context); + packBuffSize += serializeGetSize(count, CDI_DATATYPE_FLT64, context) + ui32PackSize; } if (gridP->vtable->inqAreaPtr(gridP)) { xassert(gridP->size); - packBuffSize - += serializeGetSize(gridP->size, CDI_DATATYPE_FLT64, context) + serializeGetSize(1, CDI_DATATYPE_UINT32, context); + packBuffSize += serializeGetSize(gridP->size, CDI_DATATYPE_FLT64, context) + ui32PackSize; } if (gridP->x.bounds) { xassert(gridP->nvertex); - if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED) - count = gridP->size; - else - count = gridP->x.size; + count = grid_is_irregular(gridP->type) ? gridP->size : gridP->x.size; xassert(count); - packBuffSize += (serializeGetSize(gridP->nvertex * count, CDI_DATATYPE_FLT64, context) - + serializeGetSize(1, CDI_DATATYPE_UINT32, context)); + packBuffSize += (serializeGetSize(gridP->nvertex * count, CDI_DATATYPE_FLT64, context) + ui32PackSize); } if (gridP->y.bounds) { xassert(gridP->nvertex); - if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED) - count = gridP->size; - else - count = gridP->y.size; + count = grid_is_irregular(gridP->type) ? gridP->size : gridP->y.size; xassert(count); - packBuffSize += (serializeGetSize(gridP->nvertex * count, CDI_DATATYPE_FLT64, context) - + serializeGetSize(1, CDI_DATATYPE_UINT32, context)); + packBuffSize += (serializeGetSize(gridP->nvertex * count, CDI_DATATYPE_FLT64, context) + ui32PackSize); } - packBuffSize += serializeKeysGetPackSize(&gridP->keys, context); - packBuffSize += serializeKeysGetPackSize(&gridP->x.keys, context); - packBuffSize += serializeKeysGetPackSize(&gridP->y.keys, context); - if (gridP->mask) { xassert(gridP->size); - packBuffSize - += serializeGetSize(gridP->size, CDI_DATATYPE_UCHAR, context) + serializeGetSize(1, CDI_DATATYPE_UINT32, context); + packBuffSize += serializeGetSize(gridP->size, CDI_DATATYPE_UCHAR, context) + ui32PackSize; } if (gridP->mask_gme) { xassert(gridP->size); - packBuffSize - += serializeGetSize(gridP->size, CDI_DATATYPE_UCHAR, context) + serializeGetSize(1, CDI_DATATYPE_UINT32, context); + packBuffSize += serializeGetSize(gridP->size, CDI_DATATYPE_UCHAR, context) + ui32PackSize; } return packBuffSize; } -void +static grid_t *gridUnpackScalars(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, + int force_id, int *memberMaskP); + +static void gridUnpackArrays(grid_t *gridP, int memberMask, char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, + int originNamespace, void *context); + +int gridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id) { - grid_t *gridP; - uint32_t d; - int memberMask, size; - gridInit(); + int memberMask; + grid_t *gridP + = gridUnpackScalars(unpackBuffer, unpackBufferSize, unpackBufferPos, originNamespace, context, force_id, &memberMask); + gridP->vtable->unpackArrays(gridP, memberMask, unpackBuffer, unpackBufferSize, unpackBufferPos, originNamespace, context); + reshSetStatus(gridP->self, &gridOps, reshGetStatus(gridP->self, &gridOps) & ~RESH_SYNC_BIT); + return gridP->self; +} +static grid_t * +gridUnpackScalars(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id, + int *memberMaskP) +{ + grid_t *gridP; + uint32_t d; + int memberMask; { int intBuffer[gridNint]; serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, intBuffer, gridNint, CDI_DATATYPE_INT, context); @@ -4331,7 +4391,7 @@ gridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int o gridP->gme.ni3 = intBuffer[GRID_PACK_INT_IDX_GME_NI3]; gridP->trunc = intBuffer[GRID_PACK_INT_IDX_TRUNC]; gridP->nvertex = intBuffer[GRID_PACK_INT_IDX_NVERTEX]; - gridP->reducedPointsSize = intBuffer[REDUCEDPOINTSSIZE]; + gridP->reducedPointsSize = intBuffer[GRID_PACK_INT_IDX_REDUCED_POINTS_SIZE]; gridP->size = intBuffer[GRID_PACK_INT_IDX_SIZE]; gridP->x.size = intBuffer[GRID_PACK_INT_IDX_X_SIZE]; gridP->y.size = intBuffer[GRID_PACK_INT_IDX_Y_SIZE]; @@ -4339,16 +4399,6 @@ gridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int o memberMask = intBuffer[GRID_PACK_INT_IDX_MEMBERMASK]; } - if (memberMask & gridHasReducedPointsFlag) - { - xassert(gridP->reducedPointsSize); - gridP->reducedPoints = (int *) Malloc((size_t) gridP->reducedPointsSize * sizeof(int)); - serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, gridP->reducedPoints, gridP->reducedPointsSize, - CDI_DATATYPE_INT, context); - serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); - xassert(cdiCheckSum(CDI_DATATYPE_INT, gridP->reducedPointsSize, gridP->reducedPoints) == d); - } - { double doubleBuffer[gridNdouble]; serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, doubleBuffer, gridNdouble, CDI_DATATYPE_FLT64, context); @@ -4363,10 +4413,35 @@ gridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int o gridP->y.inc = doubleBuffer[GRID_PACK_DBL_IDX_Y_INC]; } - bool irregular = gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR; + serializeKeysUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &gridP->keys, context); + serializeKeysUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &gridP->x.keys, context); + serializeKeysUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &gridP->y.keys, context); + + *memberMaskP = memberMask; + return gridP; +} + +static void +gridUnpackArrays(grid_t *gridP, int memberMask, char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, + void *context) +{ + UNUSED(originNamespace); + uint32_t d; + + if (memberMask & gridHasReducedPointsFlag) + { + xassert(gridP->reducedPointsSize); + gridP->reducedPoints = (int *) Malloc((size_t) gridP->reducedPointsSize * sizeof(int)); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, gridP->reducedPoints, gridP->reducedPointsSize, + CDI_DATATYPE_INT, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); + xassert(cdiCheckSum(CDI_DATATYPE_INT, gridP->reducedPointsSize, gridP->reducedPoints) == d); + } + + bool isIrregular = grid_is_irregular(gridP->type); if (memberMask & gridHasXValsFlag) { - size = irregular ? gridP->size : gridP->x.size; + int size = isIrregular ? gridP->size : gridP->x.size; gridP->x.vals = (double *) Malloc(size * sizeof(double)); serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, gridP->x.vals, size, CDI_DATATYPE_FLT64, context); @@ -4376,7 +4451,7 @@ gridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int o if (memberMask & gridHasYValsFlag) { - size = irregular ? gridP->size : gridP->y.size; + int size = isIrregular ? gridP->size : gridP->y.size; gridP->y.vals = (double *) Malloc(size * sizeof(double)); serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, gridP->y.vals, size, CDI_DATATYPE_FLT64, context); @@ -4386,7 +4461,7 @@ gridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int o if (memberMask & gridHasAreaFlag) { - size = gridP->size; + int size = gridP->size; xassert(size); gridP->area = (double *) Malloc(size * sizeof(double)); serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, gridP->area, size, CDI_DATATYPE_FLT64, context); @@ -4396,7 +4471,7 @@ gridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int o if (memberMask & gridHasXBoundsFlag) { - size = gridP->nvertex * (irregular ? gridP->size : gridP->x.size); + int size = gridP->nvertex * (isIrregular ? gridP->size : gridP->x.size); xassert(size); gridP->x.bounds = (double *) Malloc(size * sizeof(double)); @@ -4407,7 +4482,7 @@ gridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int o if (memberMask & gridHasYBoundsFlag) { - size = gridP->nvertex * (irregular ? gridP->size : gridP->y.size); + int size = gridP->nvertex * (isIrregular ? gridP->size : gridP->y.size); xassert(size); gridP->y.bounds = (double *) Malloc(size * sizeof(double)); @@ -4416,13 +4491,10 @@ gridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int o xassert(cdiCheckSum(CDI_DATATYPE_FLT, size, gridP->y.bounds) == d); } - serializeKeysUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &gridP->keys, context); - serializeKeysUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &gridP->x.keys, context); - serializeKeysUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &gridP->y.keys, context); - if (memberMask & gridHasMaskFlag) { - xassert((size = gridP->size)); + int size = gridP->size; + xassert(size); gridP->mask = (mask_t *) Malloc(size * sizeof(mask_t)); serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, gridP->mask, gridP->size, CDI_DATATYPE_UCHAR, context); serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); @@ -4431,21 +4503,32 @@ gridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int o if (memberMask & gridHasGMEMaskFlag) { - xassert((size = gridP->size)); + int size = gridP->size; + xassert(size); gridP->mask_gme = (mask_t *) Malloc(size * sizeof(mask_t)); serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, gridP->mask_gme, gridP->size, CDI_DATATYPE_UCHAR, context); serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); xassert(cdiCheckSum(CDI_DATATYPE_UCHAR, gridP->size, gridP->mask_gme) == d); } - - reshSetStatus(gridP->self, &gridOps, reshGetStatus(gridP->self, &gridOps) & ~RESH_SYNC_BIT); } -static void +void gridPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos, void *context) { grid_t *gridP = (grid_t *) voidP; - int size; + gridP->vtable->pack(gridP, packBuffer, packBufferSize, packBufferPos, context); +} + +static void +gridPackBase(grid_t *gridP, void *packBuffer, int packBufferSize, int *packBufferPos, void *context) +{ + int memberMask = gridP->vtable->packScalars(gridP, packBuffer, packBufferSize, packBufferPos, context); + gridP->vtable->packArrays(gridP, memberMask, packBuffer, packBufferSize, packBufferPos, context); +} + +static int +gridPackScalars(grid_t *gridP, void *packBuffer, int packBufferSize, int *packBufferPos, void *context) +{ uint32_t d; int memberMask; @@ -4463,7 +4546,7 @@ gridPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos, intBuffer[GRID_PACK_INT_IDX_GME_NI3] = gridP->gme.ni3; intBuffer[GRID_PACK_INT_IDX_TRUNC] = gridP->trunc; intBuffer[GRID_PACK_INT_IDX_NVERTEX] = gridP->nvertex; - intBuffer[REDUCEDPOINTSSIZE] = gridP->reducedPointsSize; + intBuffer[GRID_PACK_INT_IDX_REDUCED_POINTS_SIZE] = gridP->reducedPointsSize; intBuffer[GRID_PACK_INT_IDX_SIZE] = gridP->size; intBuffer[GRID_PACK_INT_IDX_X_SIZE] = gridP->x.size; intBuffer[GRID_PACK_INT_IDX_Y_SIZE] = gridP->y.size; @@ -4475,15 +4558,6 @@ gridPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos, serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); } - if (memberMask & gridHasReducedPointsFlag) - { - size = gridP->reducedPointsSize; - xassert(size > 0); - serializePack(gridP->reducedPoints, size, CDI_DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context); - d = cdiCheckSum(CDI_DATATYPE_INT, size, gridP->reducedPoints); - serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); - } - { double doubleBuffer[gridNdouble]; @@ -4499,12 +4573,31 @@ gridPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos, serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); } + serializeKeysPack(&gridP->keys, packBuffer, packBufferSize, packBufferPos, context); + serializeKeysPack(&gridP->x.keys, packBuffer, packBufferSize, packBufferPos, context); + serializeKeysPack(&gridP->y.keys, packBuffer, packBufferSize, packBufferPos, context); + + return memberMask; +} + +static void +gridPackArrays(grid_t *gridP, int memberMask, void *packBuffer, int packBufferSize, int *packBufferPos, void *context) +{ + uint32_t d; + bool isIrregular = grid_is_irregular(gridP->type); + + if (memberMask & gridHasReducedPointsFlag) + { + int size = gridP->reducedPointsSize; + xassert(size > 0); + serializePack(gridP->reducedPoints, size, CDI_DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_INT, size, gridP->reducedPoints); + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + if (memberMask & gridHasXValsFlag) { - if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR) - size = gridP->size; - else - size = gridP->x.size; + int size = isIrregular ? gridP->size : gridP->x.size; xassert(size); const double *gridP_xvals = gridP->vtable->inqXValsPtr(gridP); @@ -4515,10 +4608,7 @@ gridPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos, if (memberMask & gridHasYValsFlag) { - if (gridP->type == GRID_UNSTRUCTURED || gridP->type == GRID_CURVILINEAR) - size = gridP->size; - else - size = gridP->y.size; + int size = isIrregular ? gridP->size : gridP->y.size; xassert(size); const double *gridP_yvals = gridP->vtable->inqYValsPtr(gridP); serializePack(gridP_yvals, size, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); @@ -4528,20 +4618,18 @@ gridPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos, if (memberMask & gridHasAreaFlag) { - xassert(gridP->size); + int size = gridP->size; + xassert(size); - serializePack(gridP->area, gridP->size, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); - d = cdiCheckSum(CDI_DATATYPE_FLT, gridP->size, gridP->area); + serializePack(gridP->area, size, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_FLT, size, gridP->area); serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); } if (memberMask & gridHasXBoundsFlag) { xassert(gridP->nvertex); - if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED) - size = gridP->nvertex * gridP->size; - else - size = gridP->nvertex * gridP->x.size; + int size = isIrregular ? gridP->nvertex * gridP->size : gridP->nvertex * gridP->x.size; xassert(size); serializePack(gridP->x.bounds, size, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); @@ -4552,10 +4640,7 @@ gridPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos, if (memberMask & gridHasYBoundsFlag) { xassert(gridP->nvertex); - if (gridP->type == GRID_CURVILINEAR || gridP->type == GRID_UNSTRUCTURED) - size = gridP->nvertex * gridP->size; - else - size = gridP->nvertex * gridP->y.size; + int size = isIrregular ? gridP->nvertex * gridP->size : gridP->nvertex * gridP->y.size; xassert(size); serializePack(gridP->y.bounds, size, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); @@ -4563,13 +4648,10 @@ gridPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos, serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); } - serializeKeysPack(&gridP->keys, packBuffer, packBufferSize, packBufferPos, context); - serializeKeysPack(&gridP->x.keys, packBuffer, packBufferSize, packBufferPos, context); - serializeKeysPack(&gridP->y.keys, packBuffer, packBufferSize, packBufferPos, context); - if (memberMask & gridHasMaskFlag) { - xassert((size = gridP->size)); + int size = gridP->size; + xassert(size); serializePack(gridP->mask, size, CDI_DATATYPE_UCHAR, packBuffer, packBufferSize, packBufferPos, context); d = cdiCheckSum(CDI_DATATYPE_UCHAR, size, gridP->mask); serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); @@ -4577,7 +4659,8 @@ gridPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos, if (memberMask & gridHasGMEMaskFlag) { - xassert((size = gridP->size)); + int size = gridP->size; + xassert(size); serializePack(gridP->mask_gme, size, CDI_DATATYPE_UCHAR, packBuffer, packBufferSize, packBufferPos, context); d = cdiCheckSum(CDI_DATATYPE_UCHAR, size, gridP->mask_gme); @@ -4619,7 +4702,7 @@ cdiVlistAddGridIfNew(int vlistID, grid_t *grid, int mode) int gridID = CDI_UNDEFID; vlist_t *vlistptr = vlist_to_pointer(vlistID); - const int ngrids = vlistptr->ngrids; + int ngrids = vlistptr->ngrids; if (mode == 0) for (int index = 0; index < ngrids; index++) @@ -4640,8 +4723,7 @@ cdiVlistAddGridIfNew(int vlistID, grid_t *grid, int mode) { struct gridCompareSearchState query; query.queryKey = grid; // = { .queryKey = grid }; - if ((gridIsDefinedGlobal = (cdiResHFilterApply(&gridOps, gridCompareSearch, &query) == CDI_APPLY_STOP))) - gridID = query.resIDValue; + if ((gridIsDefinedGlobal = (cdiGridApply(gridCompareSearch, &query) == CDI_APPLY_STOP))) gridID = query.resIDValue; if (mode == 1 && gridIsDefinedGlobal) for (int index = 0; index < ngrids; index++) @@ -4698,17 +4780,28 @@ const struct gridVirtTable cdiGridVtable = { .inqXCvalsPtr = gridInqXCvalsPtrSerial, .inqYCvalsPtr = gridInqYCvalsPtrSerial, #endif + .inqXInc = gridInqXIncBase, + .inqYInc = gridInqYIncBase, .compareXYFull = compareXYvals, .compareXYAO = compareXYvals2, .inqArea = gridInqAreaSerial, .inqAreaPtr = gridInqAreaPtrBase, - .hasArea = gridHasAreaBase, + .inqPropPresence = gridInqPropPresenceBase, .inqMask = gridInqMaskSerial, .inqMaskGME = gridInqMaskGMESerial, .inqXBounds = gridInqXBoundsSerial, .inqYBounds = gridInqYBoundsSerial, .inqXBoundsPtr = gridInqXBoundsPtrSerial, .inqYBoundsPtr = gridInqYBoundsPtrSerial, + .txCode = GRID, + .getPackSize = gridGetPackSizeBase, + .getPackSizeScalars = gridGetPackSizeScalars, + .getPackSizeArrays = gridGetPackSizeArrays, + .unpackScalars = gridUnpackScalars, + .unpackArrays = gridUnpackArrays, + .pack = gridPackBase, + .packScalars = gridPackScalars, + .packArrays = gridPackArrays, }; /* diff --git a/src/grid.h b/src/grid.h index 3beacc216481bd175bcfef43bce7c8c8aa026fe6..8bcfee3d299f1da772801b796be4e270c8341a1e 100644 --- a/src/grid.h +++ b/src/grid.h @@ -6,11 +6,23 @@ #include "cdi_key.h" #include "cdi_att.h" +#include "resource_handle.h" typedef unsigned char mask_t; typedef struct grid_t grid_t; +enum gridPropInq +{ + GRID_PROP_MASK, + GRID_PROP_MASK_GME, + GRID_PROP_XVALS, + GRID_PROP_YVALS, + GRID_PROP_AREA, + GRID_PROP_XBOUNDS, + GRID_PROP_YBOUNDS, +}; + struct gridVirtTable { void (*destroy)(grid_t *gridptr); @@ -40,19 +52,35 @@ struct gridVirtTable const char **(*inqXCvalsPtr)(grid_t *gridptr); const char **(*inqYCvalsPtr)(grid_t *gridptr); #endif - // return if for both grids, all xval and all yval are equal + double (*inqXInc)(grid_t *gridptr); + double (*inqYInc)(grid_t *gridptr); + // return true if for both grids, any xval and all yval differ bool (*compareXYFull)(grid_t *gridRef, grid_t *gridTest); // return if for both grids, x[0], y[0], x[size-1] and y[size-1] are respectively equal bool (*compareXYAO)(grid_t *gridRef, grid_t *gridTest); void (*inqArea)(grid_t *gridptr, double *area); const double *(*inqAreaPtr)(grid_t *gridptr); - int (*hasArea)(grid_t *gridptr); + /* return 1 if inq property is set */ + int (*inqPropPresence)(grid_t *gridptr, enum gridPropInq inq); SizeType (*inqMask)(grid_t *gridptr, int *mask); int (*inqMaskGME)(grid_t *gridptr, int *mask_gme); SizeType (*inqXBounds)(grid_t *gridptr, double *xbounds); SizeType (*inqYBounds)(grid_t *gridptr, double *ybounds); const double *(*inqXBoundsPtr)(grid_t *gridptr); const double *(*inqYBoundsPtr)(grid_t *gridptr); + int txCode; + int (*getPackSize)(grid_t *gridptr, void *context); + int (*getPackSizeScalars)(grid_t *gridptr, void *context); + int (*getPackSizeArrays)(grid_t *gridptr, void *context); + int (*unpack)(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id); + grid_t *(*unpackScalars)(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, + int force_id, int *memberMaskP); + void (*unpackArrays)(grid_t *gridptr, int memberMask, char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, + int originNamespace, void *context); + void (*pack)(grid_t *gridptr, void *packBuffer, int packBufferSize, int *packBufferPos, void *context); + /* return member mask */ + int (*packScalars)(grid_t *gridptr, void *packBuffer, int packBufferSize, int *packBufferPos, void *context); + void (*packArrays)(grid_t *gridptr, int memberMask, void *packBuffer, int packBufferSize, int *packBufferPos, void *context); }; struct gridaxis_t @@ -104,6 +132,7 @@ struct grid_t const struct gridVirtTable *vtable; cdi_keys_t keys; cdi_atts_t atts; + void *extraData; }; void grid_init(grid_t *gridptr); @@ -129,13 +158,18 @@ const char **gridInqYCvalsPtr(int gridID); // const double *gridInqYboundsPtr(int gridID); const double *gridInqAreaPtr(int gridID); +int gridInqPropPresence(int gridID, enum gridPropInq inq); + int gridGenerate(const grid_t *grid); // int gridIsEqual(int gridID1, int gridID2); void cdiGridGetIndexList(unsigned, int *); -void gridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id); +int gridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id); + +/* apply func to each grid */ +enum cdiApplyRet cdiGridApply(enum cdiApplyRet (*func)(int id, void *res, void *data), void *data); struct addIfNewRes { diff --git a/src/ieglib.c b/src/ieglib.c index 2a03f254f74cb49cf55a18bce27c72e6ff13346b..68c1cfdc9b1ef39f715873ae40127bb4841a76d0 100644 --- a/src/ieglib.c +++ b/src/ieglib.c @@ -16,7 +16,7 @@ static int iegDefaultDprec = 0; // A version string. #undef LIBVERSION -#define LIBVERSION 1.4.2 +#define LIBVERSION 1.5.0 #define XSTRING(x) #x #define STRING(x) XSTRING(x) static const char ieg_libvers[] = STRING(LIBVERSION); @@ -49,13 +49,13 @@ iegLibInit(void) { case '4': iegDefaultDprec = EXSE_SINGLE_PRECISION; break; case '8': iegDefaultDprec = EXSE_DOUBLE_PRECISION; break; - default: Message("Invalid digit in %s: %s", envName, envString); + default: Warning("Invalid digit in %s: %s", envName, envString); } break; } default: { - Message("Invalid character in %s: %s", envName, envString); + Warning("Invalid character in %s: %s", envName, envString); break; } } @@ -128,44 +128,44 @@ iegCheckFiletype(int fileID, int *swap) if (fileRead(fileID, buffer, 4) != 4) return 0; - const size_t blocklen = get_UINT32(buffer); - const size_t sblocklen = get_SUINT32(buffer); + size_t blocklen = get_UINT32(buffer); + size_t sblocklen = get_SUINT32(buffer); if (IEG_Debug) Message("blocklen = %d sblocklen = %d", blocklen, sblocklen); // clang-format off - if ( blocklen == 636 || blocklen == 640 ) + if (blocklen == 636 || blocklen == 640) { *swap = 0; fact = 4; - if ( fileRead(fileID, buffer, blocklen+8) != blocklen+8 ) return 0; + if (fileRead(fileID, buffer, blocklen+8) != blocklen+8) return 0; pbuf = buffer+(37+4)*4; dimx = (size_t) get_UINT32(pbuf); pbuf = buffer+(37+5)*4; dimy = (size_t) get_UINT32(pbuf); pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf); } - else if ( blocklen == 1040 || blocklen == 1036 ) + else if (blocklen == 1040 || blocklen == 1036) { *swap = 0; fact = 8; - if ( fileRead(fileID, buffer, blocklen+8) != blocklen+8 ) return 0; + if (fileRead(fileID, buffer, blocklen+8) != blocklen+8) return 0; pbuf = buffer+(37+4)*4; dimx = (size_t) get_UINT32(pbuf); pbuf = buffer+(37+5)*4; dimy = (size_t) get_UINT32(pbuf); pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf); } - else if ( sblocklen == 636 || sblocklen == 640 ) + else if (sblocklen == 636 || sblocklen == 640) { *swap = 1; fact = 4; - if ( fileRead(fileID, buffer, sblocklen+8) != sblocklen+8 ) return 0; + if (fileRead(fileID, buffer, sblocklen+8) != sblocklen+8) return 0; pbuf = buffer+(37+4)*4; dimx = (size_t) get_SUINT32(pbuf); pbuf = buffer+(37+5)*4; dimy = (size_t) get_SUINT32(pbuf); pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf); } - else if ( sblocklen == 1040 || sblocklen == 1036 ) + else if (sblocklen == 1040 || sblocklen == 1036) { *swap = 1; fact = 8; - if ( fileRead(fileID, buffer, sblocklen+8) != sblocklen+8 ) return 0; + if (fileRead(fileID, buffer, sblocklen+8) != sblocklen+8) return 0; pbuf = buffer+(37+4)*4; dimx = (size_t) get_SUINT32(pbuf); pbuf = buffer+(37+5)*4; dimy = (size_t) get_SUINT32(pbuf); pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf); @@ -174,13 +174,10 @@ iegCheckFiletype(int fileID, int *swap) fileRewind(fileID); - if (IEG_Debug) - { - Message("swap = %d fact = %d", *swap, fact); - Message("dimx = %lu dimy = %lu data = %lu", dimx, dimy, data); - } + if (IEG_Debug) Message("swap = %d fact = %d", *swap, fact); + if (IEG_Debug) Message("dimx = %lu dimy = %lu data = %lu", dimx, dimy, data); - const int found = data && (dimx * dimy * fact == data || dimx * dimy * 8 == data); + int found = data && (dimx * dimy * fact == data || dimx * dimy * 8 == data); return found; } @@ -204,10 +201,10 @@ iegInqData(void *ieg, int prec, void *data) { iegrec_t *iegp = (iegrec_t *) ieg; int ierr = 0; - const int byteswap = iegp->byteswap; - const size_t datasize = iegp->datasize; + int byteswap = iegp->byteswap; + size_t datasize = iegp->datasize; void *buffer = iegp->buffer; - const int dprec = iegp->dprec; + int dprec = iegp->dprec; switch (dprec) { @@ -281,8 +278,8 @@ iegDefData(iegrec_t *iegp, int prec, const void *data) int dprec = iegDefaultDprec ? iegDefaultDprec : iegp->dprec; iegp->dprec = dprec ? dprec : prec; - const size_t datasize = (size_t) IEG_G_NumLon(iegp->igdb) * (size_t) IEG_G_NumLat(iegp->igdb); - const size_t blocklen = datasize * (size_t) dprec; + size_t datasize = (size_t) IEG_G_NumLon(iegp->igdb) * (size_t) IEG_G_NumLat(iegp->igdb); + size_t blocklen = datasize * (size_t) dprec; iegp->datasize = datasize; @@ -353,12 +350,12 @@ iegRead(int fileID, void *ieg) if (!iegp->checked) { - const int status = iegCheckFiletype(fileID, &iegp->byteswap); + int status = iegCheckFiletype(fileID, &iegp->byteswap); if (status == 0) Error("Not a IEG file!"); iegp->checked = 1; } - const int byteswap = iegp->byteswap; + int byteswap = iegp->byteswap; // read header record size_t blocklen = binReadF77Block(fileID, byteswap); @@ -463,8 +460,8 @@ iegWrite(int fileID, void *ieg) INT32 i32[200]; float fvct[100]; } buf; - const int dprec = iegp->dprec; - const int byteswap = iegp->byteswap; + int dprec = iegp->dprec; + int byteswap = iegp->byteswap; // write header record size_t blocklen = (dprec == EXSE_SINGLE_PRECISION) ? 636 : 1040; diff --git a/src/institution.c b/src/institution.c index ca74164ce81657cca4ef2e0848afc5b550f14d7c..89c4f278f6d7f75120bb942949c3bfb8225e37c5 100644 --- a/src/institution.c +++ b/src/institution.c @@ -13,7 +13,6 @@ typedef struct { int self; - int used; int center; int subcenter; char *name; @@ -25,7 +24,7 @@ static void instituteDestroyP(institute_t *instituteptr); static void institutePrintP(institute_t *instituteptr, FILE *fp); static int instituteGetPackSize(institute_t *instituteptr, void *context); static void institutePackP(void *instituteptr, void *buf, int size, int *position, void *context); -static int instituteTxCode(void); +static int instituteTxCode(void *instituteptr); static const resOps instituteOps = { (int (*)(void *, void *)) instituteCompareKernel, (void (*)(void *)) instituteDestroyP, @@ -38,7 +37,6 @@ static void instituteDefaultValue(institute_t *instituteptr) { instituteptr->self = CDI_UNDEFID; - instituteptr->used = 0; instituteptr->center = CDI_UNDEFID; instituteptr->subcenter = CDI_UNDEFID; instituteptr->name = NULL; @@ -121,7 +119,7 @@ findInstitute(int id, void *res, void *data) { institute_t *ip1 = ((struct instLoc *) data)->ip; institute_t *ip2 = (institute_t *) res; - if (ip2->used && !instituteCompareKernel(ip1, ip2)) + if (!instituteCompareKernel(ip1, ip2)) { ((struct instLoc *) data)->id = id; return CDI_APPLY_STOP; @@ -135,7 +133,6 @@ institutInq(int center, int subcenter, const char *name, const char *longname) { institute_t ip_ref; ip_ref.self = CDI_UNDEFID; - ip_ref.used = 0; ip_ref.center = center; ip_ref.subcenter = subcenter; ip_ref.name = (name && name[0]) ? (char *) name : NULL; @@ -159,7 +156,6 @@ instituteNewEntry(cdiResH resH, int center, int subcenter, const char *name, con instituteptr->self = resH; reshReplace(resH, instituteptr, &instituteOps); } - instituteptr->used = 1; instituteptr->center = center; instituteptr->subcenter = subcenter; if (name && *name) instituteptr->name = strdupx(name); @@ -177,57 +173,31 @@ institutDef(int center, int subcenter, const char *name, const char *longname) int institutInqCenter(int instID) { - institute_t *instituteptr = NULL; - - if (instID != CDI_UNDEFID) instituteptr = (institute_t *) reshGetVal(instID, &instituteOps); - - return instituteptr ? instituteptr->center : CDI_UNDEFID; + return instID != CDI_UNDEFID ? ((institute_t *) (reshGetVal(instID, &instituteOps)))->center : CDI_UNDEFID; } int institutInqSubcenter(int instID) { - institute_t *instituteptr = NULL; - - if (instID != CDI_UNDEFID) instituteptr = (institute_t *) reshGetVal(instID, &instituteOps); - - return instituteptr ? instituteptr->subcenter : CDI_UNDEFID; + return instID != CDI_UNDEFID ? ((institute_t *) (reshGetVal(instID, &instituteOps)))->subcenter : CDI_UNDEFID; } const char * institutInqNamePtr(int instID) { - institute_t *instituteptr = NULL; - - if (instID != CDI_UNDEFID) instituteptr = (institute_t *) reshGetVal(instID, &instituteOps); - - return instituteptr ? instituteptr->name : NULL; + return instID != CDI_UNDEFID ? ((institute_t *) (reshGetVal(instID, &instituteOps)))->name : NULL; } const char * institutInqLongnamePtr(int instID) { - institute_t *instituteptr = NULL; - - if (instID != CDI_UNDEFID) instituteptr = (institute_t *) reshGetVal(instID, &instituteOps); - - return instituteptr ? instituteptr->longname : NULL; -} - -static enum cdiApplyRet -activeInstitutes(int id, void *res, void *data) -{ - (void) id; - if (res && ((institute_t *) res)->used) ++(*(int *) data); - return CDI_APPLY_GO_ON; + return instID != CDI_UNDEFID ? ((institute_t *) (reshGetVal(instID, &instituteOps)))->longname : NULL; } int institutInqNumber(void) { - int instNum = 0; - - cdiResHFilterApply(&instituteOps, activeInstitutes, &instNum); + int instNum = (int) (reshCountType(&instituteOps)); return instNum; } @@ -235,11 +205,8 @@ static void instituteDestroyP(institute_t *instituteptr) { xassert(instituteptr); - - int instituteID = instituteptr->self; Free(instituteptr->name); Free(instituteptr->longname); - reshRemove(instituteID, &instituteOps); Free(instituteptr); } @@ -252,24 +219,28 @@ institutePrintP(institute_t *ip, FILE *fp) "# instituteID %d\n" "#\n" "self = %d\n" - "used = %d\n" "center = %d\n" "subcenter = %d\n" "name = %s\n" "longname = %s\n", - ip->self, ip->self, ip->used, ip->center, ip->subcenter, ip->name ? ip->name : "NN", - ip->longname ? ip->longname : "NN"); + ip->self, ip->self, ip->center, ip->subcenter, ip->name ? ip->name : "NN", ip->longname ? ip->longname : "NN"); } static int -instituteTxCode(void) +instituteTxCode(void *instituteptr) { + (void) instituteptr; return INSTITUTE; } enum { - institute_nints = 5, + INSTITUTE_PACK_INT_SELF, + INSTITUTE_PACK_INT_CENTER, + INSTITUTE_PACK_INT_SUBCENTER, + INSTITUTE_PACK_INT_NAMELEN, + INSTITUTE_PACK_INT_LNAMELEN, + institute_nints, }; static int @@ -289,32 +260,35 @@ institutePackP(void *instituteptr, void *buf, int size, int *position, void *con { institute_t *p = (institute_t *) instituteptr; int tempbuf[institute_nints]; - tempbuf[0] = p->self; - tempbuf[1] = p->center; - tempbuf[2] = p->subcenter; - tempbuf[3] = (int) strlen(p->name) + 1; - tempbuf[4] = (int) strlen(p->longname) + 1; + tempbuf[INSTITUTE_PACK_INT_SELF] = p->self; + tempbuf[INSTITUTE_PACK_INT_CENTER] = p->center; + tempbuf[INSTITUTE_PACK_INT_SUBCENTER] = p->subcenter; + tempbuf[INSTITUTE_PACK_INT_NAMELEN] = (int) strlen(p->name) + 1; + tempbuf[INSTITUTE_PACK_INT_LNAMELEN] = (int) strlen(p->longname) + 1; serializePack(tempbuf, institute_nints, CDI_DATATYPE_INT, buf, size, position, context); - serializePack(p->name, tempbuf[3], CDI_DATATYPE_TXT, buf, size, position, context); - serializePack(p->longname, tempbuf[4], CDI_DATATYPE_TXT, buf, size, position, context); + serializePack(p->name, tempbuf[INSTITUTE_PACK_INT_NAMELEN], CDI_DATATYPE_TXT, buf, size, position, context); + serializePack(p->longname, tempbuf[INSTITUTE_PACK_INT_LNAMELEN], CDI_DATATYPE_TXT, buf, size, position, context); } int instituteUnpack(void *buf, int size, int *position, int originNamespace, void *context, int force_id) { +#define adaptKey(key) (namespaceAdaptKey((key), originNamespace)) int tempbuf[institute_nints]; int instituteID; serializeUnpack(buf, size, position, tempbuf, institute_nints, CDI_DATATYPE_INT, context); - char *name = (char *) Malloc((size_t) tempbuf[3] + (size_t) tempbuf[4]); - char *longname = name + tempbuf[3]; - serializeUnpack(buf, size, position, name, tempbuf[3], CDI_DATATYPE_TXT, context); - serializeUnpack(buf, size, position, longname, tempbuf[4], CDI_DATATYPE_TXT, context); - int targetID = namespaceAdaptKey(tempbuf[0], originNamespace); - institute_t *ip = instituteNewEntry(force_id ? targetID : CDI_UNDEFID, tempbuf[1], tempbuf[2], name, longname); + char *name = (char *) Malloc((size_t) tempbuf[INSTITUTE_PACK_INT_NAMELEN] + (size_t) tempbuf[INSTITUTE_PACK_INT_LNAMELEN]), + *longname = name + tempbuf[INSTITUTE_PACK_INT_NAMELEN]; + serializeUnpack(buf, size, position, name, tempbuf[INSTITUTE_PACK_INT_NAMELEN], CDI_DATATYPE_TXT, context); + serializeUnpack(buf, size, position, longname, tempbuf[INSTITUTE_PACK_INT_LNAMELEN], CDI_DATATYPE_TXT, context); + int targetID = force_id ? adaptKey(tempbuf[INSTITUTE_PACK_INT_SELF]) : CDI_UNDEFID; + institute_t *ip + = instituteNewEntry(targetID, tempbuf[INSTITUTE_PACK_INT_CENTER], tempbuf[INSTITUTE_PACK_INT_SUBCENTER], name, longname); instituteID = ip->self; xassert(!force_id || instituteID == targetID); Free(name); reshSetStatus(instituteID, &instituteOps, reshGetStatus(instituteID, &instituteOps) & ~RESH_SYNC_BIT); +#undef adaptKey return instituteID; } diff --git a/src/iterator_fallback.c b/src/iterator_fallback.c index 6e1708b5d46ae42f433f8e49e16a1dcca00dff91..796e4e0fa41fbab5c0c25a0284e602e3ce7eec51 100644 --- a/src/iterator_fallback.c +++ b/src/iterator_fallback.c @@ -11,8 +11,8 @@ struct CdiFallbackIterator { CdiIterator super; - int streamId, vlistId, subtypeId; char *path; // needed for clone() & serialize() + int streamId, vlistId, subtypeId; int variableCount, curVariable; int curLevelCount, curLevel; @@ -26,55 +26,45 @@ cdiFallbackIterator_getSuper(CdiFallbackIterator *me) return &me->super; } -// For more information on the condestruct() pattern, see comment in src/iterator_grib.c -static CdiFallbackIterator * -cdiFallbackIterator_condestruct(CdiFallbackIterator *me, const char *path, int filetype) +CdiIterator * +cdiFallbackIterator_new(const char *path, int filetype) { - if (me) goto destruct; - - me = (CdiFallbackIterator *) Malloc(sizeof(*me)); + CdiFallbackIterator *me = (CdiFallbackIterator *) Malloc(sizeof(*me)); baseIterConstruct(&me->super, filetype); - - me->streamId = streamOpenRead(path); - if (me->streamId == CDI_UNDEFID) goto destructSuper; - me->vlistId = streamInqVlist(me->streamId); - if (me->vlistId == CDI_UNDEFID) goto closeStream; - me->variableCount = vlistNvars(me->vlistId); - if (me->variableCount <= 0) goto closeStream; me->subtypeId = CDI_UNDEFID; // Will be set in cdiFallbackIterator_nextField() me->curSubtypeCount = -1; // Will be set in cdiFallbackIterator_nextField() me->curLevelCount = -1; // Will be set in cdiFallbackIterator_nextField() - // These values are chosen so that the natural increment at the start of cdiFallbackIterator_nextField() will correctly position // us at the first slice. me->curTimestep = 0; - if (streamInqTimestep(me->streamId, me->curTimestep) <= 0) goto closeStream; me->curVariable = -1; me->curSubtype = -1; me->curLevel = -1; - me->path = path ? strdup(path) : NULL; - if (!me->path) goto closeStream; - - return me; - - // ^ constructor code ^ - // | | - // v destructor/error-cleanup code v - -destruct: - Free(me->path); -closeStream: - streamClose(me->streamId); -destructSuper: + me->streamId = streamOpenRead(path); + if (me->streamId != CDI_UNDEFID) + { + me->vlistId = streamInqVlist(me->streamId); + if (me->vlistId != CDI_UNDEFID && (me->variableCount = vlistNvars(me->vlistId)) > 0 + && streamInqTimestep(me->streamId, me->curTimestep) > 0 && (me->path = strdup(path))) + { + return (CdiIterator *) me; + } + Free(me->path); + streamClose(me->streamId); + } baseIterDestruct(&me->super); Free(me); return NULL; } -CdiIterator * -cdiFallbackIterator_new(const char *path, int filetype) +void +cdiFallbackIterator_delete(CdiIterator *super) { - return &cdiFallbackIterator_condestruct(NULL, path, filetype)->super; + CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; + Free(me->path); + streamClose(me->streamId); + baseIterDestruct(super); + Free(me); } // Fetches the info that is derived from the current variable. Most of this is published by the data members in the base class. @@ -100,20 +90,21 @@ cdiFallbackIterator_clone(CdiIterator *super) CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; // Make another stream for this file. This yields an unadvanced iterator. - CdiFallbackIterator *clone = cdiFallbackIterator_condestruct(NULL, me->path, me->super.filetype); - if (!clone) return NULL; - - // Point the clone to the same position in the file. - clone->variableCount = me->variableCount; - clone->curVariable = me->curVariable; - clone->curLevelCount = me->curLevelCount; - clone->curLevel = me->curLevel; - clone->curSubtypeCount = me->curSubtypeCount; - clone->curSubtype = me->curSubtype; - clone->curTimestep = me->curTimestep; - - clone->super.isAdvanced = super->isAdvanced; - if (super->isAdvanced) fetchVariableInfo(clone); + CdiFallbackIterator *clone = (CdiFallbackIterator *) (void *) cdiFallbackIterator_new(me->path, me->super.filetype); + if (clone) + { + // Point the clone to the same position in the file. + clone->variableCount = me->variableCount; + clone->curVariable = me->curVariable; + clone->curLevelCount = me->curLevelCount; + clone->curLevel = me->curLevel; + clone->curSubtypeCount = me->curSubtypeCount; + clone->curSubtype = me->curSubtype; + clone->curTimestep = me->curTimestep; + + clone->super.isAdvanced = super->isAdvanced; + if (super->isAdvanced) fetchVariableInfo(clone); + } return clone; } @@ -427,13 +418,6 @@ cdiFallbackIterator_readFieldF(CdiIterator *super, float *buffer, size_t *nmiss) if (nmiss) *nmiss = (size_t) missingValues; } -void -cdiFallbackIterator_delete(CdiIterator *super) -{ - CdiFallbackIterator *me = (CdiFallbackIterator *) (void *) super; - cdiFallbackIterator_condestruct(me, NULL, 0); -} - /* * Local Variables: * c-file-style: "Java" diff --git a/src/iterator_grib.c b/src/iterator_grib.c index 42699dd9710cf7624602c005db508d2920deebe6..16d82692be760f42e9556ec2386cea0246bb53be 100644 --- a/src/iterator_grib.c +++ b/src/iterator_grib.c @@ -340,7 +340,7 @@ static void hexdump(void *data, size_t size) // Read a record into memory and wrap it in a grib_handle. // XXX: I have omitted checking for szip compression as it is done in grbReadVarDP() & friends since that appears to be a // non-standard extension of the GRIB1 standard: bit 1 in octet 14 of the binary data section which is used to signal szip -// compressio is defined to be reserved in the standard. As such, it seems prudent not to support this and to encourage people with +// compression is defined to be reserved in the standard. As such, it seems prudent not to support this and to encourage people with // such szip compressed files to switch to the GRIB2/JPEG2000 format. However, in the case that this reasoning is wrong, this // function is probably the place to add the check for zsip compression. static int diff --git a/src/julian_date.c b/src/julian_date.c index 0c9fe2643aa13c68105f720d5cfecc4f3e762ea6..d82fcfb6197692b4612a4eb86e3136feb9c63155 100644 --- a/src/julian_date.c +++ b/src/julian_date.c @@ -232,100 +232,6 @@ julianDate_to_seconds(JulianDate julianDate) return julianDate.julianDay * 86400.0 + julianDate.secondOfDay; } -#ifdef TEST -int -main(void) -{ - int calendar = CALENDAR_STANDARD; - int j = 0; - - // 1 - Check valid range of years - { - int nmin = 11000; - int vdate0 = -80001201; - int vtime0 = 120500; - - printf("start time: %8d %4d\n", vdate0, vtime0); - - CdiDateTime dt = cdiDateTime_set(vdate0, vtime0); - - for (int i = 0; i < nmin; i++) - { - JulianDate julianDate = julianDate_encode(calendar, dt); - - dt = julianDate_decode(calendar, julianDate); - int vdate = (int) cdiDate_get(dt.date); - int vtime = cdiTime_get(dt.time); - - if (vdate0 != vdate || vtime0 != vtime) - printf("%4d %8d %4d %8d %4d %9d %g\n", ++j, vdate0, vtime0, vdate, vtime, (int) julianDate.julianDay, - julianDate.secondOfDay); - - dt.date.year++; - julianDate = julianDate_encode(calendar, dt); - - dt = julianDate_decode(calendar, julianDate); - vdate0 = (int) cdiDate_get(dt.date); - vtime0 = cdiTime_get(dt.time); - } - - printf("stop time: %8d %4d\n", vdate0, vtime0); - } - // 2 - Check time increment of one minute - { - int nmin = 120000; - int ijulinc = 60; - int vdate0 = 20001201; - int vtime0 = 0; - - printf("start time: %8d %4d\n", vdate0, vtime0); - - CdiDateTime dt = cdiDateTime_set(vdate0, vtime0); - JulianDate julianDate = julianDate_encode(calendar, dt); - - for (int i = 0; i < nmin; i++) - { - int year, mon, day, hour, minute, second; - cdiDecodeDate(vdate0, &year, &mon, &day); - cdiDecodeTime(vtime0, &hour, &minute, &second); - - if (++minute >= 60) - { - minute = 0; - if (++hour >= 24) - { - hour = 0; - if (++day >= 32) - { - day = 1; - if (++mon >= 13) - { - mon = 1; - year++; - } - } - } - } - - vdate0 = cdiEncodeDate(year, mon, day); - vtime0 = cdiEncodeTime(hour, minute, second); - - julianDate = julianDate_add_seconds(julianDate, ijulinc); - dt = julianDate_decode(calendar, julianDate); - int vdate = (int) cdiDate_get(dt.date); - int vtime = cdiTime_get(dt.time); - - if (vdate0 != vdate || vtime0 != vtime) - printf("%4d %8d %4d %8d %4d %9d %g\n", ++j, vdate0, vtime0, vdate, vtime, (int) julianDate.julianDay, - julianDate.secondOfDay); - } - - printf("stop time: %8d %4d\n", vdate0, vtime0); - } - return 0; -} -#endif - #ifdef TEST2 int main(void) diff --git a/src/make_cdilib b/src/make_cdilib index d39c11ebf11bff03ef4492739edeb4fa18792000..48b869f1dfaba9806f149311770f10a9ec70f8fc 100755 --- a/src/make_cdilib +++ b/src/make_cdilib @@ -19,8 +19,9 @@ rm -f ${PROG} DATE=`date +%F` -if test -f ../configure.ac ; then - CDILIBVERSION=\"`sed -n '/^AC_INIT(/s/AC_INIT *( *[^,]*,[[ ]*\([^],]*\).*/\1/ p' ../configure.ac`\" +config_file="${srcdir}/../configure.ac" +if test -f "$config_file" ; then + CDILIBVERSION=\"`sed -n '/^AC_INIT(/s/AC_INIT *( *[^,]*,[[ ]*\([^],]*\).*/\1/ p' "$config_file"`\" else echo "error: cannot find configure.ac" >&2 exit 1 @@ -109,6 +110,7 @@ files="async_worker.c \ cdi_error.c \ cdi_datetime.c \ cdi_int.c \ + cdi_query.c \ cdi_util.c \ cgribexlib.c \ cksum.c \ @@ -192,8 +194,10 @@ until test "foo$scanlist" = "foo" ; do if echo "$fileList" | grep -q '\<'"$curFile"'\>' ; then true #Nothing to do, we have already scanned this header. else + curFilePath="$srcdir/$curFile" + if [ "$curFile" = "config.h" ] ; then curFilePath="$curFile" ; fi #Prepend the includes of the current header to the scanlist so that we will scan them in the order that the preprocessor would. - scanlist="$(listIncludes "$curFile") <$curFile> $scanlist" + scanlist="$(listIncludes "$curFilePath") <$curFile> $scanlist" fi ;; esac @@ -211,7 +215,7 @@ for file in $fileList ; do done -cpp -P -DVERSION="${CDILIBVERSION}" -DCDI_H_ \ +${CPP-cpp} -P -DVERSION="${CDILIBVERSION}" -DCDI_H_ \ $srcdir/version.c >>${PROG} # Fortran interface (with -DHAVE_CF_INTERFACE) diff --git a/src/make_fint.c b/src/make_fint.c index b06e6c74b1c5c393850636cce75ee3c6ee60544e..10eda72d61c4121003f37caac9af4bd9987d216d 100644 --- a/src/make_fint.c +++ b/src/make_fint.c @@ -1,8 +1,25 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#if defined(HAVE_GETLINE) && !defined(_GNU_SOURCES) +// It seems that _GNU_SOURCES must be defined to enable getline(3) on some +// systems. However, it is unclear whether it is possible at all that +// HAVE_GETLINE gets defined on such systems by the configure script, which does +// not expand either AC_GNU_SOURCE or AC_USE_SYSTEM_EXTENSIONS and, therefore, +// checks for getline without _GNU_SOURCES defined. +#define _GNU_SOURCES 1 +#endif +#else +#define VERSION "2.2.0" +#endif + +#ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE 700 -#define _GNU_SOURCE // needed for getline(3) on some systems it seems +#endif + #include <ctype.h> #include <errno.h> #include <regex.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <stdbool.h> @@ -12,14 +29,20 @@ #include <unistd.h> #ifndef HAVE_GETLINE +#ifdef HAVE_CONFIG_H +// Avoid warning: implicit declaration of function ‘getline’ +ssize_t getline(char **linebuf, size_t *linebuf_size, FILE *fp); +#else +// This is only to cover the case when this file is compiled "manually", i.e. +// without the Makefile and without config.h, e.g. 'gcc make_fint.c', on a +// system where HAVE_GETLINE would not get defined or getline does not work +// without _GNU_SOURCES defined. #include "getline.c" #endif +#endif // clang-format off -//#include "config.h" -#define VERSION "2.1.0" - typedef struct { size_t naline; @@ -31,7 +54,6 @@ Docu; // Example: ./make_fint -d ../doc/pio/ cdipio.h -static const char default_doc_root[] = "../doc"; static struct { const char *name; size_t len; @@ -86,8 +108,8 @@ static void doctotxt(FILE *fp, const Docu *doc, const size_t ndoc) } } -enum cftype {ISVOID, ISCONSTSTRING, ISINT, ISREAL, ISDOUBLE, ISDATETYPE, ISSIZETYPE, ISMPI_COMM, - ISXT_IDXLIST, ISCHOICE, ISINTP, ISDATETYPEP, ISSIZETYPEP, ISFLOATV, ISFLOATVV, +enum cftype {ISVOID, ISCONSTSTRING, ISINT, ISLOGICAL, ISREAL, ISDOUBLE, ISDATETYPE, ISSIZETYPE, ISMPI_COMM, + ISXT_IDXLIST, ISXT_IDXLISTV, ISCHOICE, ISINTP, ISDATETYPEP, ISSIZETYPEP, ISFLOATV, ISFLOATVV, ISDOUBLEV, ISDOUBLEVV, ISINTV, ISINTVV, ISINTVVV, ISREALP, ISDOUBLEP, ISCBUF, ISUUID, ISUCHAR, ISSTRING, ISSTRINGP, VOIDFUNCVOID, @@ -115,7 +137,7 @@ struct symbol { const char *f77name, *cfint, *cfmt, *parseRE; // pair of parentheses which matches the argument name size_t nameMatch; - int needsExtraWrapper, needsPrologue; + bool needsExtraWrapper, needsPrologue; cfConversionEmitter convert; const char *convcfmt; cfPrologueEmitter prologue; @@ -146,96 +168,103 @@ static inline int isSym(const int c) /* Note: size of this table must match the cftype enum */ static struct symbol funArgSym[] = { { "", "", "%svoid", - "^"WS"*void"WS"*)", 0, 0, 0 }, + "^"WS"*void"WS"*\\)", 0, 0, 0 }, { "CHARACTER(80)", "STRING", "%schar *%.*s", - "^"WS"*const"WS"+char"WS"+\\*"SYMRE WS"*\\(", 1, 0, 0 }, + "^"WS"*const"WS"+char"WS"+\\*"SYMRE WS"*\\(", 1, false, false }, { "INTEGER", "INT", "%sint %.*s", - "^"WS"*(const"WS"+)?int("WS"+"SYMRE")?"WS"*[,\\)]", 3, 0, 0 }, + "^"WS"*(const"WS"+)?int("WS"+"SYMRE")?"WS"*[,\\)]", 3, false, false }, + { "LOGICAL", "LOGICAL", "%bool %.*s", + "^"WS"*(const"WS"+)?bool("WS"+"SYMRE")?"WS"*[,\\)]", 3, false, false }, { "REAL", "FLOAT", "%sfloat %.*s", - "^"WS"*(const"WS"+)?float"WS"+"SYMRE"?"WS"*[,\\)]", 2, 0, 0 }, + "^"WS"*(const"WS"+)?float"WS"+"SYMRE"?"WS"*[,\\)]", 2, false, false }, { "DOUBLEPRECISION", "DOUBLE", "%sdouble %.*s", - "^"WS"*(const"WS"+)?double"WS"+"SYMRE"?"WS"*[,\\)]", 2, 0, 0 }, + "^"WS"*(const"WS"+)?double"WS"+"SYMRE"?"WS"*[,\\)]", 2, false, false }, { "INTEGER", "INT", "%sDateType %.*s", - "^"WS"*(const"WS"+)?DateType("WS"+"SYMRE")?"WS"*[,\\)]", 3, 1, 0, + "^"WS"*(const"WS"+)?DateType("WS"+"SYMRE")?"WS"*[,\\)]", 3, true, false, cfDateTypeConvert, "%sint %.*s" }, { "INTEGER", "INT", "%sSizeType %.*s", - "^"WS"*(const"WS"+)?SizeType("WS"+"SYMRE")?"WS"*[,\\)]", 3, 1, 0, + "^"WS"*(const"WS"+)?SizeType("WS"+"SYMRE")?"WS"*[,\\)]", 3, true, false, cfSizeTypeConvert, "%sint %.*s" }, { "INTEGER", "INT", "%sMPI_Comm %.*s", - "^"WS"*MPI_Comm"WS"+"SYMRE"?"WS"*[,\\)]", 1, 1, 0, + "^"WS"*MPI_Comm"WS"+"SYMRE"?"WS"*[,\\)]", 1, true, false, cfMPICommConvert, "%sint %.*s" }, { "TYPE(XT_IDXLIST)", "PVOID", "%sXt_idxlist %.*s", - "^"WS"*Xt_idxlist"WS"+"SYMRE"?"WS"*[,\\)]", 1, 1, 0, + "^"WS"*Xt_idxlist"WS"+"SYMRE"?"WS"*[,\\)]", 1, true, false, cfXtIdxlistConvert, "%svoid *%.*s" }, + { "TYPE(XT_IDXLIST)", "PVOID", "%sXt_idxlist %.*s[]", + "^"WS"*(const"WS"+)?Xt_idxlist("WS"+"SYMRE")?"WS"*"ARRAY_BOUND + "[,\\)]", 3, false, false }, { "CHOICE", "PVOID", "%sconst void *%.*s", - "^"WS"*const"WS"+void"WS"*\\*"WS"*"SYMRE"?"WS"*[,\\)]", 1, 0, 0 }, + "^"WS"*const"WS"+void"WS"*\\*"WS"*"SYMRE"?"WS"*[,\\)]", 1, false, false }, { "INTEGER", "PINT", "%sint *%.*s", - "^"WS"*(const"WS"+)?int"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, 0, 0 }, + "^"WS"*(const"WS"+)?int"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, false, false }, { "INTEGER", "PINT", "%sDateType *%.*s", - "^"WS"*(const"WS"+)?DateType"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, 1, 0, + "^"WS"*(const"WS"+)?DateType"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, true, false, cfDateTypepConvert, "%sint *%.*s"}, { "INTEGER", "PINT", "%sSizeType *%.*s", - "^"WS"*(const"WS"+)?SizeType"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, 1, 0, + "^"WS"*(const"WS"+)?SizeType"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, true, false, cfSizeTypepConvert, "%sint *%.*s"}, { "REAL", "FLOATV", "%sfloat %.*s[]", "^"WS"*(const"WS"+)?float("WS"+"SYMRE")?"WS"*"ARRAY_BOUND - "[,\\)]", 3, 0, 0 }, + "[,\\)]", 3, false, false }, { "REAL", "FLOATVV", "%sfloat %.*s%s", "^"WS"*(const"WS"+)?float("WS"+"SYMRE")?"WS"*"ARRAY_BOUND - ARRAY_BOUND"[,\\)]", 3, 0, 0 }, + ARRAY_BOUND"[,\\)]", 3, false, false }, { "DOUBLEPRECISION", "DOUBLEV", "%sdouble %.*s[]", "^"WS"*(const"WS"+)?double("WS"+"SYMRE")?"WS"*"ARRAY_BOUND - "[,\\)]", 3, 0, 0 }, + "[,\\)]", 3, false, false }, { "DOUBLEPRECISION", "DOUBLEVV", "%sdouble %.*s%s", "^"WS"*(const"WS"+)?double("WS"+"SYMRE")?"WS"*"ARRAY_BOUND - ARRAY_BOUND"[,\\)]", 3, 0, 0 }, + ARRAY_BOUND"[,\\)]", 3, false, false }, { "INTEGER", "INTV", "%sint %.*s[]", "^"WS"*(const"WS"+)?int("WS"+"SYMRE")?"WS"*"ARRAY_BOUND - "[,\\)]", 3, 0, 0 }, + "[,\\)]", 3, false, false }, { "INTEGER", "INTVV", "%sint %.*s%s", "^"WS"*(const"WS"+)?int("WS"+"SYMRE")?"WS"*"ARRAY_BOUND - ARRAY_BOUND "[,\\)]", 3, 0, 0 }, + ARRAY_BOUND "[,\\)]", 3, false, false }, { "INTEGER", "INTVVV", "%sint %.*s%s", "^"WS"*(const"WS"+)?int("WS"+"SYMRE")?"WS"*"ARRAY_BOUND - ARRAY_BOUND ARRAY_BOUND"[,\\)]", 3, 0, 0 }, + ARRAY_BOUND ARRAY_BOUND"[,\\)]", 3, false, false }, { "REAL", "PFLOAT", "%sfloat *%.*s", - "^"WS"*(const"WS"+)?float"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, 0, 0 }, + "^"WS"*(const"WS"+)?float"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, false, false }, { "DOUBLEPRECISION", "PDOUBLE", "%sdouble *%.*s", - "^"WS"*(const"WS"+)?double"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, 0, 0 }, + "^"WS"*(const"WS"+)?double"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, false, false }, { "CHARACTER*(*)", "PPSTRING", "%schar *%.*s", "^"WS"*(const"WS"+)?char"WS"+\\*""([A-Za-z_][A-Za-z_0-9]*_cbuf)" - WS"*[,\\)]", 2, 0, 0 }, + WS"*[,\\)]", 2, false, false }, { "INTEGER*1(16)", "PVOID", "%sunsigned char %.*s[16]", - "^"WS"*(const"WS"+)?unsigned"WS"+char"WS"+"SYMRE"?\\[(16|CDI_UUID_SIZE)\\]"WS"*[,\\)]", 2, 0, 0 }, + "^"WS"*(const"WS"+)?unsigned"WS"+char"WS"+"SYMRE"?\\[(16|CDI_UUID_SIZE)\\]"WS"*[,\\)]", 2, false, false }, { "INTEGER*1(*)", "PVOID", "%sunsigned char *%.*s", - "^"WS"*(const"WS"+)?unsigned"WS"+char"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, 0, 0 }, + "^"WS"*(const"WS"+)?unsigned"WS"+char"WS"+\\*"SYMRE"?"WS"*[,\\)]", 2, false, false }, { "CHARACTER*(*)", "STRING", "%schar *%.*s", - "^"WS"*const"WS"+char"WS"+\\*"WS"*"SYMRE"?"WS"*[,\\)]", 1, 0, 0 }, + "^"WS"*const"WS"+char"WS"+\\*"WS"*"SYMRE"?"WS"*[,\\)]", 1, false, false }, { "CHARACTER*(*)", "PSTRING", "%schar *%.*s", - "^"WS"*char"WS"+\\*"SYMRE"?"WS"*[,\\)]", 1, 0, 0 }, + "^"WS"*char"WS"+\\*"SYMRE"?"WS"*[,\\)]", 1, false, false }, { "PROCEDURE", "ROUTINE", "%svoid (*%.*s)(void)", "^"WS"*void"WS"*\\("WS"*\\*"WS"*"SYMRE"?"WS"*\\)" - WS"*\\("WS"*void"WS"*\\)"WS"*[,\\)]", 1, 0, 1, + WS"*\\("WS"*void"WS"*\\)"WS"*[,\\)]", 1, false, true, NULL, NULL, cfVoidFuncPrologue }, }; static struct symbol funRet[] = { { "", "", "%svoid %.*s", - "void"WS"+"SYMRE WS"*\\(", 1, 0, 0 }, + "void"WS"+"SYMRE WS"*\\(", 1, false, false }, { "CHARACTER", "STRING", "%schar *%.*s", - "char"WS"+\\*"WS"*"SYMRE WS"*\\(", 1, 0, 0 }, + "char"WS"+\\*"WS"*"SYMRE WS"*\\(", 1, false, false }, { "INTEGER", "INT", "%sint %.*s", - "(const"WS"+)?int"WS"+"SYMRE WS"*\\(", 2, 0, 0 }, + "(const"WS"+)?int"WS"+"SYMRE WS"*\\(", 2, false, false }, + { "LOGICAL", "LOGICAL", "%sbool %.*s", + "(const"WS"+)?bool"WS"+"SYMRE WS"*\\(", 2, false, false }, { "REAL", "FLOAT", "%sfloat %.*s", - "(const"WS"+)?float"WS"+"SYMRE WS"*\\(", 2, 0, 0 }, + "(const"WS"+)?float"WS"+"SYMRE WS"*\\(", 2, false, false }, { "DOUBLEPRECISION", "DOUBLE", "%sdouble %.*s", - "(const"WS"+)?double"WS"+"SYMRE WS"*\\(", 2, 0, 0 }, + "(const"WS"+)?double"WS"+"SYMRE WS"*\\(", 2, false, false }, { "INTEGER", "INT", "%sMPI_Comm %.*s", - "MPI_Comm"WS"+"SYMRE WS"*\\(", 1, 0, 0, cfMPICommConvert, "%sint %.*s" }, + "MPI_Comm"WS"+"SYMRE WS"*\\(", 1, true, false, cfMPICommConvert, "%sint %.*s" }, { "INTEGER", "INT", "%sDateType %.*s", - "(const"WS"+)?DateType"WS"+"SYMRE WS"*\\(", 2, 1, 0, cfDateTypeConvert, "%sint %.*s" }, + "(const"WS"+)?DateType"WS"+"SYMRE WS"*\\(", 2, true, false, cfDateTypeConvert, "%sint %.*s" }, { "INTEGER", "INT", "%sSizeType %.*s", - "(const"WS"+)?SizeType"WS"+"SYMRE WS"*\\(", 2, 1, 0, cfSizeTypeConvert, "%sint %.*s" }, + "(const"WS"+)?SizeType"WS"+"SYMRE WS"*\\(", 2, true, false, cfSizeTypeConvert, "%sint %.*s" }, }; #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5) #pragma GCC diagnostic pop @@ -274,122 +303,16 @@ static inline int arrayArgRank(int argType); static void -sprintFortranArrayArgDims(size_t argDimsFSize, char argDimsF[argDimsFSize], - int argType, const char *argSpecC, size_t maxMatch, regmatch_t reMatch[]); - -static void -sprintCArrayArgDims(size_t argDimsCSize, char argDimsC[argDimsCSize], - int argType, const char *argSpecC, const regmatch_t reMatch[]); +emitWrapper(char *restrict delegateNameBuf, FILE *fpint, + const char *line, + enum cftype functype, const char *funcname, size_t funcnameLen, + size_t funcargc, const int funcargtype[], + const regmatch_t funcargfull[], const regmatch_t funcargname[], + size_t maxMatch, regmatch_t *restrict reMatch); static void -function_fwrap(FILE *fpint, enum cftype functype, const char *delegateName, size_t delegateNameLen, size_t funcargc, int *funcargtype, - regmatch_t *funcargfull, regmatch_t *funcargname, char *funcname, size_t maxMatch, regmatch_t *reMatch, char *line) -{ - fputs("static ", fpint); - fprintf(fpint, (funRet[functype].convert ? funRet[functype].convcfmt : funRet[functype].cfmt), - "", (int)delegateNameLen, delegateName); - fputs("(", fpint); - for (size_t i = 0; i < funcargc; ++i) - { - if (i > 0) fputs(", ", fpint); - enum { arrayDimsCSize = 128 }; - char arrayDimsC[arrayDimsCSize]; - static const char constStr[] = "const ", nonConstStr[] = ""; - const char *constStrP; - const int argType = funcargtype[i]; - const int isArray = isArrayArgType(argType); - if (!isArray) - { - arrayDimsC[0] = 0; - constStrP = nonConstStr; - } - else - { - if (regexec(&funArgSym[argType].preg, line + funcargfull[i].rm_so, maxMatch, reMatch, 0)) - { - fprintf(stderr, "unexpected non-matching of array argument regexp!\n"); - exit(1); - } - if (reMatch[1].rm_eo - reMatch[1].rm_so > 5 - && !strncmp(line + funcargfull[i].rm_so + reMatch[1].rm_so, constStr, sizeof (constStr) - 2)) - constStrP = constStr; - else - constStrP = nonConstStr; - sprintCArrayArgDims(arrayDimsCSize, arrayDimsC, argType, line + funcargfull[i].rm_so, reMatch); - } - fprintf(fpint, (funArgSym[argType].convert ? funArgSym[argType].convcfmt : funArgSym[argType].cfmt), - constStrP, (int)(funcargname[i].rm_eo - funcargname[i].rm_so), - line + funcargname[i].rm_so, arrayDimsC); - } - fputs(")\n{\n", fpint); - for (size_t i = 0; i < funcargc; ++i) - { - if (funArgSym[funcargtype[i]].convert && funcargtype[i] == ISDATETYPEP) - { - // create temporary DateType variable - fprintf(fpint, " DateType %.*s_DateType;\n", - (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so); - } - if (funArgSym[funcargtype[i]].convert && funcargtype[i] == ISSIZETYPEP) - { - // create temporary SizeType variable - fprintf(fpint, " SizeType %.*s_SizeType;\n", - (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so); - } - } - if (functype != ISVOID) - { - fputs(" ", fpint); - fprintf(fpint, funRet[functype].cfmt, "", 1, "v"); - fprintf(fpint, ";\n"); - fprintf(fpint, " v = %s(", funcname); - } - else - fprintf(fpint, " %s(", funcname); - for (size_t i = 0; i < funcargc; ++i) - { - if (i > 0) fputs(", ", fpint); - if (funArgSym[funcargtype[i]].convert) - { - funArgSym[funcargtype[i]].convert(fpint, line + funcargname[i].rm_so, - (size_t)(funcargname[i].rm_eo - funcargname[i].rm_so), CONV_ARG); - } - else - fprintf(fpint, "%.*s", (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so); - } - fputs(");\n", fpint); - for (size_t i = 0; i < funcargc; ++i) - { - if (funArgSym[funcargtype[i]].convert && funcargtype[i] == ISDATETYPEP) - { - fprintf(fpint, " assert(%.*s_DateType < INT_MAX);\n", - (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so); - // copy temporary DateType variable - fprintf(fpint, " *%.*s = %.*s_DateType;\n", - (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so, - (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so); - } - if (funArgSym[funcargtype[i]].convert && funcargtype[i] == ISSIZETYPEP) - { - fprintf(fpint, " assert(%.*s_SizeType < INT_MAX);\n", - (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so); - // copy temporary SizeType variable - fprintf(fpint, " *%.*s = %.*s_SizeType;\n", - (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so, - (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so); - } - } - if (functype != ISVOID) - { - fputs(" return ", fpint); - if (funRet[functype].convert) - funRet[functype].convert(fpint, "v", 1, CONV_RET); - else - fputc('v', fpint); - fputs(";\n", fpint); - } - fputs("}\n", fpint); -} +sprintFortranArrayArgDims(size_t argDimsFSize, char argDimsF[argDimsFSize], + int argType, const char *argSpecC, size_t maxMatch, regmatch_t reMatch[]); static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const char *doc_root) { @@ -456,7 +379,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const } /* compile complete comment regular expression */ { - static const char commentREString[] = "^"WS"*/\\*"WS"*(.*"NWS")"WS"*\\*/"; + static const char commentREString[] = "^"WS"*/\\*"WS"*("NWS"+("WS"+"NWS"+)*)?"WS"*\\*/"; static const char comment2REString[] = "^"WS"*//"WS"*(.*"NWS")"; if (reCompile(&commentRE, commentREString, &line, &lineBufSize)) exit(EXIT_FAILURE); @@ -546,9 +469,15 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const "/* These functions are meant to be called from Fortran and don't\n" " * need an interface declaration in a C header. */\n" "#ifdef __clang__\n" + "# pragma GCC diagnostic push\n" "# pragma GCC diagnostic ignored \"-Wmissing-prototypes\"\n" "#endif\n" "\n", fpint); + + + // TODO: the string below should be generated using build_header_name + // for consistency + fputs("#ifdef CDI_H_\n\n", fpint); /* fputs("static inline\n" "int DateType_c2f(DateType value_DateType)\n" @@ -565,6 +494,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const " return (int) value_SizeType;\n" "}\n" "\n", fpint); + fputs("#endif\n", fpint); bool startFortran = false; ssize_t lineLen; @@ -582,16 +512,17 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const if (strncmp(line, "//FINT_OFF", 10) == 0) break; functype = ISVOID; pline = line; - int needsExtraWrapper = 0, needsPrologue = 0; + bool needsExtraWrapper = false, needsPrologue = false; size_t funcnameLen; enum decl declType = UNKNOWN_DECL; do { for (int retType = 0; retType < NUM_RET_TYPES; ++retType) if (!regexec(&funRet[retType].preg, pline, maxMatch, reMatch, 0)) { - functype = retType; + functype = (enum cftype) retType; declType = FUNC_DECL; - needsExtraWrapper = needsExtraWrapper || funRet[retType].needsExtraWrapper; + needsPrologue |= funRet[retType].needsPrologue; + needsExtraWrapper |= funRet[retType].needsExtraWrapper; break; } if (declType == UNKNOWN_DECL) @@ -606,7 +537,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const funcnameLen = (size_t)nameLen; if ( pline[funNameLast] != '(' ) { - printf("%s\n>(< not found!", line); + fprintf(stderr, "%s\n>(< not found!", line); return; } memcpy(funcname, pline + nameMatch->rm_so, funcnameLen); @@ -691,19 +622,19 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const regmatch_t *nameMatch = reMatch + funArgSym[argtype].nameMatch; funcargname[i].rm_so = nameMatch->rm_so + argStart; funcargname[i].rm_eo = nameMatch->rm_eo + argStart; - needsExtraWrapper = needsExtraWrapper || funArgSym[argtype].needsExtraWrapper; - needsPrologue = needsPrologue || funArgSym[argtype].needsPrologue; + needsExtraWrapper |= funArgSym[argtype].needsExtraWrapper; + needsPrologue |= funArgSym[argtype].needsPrologue; break; } if (argtype == NUM_KNOWN_ARG_TYPES) { - printf("%s not implemented\n", line + funcargname[i].rm_so); + fprintf(stderr, "%s not implemented\n", line + funcargname[i].rm_so); break; } } if ( i != funcargc ) { - printf("problem parsing line: %s\n", line); + fprintf(stderr, "problem parsing line: %s\n", line); continue; } } @@ -743,7 +674,6 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const /* fortran interface */ const char *delegateName; char delegateNameBuf[MAX_FUNC_NAME_LEN + 7]; - size_t delegateNameLen = funcnameLen; /* emit prologue if needed */ if (needsPrologue) { @@ -758,20 +688,18 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const /* emit wrapper for type conversions if needed */ if (needsExtraWrapper) { - strcpy(delegateNameBuf, funcname); - strcat(delegateNameBuf, "_fwrap"); - delegateNameLen += 6; + emitWrapper(delegateNameBuf, fpint, line, + functype, funcname, funcnameLen, + funcargc, funcargtype, funcargfull, funcargname, + maxMatch, reMatch); delegateName = delegateNameBuf; - - function_fwrap(fpint, functype, delegateName, delegateNameLen, funcargc, funcargtype, - funcargfull, funcargname, funcname, maxMatch, reMatch, line); } else delegateName = funcname; - fprintf(fpint, (functype == ISVOID) ? "FCALLSCSUB" : "FCALLSCFUN"); + fputs(functype == ISVOID ? "FCALLSCSUB" : "FCALLSCFUN", fpint); fprintf(fpint, "%zd ", funcargc); - fprintf(fpint, "("); + fputs("(", fpint); if ( functype != ISVOID ) fprintf(fpint, "%s, ", funRet[functype].cfint); fprintf(fpint, "%s, ", delegateName); @@ -785,7 +713,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const { fprintf(fpint, ", %s", funArgSym[funcargtype[i]].cfint); } - fprintf(fpint, ")\n"); + fputs(")\n", fpint); if ( funcnameLen == xnameLen && memcmp(funcname, xname, funcnameLen) == 0 ) @@ -801,9 +729,10 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const cdoc[ncdoc].fname = strdup(funcname); nch = sprintf(xline, funRet[functype].cfmt, "", (int)funcnameLen, funcname); - xline[nch++] = ' '; - xline[nch++] = '('; - xline[nch] = '\0'; + xline[nch ] = ' '; + xline[nch+1] = '('; + xline[nch+2] = '\0'; + nch += 2; xlineLen = (size_t)nch; if ( (funcargc == 1 && funcargtype[0] == ISVOID) ) funcargc = 0; @@ -812,7 +741,9 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const { if (i) { - strcat(xline, ", "); + xline[xlineLen ] = ','; + xline[xlineLen+1] = ' '; + xline[xlineLen+2] = '\0'; xlineLen += 2; } @@ -835,7 +766,10 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const strcat(xline, farg); xlineLen += (size_t)nchn; } - strcat(xline, ");"); + xline[xlineLen ] = ')'; + xline[xlineLen+1] = ';'; + xline[xlineLen+2] = '\0'; + xlineLen += 2; cdoc[ncdoc].aline[cdoc[ncdoc].naline++] = strdup(xline); cdoc[ncdoc].text = strdup(xdes); @@ -847,13 +781,18 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const fdoc[nfdoc].text = NULL; fdoc[nfdoc].fname = strdup(funcname); - if ( functype == ISVOID ) - nch = sprintf(xline, "SUBROUTINE %s", xname); - else - nch = sprintf(xline, "%s FUNCTION %s", funArgSym[functype].f77name, xname); + nch = sprintf(xline, "%s%s %s", funArgSym[functype].f77name, + functype == ISVOID ? "SUBROUTINE" : " FUNCTION", + xname); if ( (funcargc == 1 && funcargtype[0] == ISVOID) ) funcargc = 0; - if (funcargc) strcat(xline, " ("), nch += 2; + if (funcargc) + { + xline[nch ] = ' '; + xline[nch+1] = '('; + xline[nch+2] = '\0'; + nch += 2; + } xlineLen = (size_t)nch; @@ -861,7 +800,9 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const { if (i) { - strcat(xline, ", "); + xline[xlineLen ] = ','; + xline[xlineLen+1] = ' '; + xline[xlineLen+2] = '\0'; xlineLen += 2U; } @@ -890,7 +831,12 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const strcat(xline, farg); xlineLen += (size_t)nchn; } - if ( funcargc ) strcat(xline, ")"); + if ( funcargc ) + { + xline[xlineLen ] = ')'; + xline[xlineLen+1] = '\0'; + xlineLen += 1; + } fdoc[nfdoc].aline[fdoc[nfdoc].naline++] = strdup(xline); fdoc[nfdoc].text = strdup(xdes); @@ -972,7 +918,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const else { if ( lineLen > 1 ) - printf("skip: line %3d size %3zd %s%s", lineno, lineLen, line, + fprintf(stderr, "skip: line %3d size %3zd %s%s", lineno, lineLen, line, line[lineLen-1]=='\n'?"":"missing new-line\n"); } } @@ -993,6 +939,7 @@ static void fortran_interface(char *fname, char *fnameinc, char *fnameint, const qsort(cdoc, ncdoc, sizeof(Docu), doccmp); qsort(fdoc, nfdoc, sizeof(Docu), doccmp); + if ( NULL == doc_root ) return; char *filename; const size_t doc_root_len = strlen(doc_root); @@ -1106,19 +1053,23 @@ build_header_name(const size_t len, const char *fname, char *cppMacro) int main(int argc, char *argv[]) { - const char *doc_root = default_doc_root; + const char *doc_root = NULL, *out_root = NULL; int optargCount = 0; { int opt; - while ((opt = getopt(argc, argv, "d:")) != -1) + while ((opt = getopt(argc, argv, "d:o:")) != -1) switch (opt) { case 'd': doc_root = optarg; - optargCount = 2; + optargCount += 2; + break; + case 'o': + out_root = optarg; + optargCount += 2; break; default: /* '?' */ - fprintf(stderr, "Usage: %s [-d DOCROOT] includefile\n", argv[0]); + fprintf(stderr, "Usage: %s [-d DOCROOT] [-o OUTROOT] includefile\n", argv[0]); return EXIT_FAILURE; } } @@ -1126,21 +1077,53 @@ int main(int argc, char *argv[]) if ( argc != 2 + optargCount) { - printf("Usage: %s [-d DOCROOT] includefile\n", argv[0]); + printf("Usage: %s [-d DOCROOT] [-o OUTROOT] includefile\n", argv[0]); return 1; } char *fname = argv[1 + optargCount]; - char *cp = strrchr(fname, '.'); - const size_t len = (cp == NULL) ? strlen(fname) : (size_t)(cp - fname); + const char *cs = strrchr(fname, '/'); + const char *fbasename = (cs == NULL) ? fname : cs + 1; + + const char *cp = strrchr(fbasename, '.'); + const size_t fbasename_len = (cp == NULL) ? strlen(fbasename) : (size_t) (cp - fbasename); + + const char *fprefix; + size_t fprefix_len; + + if (out_root == NULL) + { + fprefix = fname; + fprefix_len = (size_t) (fbasename - fname); + } + else + { + fprefix = out_root; + fprefix_len = strlen(out_root); + } char fnameinc[128], fnameint[128]; - memcpy(fnameinc, fname, len); - memcpy(fnameint, fname, len); - strcpy(fnameinc+len, ".inc"); - strcpy(fnameint+len, "Fortran.c"); + if (fprefix_len > 0) + { + memcpy(fnameinc, fprefix, fprefix_len); + memcpy(fnameint, fprefix, fprefix_len); + + if (fprefix[fprefix_len - 1] != '/') + { + fnameinc[fprefix_len] = fnameint[fprefix_len] = '/'; + fprefix_len += 1; + } + } + + size_t fname_idx = fprefix_len; + memcpy(fnameinc + fname_idx, fbasename, fbasename_len); + memcpy(fnameint + fname_idx, fbasename, fbasename_len); + + fname_idx += fbasename_len; + strcpy(fnameinc + fname_idx, ".inc"); + strcpy(fnameint + fname_idx, "Fortran.c"); fortran_interface(fname, fnameinc, fnameint, doc_root); @@ -1435,6 +1418,7 @@ isArrayArgType(const int argType) || argType == ISFLOATVV || argType == ISDOUBLEV || argType == ISDOUBLEVV + || argType == ISXT_IDXLISTV || argType == ISINTV || argType == ISINTVV || argType == ISINTVVV; @@ -1448,6 +1432,7 @@ arrayArgRank(const int argType) case ISFLOATV: case ISDOUBLEV: case ISINTV: + case ISXT_IDXLISTV: rank = 1; break; case ISINTVV: @@ -1465,30 +1450,7 @@ arrayArgRank(const int argType) static void sprintCArrayArgDims(size_t argDimsCSize, char argDimsC[argDimsCSize], int argType, const char *argSpecC, - const regmatch_t reMatch[]) -{ - size_t argDimsCPos = 0; - const int arank = arrayArgRank(argType); - for (int rank = 1; rank <= arank; ++rank) - { - const size_t rankBoundMatch - = funArgSym[argType].nameMatch + (size_t)rank; - const size_t boundStringLen - = (size_t)(reMatch[rankBoundMatch].rm_eo - - reMatch[rankBoundMatch].rm_so); - argDimsC[argDimsCPos++] = '['; - if (boundStringLen) - { - memcpy(argDimsC + argDimsCPos, - argSpecC + reMatch[rankBoundMatch].rm_so, - boundStringLen); - argDimsCPos += boundStringLen; - } - argDimsC[argDimsCPos++] = ']'; - } - argDimsC[argDimsCPos++] = 0; -} - + const regmatch_t reMatch[]); static void sprintFortranArrayArgDims(size_t argDimsFSize, char argDimsF[argDimsFSize], @@ -1525,6 +1487,160 @@ sprintFortranArrayArgDims(size_t argDimsFSize, char argDimsF[argDimsFSize], argDimsF[argDimsFPos++] = 0; } +/* + * Creates a wrapper function to call funcname indirectly. + * + * This is needed in case a function needs a wrapper going from + * Fortran to C or back because a variable type cannot be used + * directly like e.g. MPI_Comm + */ +static void +emitWrapper(char *restrict delegateNameBuf, FILE *fpint, + const char *line, + enum cftype functype, const char *funcname, size_t funcnameLen, + size_t funcargc, const int funcargtype[], + const regmatch_t funcargfull[], const regmatch_t funcargname[], + size_t maxMatch, regmatch_t *restrict reMatch) +{ + static const char fwrap_suffix[] = "_fwrap"; + size_t delegateNameLen = funcnameLen; + strcpy(delegateNameBuf, funcname); + strcpy(delegateNameBuf+delegateNameLen, fwrap_suffix); + delegateNameLen += sizeof (fwrap_suffix) - 1; + const char *delegateName = delegateNameBuf; + fputs("static ", fpint); + fprintf(fpint, (funRet[functype].convert ? funRet[functype].convcfmt : funRet[functype].cfmt), + "", (int)delegateNameLen, delegateName); + fputs("(", fpint); + for (size_t i = 0; i < funcargc; ++i) + { + if (i > 0) fputs(", ", fpint); + enum { arrayDimsCSize = 128 }; + char arrayDimsC[arrayDimsCSize]; + static const char constStr[] = "const ", nonConstStr[] = ""; + const char *constStrP; + const int argType = funcargtype[i]; + const int isArray = isArrayArgType(argType); + if (!isArray) + { + arrayDimsC[0] = 0; + constStrP = nonConstStr; + } + else + { + if (regexec(&funArgSym[argType].preg, line + funcargfull[i].rm_so, maxMatch, reMatch, 0)) + { + fprintf(stderr, "unexpected non-matching of array argument regexp!\n"); + exit(1); + } + if (reMatch[1].rm_eo - reMatch[1].rm_so > 5 + && !strncmp(line + funcargfull[i].rm_so + reMatch[1].rm_so, constStr, sizeof (constStr) - 2)) + constStrP = constStr; + else + constStrP = nonConstStr; + sprintCArrayArgDims(arrayDimsCSize, arrayDimsC, argType, line + funcargfull[i].rm_so, reMatch); + } + fprintf(fpint, (funArgSym[argType].convert ? funArgSym[argType].convcfmt : funArgSym[argType].cfmt), + constStrP, (int)(funcargname[i].rm_eo - funcargname[i].rm_so), + line + funcargname[i].rm_so, arrayDimsC); + } + fputs(")\n{\n", fpint); + for (size_t i = 0; i < funcargc; ++i) + { + if (funArgSym[funcargtype[i]].convert && funcargtype[i] == ISDATETYPEP) + { + // create temporary DateType variable + fprintf(fpint, " DateType %.*s_DateType;\n", + (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so); + } + if (funArgSym[funcargtype[i]].convert && funcargtype[i] == ISSIZETYPEP) + { + // create temporary SizeType variable + fprintf(fpint, " SizeType %.*s_SizeType;\n", + (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so); + } + } + if (functype != ISVOID) + { + fputs(" ", fpint); + fprintf(fpint, funRet[functype].cfmt, "", 1, "v"); + fprintf(fpint, ";\n"); + fprintf(fpint, " v = %s(", funcname); + } + else + fprintf(fpint, " %s(", funcname); + for (size_t i = 0; i < funcargc; ++i) + { + if (i > 0) fputs(", ", fpint); + if (funArgSym[funcargtype[i]].convert) + { + funArgSym[funcargtype[i]].convert(fpint, line + funcargname[i].rm_so, + (size_t)(funcargname[i].rm_eo - funcargname[i].rm_so), CONV_ARG); + } + else + fprintf(fpint, "%.*s", (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so); + } + fputs(");\n", fpint); + for (size_t i = 0; i < funcargc; ++i) + { + if (funArgSym[funcargtype[i]].convert && funcargtype[i] == ISDATETYPEP) + { + fprintf(fpint, " assert(%.*s_DateType < INT_MAX);\n", + (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so); + // copy temporary DateType variable + fprintf(fpint, " *%.*s = %.*s_DateType;\n", + (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so, + (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so); + } + if (funArgSym[funcargtype[i]].convert && funcargtype[i] == ISSIZETYPEP) + { + fprintf(fpint, " assert(%.*s_SizeType < INT_MAX);\n", + (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so); + // copy temporary SizeType variable + fprintf(fpint, " *%.*s = %.*s_SizeType;\n", + (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so, + (int)(funcargname[i].rm_eo - funcargname[i].rm_so), line + funcargname[i].rm_so); + } + } + if (functype != ISVOID) + { + fputs(" return ", fpint); + if (funRet[functype].convert) + funRet[functype].convert(fpint, "v", 1, CONV_RET); + else + fputc('v', fpint); + fputs(";\n", fpint); + } + fputs("}\n", fpint); +} + +static void +sprintCArrayArgDims(size_t argDimsCSize, char argDimsC[argDimsCSize], + int argType, const char *argSpecC, + const regmatch_t reMatch[]) +{ + size_t argDimsCPos = 0; + const int arank = arrayArgRank(argType); + for (int rank = 1; rank <= arank; ++rank) + { + const size_t rankBoundMatch + = funArgSym[argType].nameMatch + (size_t)rank; + const size_t boundStringLen + = (size_t)(reMatch[rankBoundMatch].rm_eo + - reMatch[rankBoundMatch].rm_so); + argDimsC[argDimsCPos++] = '['; + if (boundStringLen) + { + memcpy(argDimsC + argDimsCPos, + argSpecC + reMatch[rankBoundMatch].rm_so, + boundStringLen); + argDimsCPos += boundStringLen; + } + argDimsC[argDimsCPos++] = ']'; + } + argDimsC[argDimsCPos++] = 0; +} + // clang-format on /* diff --git a/src/mo_cdi.f90 b/src/mo_cdi.f90 deleted file mode 100644 index 873220153e6bca71b1c38446da904e2fd777709c..0000000000000000000000000000000000000000 --- a/src/mo_cdi.f90 +++ /dev/null @@ -1,6213 +0,0 @@ -! >>> Warning: This is a generated file. If you modify it, you get what you deserve. <<< -! -! Generated by "../../../interfaces/f2003/bindGen.rb" from input file "cditmp.h". - -module mo_cdi - use iso_c_binding - implicit none - private - - public ctrim - public c_len - - interface - integer(c_size_t) function lib_strlen(charPtr) bind(c, name = "strlen") - import c_size_t, c_ptr - type(c_ptr), value :: charPtr - end function lib_strlen - - subroutine lib_free(pointer) bind(c, name = "free") - import c_ptr - type(c_ptr), value, intent(in) :: pointer - end subroutine lib_free - end interface - - integer(c_int), public, parameter :: CDI_MAX_NAME = 256 - integer(c_int), public, parameter :: CDI_UNDEFID = -1 - integer(c_int), public, parameter :: CDI_GLOBAL = -1 - integer(c_int), public, parameter :: CDI_XAXIS = 1 - integer(c_int), public, parameter :: CDI_YAXIS = 2 - integer(c_int), public, parameter :: CDI_BIGENDIAN = 0 - integer(c_int), public, parameter :: CDI_LITTLEENDIAN = 1 - integer(c_int), public, parameter :: CDI_PDPENDIAN = 2 - integer(c_int), public, parameter :: CDI_REAL = 1 - integer(c_int), public, parameter :: CDI_COMP = 2 - integer(c_int), public, parameter :: CDI_BOTH = 3 - integer(c_int), public, parameter :: CDI_NOERR = 0 - integer(c_int), public, parameter :: CDI_EEOF = -1 - integer(c_int), public, parameter :: CDI_ETMOF = -9 - integer(c_int), public, parameter :: CDI_ESYSTEM = -10 - integer(c_int), public, parameter :: CDI_EINVAL = -20 - integer(c_int), public, parameter :: CDI_EISDIR = -21 - integer(c_int), public, parameter :: CDI_EISEMPTY = -22 - integer(c_int), public, parameter :: CDI_EUFTYPE = -23 - integer(c_int), public, parameter :: CDI_ELIBNAVAIL = -24 - integer(c_int), public, parameter :: CDI_EUFSTRUCT = -25 - integer(c_int), public, parameter :: CDI_EUNC4 = -26 - integer(c_int), public, parameter :: CDI_EDIMSIZE = -27 - integer(c_int), public, parameter :: CDI_ELIMIT = -99 - integer(c_int), public, parameter :: CDI_FILETYPE_GRB = 1 - integer(c_int), public, parameter :: CDI_FILETYPE_GRB2 = 2 - integer(c_int), public, parameter :: CDI_FILETYPE_NC = 3 - integer(c_int), public, parameter :: CDI_FILETYPE_NC2 = 4 - integer(c_int), public, parameter :: CDI_FILETYPE_NC4 = 5 - integer(c_int), public, parameter :: CDI_FILETYPE_NC4C = 6 - integer(c_int), public, parameter :: CDI_FILETYPE_NC5 = 7 - integer(c_int), public, parameter :: CDI_FILETYPE_SRV = 8 - integer(c_int), public, parameter :: CDI_FILETYPE_EXT = 9 - integer(c_int), public, parameter :: CDI_FILETYPE_IEG = 10 - integer(c_int), public, parameter :: CDI_FILETYPE_NCZARR = 11 - integer(c_int), public, parameter :: FILETYPE_GRB = 1 - integer(c_int), public, parameter :: FILETYPE_GRB2 = 2 - integer(c_int), public, parameter :: FILETYPE_NC = 3 - integer(c_int), public, parameter :: FILETYPE_NC2 = 4 - integer(c_int), public, parameter :: FILETYPE_NC4 = 5 - integer(c_int), public, parameter :: CDI_PROTOCOL_OTHER = 0 - integer(c_int), public, parameter :: CDI_PROTOCOL_FILE = 1 - integer(c_int), public, parameter :: CDI_PROTOCOL_FDB = 2 - integer(c_int), public, parameter :: CDI_PROTOCOL_ACROSS = 3 - integer(c_int), public, parameter :: CDI_COMPRESS_NONE = 0 - integer(c_int), public, parameter :: CDI_COMPRESS_SZIP = 1 - integer(c_int), public, parameter :: CDI_COMPRESS_AEC = 2 - integer(c_int), public, parameter :: CDI_COMPRESS_ZIP = 3 - integer(c_int), public, parameter :: CDI_COMPRESS_JPEG = 4 - integer(c_int), public, parameter :: DATATYPE_PACK16 = 16 - integer(c_int), public, parameter :: DATATYPE_PACK24 = 24 - integer(c_int), public, parameter :: DATATYPE_FLT32 = 132 - integer(c_int), public, parameter :: DATATYPE_FLT64 = 164 - integer(c_int), public, parameter :: DATATYPE_INT32 = 232 - integer(c_int), public, parameter :: DATATYPE_INT = 251 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK = 0 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK1 = 1 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK2 = 2 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK3 = 3 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK4 = 4 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK5 = 5 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK6 = 6 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK7 = 7 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK8 = 8 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK9 = 9 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK10 = 10 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK11 = 11 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK12 = 12 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK13 = 13 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK14 = 14 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK15 = 15 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK16 = 16 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK17 = 17 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK18 = 18 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK19 = 19 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK20 = 20 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK21 = 21 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK22 = 22 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK23 = 23 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK24 = 24 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK25 = 25 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK26 = 26 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK27 = 27 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK28 = 28 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK29 = 29 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK30 = 30 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK31 = 31 - integer(c_int), public, parameter :: CDI_DATATYPE_PACK32 = 32 - integer(c_int), public, parameter :: CDI_DATATYPE_CPX32 = 64 - integer(c_int), public, parameter :: CDI_DATATYPE_CPX64 = 128 - integer(c_int), public, parameter :: CDI_DATATYPE_FLT32 = 132 - integer(c_int), public, parameter :: CDI_DATATYPE_FLT64 = 164 - integer(c_int), public, parameter :: CDI_DATATYPE_INT8 = 208 - integer(c_int), public, parameter :: CDI_DATATYPE_INT16 = 216 - integer(c_int), public, parameter :: CDI_DATATYPE_INT32 = 232 - integer(c_int), public, parameter :: CDI_DATATYPE_UINT8 = 308 - integer(c_int), public, parameter :: CDI_DATATYPE_UINT16 = 316 - integer(c_int), public, parameter :: CDI_DATATYPE_UINT32 = 332 - integer(c_int), public, parameter :: CDI_DATATYPE_INT = 251 - integer(c_int), public, parameter :: CDI_DATATYPE_FLT = 252 - integer(c_int), public, parameter :: CDI_DATATYPE_TXT = 253 - integer(c_int), public, parameter :: CDI_DATATYPE_CPX = 254 - integer(c_int), public, parameter :: CDI_DATATYPE_UCHAR = 255 - integer(c_int), public, parameter :: CDI_DATATYPE_LONG = 256 - integer(c_int), public, parameter :: CDI_DATATYPE_UINT = 257 - integer(c_int), public, parameter :: CDI_CHUNK_AUTO = 1 - integer(c_int), public, parameter :: CDI_CHUNK_GRID = 2 - integer(c_int), public, parameter :: CDI_CHUNK_LINES = 3 - integer(c_int), public, parameter :: GRID_GENERIC = 1 - integer(c_int), public, parameter :: GRID_GAUSSIAN = 2 - integer(c_int), public, parameter :: GRID_GAUSSIAN_REDUCED = 3 - integer(c_int), public, parameter :: GRID_LONLAT = 4 - integer(c_int), public, parameter :: GRID_SPECTRAL = 5 - integer(c_int), public, parameter :: GRID_FOURIER = 6 - integer(c_int), public, parameter :: GRID_GME = 7 - integer(c_int), public, parameter :: GRID_TRAJECTORY = 8 - integer(c_int), public, parameter :: GRID_UNSTRUCTURED = 9 - integer(c_int), public, parameter :: GRID_CURVILINEAR = 10 - integer(c_int), public, parameter :: GRID_PROJECTION = 12 - integer(c_int), public, parameter :: GRID_CHARXY = 13 - integer(c_int), public, parameter :: CDI_PROJ_RLL = 21 - integer(c_int), public, parameter :: CDI_PROJ_LCC = 22 - integer(c_int), public, parameter :: CDI_PROJ_LAEA = 23 - integer(c_int), public, parameter :: CDI_PROJ_SINU = 24 - integer(c_int), public, parameter :: CDI_PROJ_STERE = 25 - integer(c_int), public, parameter :: CDI_PROJ_HEALPIX = 26 - integer(c_int), public, parameter :: ZAXIS_SURFACE = 0 - integer(c_int), public, parameter :: ZAXIS_GENERIC = 1 - integer(c_int), public, parameter :: ZAXIS_HYBRID = 2 - integer(c_int), public, parameter :: ZAXIS_HYBRID_HALF = 3 - integer(c_int), public, parameter :: ZAXIS_PRESSURE = 4 - integer(c_int), public, parameter :: ZAXIS_HEIGHT = 5 - integer(c_int), public, parameter :: ZAXIS_DEPTH_BELOW_SEA = 6 - integer(c_int), public, parameter :: ZAXIS_DEPTH_BELOW_LAND = 7 - integer(c_int), public, parameter :: ZAXIS_ISENTROPIC = 8 - integer(c_int), public, parameter :: ZAXIS_TRAJECTORY = 9 - integer(c_int), public, parameter :: ZAXIS_ALTITUDE = 10 - integer(c_int), public, parameter :: ZAXIS_SIGMA = 11 - integer(c_int), public, parameter :: ZAXIS_MEANSEA = 12 - integer(c_int), public, parameter :: ZAXIS_TOA = 13 - integer(c_int), public, parameter :: ZAXIS_SEA_BOTTOM = 14 - integer(c_int), public, parameter :: ZAXIS_ATMOSPHERE = 15 - integer(c_int), public, parameter :: ZAXIS_CLOUD_BASE = 16 - integer(c_int), public, parameter :: ZAXIS_CLOUD_TOP = 17 - integer(c_int), public, parameter :: ZAXIS_ISOTHERM_ZERO = 18 - integer(c_int), public, parameter :: ZAXIS_SNOW = 19 - integer(c_int), public, parameter :: ZAXIS_LAKE_BOTTOM = 20 - integer(c_int), public, parameter :: ZAXIS_SEDIMENT_BOTTOM = 21 - integer(c_int), public, parameter :: ZAXIS_SEDIMENT_BOTTOM_TA = 22 - integer(c_int), public, parameter :: ZAXIS_SEDIMENT_BOTTOM_TW = 23 - integer(c_int), public, parameter :: ZAXIS_MIX_LAYER = 24 - integer(c_int), public, parameter :: ZAXIS_REFERENCE = 25 - integer(c_int), public, parameter :: ZAXIS_CHAR = 26 - integer(c_int), public, parameter :: ZAXIS_TROPOPAUSE = 27 - integer(c_int), public, parameter :: MAX_KV_PAIRS_MATCH = 10 - integer(c_int), public, parameter :: TIME_CONSTANT = 0 - integer(c_int), public, parameter :: TIME_VARYING = 1 - integer(c_int), public, parameter :: TIME_VARIABLE = 1 - integer(c_int), public, parameter :: TSTEP_CONSTANT = 0 - integer(c_int), public, parameter :: TSTEP_INSTANT = 1 - integer(c_int), public, parameter :: TSTEP_AVG = 2 - integer(c_int), public, parameter :: TSTEP_ACCUM = 3 - integer(c_int), public, parameter :: TSTEP_MAX = 4 - integer(c_int), public, parameter :: TSTEP_MIN = 5 - integer(c_int), public, parameter :: TSTEP_DIFF = 6 - integer(c_int), public, parameter :: TSTEP_RMS = 7 - integer(c_int), public, parameter :: TSTEP_SD = 8 - integer(c_int), public, parameter :: TSTEP_COV = 9 - integer(c_int), public, parameter :: TSTEP_RATIO = 10 - integer(c_int), public, parameter :: TSTEP_SUM = 11 - integer(c_int), public, parameter :: TSTEP_RANGE = 12 - integer(c_int), public, parameter :: TSTEP_INSTANT2 = 13 - integer(c_int), public, parameter :: TSTEP_INSTANT3 = 14 - integer(c_int), public, parameter :: TAXIS_ABSOLUTE = 1 - integer(c_int), public, parameter :: TAXIS_RELATIVE = 2 - integer(c_int), public, parameter :: TAXIS_FORECAST = 3 - integer(c_int), public, parameter :: TUNIT_SECOND = 1 - integer(c_int), public, parameter :: TUNIT_MINUTE = 2 - integer(c_int), public, parameter :: TUNIT_QUARTER = 3 - integer(c_int), public, parameter :: TUNIT_30MINUTES = 4 - integer(c_int), public, parameter :: TUNIT_HOUR = 5 - integer(c_int), public, parameter :: TUNIT_3HOURS = 6 - integer(c_int), public, parameter :: TUNIT_6HOURS = 7 - integer(c_int), public, parameter :: TUNIT_12HOURS = 8 - integer(c_int), public, parameter :: TUNIT_DAY = 9 - integer(c_int), public, parameter :: TUNIT_MONTH = 10 - integer(c_int), public, parameter :: TUNIT_YEAR = 11 - integer(c_int), public, parameter :: CALENDAR_STANDARD = 0 - integer(c_int), public, parameter :: CALENDAR_GREGORIAN = 1 - integer(c_int), public, parameter :: CALENDAR_PROLEPTIC = 2 - integer(c_int), public, parameter :: CALENDAR_360DAYS = 3 - integer(c_int), public, parameter :: CALENDAR_365DAYS = 4 - integer(c_int), public, parameter :: CALENDAR_366DAYS = 5 - integer(c_int), public, parameter :: CALENDAR_NONE = 6 - integer(c_int), public, parameter :: CDI_UUID_SIZE = 16 - - public t_CdiParam - type, bind(c) :: t_CdiParam - integer(c_int) :: discipline - integer(c_int) :: category - integer(c_int) :: number - end type t_CdiParam - - public :: t_CdiIterator - type :: t_CdiIterator - type(c_ptr) :: ptr - end type t_CdiIterator - - public :: t_CdiGribIterator - type :: t_CdiGribIterator - type(c_ptr) :: ptr - end type t_CdiGribIterator - public :: cdiReset - public :: cdiStringError - public :: cdiDebug - public :: cdiLibraryVersion - public :: cdiPrintVersion - public :: cdiHaveFiletype - public :: cdiDefMissval - public :: cdiInqMissval - public :: cdiDefGlobal - public :: namespaceNew - public :: namespaceSetActive - public :: namespaceGetActive - public :: namespaceDelete - public :: cdiParamToString - public :: cdiDecodeParam - public :: cdiEncodeParam - public :: cdiDecodeDate - public :: cdiEncodeDate - public :: cdiDecodeTime - public :: cdiEncodeTime - public :: cdiGetFiletype - public :: streamOpenRead - public :: streamOpenWrite - public :: streamOpenAppend - public :: streamClose - public :: streamSync - public :: streamDefMaxSteps - public :: streamDefNumWorker - public :: streamDefVlist - public :: streamInqVlist - public :: streamInqFiletype - public :: streamDefByteorder - public :: streamInqByteorder - public :: streamDefCompType - public :: streamInqCompType - public :: streamDefCompLevel - public :: streamInqCompLevel - public :: streamDefTimestep - public :: streamInqTimestep - public :: streamInqCurTimestepID - public :: streamFilename - public :: streamFilesuffix - public :: streamNvals - public :: streamInqNvars - public :: streamWriteVar - public :: streamWriteVarF - public :: streamReadVar - public :: streamReadVarF - public :: streamWriteVarSlice - public :: streamWriteVarSliceF - public :: streamReadVarSlice - public :: streamReadVarSliceF - public :: streamWriteVarChunk - public :: streamDefRecord - public :: streamInqRecord - public :: streamWriteRecord - public :: streamWriteRecordF - public :: streamReadRecord - public :: streamReadRecordF - public :: streamCopyRecord - public :: cdiIterator_new - public :: cdiIterator_clone - public :: cdiIterator_serialize - public :: cdiIterator_deserialize - public :: cdiIterator_delete - public :: cdiIterator_nextField - public :: cdiIterator_inqStartTime - public :: cdiIterator_inqEndTime - public :: cdiIterator_inqRTime - public :: cdiIterator_inqVTime - public :: cdiIterator_inqLevelType - public :: cdiIterator_inqLevel - public :: cdiIterator_inqLevelUuid - public :: cdiIterator_inqTile - public :: cdiIterator_inqTileCount - public :: cdiIterator_inqParam - public :: cdiIterator_inqParamParts - public :: cdiIterator_inqDatatype - public :: cdiIterator_inqFiletype - public :: cdiIterator_inqTsteptype - public :: cdiIterator_inqVariableName - public :: cdiIterator_inqGridId - public :: cdiIterator_readField - public :: cdiIterator_readFieldF - public :: cdiGribIterator_clone - public :: cdiGribIterator_delete - public :: cdiGribIterator_getLong - public :: cdiGribIterator_getDouble - public :: cdiGribIterator_getLength - public :: cdiGribIterator_getString - public :: cdiGribIterator_getSize - public :: cdiGribIterator_getLongArray - public :: cdiGribIterator_getDoubleArray - public :: cdiGribIterator_inqEdition - public :: cdiGribIterator_inqLongValue - public :: cdiGribIterator_inqLongDefaultValue - public :: cdiGribIterator_inqDoubleValue - public :: cdiGribIterator_inqDoubleDefaultValue - public :: cdiGribIterator_inqStringValue - public :: vlistCreate - public :: vlistDestroy - public :: vlistDuplicate - public :: vlistCopy - public :: vlistCopyFlag - public :: vlistClearFlag - public :: vlistCat - public :: vlistMerge - public :: vlistPrint - public :: vlistNumber - public :: vlistNvars - public :: vlistNgrids - public :: vlistNzaxis - public :: vlistNsubtypes - public :: vlistDefNtsteps - public :: vlistNtsteps - public :: vlistGridsizeMax - public :: vlistGrid - public :: vlistGridIndex - public :: vlistChangeGridIndex - public :: vlistChangeGrid - public :: vlistZaxis - public :: vlistZaxisIndex - public :: vlistChangeZaxisIndex - public :: vlistChangeZaxis - public :: vlistNrecs - public :: vlistSubtype - public :: vlistSubtypeIndex - public :: vlistDefTaxis - public :: vlistInqTaxis - public :: vlistDefTable - public :: vlistInqTable - public :: vlistDefInstitut - public :: vlistInqInstitut - public :: vlistDefModel - public :: vlistInqModel - public :: vlistDefVarTiles - public :: vlistDefVar - public :: vlistChangeVarGrid - public :: vlistChangeVarZaxis - public :: vlistInqVar - public :: vlistInqVarGrid - public :: vlistInqVarZaxis - public :: vlistInqVarID - public :: vlistDefVarTimetype - public :: vlistInqVarTimetype - public :: vlistDefVarTsteptype - public :: vlistInqVarTsteptype - public :: vlistDefVarCompType - public :: vlistInqVarCompType - public :: vlistDefVarCompLevel - public :: vlistInqVarCompLevel - public :: vlistDefVarParam - public :: vlistInqVarParam - public :: vlistDefVarCode - public :: vlistInqVarCode - public :: vlistDefVarDatatype - public :: vlistInqVarDatatype - public :: vlistDefVarXYZ - public :: vlistInqVarXYZ - public :: vlistDefVarNSB - public :: vlistInqVarNSB - public :: vlistInqVarNumber - public :: vlistDefVarInstitut - public :: vlistInqVarInstitut - public :: vlistDefVarModel - public :: vlistInqVarModel - public :: vlistDefVarTable - public :: vlistInqVarTable - public :: vlistDefVarName - public :: vlistInqVarName - public :: vlistCopyVarName - public :: vlistDefVarStdname - public :: vlistInqVarStdname - public :: vlistDefVarLongname - public :: vlistInqVarLongname - public :: vlistDefVarUnits - public :: vlistInqVarUnits - public :: vlistDefVarMissval - public :: vlistInqVarMissval - public :: vlistDefVarExtra - public :: vlistInqVarExtra - public :: vlistDefVarScalefactor - public :: vlistInqVarScalefactor - public :: vlistDefVarAddoffset - public :: vlistInqVarAddoffset - public :: vlistInqVarSize - public :: vlistDefIndex - public :: vlistInqIndex - public :: vlistDefFlag - public :: vlistInqFlag - public :: vlistFindVar - public :: vlistFindLevel - public :: vlistMergedVar - public :: vlistMergedLevel - public :: cdiClearAdditionalKeys - public :: cdiDefAdditionalKey - public :: vlistDefVarIntKey - public :: vlistDefVarDblKey - public :: vlistHasVarKey - public :: vlistInqVarDblKey - public :: vlistInqVarIntKey - public :: cdiInqNatts - public :: cdiInqAtt - public :: cdiInqAttLen - public :: cdiInqAttType - public :: cdiDelAtt - public :: cdiCopyAtts - public :: cdiDefAttInt - public :: cdiDefAttFlt - public :: cdiDefAttTxt - public :: cdiInqAttInt - public :: cdiInqAttFlt - public :: cdiInqAttTxt - public :: gridName - public :: gridNamePtr - public :: gridCompress - public :: gridDefMaskGME - public :: gridInqMaskGME - public :: gridDefMask - public :: gridInqMask - public :: gridCreate - public :: gridDestroy - public :: gridDuplicate - public :: gridDefProj - public :: gridInqProj - public :: gridInqProjType - public :: gridInqType - public :: gridInqSize - public :: gridDefXsize - public :: gridInqXsize - public :: gridDefYsize - public :: gridInqYsize - public :: gridDefNP - public :: gridInqNP - public :: gridDefXvals - public :: gridInqXvals - public :: gridInqXvalsPart - public :: gridInqXvalsPtr - public :: gridInqXIsc - public :: gridDefYvals - public :: gridInqYvals - public :: gridInqYvalsPart - public :: gridInqYvalsPtr - public :: gridInqYIsc - integer(c_int), public, parameter :: CDI_KEY_NAME = 942 - integer(c_int), public, parameter :: CDI_KEY_LONGNAME = 943 - integer(c_int), public, parameter :: CDI_KEY_STDNAME = 944 - integer(c_int), public, parameter :: CDI_KEY_UNITS = 945 - integer(c_int), public, parameter :: CDI_KEY_DATATYPE = 946 - integer(c_int), public, parameter :: CDI_KEY_REFERENCEURI = 947 - integer(c_int), public, parameter :: CDI_KEY_NUMBEROFGRIDUSED = 961 - integer(c_int), public, parameter :: CDI_KEY_NUMBEROFGRIDINREFERENCE = 962 - integer(c_int), public, parameter :: CDI_KEY_NUMBEROFVGRIDUSED = 963 - integer(c_int), public, parameter :: CDI_KEY_NLEV = 964 - integer(c_int), public, parameter :: CDI_KEY_CHUNKTYPE = 965 - integer(c_int), public, parameter :: CDI_KEY_CHUNKSIZE = 966 - integer(c_int), public, parameter :: CDI_KEY_MISSVAL = 701 - integer(c_int), public, parameter :: CDI_KEY_UUID = 960 - integer(c_int), public, parameter :: CDI_KEY_DIMNAME = 941 - integer(c_int), public, parameter :: CDI_KEY_PSNAME = 950 - integer(c_int), public, parameter :: CDI_KEY_P0NAME = 951 - integer(c_int), public, parameter :: CDI_KEY_P0VALUE = 952 - integer(c_int), public, parameter :: CDI_KEY_TABLESVERSION = 801 - integer(c_int), public, parameter :: CDI_KEY_LOCALTABLESVERSION = 802 - integer(c_int), public, parameter :: CDI_KEY_TYPEOFGENERATINGPROCESS = 803 - integer(c_int), public, parameter :: CDI_KEY_PRODUCTDEFINITIONTEMPLATE = 804 - integer(c_int), public, parameter :: CDI_KEY_TYPEOFPROCESSEDDATA = 805 - integer(c_int), public, parameter :: CDI_KEY_SHAPEOFTHEEARTH = 806 - integer(c_int), public, parameter :: CDI_KEY_BACKGROUNDPROCESS = 807 - integer(c_int), public, parameter :: CDI_KEY_TYPEOFENSEMBLEFORECAST = 808 - integer(c_int), public, parameter :: CDI_KEY_NUMBEROFFORECASTSINENSEMBLE =& - & 809 - integer(c_int), public, parameter :: CDI_KEY_PERTURBATIONNUMBER = 810 - integer(c_int), public, parameter :: CDI_KEY_CENTRE = 811 - integer(c_int), public, parameter :: CDI_KEY_SUBCENTRE = 812 - integer(c_int), public, parameter :: CDI_KEY_MPIMTYPE = 813 - integer(c_int), public, parameter :: CDI_KEY_MPIMCLASS = 814 - integer(c_int), public, parameter :: CDI_KEY_MPIMUSER = 815 - integer(c_int), public, parameter :: CDI_KEY_REVSTATUS = 816 - integer(c_int), public, parameter :: CDI_KEY_REVNUMBER = 817 - integer(c_int), public, parameter :: CDI_KEY_GRIB2LOCALSECTIONNUMBER = 818 - integer(c_int), public, parameter :: CDI_KEY_SECTION2PADDINGLENGTH = 819 - integer(c_int), public, parameter :: CDI_KEY_SECTION2PADDING = 820 - integer(c_int), public, parameter :: CDI_KEY_CONSTITUENTTYPE = 821 - integer(c_int), public, parameter :: CDI_KEY_TYPEOFTIMEINCREMENT = 822 - integer(c_int), public, parameter :: CDI_KEY_TYPEOFFIRSTFIXEDSURFACE = 823 - integer(c_int), public, parameter :: CDI_KEY_TYPEOFSECONDFIXEDSURFACE = 824 - integer(c_int), public, parameter :: CDI_KEY_UVRELATIVETOGRID = 825 - integer(c_int), public, parameter :: CDI_KEY_SCANNINGMODE = 826 - integer(c_int), public, parameter :: CDI_KEY_VDIMNAME = 920 - integer(c_int), public, parameter :: CDI_KEY_GRIDMAP_VARTYPE = 921 - integer(c_int), public, parameter :: CDI_KEY_GRIDMAP_VARNAME = 922 - integer(c_int), public, parameter :: CDI_KEY_GRIDMAP_NAME = 923 - public :: cdiDefKeyInt - public :: cdiInqKeyInt - public :: cdiDefKeyFloat - public :: cdiInqKeyFloat - public :: cdiDefKeyBytes - public :: cdiInqKeyBytes - public :: cdiDefKeyString - public :: cdiInqKeyString - public :: cdiInqKeyLen - public :: cdiCopyKeys - public :: cdiCopyKey - public :: cdiDeleteKey - public :: gridDefXname - public :: gridInqXname - public :: gridDefXlongname - public :: gridInqXlongname - public :: gridDefXunits - public :: gridInqXunits - public :: gridDefYname - public :: gridInqYname - public :: gridDefYlongname - public :: gridInqYlongname - public :: gridDefYunits - public :: gridInqYunits - public :: gridDefDatatype - public :: gridInqDatatype - public :: gridInqXval - public :: gridInqYval - public :: gridInqXinc - public :: gridInqYinc - public :: gridIsCircular - public :: gridInqTrunc - public :: gridDefTrunc - public :: gridDefNumber - public :: gridInqNumber - public :: gridDefPosition - public :: gridInqPosition - public :: gridDefReference - public :: gridInqReference - public :: gridDefUUID - public :: gridInqUUID - public :: gridDefParamRLL - public :: gridInqParamRLL - public :: gridDefParamGME - public :: gridInqParamGME - public :: gridDefArea - public :: gridInqArea - public :: gridHasArea - public :: gridDefNvertex - public :: gridInqNvertex - public :: gridDefXbounds - public :: gridInqXbounds - public :: gridInqXboundsPart - public :: gridInqXboundsPtr - public :: gridDefYbounds - public :: gridInqYbounds - public :: gridInqYboundsPart - public :: gridInqYboundsPtr - public :: gridDefReducedPoints - public :: gridInqReducedPoints - public :: gridChangeType - public :: gridDefComplexPacking - public :: gridInqComplexPacking - public :: zaxisName - public :: zaxisNamePtr - public :: zaxisCreate - public :: zaxisDestroy - public :: zaxisInqType - public :: zaxisInqSize - public :: zaxisDuplicate - public :: zaxisDefLevels - public :: zaxisInqLevels - public :: zaxisInqCLen - public :: zaxisDefLevel - public :: zaxisInqLevel - public :: zaxisDefNlevRef - public :: zaxisInqNlevRef - public :: zaxisDefNumber - public :: zaxisInqNumber - public :: zaxisDefUUID - public :: zaxisInqUUID - public :: zaxisDefName - public :: zaxisInqName - public :: zaxisDefLongname - public :: zaxisInqLongname - public :: zaxisDefUnits - public :: zaxisInqUnits - public :: zaxisInqStdname - public :: zaxisDefDatatype - public :: zaxisInqDatatype - public :: zaxisDefPositive - public :: zaxisInqPositive - public :: zaxisDefScalar - public :: zaxisInqScalar - public :: zaxisDefVct - public :: zaxisInqVct - public :: zaxisInqVctSize - public :: zaxisInqVctPtr - public :: zaxisDefLbounds - public :: zaxisInqLbounds - public :: zaxisInqLbound - public :: zaxisDefUbounds - public :: zaxisInqUbounds - public :: zaxisInqUbound - public :: zaxisDefWeights - public :: zaxisInqWeights - public :: zaxisChangeType - public :: taxisCreate - public :: taxisDestroy - public :: taxisDuplicate - public :: taxisCopyTimestep - public :: taxisDefType - public :: taxisInqType - public :: taxisDefVdate - public :: taxisDefVtime - public :: taxisInqVdate - public :: taxisInqVtime - public :: taxisDefRdate - public :: taxisDefRtime - public :: taxisInqRdate - public :: taxisInqRtime - public :: taxisDefFdate - public :: taxisDefFtime - public :: taxisInqFdate - public :: taxisInqFtime - public :: taxisHasBounds - public :: taxisWithBounds - public :: taxisDeleteBounds - public :: taxisDefVdateBounds - public :: taxisDefVtimeBounds - public :: taxisInqVdateBounds - public :: taxisInqVtimeBounds - public :: taxisDefCalendar - public :: taxisInqCalendar - public :: taxisDefTunit - public :: taxisInqTunit - public :: taxisDefForecastTunit - public :: taxisInqForecastTunit - public :: taxisDefForecastPeriod - public :: taxisInqForecastPeriod - public :: taxisDefNumavg - public :: taxisInqNumavg - public :: taxisNamePtr - public :: tunitNamePtr - public :: institutDef - public :: institutInq - public :: institutInqNumber - public :: institutInqCenter - public :: institutInqSubcenter - public :: institutInqNamePtr - public :: institutInqLongnamePtr - public :: modelDef - public :: modelInq - public :: modelInqInstitut - public :: modelInqGribID - public :: modelInqNamePtr - public :: tableWrite - public :: tableRead - public :: tableDef - public :: tableInqNamePtr - public :: tableInq - public :: tableInqNumber - public :: tableInqNum - public :: tableInqModel - public :: tableInqEntry - public :: subtypeCreate - public :: subtypePrint - public :: subtypeCompare - public :: subtypeInqSize - public :: subtypeInqActiveIndex - public :: subtypeDefActiveIndex - public :: subtypeInqTile - public :: subtypeInqAttribute - public :: vlistInqVarSubtype - public :: gribapiLibraryVersion - public :: zaxisDefLtype - public :: vlistInqVarTypeOfGeneratingProcess - public :: vlistDefVarTypeOfGeneratingProcess - public :: vlistDefVarProductDefinitionTemplate - public :: date_to_julday - public :: julday_to_date - public :: time_to_sec - public :: sec_to_time - integer(c_int), public, parameter :: HAVE_CDI_PROJ_FUNCS = 1 - - interface - subroutine cdiReset() bind(c, name = 'cdiReset') - end subroutine cdiReset - - subroutine cdiDebug(debug_dummy) bind(c, name = 'cdiDebug') - import c_int - integer(c_int), value :: debug_dummy - end subroutine cdiDebug - - subroutine cdiPrintVersion() bind(c, name = 'cdiPrintVersion') - end subroutine cdiPrintVersion - - function cdiHaveFiletype(filetype_dummy) bind(c, name = 'cdiHaveFiletype')& - & result(f_result) - import c_int - integer(c_int), value :: filetype_dummy - integer(c_int) :: f_result - end function cdiHaveFiletype - - subroutine cdiDefMissval(missval_dummy) bind(c, name = 'cdiDefMissval') - import c_double - real(c_double), value :: missval_dummy - end subroutine cdiDefMissval - - function cdiInqMissval() bind(c, name = 'cdiInqMissval') result(f_result) - import c_double - real(c_double) :: f_result - end function cdiInqMissval - - function namespaceNew() bind(c, name = 'namespaceNew') result(f_result) - import c_int - integer(c_int) :: f_result - end function namespaceNew - - subroutine namespaceSetActive(namespaceID_dummy) bind(c, name =& - & 'namespaceSetActive') - import c_int - integer(c_int), value :: namespaceID_dummy - end subroutine namespaceSetActive - - function namespaceGetActive() bind(c, name = 'namespaceGetActive')& - & result(f_result) - import c_int - integer(c_int) :: f_result - end function namespaceGetActive - - subroutine namespaceDelete(namespaceID_dummy) bind(c, name =& - & 'namespaceDelete') - import c_int - integer(c_int), value :: namespaceID_dummy - end subroutine namespaceDelete - - subroutine cdiDecodeParam(param_dummy, pnum_dummy, pcat_dummy, pdis_dummy)& - & bind(c, name = 'cdiDecodeParam') - import c_int - integer(c_int), value :: param_dummy - integer(c_int), intent(inout) :: pnum_dummy - integer(c_int), intent(inout) :: pcat_dummy - integer(c_int), intent(inout) :: pdis_dummy - end subroutine cdiDecodeParam - - function cdiEncodeParam(pnum_dummy, pcat_dummy, pdis_dummy) bind(c, name =& - & 'cdiEncodeParam') result(f_result) - import c_int - integer(c_int), value :: pnum_dummy - integer(c_int), value :: pcat_dummy - integer(c_int), value :: pdis_dummy - integer(c_int) :: f_result - end function cdiEncodeParam - - subroutine cdiDecodeDate(date_dummy, year_dummy, month_dummy, day_dummy)& - & bind(c, name = 'cdiDecodeDate') - import c_int - integer(c_int), value :: date_dummy - integer(c_int), intent(inout) :: year_dummy - integer(c_int), intent(inout) :: month_dummy - integer(c_int), intent(inout) :: day_dummy - end subroutine cdiDecodeDate - - function cdiEncodeDate(year_dummy, month_dummy, day_dummy) bind(c, name =& - & 'cdiEncodeDate') result(f_result) - import c_int - integer(c_int), value :: year_dummy - integer(c_int), value :: month_dummy - integer(c_int), value :: day_dummy - integer(c_int) :: f_result - end function cdiEncodeDate - - subroutine cdiDecodeTime(time_dummy, hour_dummy, minute_dummy,& - & second_dummy) bind(c, name = 'cdiDecodeTime') - import c_int - integer(c_int), value :: time_dummy - integer(c_int), intent(inout) :: hour_dummy - integer(c_int), intent(inout) :: minute_dummy - integer(c_int), intent(inout) :: second_dummy - end subroutine cdiDecodeTime - - function cdiEncodeTime(hour_dummy, minute_dummy, second_dummy) bind(c, name& - & = 'cdiEncodeTime') result(f_result) - import c_int - integer(c_int), value :: hour_dummy - integer(c_int), value :: minute_dummy - integer(c_int), value :: second_dummy - integer(c_int) :: f_result - end function cdiEncodeTime - - subroutine streamClose(streamID_dummy) bind(c, name = 'streamClose') - import c_int - integer(c_int), value :: streamID_dummy - end subroutine streamClose - - subroutine streamSync(streamID_dummy) bind(c, name = 'streamSync') - import c_int - integer(c_int), value :: streamID_dummy - end subroutine streamSync - - subroutine streamDefMaxSteps(streamID_dummy, maxSteps_dummy) bind(c, name =& - & 'streamDefMaxSteps') - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: maxSteps_dummy - end subroutine streamDefMaxSteps - - subroutine streamDefNumWorker(streamID_dummy, numWorker_dummy) bind(c, name& - & = 'streamDefNumWorker') - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: numWorker_dummy - end subroutine streamDefNumWorker - - subroutine streamDefVlist(streamID_dummy, vlistID_dummy) bind(c, name =& - & 'streamDefVlist') - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: vlistID_dummy - end subroutine streamDefVlist - - function streamInqVlist(streamID_dummy) bind(c, name = 'streamInqVlist')& - & result(f_result) - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int) :: f_result - end function streamInqVlist - - function streamInqFiletype(streamID_dummy) bind(c, name =& - & 'streamInqFiletype') result(f_result) - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int) :: f_result - end function streamInqFiletype - - subroutine streamDefByteorder(streamID_dummy, byteorder_dummy) bind(c, name& - & = 'streamDefByteorder') - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: byteorder_dummy - end subroutine streamDefByteorder - - function streamInqByteorder(streamID_dummy) bind(c, name =& - & 'streamInqByteorder') result(f_result) - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int) :: f_result - end function streamInqByteorder - - subroutine streamDefCompType(streamID_dummy, comptype_dummy) bind(c, name =& - & 'streamDefCompType') - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: comptype_dummy - end subroutine streamDefCompType - - function streamInqCompType(streamID_dummy) bind(c, name =& - & 'streamInqCompType') result(f_result) - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int) :: f_result - end function streamInqCompType - - subroutine streamDefCompLevel(streamID_dummy, complevel_dummy) bind(c, name& - & = 'streamDefCompLevel') - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: complevel_dummy - end subroutine streamDefCompLevel - - function streamInqCompLevel(streamID_dummy) bind(c, name =& - & 'streamInqCompLevel') result(f_result) - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int) :: f_result - end function streamInqCompLevel - - function streamDefTimestep(streamID_dummy, tsID_dummy) bind(c, name =& - & 'streamDefTimestep') result(f_result) - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: tsID_dummy - integer(c_int) :: f_result - end function streamDefTimestep - - function streamInqTimestep(streamID_dummy, tsID_dummy) bind(c, name =& - & 'streamInqTimestep') result(f_result) - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: tsID_dummy - integer(c_int) :: f_result - end function streamInqTimestep - - function streamInqCurTimestepID(streamID_dummy) bind(c, name =& - & 'streamInqCurTimestepID') result(f_result) - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int) :: f_result - end function streamInqCurTimestepID - - function streamNvals(streamID_dummy) bind(c, name = 'streamNvals')& - & result(f_result) - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int) :: f_result - end function streamNvals - - function streamInqNvars(streamID_dummy) bind(c, name = 'streamInqNvars')& - & result(f_result) - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int) :: f_result - end function streamInqNvars - - subroutine streamWriteVar(streamID_dummy, varID_dummy, data_dummy,& - & nmiss_dummy) bind(c, name = 'streamWriteVar') - import c_double, c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: varID_dummy - real(c_double), intent(in) :: data_dummy(*) - integer(c_int), value :: nmiss_dummy - end subroutine streamWriteVar - - subroutine streamWriteVarF(streamID_dummy, varID_dummy, data_dummy,& - & nmiss_dummy) bind(c, name = 'streamWriteVarF') - import c_float, c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: varID_dummy - real(c_float), intent(in) :: data_dummy(*) - integer(c_int), value :: nmiss_dummy - end subroutine streamWriteVarF - - subroutine streamReadVar(streamID_dummy, varID_dummy, data_dummy,& - & nmiss_dummy) bind(c, name = 'streamReadVar') - import c_double, c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: varID_dummy - real(c_double), intent(inout) :: data_dummy(*) - integer(c_int), intent(inout) :: nmiss_dummy - end subroutine streamReadVar - - subroutine streamReadVarF(streamID_dummy, varID_dummy, data_dummy,& - & nmiss_dummy) bind(c, name = 'streamReadVarF') - import c_float, c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: varID_dummy - real(c_float), intent(inout) :: data_dummy(*) - integer(c_int), intent(inout) :: nmiss_dummy - end subroutine streamReadVarF - - subroutine streamWriteVarSlice(streamID_dummy, varID_dummy, levelID_dummy,& - & data_dummy, nmiss_dummy) bind(c, name = 'streamWriteVarSlice') - import c_double, c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: levelID_dummy - real(c_double), intent(in) :: data_dummy(*) - integer(c_int), value :: nmiss_dummy - end subroutine streamWriteVarSlice - - subroutine streamWriteVarSliceF(streamID_dummy, varID_dummy, levelID_dummy,& - & data_dummy, nmiss_dummy) bind(c, name = 'streamWriteVarSliceF') - import c_float, c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: levelID_dummy - real(c_float), intent(in) :: data_dummy(*) - integer(c_int), value :: nmiss_dummy - end subroutine streamWriteVarSliceF - - subroutine streamReadVarSlice(streamID_dummy, varID_dummy, levelID_dummy,& - & data_dummy, nmiss_dummy) bind(c, name = 'streamReadVarSlice') - import c_double, c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: levelID_dummy - real(c_double), intent(inout) :: data_dummy(*) - integer(c_int), intent(inout) :: nmiss_dummy - end subroutine streamReadVarSlice - - subroutine streamReadVarSliceF(streamID_dummy, varID_dummy, levelID_dummy,& - & data_dummy, nmiss_dummy) bind(c, name = 'streamReadVarSliceF') - import c_float, c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: levelID_dummy - real(c_float), intent(inout) :: data_dummy(*) - integer(c_int), intent(inout) :: nmiss_dummy - end subroutine streamReadVarSliceF - - subroutine streamWriteVarChunk(streamID_dummy, varID_dummy, rect_dummy,& - & data_dummy, nmiss_dummy) bind(c, name = 'streamWriteVarChunk') - import c_double, c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), intent(in) :: rect_dummy(2, 3) - real(c_double), intent(in) :: data_dummy(*) - integer(c_int), value :: nmiss_dummy - end subroutine streamWriteVarChunk - - subroutine streamDefRecord(streamID_dummy, varID_dummy, levelID_dummy)& - & bind(c, name = 'streamDefRecord') - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: levelID_dummy - end subroutine streamDefRecord - - subroutine streamInqRecord(streamID_dummy, varID_dummy, levelID_dummy)& - & bind(c, name = 'streamInqRecord') - import c_int - integer(c_int), value :: streamID_dummy - integer(c_int), intent(inout) :: varID_dummy - integer(c_int), intent(inout) :: levelID_dummy - end subroutine streamInqRecord - - subroutine streamWriteRecord(streamID_dummy, data_dummy, nmiss_dummy)& - & bind(c, name = 'streamWriteRecord') - import c_double, c_int - integer(c_int), value :: streamID_dummy - real(c_double), intent(in) :: data_dummy(*) - integer(c_int), value :: nmiss_dummy - end subroutine streamWriteRecord - - subroutine streamWriteRecordF(streamID_dummy, data_dummy, nmiss_dummy)& - & bind(c, name = 'streamWriteRecordF') - import c_float, c_int - integer(c_int), value :: streamID_dummy - real(c_float), intent(in) :: data_dummy(*) - integer(c_int), value :: nmiss_dummy - end subroutine streamWriteRecordF - - subroutine streamReadRecord(streamID_dummy, data_dummy, nmiss_dummy)& - & bind(c, name = 'streamReadRecord') - import c_double, c_int - integer(c_int), value :: streamID_dummy - real(c_double), intent(inout) :: data_dummy(*) - integer(c_int), intent(inout) :: nmiss_dummy - end subroutine streamReadRecord - - subroutine streamReadRecordF(streamID_dummy, data_dummy, nmiss_dummy)& - & bind(c, name = 'streamReadRecordF') - import c_float, c_int - integer(c_int), value :: streamID_dummy - real(c_float), intent(inout) :: data_dummy(*) - integer(c_int), intent(inout) :: nmiss_dummy - end subroutine streamReadRecordF - - subroutine streamCopyRecord(streamIDdest_dummy, streamIDsrc_dummy) bind(c,& - & name = 'streamCopyRecord') - import c_int - integer(c_int), value :: streamIDdest_dummy - integer(c_int), value :: streamIDsrc_dummy - end subroutine streamCopyRecord - - function vlistCreate() bind(c, name = 'vlistCreate') result(f_result) - import c_int - integer(c_int) :: f_result - end function vlistCreate - - subroutine vlistDestroy(vlistID_dummy) bind(c, name = 'vlistDestroy') - import c_int - integer(c_int), value :: vlistID_dummy - end subroutine vlistDestroy - - function vlistDuplicate(vlistID_dummy) bind(c, name = 'vlistDuplicate')& - & result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int) :: f_result - end function vlistDuplicate - - subroutine vlistCopy(vlistID2_dummy, vlistID1_dummy) bind(c, name =& - & 'vlistCopy') - import c_int - integer(c_int), value :: vlistID2_dummy - integer(c_int), value :: vlistID1_dummy - end subroutine vlistCopy - - subroutine vlistCopyFlag(vlistID2_dummy, vlistID1_dummy) bind(c, name =& - & 'vlistCopyFlag') - import c_int - integer(c_int), value :: vlistID2_dummy - integer(c_int), value :: vlistID1_dummy - end subroutine vlistCopyFlag - - subroutine vlistClearFlag(vlistID_dummy) bind(c, name = 'vlistClearFlag') - import c_int - integer(c_int), value :: vlistID_dummy - end subroutine vlistClearFlag - - subroutine vlistCat(vlistID2_dummy, vlistID1_dummy) bind(c, name =& - & 'vlistCat') - import c_int - integer(c_int), value :: vlistID2_dummy - integer(c_int), value :: vlistID1_dummy - end subroutine vlistCat - - subroutine vlistMerge(vlistID2_dummy, vlistID1_dummy) bind(c, name =& - & 'vlistMerge') - import c_int - integer(c_int), value :: vlistID2_dummy - integer(c_int), value :: vlistID1_dummy - end subroutine vlistMerge - - subroutine vlistPrint(vlistID_dummy) bind(c, name = 'vlistPrint') - import c_int - integer(c_int), value :: vlistID_dummy - end subroutine vlistPrint - - function vlistNumber(vlistID_dummy) bind(c, name = 'vlistNumber')& - & result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int) :: f_result - end function vlistNumber - - function vlistNvars(vlistID_dummy) bind(c, name = 'vlistNvars')& - & result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int) :: f_result - end function vlistNvars - - function vlistNgrids(vlistID_dummy) bind(c, name = 'vlistNgrids')& - & result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int) :: f_result - end function vlistNgrids - - function vlistNzaxis(vlistID_dummy) bind(c, name = 'vlistNzaxis')& - & result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int) :: f_result - end function vlistNzaxis - - function vlistNsubtypes(vlistID_dummy) bind(c, name = 'vlistNsubtypes')& - & result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int) :: f_result - end function vlistNsubtypes - - subroutine vlistDefNtsteps(vlistID_dummy, nts_dummy) bind(c, name =& - & 'vlistDefNtsteps') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: nts_dummy - end subroutine vlistDefNtsteps - - function vlistNtsteps(vlistID_dummy) bind(c, name = 'vlistNtsteps')& - & result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int) :: f_result - end function vlistNtsteps - - function vlistGridsizeMax(vlistID_dummy) bind(c, name = 'vlistGridsizeMax')& - & result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int) :: f_result - end function vlistGridsizeMax - - function vlistGrid(vlistID_dummy, index_dummy) bind(c, name = 'vlistGrid')& - & result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: index_dummy - integer(c_int) :: f_result - end function vlistGrid - - function vlistGridIndex(vlistID_dummy, gridID_dummy) bind(c, name =& - & 'vlistGridIndex') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function vlistGridIndex - - subroutine vlistChangeGridIndex(vlistID_dummy, index_dummy, gridID_dummy)& - & bind(c, name = 'vlistChangeGridIndex') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: index_dummy - integer(c_int), value :: gridID_dummy - end subroutine vlistChangeGridIndex - - subroutine vlistChangeGrid(vlistID_dummy, gridID1_dummy, gridID2_dummy)& - & bind(c, name = 'vlistChangeGrid') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: gridID1_dummy - integer(c_int), value :: gridID2_dummy - end subroutine vlistChangeGrid - - function vlistZaxis(vlistID_dummy, index_dummy) bind(c, name =& - & 'vlistZaxis') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: index_dummy - integer(c_int) :: f_result - end function vlistZaxis - - function vlistZaxisIndex(vlistID_dummy, zaxisID_dummy) bind(c, name =& - & 'vlistZaxisIndex') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: zaxisID_dummy - integer(c_int) :: f_result - end function vlistZaxisIndex - - subroutine vlistChangeZaxisIndex(vlistID_dummy, index_dummy, zaxisID_dummy)& - & bind(c, name = 'vlistChangeZaxisIndex') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: index_dummy - integer(c_int), value :: zaxisID_dummy - end subroutine vlistChangeZaxisIndex - - subroutine vlistChangeZaxis(vlistID_dummy, zaxisID1_dummy, zaxisID2_dummy)& - & bind(c, name = 'vlistChangeZaxis') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: zaxisID1_dummy - integer(c_int), value :: zaxisID2_dummy - end subroutine vlistChangeZaxis - - function vlistNrecs(vlistID_dummy) bind(c, name = 'vlistNrecs')& - & result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int) :: f_result - end function vlistNrecs - - function vlistSubtype(vlistID_dummy, index_dummy) bind(c, name =& - & 'vlistSubtype') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: index_dummy - integer(c_int) :: f_result - end function vlistSubtype - - function vlistSubtypeIndex(vlistID_dummy, subtypeID_dummy) bind(c, name =& - & 'vlistSubtypeIndex') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: subtypeID_dummy - integer(c_int) :: f_result - end function vlistSubtypeIndex - - subroutine vlistDefTaxis(vlistID_dummy, taxisID_dummy) bind(c, name =& - & 'vlistDefTaxis') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: taxisID_dummy - end subroutine vlistDefTaxis - - function vlistInqTaxis(vlistID_dummy) bind(c, name = 'vlistInqTaxis')& - & result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int) :: f_result - end function vlistInqTaxis - - subroutine vlistDefTable(vlistID_dummy, tableID_dummy) bind(c, name =& - & 'vlistDefTable') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: tableID_dummy - end subroutine vlistDefTable - - function vlistInqTable(vlistID_dummy) bind(c, name = 'vlistInqTable')& - & result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int) :: f_result - end function vlistInqTable - - subroutine vlistDefInstitut(vlistID_dummy, instID_dummy) bind(c, name =& - & 'vlistDefInstitut') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: instID_dummy - end subroutine vlistDefInstitut - - function vlistInqInstitut(vlistID_dummy) bind(c, name = 'vlistInqInstitut')& - & result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int) :: f_result - end function vlistInqInstitut - - subroutine vlistDefModel(vlistID_dummy, modelID_dummy) bind(c, name =& - & 'vlistDefModel') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: modelID_dummy - end subroutine vlistDefModel - - function vlistInqModel(vlistID_dummy) bind(c, name = 'vlistInqModel')& - & result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int) :: f_result - end function vlistInqModel - - function vlistDefVarTiles(vlistID_dummy, gridID_dummy, zaxisID_dummy,& - & timetype_dummy, tilesetID_dummy) bind(c, name = 'vlistDefVarTiles')& - & result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: gridID_dummy - integer(c_int), value :: zaxisID_dummy - integer(c_int), value :: timetype_dummy - integer(c_int), value :: tilesetID_dummy - integer(c_int) :: f_result - end function vlistDefVarTiles - - function vlistDefVar(vlistID_dummy, gridID_dummy, zaxisID_dummy,& - & timetype_dummy) bind(c, name = 'vlistDefVar') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: gridID_dummy - integer(c_int), value :: zaxisID_dummy - integer(c_int), value :: timetype_dummy - integer(c_int) :: f_result - end function vlistDefVar - - subroutine vlistChangeVarGrid(vlistID_dummy, varID_dummy, gridID_dummy)& - & bind(c, name = 'vlistChangeVarGrid') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: gridID_dummy - end subroutine vlistChangeVarGrid - - subroutine vlistChangeVarZaxis(vlistID_dummy, varID_dummy, zaxisID_dummy)& - & bind(c, name = 'vlistChangeVarZaxis') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: zaxisID_dummy - end subroutine vlistChangeVarZaxis - - subroutine vlistInqVar(vlistID_dummy, varID_dummy, gridID_dummy,& - & zaxisID_dummy, timetype_dummy) bind(c, name = 'vlistInqVar') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), intent(inout) :: gridID_dummy - integer(c_int), intent(inout) :: zaxisID_dummy - integer(c_int), intent(inout) :: timetype_dummy - end subroutine vlistInqVar - - function vlistInqVarGrid(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarGrid') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarGrid - - function vlistInqVarZaxis(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarZaxis') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarZaxis - - function vlistInqVarID(vlistID_dummy, code_dummy) bind(c, name =& - & 'vlistInqVarID') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: code_dummy - integer(c_int) :: f_result - end function vlistInqVarID - - subroutine vlistDefVarTimetype(vlistID_dummy, varID_dummy, timetype_dummy)& - & bind(c, name = 'vlistDefVarTimetype') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: timetype_dummy - end subroutine vlistDefVarTimetype - - function vlistInqVarTimetype(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarTimetype') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarTimetype - - subroutine vlistDefVarTsteptype(vlistID_dummy, varID_dummy,& - & tsteptype_dummy) bind(c, name = 'vlistDefVarTsteptype') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: tsteptype_dummy - end subroutine vlistDefVarTsteptype - - function vlistInqVarTsteptype(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarTsteptype') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarTsteptype - - subroutine vlistDefVarCompType(vlistID_dummy, varID_dummy, comptype_dummy)& - & bind(c, name = 'vlistDefVarCompType') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: comptype_dummy - end subroutine vlistDefVarCompType - - function vlistInqVarCompType(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarCompType') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarCompType - - subroutine vlistDefVarCompLevel(vlistID_dummy, varID_dummy,& - & complevel_dummy) bind(c, name = 'vlistDefVarCompLevel') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: complevel_dummy - end subroutine vlistDefVarCompLevel - - function vlistInqVarCompLevel(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarCompLevel') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarCompLevel - - subroutine vlistDefVarParam(vlistID_dummy, varID_dummy, param_dummy)& - & bind(c, name = 'vlistDefVarParam') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: param_dummy - end subroutine vlistDefVarParam - - function vlistInqVarParam(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarParam') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarParam - - subroutine vlistDefVarCode(vlistID_dummy, varID_dummy, code_dummy) bind(c,& - & name = 'vlistDefVarCode') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: code_dummy - end subroutine vlistDefVarCode - - function vlistInqVarCode(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarCode') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarCode - - subroutine vlistDefVarDatatype(vlistID_dummy, varID_dummy, datatype_dummy)& - & bind(c, name = 'vlistDefVarDatatype') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: datatype_dummy - end subroutine vlistDefVarDatatype - - function vlistInqVarDatatype(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarDatatype') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarDatatype - - subroutine vlistDefVarXYZ(vlistID_dummy, varID_dummy, xyz_dummy) bind(c,& - & name = 'vlistDefVarXYZ') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: xyz_dummy - end subroutine vlistDefVarXYZ - - function vlistInqVarXYZ(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarXYZ') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarXYZ - - subroutine vlistDefVarNSB(vlistID_dummy, varID_dummy, nsb_dummy) bind(c,& - & name = 'vlistDefVarNSB') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: nsb_dummy - end subroutine vlistDefVarNSB - - function vlistInqVarNSB(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarNSB') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarNSB - - function vlistInqVarNumber(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarNumber') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarNumber - - subroutine vlistDefVarInstitut(vlistID_dummy, varID_dummy, instID_dummy)& - & bind(c, name = 'vlistDefVarInstitut') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: instID_dummy - end subroutine vlistDefVarInstitut - - function vlistInqVarInstitut(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarInstitut') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarInstitut - - subroutine vlistDefVarModel(vlistID_dummy, varID_dummy, modelID_dummy)& - & bind(c, name = 'vlistDefVarModel') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: modelID_dummy - end subroutine vlistDefVarModel - - function vlistInqVarModel(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarModel') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarModel - - subroutine vlistDefVarTable(vlistID_dummy, varID_dummy, tableID_dummy)& - & bind(c, name = 'vlistDefVarTable') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: tableID_dummy - end subroutine vlistDefVarTable - - function vlistInqVarTable(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarTable') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarTable - - subroutine vlistDefVarMissval(vlistID_dummy, varID_dummy, missval_dummy)& - & bind(c, name = 'vlistDefVarMissval') - import c_double, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - real(c_double), value :: missval_dummy - end subroutine vlistDefVarMissval - - function vlistInqVarMissval(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarMissval') result(f_result) - import c_double, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - real(c_double) :: f_result - end function vlistInqVarMissval - - subroutine vlistDefVarScalefactor(vlistID_dummy, varID_dummy,& - & scalefactor_dummy) bind(c, name = 'vlistDefVarScalefactor') - import c_double, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - real(c_double), value :: scalefactor_dummy - end subroutine vlistDefVarScalefactor - - function vlistInqVarScalefactor(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarScalefactor') result(f_result) - import c_double, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - real(c_double) :: f_result - end function vlistInqVarScalefactor - - subroutine vlistDefVarAddoffset(vlistID_dummy, varID_dummy,& - & addoffset_dummy) bind(c, name = 'vlistDefVarAddoffset') - import c_double, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - real(c_double), value :: addoffset_dummy - end subroutine vlistDefVarAddoffset - - function vlistInqVarAddoffset(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarAddoffset') result(f_result) - import c_double, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - real(c_double) :: f_result - end function vlistInqVarAddoffset - - function vlistInqVarSize(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarSize') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarSize - - subroutine vlistDefIndex(vlistID_dummy, varID_dummy, levID_dummy,& - & index_dummy) bind(c, name = 'vlistDefIndex') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: levID_dummy - integer(c_int), value :: index_dummy - end subroutine vlistDefIndex - - function vlistInqIndex(vlistID_dummy, varID_dummy, levID_dummy) bind(c,& - & name = 'vlistInqIndex') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: levID_dummy - integer(c_int) :: f_result - end function vlistInqIndex - - subroutine vlistDefFlag(vlistID_dummy, varID_dummy, levID_dummy,& - & flag_dummy) bind(c, name = 'vlistDefFlag') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: levID_dummy - integer(c_int), value :: flag_dummy - end subroutine vlistDefFlag - - function vlistInqFlag(vlistID_dummy, varID_dummy, levID_dummy) bind(c, name& - & = 'vlistInqFlag') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: levID_dummy - integer(c_int) :: f_result - end function vlistInqFlag - - function vlistFindVar(vlistID_dummy, fvarID_dummy) bind(c, name =& - & 'vlistFindVar') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: fvarID_dummy - integer(c_int) :: f_result - end function vlistFindVar - - function vlistFindLevel(vlistID_dummy, fvarID_dummy, flevelID_dummy)& - & bind(c, name = 'vlistFindLevel') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: fvarID_dummy - integer(c_int), value :: flevelID_dummy - integer(c_int) :: f_result - end function vlistFindLevel - - function vlistMergedVar(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistMergedVar') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistMergedVar - - function vlistMergedLevel(vlistID_dummy, varID_dummy, levelID_dummy)& - & bind(c, name = 'vlistMergedLevel') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: levelID_dummy - integer(c_int) :: f_result - end function vlistMergedLevel - - subroutine cdiClearAdditionalKeys() bind(c, name =& - & 'cdiClearAdditionalKeys') - end subroutine cdiClearAdditionalKeys - - function cdiInqNatts(cdiID_dummy, varID_dummy, nattsp_dummy) bind(c, name =& - & 'cdiInqNatts') result(f_result) - import c_int - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), intent(inout) :: nattsp_dummy - integer(c_int) :: f_result - end function cdiInqNatts - - function cdiCopyAtts(cdiID1_dummy, varID1_dummy, cdiID2_dummy,& - & varID2_dummy) bind(c, name = 'cdiCopyAtts') result(f_result) - import c_int - integer(c_int), value :: cdiID1_dummy - integer(c_int), value :: varID1_dummy - integer(c_int), value :: cdiID2_dummy - integer(c_int), value :: varID2_dummy - integer(c_int) :: f_result - end function cdiCopyAtts - - subroutine gridCompress(gridID_dummy) bind(c, name = 'gridCompress') - import c_int - integer(c_int), value :: gridID_dummy - end subroutine gridCompress - - subroutine gridDefMaskGME(gridID_dummy, mask_dummy) bind(c, name =& - & 'gridDefMaskGME') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), intent(in) :: mask_dummy(*) - end subroutine gridDefMaskGME - - function gridInqMaskGME(gridID_dummy, mask_dummy) bind(c, name =& - & 'gridInqMaskGME') result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), intent(inout) :: mask_dummy(*) - integer(c_int) :: f_result - end function gridInqMaskGME - - subroutine gridDefMask(gridID_dummy, mask_dummy) bind(c, name =& - & 'gridDefMask') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), intent(in) :: mask_dummy(*) - end subroutine gridDefMask - - function gridInqMask(gridID_dummy, mask_dummy) bind(c, name =& - & 'gridInqMask') result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), intent(inout) :: mask_dummy(*) - integer(c_int) :: f_result - end function gridInqMask - - function gridCreate(gridtype_dummy, size_dummy) bind(c, name =& - & 'gridCreate') result(f_result) - import c_int - integer(c_int), value :: gridtype_dummy - integer(c_int), value :: size_dummy - integer(c_int) :: f_result - end function gridCreate - - subroutine gridDestroy(gridID_dummy) bind(c, name = 'gridDestroy') - import c_int - integer(c_int), value :: gridID_dummy - end subroutine gridDestroy - - function gridDuplicate(gridID_dummy) bind(c, name = 'gridDuplicate')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridDuplicate - - subroutine gridDefProj(gridID_dummy, projID_dummy) bind(c, name =& - & 'gridDefProj') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: projID_dummy - end subroutine gridDefProj - - function gridInqProj(gridID_dummy) bind(c, name = 'gridInqProj')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridInqProj - - function gridInqProjType(gridID_dummy) bind(c, name = 'gridInqProjType')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridInqProjType - - function gridInqType(gridID_dummy) bind(c, name = 'gridInqType')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridInqType - - function gridInqSize(gridID_dummy) bind(c, name = 'gridInqSize')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridInqSize - - subroutine gridDefXsize(gridID_dummy, xsize_dummy) bind(c, name =& - & 'gridDefXsize') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: xsize_dummy - end subroutine gridDefXsize - - function gridInqXsize(gridID_dummy) bind(c, name = 'gridInqXsize')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridInqXsize - - subroutine gridDefYsize(gridID_dummy, ysize_dummy) bind(c, name =& - & 'gridDefYsize') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: ysize_dummy - end subroutine gridDefYsize - - function gridInqYsize(gridID_dummy) bind(c, name = 'gridInqYsize')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridInqYsize - - subroutine gridDefNP(gridID_dummy, np_dummy) bind(c, name = 'gridDefNP') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: np_dummy - end subroutine gridDefNP - - function gridInqNP(gridID_dummy) bind(c, name = 'gridInqNP')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridInqNP - - subroutine gridDefXvals(gridID_dummy, xvals_dummy) bind(c, name =& - & 'gridDefXvals') - import c_double, c_int - integer(c_int), value :: gridID_dummy - real(c_double), intent(in) :: xvals_dummy(*) - end subroutine gridDefXvals - - function gridInqXvals(gridID_dummy, xvals_dummy) bind(c, name =& - & 'gridInqXvals') result(f_result) - import c_double, c_int - integer(c_int), value :: gridID_dummy - real(c_double), intent(inout) :: xvals_dummy(*) - integer(c_int) :: f_result - end function gridInqXvals - - function gridInqXvalsPart(gridID_dummy, start_dummy, size_dummy,& - & xvals_dummy) bind(c, name = 'gridInqXvalsPart') result(f_result) - import c_double, c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: start_dummy - integer(c_int), value :: size_dummy - real(c_double), intent(inout) :: xvals_dummy(*) - integer(c_int) :: f_result - end function gridInqXvalsPart - - function gridInqXvalsPtr(gridID_dummy) bind(c, name = 'gridInqXvalsPtr')& - & result(f_result) - import c_int, c_ptr - integer(c_int), value :: gridID_dummy - type(c_ptr) :: f_result - end function gridInqXvalsPtr - - function gridInqXIsc(gridID_dummy) bind(c, name = 'gridInqXIsc')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridInqXIsc - - subroutine gridDefYvals(gridID_dummy, yvals_dummy) bind(c, name =& - & 'gridDefYvals') - import c_double, c_int - integer(c_int), value :: gridID_dummy - real(c_double), intent(in) :: yvals_dummy(*) - end subroutine gridDefYvals - - function gridInqYvals(gridID_dummy, yvals_dummy) bind(c, name =& - & 'gridInqYvals') result(f_result) - import c_double, c_int - integer(c_int), value :: gridID_dummy - real(c_double), intent(inout) :: yvals_dummy(*) - integer(c_int) :: f_result - end function gridInqYvals - - function gridInqYvalsPart(gridID_dummy, start_dummy, size_dummy,& - & yvals_dummy) bind(c, name = 'gridInqYvalsPart') result(f_result) - import c_double, c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: start_dummy - integer(c_int), value :: size_dummy - real(c_double), intent(inout) :: yvals_dummy(*) - integer(c_int) :: f_result - end function gridInqYvalsPart - - function gridInqYvalsPtr(gridID_dummy) bind(c, name = 'gridInqYvalsPtr')& - & result(f_result) - import c_int, c_ptr - integer(c_int), value :: gridID_dummy - type(c_ptr) :: f_result - end function gridInqYvalsPtr - - function gridInqYIsc(gridID_dummy) bind(c, name = 'gridInqYIsc')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridInqYIsc - - function cdiDefKeyInt(cdiID_dummy, varID_dummy, key_dummy, value_dummy)& - & bind(c, name = 'cdiDefKeyInt') result(f_result) - import c_int - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: key_dummy - integer(c_int), value :: value_dummy - integer(c_int) :: f_result - end function cdiDefKeyInt - - function cdiInqKeyInt(cdiID_dummy, varID_dummy, key_dummy, value_dummy)& - & bind(c, name = 'cdiInqKeyInt') result(f_result) - import c_int - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: key_dummy - integer(c_int), intent(inout) :: value_dummy - integer(c_int) :: f_result - end function cdiInqKeyInt - - function cdiDefKeyFloat(cdiID_dummy, varID_dummy, key_dummy, value_dummy)& - & bind(c, name = 'cdiDefKeyFloat') result(f_result) - import c_double, c_int - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: key_dummy - real(c_double), value :: value_dummy - integer(c_int) :: f_result - end function cdiDefKeyFloat - - function cdiInqKeyFloat(cdiID_dummy, varID_dummy, key_dummy, value_dummy)& - & bind(c, name = 'cdiInqKeyFloat') result(f_result) - import c_double, c_int - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: key_dummy - real(c_double), intent(inout) :: value_dummy - integer(c_int) :: f_result - end function cdiInqKeyFloat - - function cdiDefKeyBytes(cdiID_dummy, varID_dummy, key_dummy, bytes_dummy,& - & length_dummy) bind(c, name = 'cdiDefKeyBytes') result(f_result) - import c_int, c_signed_char - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: key_dummy - integer(kind = c_signed_char), intent(in) :: bytes_dummy(*) - integer(c_int), value :: length_dummy - integer(c_int) :: f_result - end function cdiDefKeyBytes - - function cdiInqKeyBytes(cdiID_dummy, varID_dummy, key_dummy, bytes_dummy,& - & length_dummy) bind(c, name = 'cdiInqKeyBytes') result(f_result) - import c_int, c_signed_char - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: key_dummy - integer(kind = c_signed_char), intent(inout) :: bytes_dummy(*) - integer(c_int), intent(inout) :: length_dummy - integer(c_int) :: f_result - end function cdiInqKeyBytes - - function cdiInqKeyLen(cdiID_dummy, varID_dummy, key_dummy, length_dummy)& - & bind(c, name = 'cdiInqKeyLen') result(f_result) - import c_int - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: key_dummy - integer(c_int), intent(inout) :: length_dummy - integer(c_int) :: f_result - end function cdiInqKeyLen - - function cdiCopyKeys(cdiID1_dummy, varID1_dummy, cdiID2_dummy,& - & varID2_dummy) bind(c, name = 'cdiCopyKeys') result(f_result) - import c_int - integer(c_int), value :: cdiID1_dummy - integer(c_int), value :: varID1_dummy - integer(c_int), value :: cdiID2_dummy - integer(c_int), value :: varID2_dummy - integer(c_int) :: f_result - end function cdiCopyKeys - - function cdiCopyKey(cdiID1_dummy, varID1_dummy, key_dummy, cdiID2_dummy)& - & bind(c, name = 'cdiCopyKey') result(f_result) - import c_int - integer(c_int), value :: cdiID1_dummy - integer(c_int), value :: varID1_dummy - integer(c_int), value :: key_dummy - integer(c_int), value :: cdiID2_dummy - integer(c_int) :: f_result - end function cdiCopyKey - - function cdiDeleteKey(cdiID_dummy, varID_dummy, key_dummy) bind(c, name =& - & 'cdiDeleteKey') result(f_result) - import c_int - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: key_dummy - integer(c_int) :: f_result - end function cdiDeleteKey - - subroutine gridDefDatatype(gridID_dummy, datatype_dummy) bind(c, name =& - & 'gridDefDatatype') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: datatype_dummy - end subroutine gridDefDatatype - - function gridInqDatatype(gridID_dummy) bind(c, name = 'gridInqDatatype')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridInqDatatype - - function gridInqXval(gridID_dummy, index_dummy) bind(c, name =& - & 'gridInqXval') result(f_result) - import c_double, c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: index_dummy - real(c_double) :: f_result - end function gridInqXval - - function gridInqYval(gridID_dummy, index_dummy) bind(c, name =& - & 'gridInqYval') result(f_result) - import c_double, c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: index_dummy - real(c_double) :: f_result - end function gridInqYval - - function gridInqXinc(gridID_dummy) bind(c, name = 'gridInqXinc')& - & result(f_result) - import c_double, c_int - integer(c_int), value :: gridID_dummy - real(c_double) :: f_result - end function gridInqXinc - - function gridInqYinc(gridID_dummy) bind(c, name = 'gridInqYinc')& - & result(f_result) - import c_double, c_int - integer(c_int), value :: gridID_dummy - real(c_double) :: f_result - end function gridInqYinc - - function gridIsCircular(gridID_dummy) bind(c, name = 'gridIsCircular')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridIsCircular - - function gridInqTrunc(gridID_dummy) bind(c, name = 'gridInqTrunc')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridInqTrunc - - subroutine gridDefTrunc(gridID_dummy, trunc_dummy) bind(c, name =& - & 'gridDefTrunc') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: trunc_dummy - end subroutine gridDefTrunc - - subroutine gridDefNumber(gridID_dummy, number_dummy) bind(c, name =& - & 'gridDefNumber') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: number_dummy - end subroutine gridDefNumber - - function gridInqNumber(gridID_dummy) bind(c, name = 'gridInqNumber')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridInqNumber - - subroutine gridDefPosition(gridID_dummy, position_dummy) bind(c, name =& - & 'gridDefPosition') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: position_dummy - end subroutine gridDefPosition - - function gridInqPosition(gridID_dummy) bind(c, name = 'gridInqPosition')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridInqPosition - - subroutine gridDefUUID(gridID_dummy, uuid_dummy) bind(c, name =& - & 'gridDefUUID') - import CDI_UUID_SIZE, c_int, c_signed_char - integer(c_int), value :: gridID_dummy - integer(kind = c_signed_char), intent(in) :: uuid_dummy(CDI_UUID_SIZE) - end subroutine gridDefUUID - - subroutine gridInqUUID(gridID_dummy, uuid_dummy) bind(c, name =& - & 'gridInqUUID') - import CDI_UUID_SIZE, c_int, c_signed_char - integer(c_int), value :: gridID_dummy - integer(kind = c_signed_char), intent(inout) :: uuid_dummy(CDI_UUID_SIZE) - end subroutine gridInqUUID - - subroutine gridDefParamRLL(gridID_dummy, xpole_dummy, ypole_dummy,& - & angle_dummy) bind(c, name = 'gridDefParamRLL') - import c_double, c_int - integer(c_int), value :: gridID_dummy - real(c_double), value :: xpole_dummy - real(c_double), value :: ypole_dummy - real(c_double), value :: angle_dummy - end subroutine gridDefParamRLL - - subroutine gridInqParamRLL(gridID_dummy, xpole_dummy, ypole_dummy,& - & angle_dummy) bind(c, name = 'gridInqParamRLL') - import c_double, c_int - integer(c_int), value :: gridID_dummy - real(c_double), intent(inout) :: xpole_dummy - real(c_double), intent(inout) :: ypole_dummy - real(c_double), intent(inout) :: angle_dummy - end subroutine gridInqParamRLL - - subroutine gridDefParamGME(gridID_dummy, nd_dummy, ni_dummy, ni2_dummy,& - & ni3_dummy) bind(c, name = 'gridDefParamGME') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: nd_dummy - integer(c_int), value :: ni_dummy - integer(c_int), value :: ni2_dummy - integer(c_int), value :: ni3_dummy - end subroutine gridDefParamGME - - subroutine gridInqParamGME(gridID_dummy, nd_dummy, ni_dummy, ni2_dummy,& - & ni3_dummy) bind(c, name = 'gridInqParamGME') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), intent(inout) :: nd_dummy - integer(c_int), intent(inout) :: ni_dummy - integer(c_int), intent(inout) :: ni2_dummy - integer(c_int), intent(inout) :: ni3_dummy - end subroutine gridInqParamGME - - subroutine gridDefArea(gridID_dummy, area_dummy) bind(c, name =& - & 'gridDefArea') - import c_double, c_int - integer(c_int), value :: gridID_dummy - real(c_double), intent(in) :: area_dummy(*) - end subroutine gridDefArea - - subroutine gridInqArea(gridID_dummy, area_dummy) bind(c, name =& - & 'gridInqArea') - import c_double, c_int - integer(c_int), value :: gridID_dummy - real(c_double), intent(inout) :: area_dummy(*) - end subroutine gridInqArea - - function gridHasArea(gridID_dummy) bind(c, name = 'gridHasArea')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridHasArea - - subroutine gridDefNvertex(gridID_dummy, nvertex_dummy) bind(c, name =& - & 'gridDefNvertex') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: nvertex_dummy - end subroutine gridDefNvertex - - function gridInqNvertex(gridID_dummy) bind(c, name = 'gridInqNvertex')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridInqNvertex - - subroutine gridDefXbounds(gridID_dummy, xbounds_dummy) bind(c, name =& - & 'gridDefXbounds') - import c_double, c_int - integer(c_int), value :: gridID_dummy - real(c_double), intent(in) :: xbounds_dummy(*) - end subroutine gridDefXbounds - - function gridInqXbounds(gridID_dummy, xbounds_dummy) bind(c, name =& - & 'gridInqXbounds') result(f_result) - import c_double, c_int - integer(c_int), value :: gridID_dummy - real(c_double), intent(inout) :: xbounds_dummy(*) - integer(c_int) :: f_result - end function gridInqXbounds - - function gridInqXboundsPart(gridID_dummy, start_dummy, size_dummy,& - & xbounds_dummy) bind(c, name = 'gridInqXboundsPart') result(f_result) - import c_double, c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: start_dummy - integer(c_int), value :: size_dummy - real(c_double), intent(inout) :: xbounds_dummy(*) - integer(c_int) :: f_result - end function gridInqXboundsPart - - function gridInqXboundsPtr(gridID_dummy) bind(c, name =& - & 'gridInqXboundsPtr') result(f_result) - import c_int, c_ptr - integer(c_int), value :: gridID_dummy - type(c_ptr) :: f_result - end function gridInqXboundsPtr - - subroutine gridDefYbounds(gridID_dummy, ybounds_dummy) bind(c, name =& - & 'gridDefYbounds') - import c_double, c_int - integer(c_int), value :: gridID_dummy - real(c_double), intent(in) :: ybounds_dummy(*) - end subroutine gridDefYbounds - - function gridInqYbounds(gridID_dummy, ybounds_dummy) bind(c, name =& - & 'gridInqYbounds') result(f_result) - import c_double, c_int - integer(c_int), value :: gridID_dummy - real(c_double), intent(inout) :: ybounds_dummy(*) - integer(c_int) :: f_result - end function gridInqYbounds - - function gridInqYboundsPart(gridID_dummy, start_dummy, size_dummy,& - & ybounds_dummy) bind(c, name = 'gridInqYboundsPart') result(f_result) - import c_double, c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: start_dummy - integer(c_int), value :: size_dummy - real(c_double), intent(inout) :: ybounds_dummy(*) - integer(c_int) :: f_result - end function gridInqYboundsPart - - function gridInqYboundsPtr(gridID_dummy) bind(c, name =& - & 'gridInqYboundsPtr') result(f_result) - import c_int, c_ptr - integer(c_int), value :: gridID_dummy - type(c_ptr) :: f_result - end function gridInqYboundsPtr - - subroutine gridDefReducedPoints(gridID_dummy, reducedPointsSize_dummy,& - & reducedPoints_dummy) bind(c, name = 'gridDefReducedPoints') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: reducedPointsSize_dummy - integer(c_int), intent(in) :: reducedPoints_dummy(*) - end subroutine gridDefReducedPoints - - subroutine gridInqReducedPoints(gridID_dummy, reducedPoints_dummy) bind(c,& - & name = 'gridInqReducedPoints') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), intent(inout) :: reducedPoints_dummy(*) - end subroutine gridInqReducedPoints - - subroutine gridChangeType(gridID_dummy, gridtype_dummy) bind(c, name =& - & 'gridChangeType') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: gridtype_dummy - end subroutine gridChangeType - - subroutine gridDefComplexPacking(gridID_dummy, lpack_dummy) bind(c, name =& - & 'gridDefComplexPacking') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: lpack_dummy - end subroutine gridDefComplexPacking - - function gridInqComplexPacking(gridID_dummy) bind(c, name =& - & 'gridInqComplexPacking') result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function gridInqComplexPacking - - function zaxisCreate(zaxistype_dummy, size_dummy) bind(c, name =& - & 'zaxisCreate') result(f_result) - import c_int - integer(c_int), value :: zaxistype_dummy - integer(c_int), value :: size_dummy - integer(c_int) :: f_result - end function zaxisCreate - - subroutine zaxisDestroy(zaxisID_dummy) bind(c, name = 'zaxisDestroy') - import c_int - integer(c_int), value :: zaxisID_dummy - end subroutine zaxisDestroy - - function zaxisInqType(zaxisID_dummy) bind(c, name = 'zaxisInqType')& - & result(f_result) - import c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int) :: f_result - end function zaxisInqType - - function zaxisInqSize(zaxisID_dummy) bind(c, name = 'zaxisInqSize')& - & result(f_result) - import c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int) :: f_result - end function zaxisInqSize - - function zaxisDuplicate(zaxisID_dummy) bind(c, name = 'zaxisDuplicate')& - & result(f_result) - import c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int) :: f_result - end function zaxisDuplicate - - subroutine zaxisDefLevels(zaxisID_dummy, levels_dummy) bind(c, name =& - & 'zaxisDefLevels') - import c_double, c_int - integer(c_int), value :: zaxisID_dummy - real(c_double), intent(in) :: levels_dummy(*) - end subroutine zaxisDefLevels - - function zaxisInqLevels(zaxisID_dummy, levels_dummy) bind(c, name =& - & 'zaxisInqLevels') result(f_result) - import c_double, c_int - integer(c_int), value :: zaxisID_dummy - real(c_double), intent(inout) :: levels_dummy(*) - integer(c_int) :: f_result - end function zaxisInqLevels - - function zaxisInqCLen(zaxisID_dummy) bind(c, name = 'zaxisInqCLen')& - & result(f_result) - import c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int) :: f_result - end function zaxisInqCLen - - subroutine zaxisDefLevel(zaxisID_dummy, levelID_dummy, levels_dummy)& - & bind(c, name = 'zaxisDefLevel') - import c_double, c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int), value :: levelID_dummy - real(c_double), value :: levels_dummy - end subroutine zaxisDefLevel - - function zaxisInqLevel(zaxisID_dummy, levelID_dummy) bind(c, name =& - & 'zaxisInqLevel') result(f_result) - import c_double, c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int), value :: levelID_dummy - real(c_double) :: f_result - end function zaxisInqLevel - - subroutine zaxisDefNlevRef(gridID_dummy, nhlev_dummy) bind(c, name =& - & 'zaxisDefNlevRef') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: nhlev_dummy - end subroutine zaxisDefNlevRef - - function zaxisInqNlevRef(gridID_dummy) bind(c, name = 'zaxisInqNlevRef')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function zaxisInqNlevRef - - subroutine zaxisDefNumber(gridID_dummy, number_dummy) bind(c, name =& - & 'zaxisDefNumber') - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int), value :: number_dummy - end subroutine zaxisDefNumber - - function zaxisInqNumber(gridID_dummy) bind(c, name = 'zaxisInqNumber')& - & result(f_result) - import c_int - integer(c_int), value :: gridID_dummy - integer(c_int) :: f_result - end function zaxisInqNumber - - subroutine zaxisDefUUID(zaxisID_dummy, uuid_dummy) bind(c, name =& - & 'zaxisDefUUID') - import CDI_UUID_SIZE, c_int, c_signed_char - integer(c_int), value :: zaxisID_dummy - integer(kind = c_signed_char), intent(in) :: uuid_dummy(CDI_UUID_SIZE) - end subroutine zaxisDefUUID - - subroutine zaxisInqUUID(zaxisID_dummy, uuid_dummy) bind(c, name =& - & 'zaxisInqUUID') - import CDI_UUID_SIZE, c_int, c_signed_char - integer(c_int), value :: zaxisID_dummy - integer(kind = c_signed_char), intent(inout) :: uuid_dummy(CDI_UUID_SIZE) - end subroutine zaxisInqUUID - - subroutine zaxisDefDatatype(zaxisID_dummy, datatype_dummy) bind(c, name =& - & 'zaxisDefDatatype') - import c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int), value :: datatype_dummy - end subroutine zaxisDefDatatype - - function zaxisInqDatatype(zaxisID_dummy) bind(c, name = 'zaxisInqDatatype')& - & result(f_result) - import c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int) :: f_result - end function zaxisInqDatatype - - subroutine zaxisDefPositive(zaxisID_dummy, positive_dummy) bind(c, name =& - & 'zaxisDefPositive') - import c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int), value :: positive_dummy - end subroutine zaxisDefPositive - - function zaxisInqPositive(zaxisID_dummy) bind(c, name = 'zaxisInqPositive')& - & result(f_result) - import c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int) :: f_result - end function zaxisInqPositive - - subroutine zaxisDefScalar(zaxisID_dummy) bind(c, name = 'zaxisDefScalar') - import c_int - integer(c_int), value :: zaxisID_dummy - end subroutine zaxisDefScalar - - function zaxisInqScalar(zaxisID_dummy) bind(c, name = 'zaxisInqScalar')& - & result(f_result) - import c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int) :: f_result - end function zaxisInqScalar - - subroutine zaxisDefVct(zaxisID_dummy, size_dummy, vct_dummy) bind(c, name =& - & 'zaxisDefVct') - import c_double, c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int), value :: size_dummy - real(c_double), intent(in) :: vct_dummy(*) - end subroutine zaxisDefVct - - subroutine zaxisInqVct(zaxisID_dummy, vct_dummy) bind(c, name =& - & 'zaxisInqVct') - import c_double, c_int - integer(c_int), value :: zaxisID_dummy - real(c_double), intent(inout) :: vct_dummy(*) - end subroutine zaxisInqVct - - function zaxisInqVctSize(zaxisID_dummy) bind(c, name = 'zaxisInqVctSize')& - & result(f_result) - import c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int) :: f_result - end function zaxisInqVctSize - - function zaxisInqVctPtr(zaxisID_dummy) bind(c, name = 'zaxisInqVctPtr')& - & result(f_result) - import c_int, c_ptr - integer(c_int), value :: zaxisID_dummy - type(c_ptr) :: f_result - end function zaxisInqVctPtr - - subroutine zaxisDefLbounds(zaxisID_dummy, lbounds_dummy) bind(c, name =& - & 'zaxisDefLbounds') - import c_double, c_int - integer(c_int), value :: zaxisID_dummy - real(c_double), intent(in) :: lbounds_dummy(*) - end subroutine zaxisDefLbounds - - function zaxisInqLbound(zaxisID_dummy, index_dummy) bind(c, name =& - & 'zaxisInqLbound') result(f_result) - import c_double, c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int), value :: index_dummy - real(c_double) :: f_result - end function zaxisInqLbound - - subroutine zaxisDefUbounds(zaxisID_dummy, ubounds_dummy) bind(c, name =& - & 'zaxisDefUbounds') - import c_double, c_int - integer(c_int), value :: zaxisID_dummy - real(c_double), intent(in) :: ubounds_dummy(*) - end subroutine zaxisDefUbounds - - function zaxisInqUbound(zaxisID_dummy, index_dummy) bind(c, name =& - & 'zaxisInqUbound') result(f_result) - import c_double, c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int), value :: index_dummy - real(c_double) :: f_result - end function zaxisInqUbound - - subroutine zaxisDefWeights(zaxisID_dummy, weights_dummy) bind(c, name =& - & 'zaxisDefWeights') - import c_double, c_int - integer(c_int), value :: zaxisID_dummy - real(c_double), intent(in) :: weights_dummy(*) - end subroutine zaxisDefWeights - - subroutine zaxisChangeType(zaxisID_dummy, zaxistype_dummy) bind(c, name =& - & 'zaxisChangeType') - import c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int), value :: zaxistype_dummy - end subroutine zaxisChangeType - - function taxisCreate(taxistype_dummy) bind(c, name = 'taxisCreate')& - & result(f_result) - import c_int - integer(c_int), value :: taxistype_dummy - integer(c_int) :: f_result - end function taxisCreate - - subroutine taxisDestroy(taxisID_dummy) bind(c, name = 'taxisDestroy') - import c_int - integer(c_int), value :: taxisID_dummy - end subroutine taxisDestroy - - function taxisDuplicate(taxisID_dummy) bind(c, name = 'taxisDuplicate')& - & result(f_result) - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int) :: f_result - end function taxisDuplicate - - subroutine taxisCopyTimestep(taxisIDdes_dummy, taxisIDsrc_dummy) bind(c,& - & name = 'taxisCopyTimestep') - import c_int - integer(c_int), value :: taxisIDdes_dummy - integer(c_int), value :: taxisIDsrc_dummy - end subroutine taxisCopyTimestep - - subroutine taxisDefType(taxisID_dummy, taxistype_dummy) bind(c, name =& - & 'taxisDefType') - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int), value :: taxistype_dummy - end subroutine taxisDefType - - function taxisInqType(taxisID_dummy) bind(c, name = 'taxisInqType')& - & result(f_result) - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int) :: f_result - end function taxisInqType - - subroutine taxisDefVdate(taxisID_dummy, date_dummy) bind(c, name =& - & 'taxisDefVdate') - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int), value :: date_dummy - end subroutine taxisDefVdate - - subroutine taxisDefVtime(taxisID_dummy, time_dummy) bind(c, name =& - & 'taxisDefVtime') - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int), value :: time_dummy - end subroutine taxisDefVtime - - function taxisInqVdate(taxisID_dummy) bind(c, name = 'taxisInqVdate')& - & result(f_result) - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int) :: f_result - end function taxisInqVdate - - function taxisInqVtime(taxisID_dummy) bind(c, name = 'taxisInqVtime')& - & result(f_result) - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int) :: f_result - end function taxisInqVtime - - subroutine taxisDefRdate(taxisID_dummy, date_dummy) bind(c, name =& - & 'taxisDefRdate') - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int), value :: date_dummy - end subroutine taxisDefRdate - - subroutine taxisDefRtime(taxisID_dummy, time_dummy) bind(c, name =& - & 'taxisDefRtime') - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int), value :: time_dummy - end subroutine taxisDefRtime - - function taxisInqRdate(taxisID_dummy) bind(c, name = 'taxisInqRdate')& - & result(f_result) - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int) :: f_result - end function taxisInqRdate - - function taxisInqRtime(taxisID_dummy) bind(c, name = 'taxisInqRtime')& - & result(f_result) - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int) :: f_result - end function taxisInqRtime - - subroutine taxisDefFdate(taxisID_dummy, date_dummy) bind(c, name =& - & 'taxisDefFdate') - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int), value :: date_dummy - end subroutine taxisDefFdate - - subroutine taxisDefFtime(taxisID_dummy, time_dummy) bind(c, name =& - & 'taxisDefFtime') - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int), value :: time_dummy - end subroutine taxisDefFtime - - function taxisInqFdate(taxisID_dummy) bind(c, name = 'taxisInqFdate')& - & result(f_result) - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int) :: f_result - end function taxisInqFdate - - function taxisInqFtime(taxisID_dummy) bind(c, name = 'taxisInqFtime')& - & result(f_result) - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int) :: f_result - end function taxisInqFtime - - function taxisHasBounds(taxisID_dummy) bind(c, name = 'taxisHasBounds')& - & result(f_result) - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int) :: f_result - end function taxisHasBounds - - subroutine taxisWithBounds(taxisID_dummy) bind(c, name = 'taxisWithBounds') - import c_int - integer(c_int), value :: taxisID_dummy - end subroutine taxisWithBounds - - subroutine taxisDeleteBounds(taxisID_dummy) bind(c, name =& - & 'taxisDeleteBounds') - import c_int - integer(c_int), value :: taxisID_dummy - end subroutine taxisDeleteBounds - - subroutine taxisDefVdateBounds(taxisID_dummy, vdate_lb_dummy,& - & vdate_ub_dummy) bind(c, name = 'taxisDefVdateBounds') - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int), value :: vdate_lb_dummy - integer(c_int), value :: vdate_ub_dummy - end subroutine taxisDefVdateBounds - - subroutine taxisDefVtimeBounds(taxisID_dummy, vtime_lb_dummy,& - & vtime_ub_dummy) bind(c, name = 'taxisDefVtimeBounds') - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int), value :: vtime_lb_dummy - integer(c_int), value :: vtime_ub_dummy - end subroutine taxisDefVtimeBounds - - subroutine taxisInqVdateBounds(taxisID_dummy, vdate_lb_dummy,& - & vdate_ub_dummy) bind(c, name = 'taxisInqVdateBounds') - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int), intent(inout) :: vdate_lb_dummy - integer(c_int), intent(inout) :: vdate_ub_dummy - end subroutine taxisInqVdateBounds - - subroutine taxisInqVtimeBounds(taxisID_dummy, vtime_lb_dummy,& - & vtime_ub_dummy) bind(c, name = 'taxisInqVtimeBounds') - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int), intent(inout) :: vtime_lb_dummy - integer(c_int), intent(inout) :: vtime_ub_dummy - end subroutine taxisInqVtimeBounds - - subroutine taxisDefCalendar(taxisID_dummy, calendar_dummy) bind(c, name =& - & 'taxisDefCalendar') - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int), value :: calendar_dummy - end subroutine taxisDefCalendar - - function taxisInqCalendar(taxisID_dummy) bind(c, name = 'taxisInqCalendar')& - & result(f_result) - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int) :: f_result - end function taxisInqCalendar - - subroutine taxisDefTunit(taxisID_dummy, tunit_dummy) bind(c, name =& - & 'taxisDefTunit') - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int), value :: tunit_dummy - end subroutine taxisDefTunit - - function taxisInqTunit(taxisID_dummy) bind(c, name = 'taxisInqTunit')& - & result(f_result) - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int) :: f_result - end function taxisInqTunit - - subroutine taxisDefForecastTunit(taxisID_dummy, tunit_dummy) bind(c, name =& - & 'taxisDefForecastTunit') - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int), value :: tunit_dummy - end subroutine taxisDefForecastTunit - - function taxisInqForecastTunit(taxisID_dummy) bind(c, name =& - & 'taxisInqForecastTunit') result(f_result) - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int) :: f_result - end function taxisInqForecastTunit - - subroutine taxisDefForecastPeriod(taxisID_dummy, fc_period_dummy) bind(c,& - & name = 'taxisDefForecastPeriod') - import c_double, c_int - integer(c_int), value :: taxisID_dummy - real(c_double), value :: fc_period_dummy - end subroutine taxisDefForecastPeriod - - function taxisInqForecastPeriod(taxisID_dummy) bind(c, name =& - & 'taxisInqForecastPeriod') result(f_result) - import c_double, c_int - integer(c_int), value :: taxisID_dummy - real(c_double) :: f_result - end function taxisInqForecastPeriod - - subroutine taxisDefNumavg(taxisID_dummy, numavg_dummy) bind(c, name =& - & 'taxisDefNumavg') - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int), value :: numavg_dummy - end subroutine taxisDefNumavg - - function taxisInqNumavg(taxisID_dummy) bind(c, name = 'taxisInqNumavg')& - & result(f_result) - import c_int - integer(c_int), value :: taxisID_dummy - integer(c_int) :: f_result - end function taxisInqNumavg - - function institutInqNumber() bind(c, name = 'institutInqNumber')& - & result(f_result) - import c_int - integer(c_int) :: f_result - end function institutInqNumber - - function institutInqCenter(instID_dummy) bind(c, name =& - & 'institutInqCenter') result(f_result) - import c_int - integer(c_int), value :: instID_dummy - integer(c_int) :: f_result - end function institutInqCenter - - function institutInqSubcenter(instID_dummy) bind(c, name =& - & 'institutInqSubcenter') result(f_result) - import c_int - integer(c_int), value :: instID_dummy - integer(c_int) :: f_result - end function institutInqSubcenter - - function modelInqInstitut(modelID_dummy) bind(c, name = 'modelInqInstitut')& - & result(f_result) - import c_int - integer(c_int), value :: modelID_dummy - integer(c_int) :: f_result - end function modelInqInstitut - - function modelInqGribID(modelID_dummy) bind(c, name = 'modelInqGribID')& - & result(f_result) - import c_int - integer(c_int), value :: modelID_dummy - integer(c_int) :: f_result - end function modelInqGribID - - function tableInqNumber() bind(c, name = 'tableInqNumber') result(f_result) - import c_int - integer(c_int) :: f_result - end function tableInqNumber - - function tableInqNum(tableID_dummy) bind(c, name = 'tableInqNum')& - & result(f_result) - import c_int - integer(c_int), value :: tableID_dummy - integer(c_int) :: f_result - end function tableInqNum - - function tableInqModel(tableID_dummy) bind(c, name = 'tableInqModel')& - & result(f_result) - import c_int - integer(c_int), value :: tableID_dummy - integer(c_int) :: f_result - end function tableInqModel - - function subtypeCreate(subtype_dummy) bind(c, name = 'subtypeCreate')& - & result(f_result) - import c_int - integer(c_int), value :: subtype_dummy - integer(c_int) :: f_result - end function subtypeCreate - - subroutine subtypePrint(subtypeID_dummy) bind(c, name = 'subtypePrint') - import c_int - integer(c_int), value :: subtypeID_dummy - end subroutine subtypePrint - - function subtypeCompare(subtypeID1_dummy, subtypeID2_dummy) bind(c, name =& - & 'subtypeCompare') result(f_result) - import c_int - integer(c_int), value :: subtypeID1_dummy - integer(c_int), value :: subtypeID2_dummy - integer(c_int) :: f_result - end function subtypeCompare - - function subtypeInqSize(subtypeID_dummy) bind(c, name = 'subtypeInqSize')& - & result(f_result) - import c_int - integer(c_int), value :: subtypeID_dummy - integer(c_int) :: f_result - end function subtypeInqSize - - function subtypeInqActiveIndex(subtypeID_dummy) bind(c, name =& - & 'subtypeInqActiveIndex') result(f_result) - import c_int - integer(c_int), value :: subtypeID_dummy - integer(c_int) :: f_result - end function subtypeInqActiveIndex - - subroutine subtypeDefActiveIndex(subtypeID_dummy, index_dummy) bind(c, name& - & = 'subtypeDefActiveIndex') - import c_int - integer(c_int), value :: subtypeID_dummy - integer(c_int), value :: index_dummy - end subroutine subtypeDefActiveIndex - - function subtypeInqTile(subtypeID_dummy, tileindex_dummy, attribute_dummy)& - & bind(c, name = 'subtypeInqTile') result(f_result) - import c_int - integer(c_int), value :: subtypeID_dummy - integer(c_int), value :: tileindex_dummy - integer(c_int), value :: attribute_dummy - integer(c_int) :: f_result - end function subtypeInqTile - - function vlistInqVarSubtype(vlistID_dummy, varID_dummy) bind(c, name =& - & 'vlistInqVarSubtype') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarSubtype - - subroutine gribapiLibraryVersion(major_version_dummy, minor_version_dummy,& - & revision_version_dummy) bind(c, name = 'gribapiLibraryVersion') - import c_int - integer(c_int), intent(inout) :: major_version_dummy - integer(c_int), intent(inout) :: minor_version_dummy - integer(c_int), intent(inout) :: revision_version_dummy - end subroutine gribapiLibraryVersion - - subroutine zaxisDefLtype(zaxisID_dummy, ltype_dummy) bind(c, name =& - & 'zaxisDefLtype') - import c_int - integer(c_int), value :: zaxisID_dummy - integer(c_int), value :: ltype_dummy - end subroutine zaxisDefLtype - - function vlistInqVarTypeOfGeneratingProcess(vlistID_dummy, varID_dummy)& - & bind(c, name = 'vlistInqVarTypeOfGeneratingProcess') result(f_result) - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int) :: f_result - end function vlistInqVarTypeOfGeneratingProcess - - subroutine vlistDefVarTypeOfGeneratingProcess(vlistID_dummy, varID_dummy,& - & typeOfGeneratingProcess_dummy) bind(c, name =& - & 'vlistDefVarTypeOfGeneratingProcess') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: typeOfGeneratingProcess_dummy - end subroutine vlistDefVarTypeOfGeneratingProcess - - subroutine vlistDefVarProductDefinitionTemplate(vlistID_dummy, varID_dummy,& - & productDefinitionTemplate_dummy) bind(c, name =& - & 'vlistDefVarProductDefinitionTemplate') - import c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: productDefinitionTemplate_dummy - end subroutine vlistDefVarProductDefinitionTemplate - - function date_to_julday(calendar_dummy, date_dummy) bind(c, name =& - & 'date_to_julday') result(f_result) - import c_int, c_int64_t - integer(c_int), value :: calendar_dummy - integer(c_int64_t), value :: date_dummy - integer(c_int64_t) :: f_result - end function date_to_julday - - function julday_to_date(calendar_dummy, julday_dummy) bind(c, name =& - & 'julday_to_date') result(f_result) - import c_int, c_int64_t - integer(c_int), value :: calendar_dummy - integer(c_int64_t), value :: julday_dummy - integer(c_int64_t) :: f_result - end function julday_to_date - - function time_to_sec(time_dummy) bind(c, name = 'time_to_sec')& - & result(f_result) - import c_int - integer(c_int), value :: time_dummy - integer(c_int) :: f_result - end function time_to_sec - - function sec_to_time(secofday_dummy) bind(c, name = 'sec_to_time')& - & result(f_result) - import c_int - integer(c_int), value :: secofday_dummy - integer(c_int) :: f_result - end function sec_to_time - - end interface - -contains - - subroutine ctrim(str) - character(kind = c_char, len = *), intent(inout) :: str - integer :: i - - do i=1,len(str) - if (str(i:i) == c_null_char) then - str(i:len(str)) = ' ' - exit - end if - end do - end subroutine ctrim - - function c_len(s) result(i) - character(kind = c_char, len = *), intent(in) :: s - integer :: i - - do i = 1, len(s) - if (s(i:i) == c_null_char) exit - end do - i = i - 1 - end function - - function cdiStringError(cdiErrno_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - integer(c_int), value :: cdiErrno_dummy - type(c_ptr) :: ptr - integer :: rv_shape(1) - interface - function lib_cdiStringError(cdiErrno_dummy) bind(c, name =& - & 'cdiStringError') result(c_result) - import c_int, c_ptr - type(c_ptr) :: c_result - integer(c_int), value :: cdiErrno_dummy - end function lib_cdiStringError - end interface - f_result => null() - ptr = lib_cdiStringError(cdiErrno_dummy) - if(c_associated(ptr)) then - rv_shape(1) = int(lib_strlen(ptr)) - call c_f_pointer(ptr, f_result, rv_shape) - end if - end function cdiStringError - - function cdiLibraryVersion() result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - type(c_ptr) :: ptr - integer :: rv_shape(1) - interface - function lib_cdiLibraryVersion() bind(c, name = 'cdiLibraryVersion')& - & result(c_result) - import c_ptr - type(c_ptr) :: c_result - end function lib_cdiLibraryVersion - end interface - f_result => null() - ptr = lib_cdiLibraryVersion() - if(c_associated(ptr)) then - rv_shape(1) = int(lib_strlen(ptr)) - call c_f_pointer(ptr, f_result, rv_shape) - end if - end function cdiLibraryVersion - - subroutine cdiDefGlobal(string_dummy, val_dummy) - character(kind = c_char, len = *), intent(in) :: string_dummy - integer(c_int), value :: val_dummy - character(kind = c_char) :: string_temp(len(string_dummy) + 1) - integer :: string_i - interface - subroutine lib_cdiDefGlobal(string_dummy, val_dummy) bind(c, name =& - & 'cdiDefGlobal') - import c_char, c_int - character(kind = c_char) :: string_dummy(*) - integer(c_int), value :: val_dummy - end subroutine lib_cdiDefGlobal - end interface - do string_i = 1, len(string_dummy) - string_temp(string_i) = string_dummy(string_i:string_i) - end do - string_temp(len(string_dummy) + 1) = c_null_char - call lib_cdiDefGlobal(string_temp, val_dummy) - end subroutine cdiDefGlobal - - subroutine cdiParamToString(param_dummy, paramstr_dummy, maxlen_dummy) - integer(c_int), value :: param_dummy - character(kind = c_char, len = *), intent(inout) :: paramstr_dummy - integer(c_int), value :: maxlen_dummy - character(kind = c_char) :: paramstr_temp(len(paramstr_dummy) + 1) - integer :: paramstr_i - interface - subroutine lib_cdiParamToString(param_dummy, paramstr_dummy,& - & maxlen_dummy) bind(c, name = 'cdiParamToString') - import c_char, c_int - integer(c_int), value :: param_dummy - character(kind = c_char) :: paramstr_dummy(*) - integer(c_int), value :: maxlen_dummy - end subroutine lib_cdiParamToString - end interface - paramstr_temp(len(paramstr_dummy) + 1) = c_null_char - do paramstr_i = len(paramstr_dummy), 1, -1 - if(paramstr_dummy(paramstr_i:paramstr_i) /= ' ') exit - paramstr_temp(paramstr_i) = c_null_char - end do - do paramstr_i = paramstr_i, 1, -1 - paramstr_temp(paramstr_i) = paramstr_dummy(paramstr_i:paramstr_i) - end do - call lib_cdiParamToString(param_dummy, paramstr_temp, maxlen_dummy) - do paramstr_i = 1, len(paramstr_dummy) - if(paramstr_temp(paramstr_i) == c_null_char) exit - paramstr_dummy(paramstr_i:paramstr_i) = paramstr_temp(paramstr_i) - end do - do paramstr_i = paramstr_i, len(paramstr_dummy) - paramstr_dummy(paramstr_i:paramstr_i) = ' ' - end do - end subroutine cdiParamToString - - function cdiGetFiletype(uri_dummy, byteorder_dummy) result(f_result) - integer(c_int) :: f_result - character(kind = c_char, len = *), intent(in) :: uri_dummy - integer(c_int), intent(inout) :: byteorder_dummy - character(kind = c_char) :: uri_temp(len(uri_dummy) + 1) - integer :: uri_i - interface - function lib_cdiGetFiletype(uri_dummy, byteorder_dummy) bind(c, name =& - & 'cdiGetFiletype') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - character(kind = c_char) :: uri_dummy(*) - integer(c_int), intent(inout) :: byteorder_dummy - end function lib_cdiGetFiletype - end interface - do uri_i = 1, len(uri_dummy) - uri_temp(uri_i) = uri_dummy(uri_i:uri_i) - end do - uri_temp(len(uri_dummy) + 1) = c_null_char - f_result = lib_cdiGetFiletype(uri_temp, byteorder_dummy) - end function cdiGetFiletype - - function streamOpenRead(path_dummy) result(f_result) - integer(c_int) :: f_result - character(kind = c_char, len = *), intent(in) :: path_dummy - character(kind = c_char) :: path_temp(len(path_dummy) + 1) - integer :: path_i - interface - function lib_streamOpenRead(path_dummy) bind(c, name = 'streamOpenRead')& - & result(c_result) - import c_char, c_int - integer(c_int) :: c_result - character(kind = c_char) :: path_dummy(*) - end function lib_streamOpenRead - end interface - do path_i = 1, len(path_dummy) - path_temp(path_i) = path_dummy(path_i:path_i) - end do - path_temp(len(path_dummy) + 1) = c_null_char - f_result = lib_streamOpenRead(path_temp) - end function streamOpenRead - - function streamOpenWrite(path_dummy, filetype_dummy) result(f_result) - integer(c_int) :: f_result - character(kind = c_char, len = *), intent(in) :: path_dummy - integer(c_int), value :: filetype_dummy - character(kind = c_char) :: path_temp(len(path_dummy) + 1) - integer :: path_i - interface - function lib_streamOpenWrite(path_dummy, filetype_dummy) bind(c, name =& - & 'streamOpenWrite') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - character(kind = c_char) :: path_dummy(*) - integer(c_int), value :: filetype_dummy - end function lib_streamOpenWrite - end interface - do path_i = 1, len(path_dummy) - path_temp(path_i) = path_dummy(path_i:path_i) - end do - path_temp(len(path_dummy) + 1) = c_null_char - f_result = lib_streamOpenWrite(path_temp, filetype_dummy) - end function streamOpenWrite - - function streamOpenAppend(path_dummy) result(f_result) - integer(c_int) :: f_result - character(kind = c_char, len = *), intent(in) :: path_dummy - character(kind = c_char) :: path_temp(len(path_dummy) + 1) - integer :: path_i - interface - function lib_streamOpenAppend(path_dummy) bind(c, name =& - & 'streamOpenAppend') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - character(kind = c_char) :: path_dummy(*) - end function lib_streamOpenAppend - end interface - do path_i = 1, len(path_dummy) - path_temp(path_i) = path_dummy(path_i:path_i) - end do - path_temp(len(path_dummy) + 1) = c_null_char - f_result = lib_streamOpenAppend(path_temp) - end function streamOpenAppend - - function streamFilename(streamID_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - integer(c_int), value :: streamID_dummy - type(c_ptr) :: ptr - integer :: rv_shape(1) - interface - function lib_streamFilename(streamID_dummy) bind(c, name =& - & 'streamFilename') result(c_result) - import c_int, c_ptr - type(c_ptr) :: c_result - integer(c_int), value :: streamID_dummy - end function lib_streamFilename - end interface - f_result => null() - ptr = lib_streamFilename(streamID_dummy) - if(c_associated(ptr)) then - rv_shape(1) = int(lib_strlen(ptr)) - call c_f_pointer(ptr, f_result, rv_shape) - end if - end function streamFilename - - function streamFilesuffix(filetype_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - integer(c_int), value :: filetype_dummy - type(c_ptr) :: ptr - integer :: rv_shape(1) - interface - function lib_streamFilesuffix(filetype_dummy) bind(c, name =& - & 'streamFilesuffix') result(c_result) - import c_int, c_ptr - type(c_ptr) :: c_result - integer(c_int), value :: filetype_dummy - end function lib_streamFilesuffix - end interface - f_result => null() - ptr = lib_streamFilesuffix(filetype_dummy) - if(c_associated(ptr)) then - rv_shape(1) = int(lib_strlen(ptr)) - call c_f_pointer(ptr, f_result, rv_shape) - end if - end function streamFilesuffix - - function cdiIterator_new(path_dummy) result(f_result) - type(t_CdiIterator) :: f_result - character(kind = c_char, len = *), intent(in) :: path_dummy - character(kind = c_char) :: path_temp(len(path_dummy) + 1) - integer :: path_i - interface - function lib_cdiIterator_new(path_dummy) bind(c, name =& - & 'cdiIterator_new') result(c_result) - import c_char, c_ptr - type(c_ptr) :: c_result - character(kind = c_char) :: path_dummy(*) - end function lib_cdiIterator_new - end interface - do path_i = 1, len(path_dummy) - path_temp(path_i) = path_dummy(path_i:path_i) - end do - path_temp(len(path_dummy) + 1) = c_null_char - f_result%ptr = lib_cdiIterator_new(path_temp) - end function cdiIterator_new - - function cdiIterator_clone(me_dummy) result(f_result) - type(t_CdiIterator) :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - interface - function lib_cdiIterator_clone(me_dummy) bind(c, name =& - & 'cdiIterator_clone') result(c_result) - import c_ptr - type(c_ptr) :: c_result - type(c_ptr), value :: me_dummy - end function lib_cdiIterator_clone - end interface - f_result%ptr = lib_cdiIterator_clone(me_dummy%ptr) - end function cdiIterator_clone - - function cdiIterator_serialize(me_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - type(c_ptr) :: cString - integer :: rv_shape(1) - character(kind = c_char), dimension(:), pointer :: temp - interface - function lib_cdiIterator_serialize(me_dummy) bind(c, name =& - & 'cdiIterator_serialize') result(c_result) - import c_ptr - type(c_ptr) :: c_result - type(c_ptr), value :: me_dummy - end function lib_cdiIterator_serialize - end interface - cString = lib_cdiIterator_serialize(me_dummy%ptr) - if(c_associated(cString)) then - rv_shape(1) = int(lib_strlen(cString)) - call c_f_pointer(cString, temp, rv_shape) - allocate(f_result(rv_shape(1))) - f_result = temp - call lib_free(cString) - else - f_result => null() - end if - end function cdiIterator_serialize - - function cdiIterator_deserialize(description_dummy) result(f_result) - type(t_CdiIterator) :: f_result - character(kind = c_char, len = *), intent(in) :: description_dummy - character(kind = c_char) :: description_temp(len(description_dummy) + 1) - integer :: description_i - interface - function lib_cdiIterator_deserialize(description_dummy) bind(c, name =& - & 'cdiIterator_deserialize') result(c_result) - import c_char, c_ptr - type(c_ptr) :: c_result - character(kind = c_char) :: description_dummy(*) - end function lib_cdiIterator_deserialize - end interface - do description_i = 1, len(description_dummy) - description_temp(description_i) =& - & description_dummy(description_i:description_i) - end do - description_temp(len(description_dummy) + 1) = c_null_char - f_result%ptr = lib_cdiIterator_deserialize(description_temp) - end function cdiIterator_deserialize - - subroutine cdiIterator_delete(me_dummy) - type(t_CdiIterator), intent(in) :: me_dummy - interface - subroutine lib_cdiIterator_delete(me_dummy) bind(c, name =& - & 'cdiIterator_delete') - import c_ptr - type(c_ptr), value :: me_dummy - end subroutine lib_cdiIterator_delete - end interface - call lib_cdiIterator_delete(me_dummy%ptr) - end subroutine cdiIterator_delete - - function cdiIterator_nextField(me_dummy) result(f_result) - integer(c_int) :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - interface - function lib_cdiIterator_nextField(me_dummy) bind(c, name =& - & 'cdiIterator_nextField') result(c_result) - import c_int, c_ptr - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - end function lib_cdiIterator_nextField - end interface - f_result = lib_cdiIterator_nextField(me_dummy%ptr) - end function cdiIterator_nextField - - function cdiIterator_inqStartTime(me_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - type(c_ptr) :: cString - integer :: rv_shape(1) - character(kind = c_char), dimension(:), pointer :: temp - interface - function lib_cdiIterator_inqStartTime(me_dummy) bind(c, name =& - & 'cdiIterator_inqStartTime') result(c_result) - import c_ptr - type(c_ptr) :: c_result - type(c_ptr), value :: me_dummy - end function lib_cdiIterator_inqStartTime - end interface - cString = lib_cdiIterator_inqStartTime(me_dummy%ptr) - if(c_associated(cString)) then - rv_shape(1) = int(lib_strlen(cString)) - call c_f_pointer(cString, temp, rv_shape) - allocate(f_result(rv_shape(1))) - f_result = temp - call lib_free(cString) - else - f_result => null() - end if - end function cdiIterator_inqStartTime - - function cdiIterator_inqEndTime(me_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - type(c_ptr) :: cString - integer :: rv_shape(1) - character(kind = c_char), dimension(:), pointer :: temp - interface - function lib_cdiIterator_inqEndTime(me_dummy) bind(c, name =& - & 'cdiIterator_inqEndTime') result(c_result) - import c_ptr - type(c_ptr) :: c_result - type(c_ptr), value :: me_dummy - end function lib_cdiIterator_inqEndTime - end interface - cString = lib_cdiIterator_inqEndTime(me_dummy%ptr) - if(c_associated(cString)) then - rv_shape(1) = int(lib_strlen(cString)) - call c_f_pointer(cString, temp, rv_shape) - allocate(f_result(rv_shape(1))) - f_result = temp - call lib_free(cString) - else - f_result => null() - end if - end function cdiIterator_inqEndTime - - function cdiIterator_inqRTime(me_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - type(c_ptr) :: cString - integer :: rv_shape(1) - character(kind = c_char), dimension(:), pointer :: temp - interface - function lib_cdiIterator_inqRTime(me_dummy) bind(c, name =& - & 'cdiIterator_inqRTime') result(c_result) - import c_ptr - type(c_ptr) :: c_result - type(c_ptr), value :: me_dummy - end function lib_cdiIterator_inqRTime - end interface - cString = lib_cdiIterator_inqRTime(me_dummy%ptr) - if(c_associated(cString)) then - rv_shape(1) = int(lib_strlen(cString)) - call c_f_pointer(cString, temp, rv_shape) - allocate(f_result(rv_shape(1))) - f_result = temp - call lib_free(cString) - else - f_result => null() - end if - end function cdiIterator_inqRTime - - function cdiIterator_inqVTime(me_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - type(c_ptr) :: cString - integer :: rv_shape(1) - character(kind = c_char), dimension(:), pointer :: temp - interface - function lib_cdiIterator_inqVTime(me_dummy) bind(c, name =& - & 'cdiIterator_inqVTime') result(c_result) - import c_ptr - type(c_ptr) :: c_result - type(c_ptr), value :: me_dummy - end function lib_cdiIterator_inqVTime - end interface - cString = lib_cdiIterator_inqVTime(me_dummy%ptr) - if(c_associated(cString)) then - rv_shape(1) = int(lib_strlen(cString)) - call c_f_pointer(cString, temp, rv_shape) - allocate(f_result(rv_shape(1))) - f_result = temp - call lib_free(cString) - else - f_result => null() - end if - end function cdiIterator_inqVTime - - function cdiIterator_inqLevelType(me_dummy, levelSelector_dummy, outName,& - & outLongName, outStdName, outUnit) result(f_result) - integer(c_int) :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - integer(c_int), value :: levelSelector_dummy - character(kind = c_char), pointer, optional, intent(inout) :: outName(:) - character(kind = c_char), pointer, optional, intent(inout) ::& - & outLongName(:) - character(kind = c_char), pointer, optional, intent(inout) :: outStdName(:) - character(kind = c_char), pointer, optional, intent(inout) :: outUnit(:) - type(c_ptr), target :: outName_cptr - type(c_ptr) :: outName_handle - integer :: outName_shape(1) - character(kind = c_char), pointer :: outName_fptr(:) - type(c_ptr), target :: outLongName_cptr - type(c_ptr) :: outLongName_handle - integer :: outLongName_shape(1) - character(kind = c_char), pointer :: outLongName_fptr(:) - type(c_ptr), target :: outStdName_cptr - type(c_ptr) :: outStdName_handle - integer :: outStdName_shape(1) - character(kind = c_char), pointer :: outStdName_fptr(:) - type(c_ptr), target :: outUnit_cptr - type(c_ptr) :: outUnit_handle - integer :: outUnit_shape(1) - character(kind = c_char), pointer :: outUnit_fptr(:) - interface - function lib_cdiIterator_inqLevelType(me_dummy, levelSelector_dummy,& - & outName, outLongName, outStdName, outUnit) bind(c, name =& - & 'cdiIterator_inqLevelType') result(c_result) - import c_int, c_ptr - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - integer(c_int), value :: levelSelector_dummy - type(c_ptr), value :: outName - type(c_ptr), value :: outLongName - type(c_ptr), value :: outStdName - type(c_ptr), value :: outUnit - end function lib_cdiIterator_inqLevelType - end interface - outName_handle = c_null_ptr - if(present(outName)) outName_handle = c_loc(outName_cptr) - outLongName_handle = c_null_ptr - if(present(outLongName)) outLongName_handle = c_loc(outLongName_cptr) - outStdName_handle = c_null_ptr - if(present(outStdName)) outStdName_handle = c_loc(outStdName_cptr) - outUnit_handle = c_null_ptr - if(present(outUnit)) outUnit_handle = c_loc(outUnit_cptr) - f_result = lib_cdiIterator_inqLevelType(me_dummy%ptr, levelSelector_dummy,& - & outName_handle, outLongName_handle, outStdName_handle, outUnit_handle) - if(present(outName)) then - if(c_associated(outName_cptr)) then - outName_shape(1) = int(lib_strlen(outName_cptr)) - call c_f_pointer(outName_cptr, outName_fptr, outName_shape) - allocate(outName(outName_shape(1))) - outName = outName_fptr - call lib_free(outName_cptr) - else - outName => null() - end if - end if - if(present(outLongName)) then - if(c_associated(outLongName_cptr)) then - outLongName_shape(1) = int(lib_strlen(outLongName_cptr)) - call c_f_pointer(outLongName_cptr, outLongName_fptr, outLongName_shape) - allocate(outLongName(outLongName_shape(1))) - outLongName = outLongName_fptr - call lib_free(outLongName_cptr) - else - outLongName => null() - end if - end if - if(present(outStdName)) then - if(c_associated(outStdName_cptr)) then - outStdName_shape(1) = int(lib_strlen(outStdName_cptr)) - call c_f_pointer(outStdName_cptr, outStdName_fptr, outStdName_shape) - allocate(outStdName(outStdName_shape(1))) - outStdName = outStdName_fptr - call lib_free(outStdName_cptr) - else - outStdName => null() - end if - end if - if(present(outUnit)) then - if(c_associated(outUnit_cptr)) then - outUnit_shape(1) = int(lib_strlen(outUnit_cptr)) - call c_f_pointer(outUnit_cptr, outUnit_fptr, outUnit_shape) - allocate(outUnit(outUnit_shape(1))) - outUnit = outUnit_fptr - call lib_free(outUnit_cptr) - else - outUnit => null() - end if - end if - end function cdiIterator_inqLevelType - - function cdiIterator_inqLevel(me_dummy, levelSelector_dummy, outValue1,& - & outValue2) result(f_result) - integer(c_int) :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - integer(c_int), value :: levelSelector_dummy - real(c_double), target, optional, intent(inout) :: outValue1 - real(c_double), target, optional, intent(inout) :: outValue2 - type(c_ptr) :: outValue1_cptr - type(c_ptr) :: outValue2_cptr - interface - function lib_cdiIterator_inqLevel(me_dummy, levelSelector_dummy,& - & outValue1, outValue2) bind(c, name = 'cdiIterator_inqLevel')& - & result(c_result) - import c_int, c_ptr - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - integer(c_int), value :: levelSelector_dummy - type(c_ptr), value :: outValue1 - type(c_ptr), value :: outValue2 - end function lib_cdiIterator_inqLevel - end interface - outValue1_cptr = c_null_ptr - if(present(outValue1)) outValue1_cptr = c_loc(outValue1) - outValue2_cptr = c_null_ptr - if(present(outValue2)) outValue2_cptr = c_loc(outValue2) - f_result = lib_cdiIterator_inqLevel(me_dummy%ptr, levelSelector_dummy,& - & outValue1_cptr, outValue2_cptr) - end function cdiIterator_inqLevel - - function cdiIterator_inqLevelUuid(me_dummy, outVgridNumber, outLevelCount,& - & outUuid) result(f_result) - integer(c_int) :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - integer(c_int), optional, target, intent(inout) :: outVgridNumber - integer(c_int), optional, target, intent(inout) :: outLevelCount - integer(kind = c_signed_char), target, optional, intent(inout) ::& - & outUuid(CDI_UUID_SIZE) - type(c_ptr) :: outVgridNumber_cptr - type(c_ptr) :: outLevelCount_cptr - type(c_ptr) :: outUuid_cptr - interface - function lib_cdiIterator_inqLevelUuid(me_dummy, outVgridNumber,& - & outLevelCount, outUuid) bind(c, name = 'cdiIterator_inqLevelUuid')& - & result(c_result) - import c_int, c_ptr - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - type(c_ptr), value :: outVgridNumber - type(c_ptr), value :: outLevelCount - type(c_ptr), value :: outUuid - end function lib_cdiIterator_inqLevelUuid - end interface - outVgridNumber_cptr = c_null_ptr - if(present(outVgridNumber)) outVgridNumber_cptr = c_loc(outVgridNumber) - outLevelCount_cptr = c_null_ptr - if(present(outLevelCount)) outLevelCount_cptr = c_loc(outLevelCount) - outUuid_cptr = c_null_ptr - if(present(outUuid)) outUuid_cptr = c_loc(outUuid) - f_result = lib_cdiIterator_inqLevelUuid(me_dummy%ptr, outVgridNumber_cptr,& - & outLevelCount_cptr, outUuid_cptr) - end function cdiIterator_inqLevelUuid - - function cdiIterator_inqTile(me_dummy, outTileIndex_dummy,& - & outTileAttribute_dummy) result(f_result) - integer(c_int) :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - integer(c_int), intent(inout) :: outTileIndex_dummy - integer(c_int), intent(inout) :: outTileAttribute_dummy - interface - function lib_cdiIterator_inqTile(me_dummy, outTileIndex_dummy,& - & outTileAttribute_dummy) bind(c, name = 'cdiIterator_inqTile')& - & result(c_result) - import c_int, c_ptr - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - integer(c_int), intent(inout) :: outTileIndex_dummy - integer(c_int), intent(inout) :: outTileAttribute_dummy - end function lib_cdiIterator_inqTile - end interface - f_result = lib_cdiIterator_inqTile(me_dummy%ptr, outTileIndex_dummy,& - & outTileAttribute_dummy) - end function cdiIterator_inqTile - - function cdiIterator_inqTileCount(me_dummy, outTileCount_dummy,& - & outTileAttributeCount_dummy) result(f_result) - integer(c_int) :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - integer(c_int), intent(inout) :: outTileCount_dummy - integer(c_int), intent(inout) :: outTileAttributeCount_dummy - interface - function lib_cdiIterator_inqTileCount(me_dummy, outTileCount_dummy,& - & outTileAttributeCount_dummy) bind(c, name = 'cdiIterator_inqTileCount')& - & result(c_result) - import c_int, c_ptr - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - integer(c_int), intent(inout) :: outTileCount_dummy - integer(c_int), intent(inout) :: outTileAttributeCount_dummy - end function lib_cdiIterator_inqTileCount - end interface - f_result = lib_cdiIterator_inqTileCount(me_dummy%ptr, outTileCount_dummy,& - & outTileAttributeCount_dummy) - end function cdiIterator_inqTileCount - - function cdiIterator_inqParam(me_dummy) result(f_result) - type(t_CdiParam) :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - interface - function lib_cdiIterator_inqParam(me_dummy) bind(c, name =& - & 'cdiIterator_inqParam') result(c_result) - import c_ptr, t_CdiParam - type(t_CdiParam) :: c_result - type(c_ptr), value :: me_dummy - end function lib_cdiIterator_inqParam - end interface - f_result = lib_cdiIterator_inqParam(me_dummy%ptr) - end function cdiIterator_inqParam - - subroutine cdiIterator_inqParamParts(me_dummy, outDiscipline_dummy,& - & outCategory_dummy, outNumber_dummy) - type(t_CdiIterator), intent(in) :: me_dummy - integer(c_int), intent(inout) :: outDiscipline_dummy - integer(c_int), intent(inout) :: outCategory_dummy - integer(c_int), intent(inout) :: outNumber_dummy - interface - subroutine lib_cdiIterator_inqParamParts(me_dummy, outDiscipline_dummy,& - & outCategory_dummy, outNumber_dummy) bind(c, name =& - & 'cdiIterator_inqParamParts') - import c_int, c_ptr - type(c_ptr), value :: me_dummy - integer(c_int), intent(inout) :: outDiscipline_dummy - integer(c_int), intent(inout) :: outCategory_dummy - integer(c_int), intent(inout) :: outNumber_dummy - end subroutine lib_cdiIterator_inqParamParts - end interface - call lib_cdiIterator_inqParamParts(me_dummy%ptr, outDiscipline_dummy,& - & outCategory_dummy, outNumber_dummy) - end subroutine cdiIterator_inqParamParts - - function cdiIterator_inqDatatype(me_dummy) result(f_result) - integer(c_int) :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - interface - function lib_cdiIterator_inqDatatype(me_dummy) bind(c, name =& - & 'cdiIterator_inqDatatype') result(c_result) - import c_int, c_ptr - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - end function lib_cdiIterator_inqDatatype - end interface - f_result = lib_cdiIterator_inqDatatype(me_dummy%ptr) - end function cdiIterator_inqDatatype - - function cdiIterator_inqFiletype(me_dummy) result(f_result) - integer(c_int) :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - interface - function lib_cdiIterator_inqFiletype(me_dummy) bind(c, name =& - & 'cdiIterator_inqFiletype') result(c_result) - import c_int, c_ptr - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - end function lib_cdiIterator_inqFiletype - end interface - f_result = lib_cdiIterator_inqFiletype(me_dummy%ptr) - end function cdiIterator_inqFiletype - - function cdiIterator_inqTsteptype(me_dummy) result(f_result) - integer(c_int) :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - interface - function lib_cdiIterator_inqTsteptype(me_dummy) bind(c, name =& - & 'cdiIterator_inqTsteptype') result(c_result) - import c_int, c_ptr - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - end function lib_cdiIterator_inqTsteptype - end interface - f_result = lib_cdiIterator_inqTsteptype(me_dummy%ptr) - end function cdiIterator_inqTsteptype - - function cdiIterator_inqVariableName(me_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - type(c_ptr) :: cString - integer :: rv_shape(1) - character(kind = c_char), dimension(:), pointer :: temp - interface - function lib_cdiIterator_inqVariableName(me_dummy) bind(c, name =& - & 'cdiIterator_inqVariableName') result(c_result) - import c_ptr - type(c_ptr) :: c_result - type(c_ptr), value :: me_dummy - end function lib_cdiIterator_inqVariableName - end interface - cString = lib_cdiIterator_inqVariableName(me_dummy%ptr) - if(c_associated(cString)) then - rv_shape(1) = int(lib_strlen(cString)) - call c_f_pointer(cString, temp, rv_shape) - allocate(f_result(rv_shape(1))) - f_result = temp - call lib_free(cString) - else - f_result => null() - end if - end function cdiIterator_inqVariableName - - function cdiIterator_inqGridId(me_dummy) result(f_result) - integer(c_int) :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - interface - function lib_cdiIterator_inqGridId(me_dummy) bind(c, name =& - & 'cdiIterator_inqGridId') result(c_result) - import c_int, c_ptr - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - end function lib_cdiIterator_inqGridId - end interface - f_result = lib_cdiIterator_inqGridId(me_dummy%ptr) - end function cdiIterator_inqGridId - - subroutine cdiIterator_readField(me_dummy, data_dummy, nmiss) - type(t_CdiIterator), intent(in) :: me_dummy - real(c_double), intent(inout) :: data_dummy(*) - integer(c_int), optional, target, intent(inout) :: nmiss - type(c_ptr) :: nmiss_cptr - interface - subroutine lib_cdiIterator_readField(me_dummy, data_dummy, nmiss) bind(c,& - & name = 'cdiIterator_readField') - import c_double, c_ptr - type(c_ptr), value :: me_dummy - real(c_double), intent(inout) :: data_dummy(*) - type(c_ptr), value :: nmiss - end subroutine lib_cdiIterator_readField - end interface - nmiss_cptr = c_null_ptr - if(present(nmiss)) nmiss_cptr = c_loc(nmiss) - call lib_cdiIterator_readField(me_dummy%ptr, data_dummy, nmiss_cptr) - end subroutine cdiIterator_readField - - subroutine cdiIterator_readFieldF(me_dummy, data_dummy, nmiss) - type(t_CdiIterator), intent(in) :: me_dummy - real(c_float), intent(inout) :: data_dummy(*) - integer(c_int), optional, target, intent(inout) :: nmiss - type(c_ptr) :: nmiss_cptr - interface - subroutine lib_cdiIterator_readFieldF(me_dummy, data_dummy, nmiss)& - & bind(c, name = 'cdiIterator_readFieldF') - import c_float, c_ptr - type(c_ptr), value :: me_dummy - real(c_float), intent(inout) :: data_dummy(*) - type(c_ptr), value :: nmiss - end subroutine lib_cdiIterator_readFieldF - end interface - nmiss_cptr = c_null_ptr - if(present(nmiss)) nmiss_cptr = c_loc(nmiss) - call lib_cdiIterator_readFieldF(me_dummy%ptr, data_dummy, nmiss_cptr) - end subroutine cdiIterator_readFieldF - - function cdiGribIterator_clone(me_dummy) result(f_result) - type(t_CdiGribIterator) :: f_result - type(t_CdiIterator), intent(in) :: me_dummy - interface - function lib_cdiGribIterator_clone(me_dummy) bind(c, name =& - & 'cdiGribIterator_clone') result(c_result) - import c_ptr - type(c_ptr) :: c_result - type(c_ptr), value :: me_dummy - end function lib_cdiGribIterator_clone - end interface - f_result%ptr = lib_cdiGribIterator_clone(me_dummy%ptr) - end function cdiGribIterator_clone - - subroutine cdiGribIterator_delete(me_dummy) - type(t_CdiGribIterator), intent(in) :: me_dummy - interface - subroutine lib_cdiGribIterator_delete(me_dummy) bind(c, name =& - & 'cdiGribIterator_delete') - import c_ptr - type(c_ptr), value :: me_dummy - end subroutine lib_cdiGribIterator_delete - end interface - call lib_cdiGribIterator_delete(me_dummy%ptr) - end subroutine cdiGribIterator_delete - - function cdiGribIterator_getLong(me_dummy, key_dummy, value_dummy)& - & result(f_result) - integer(c_int) :: f_result - type(t_CdiGribIterator), intent(in) :: me_dummy - character(kind = c_char, len = *), intent(in) :: key_dummy - integer(c_long), intent(inout) :: value_dummy - character(kind = c_char) :: key_temp(len(key_dummy) + 1) - integer :: key_i - interface - function lib_cdiGribIterator_getLong(me_dummy, key_dummy, value_dummy)& - & bind(c, name = 'cdiGribIterator_getLong') result(c_result) - import c_char, c_int, c_long, c_ptr - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - character(kind = c_char) :: key_dummy(*) - integer(c_long), intent(inout) :: value_dummy - end function lib_cdiGribIterator_getLong - end interface - do key_i = 1, len(key_dummy) - key_temp(key_i) = key_dummy(key_i:key_i) - end do - key_temp(len(key_dummy) + 1) = c_null_char - f_result = lib_cdiGribIterator_getLong(me_dummy%ptr, key_temp, value_dummy) - end function cdiGribIterator_getLong - - function cdiGribIterator_getDouble(me_dummy, key_dummy, value_dummy)& - & result(f_result) - integer(c_int) :: f_result - type(t_CdiGribIterator), intent(in) :: me_dummy - character(kind = c_char, len = *), intent(in) :: key_dummy - real(c_double), intent(inout) :: value_dummy - character(kind = c_char) :: key_temp(len(key_dummy) + 1) - integer :: key_i - interface - function lib_cdiGribIterator_getDouble(me_dummy, key_dummy, value_dummy)& - & bind(c, name = 'cdiGribIterator_getDouble') result(c_result) - import c_char, c_double, c_int, c_ptr - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - character(kind = c_char) :: key_dummy(*) - real(c_double), intent(inout) :: value_dummy - end function lib_cdiGribIterator_getDouble - end interface - do key_i = 1, len(key_dummy) - key_temp(key_i) = key_dummy(key_i:key_i) - end do - key_temp(len(key_dummy) + 1) = c_null_char - f_result = lib_cdiGribIterator_getDouble(me_dummy%ptr, key_temp,& - & value_dummy) - end function cdiGribIterator_getDouble - - function cdiGribIterator_getLength(me_dummy, key_dummy, value_dummy)& - & result(f_result) - integer(c_int) :: f_result - type(t_CdiGribIterator), intent(in) :: me_dummy - character(kind = c_char, len = *), intent(in) :: key_dummy - integer(c_size_t), intent(inout) :: value_dummy - character(kind = c_char) :: key_temp(len(key_dummy) + 1) - integer :: key_i - interface - function lib_cdiGribIterator_getLength(me_dummy, key_dummy, value_dummy)& - & bind(c, name = 'cdiGribIterator_getLength') result(c_result) - import c_char, c_int, c_ptr, c_size_t - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - character(kind = c_char) :: key_dummy(*) - integer(c_size_t), intent(inout) :: value_dummy - end function lib_cdiGribIterator_getLength - end interface - do key_i = 1, len(key_dummy) - key_temp(key_i) = key_dummy(key_i:key_i) - end do - key_temp(len(key_dummy) + 1) = c_null_char - f_result = lib_cdiGribIterator_getLength(me_dummy%ptr, key_temp,& - & value_dummy) - end function cdiGribIterator_getLength - - function cdiGribIterator_getString(me_dummy, key_dummy, value_dummy,& - & length_dummy) result(f_result) - integer(c_int) :: f_result - type(t_CdiGribIterator), intent(in) :: me_dummy - character(kind = c_char, len = *), intent(in) :: key_dummy - character(kind = c_char, len = *), intent(inout) :: value_dummy - integer(c_size_t), intent(inout) :: length_dummy - character(kind = c_char) :: key_temp(len(key_dummy) + 1) - integer :: key_i - character(kind = c_char) :: value_temp(len(value_dummy) + 1) - integer :: value_i - interface - function lib_cdiGribIterator_getString(me_dummy, key_dummy, value_dummy,& - & length_dummy) bind(c, name = 'cdiGribIterator_getString')& - & result(c_result) - import c_char, c_int, c_ptr, c_size_t - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - character(kind = c_char) :: key_dummy(*) - character(kind = c_char) :: value_dummy(*) - integer(c_size_t), intent(inout) :: length_dummy - end function lib_cdiGribIterator_getString - end interface - do key_i = 1, len(key_dummy) - key_temp(key_i) = key_dummy(key_i:key_i) - end do - key_temp(len(key_dummy) + 1) = c_null_char - value_temp(len(value_dummy) + 1) = c_null_char - do value_i = len(value_dummy), 1, -1 - if(value_dummy(value_i:value_i) /= ' ') exit - value_temp(value_i) = c_null_char - end do - do value_i = value_i, 1, -1 - value_temp(value_i) = value_dummy(value_i:value_i) - end do - f_result = lib_cdiGribIterator_getString(me_dummy%ptr, key_temp,& - & value_temp, length_dummy) - do value_i = 1, len(value_dummy) - if(value_temp(value_i) == c_null_char) exit - value_dummy(value_i:value_i) = value_temp(value_i) - end do - do value_i = value_i, len(value_dummy) - value_dummy(value_i:value_i) = ' ' - end do - end function cdiGribIterator_getString - - function cdiGribIterator_getSize(me_dummy, key_dummy, value_dummy)& - & result(f_result) - integer(c_int) :: f_result - type(t_CdiGribIterator), intent(in) :: me_dummy - character(kind = c_char, len = *), intent(in) :: key_dummy - integer(c_size_t), intent(inout) :: value_dummy - character(kind = c_char) :: key_temp(len(key_dummy) + 1) - integer :: key_i - interface - function lib_cdiGribIterator_getSize(me_dummy, key_dummy, value_dummy)& - & bind(c, name = 'cdiGribIterator_getSize') result(c_result) - import c_char, c_int, c_ptr, c_size_t - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - character(kind = c_char) :: key_dummy(*) - integer(c_size_t), intent(inout) :: value_dummy - end function lib_cdiGribIterator_getSize - end interface - do key_i = 1, len(key_dummy) - key_temp(key_i) = key_dummy(key_i:key_i) - end do - key_temp(len(key_dummy) + 1) = c_null_char - f_result = lib_cdiGribIterator_getSize(me_dummy%ptr, key_temp, value_dummy) - end function cdiGribIterator_getSize - - function cdiGribIterator_getLongArray(me_dummy, key_dummy, value_dummy,& - & array_size_dummy) result(f_result) - integer(c_int) :: f_result - type(t_CdiGribIterator), intent(in) :: me_dummy - character(kind = c_char, len = *), intent(in) :: key_dummy - integer(c_long), intent(inout) :: value_dummy - integer(c_size_t), intent(inout) :: array_size_dummy - character(kind = c_char) :: key_temp(len(key_dummy) + 1) - integer :: key_i - interface - function lib_cdiGribIterator_getLongArray(me_dummy, key_dummy,& - & value_dummy, array_size_dummy) bind(c, name =& - & 'cdiGribIterator_getLongArray') result(c_result) - import c_char, c_int, c_long, c_ptr, c_size_t - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - character(kind = c_char) :: key_dummy(*) - integer(c_long), intent(inout) :: value_dummy - integer(c_size_t), intent(inout) :: array_size_dummy - end function lib_cdiGribIterator_getLongArray - end interface - do key_i = 1, len(key_dummy) - key_temp(key_i) = key_dummy(key_i:key_i) - end do - key_temp(len(key_dummy) + 1) = c_null_char - f_result = lib_cdiGribIterator_getLongArray(me_dummy%ptr, key_temp,& - & value_dummy, array_size_dummy) - end function cdiGribIterator_getLongArray - - function cdiGribIterator_getDoubleArray(me_dummy, key_dummy, value_dummy,& - & array_size_dummy) result(f_result) - integer(c_int) :: f_result - type(t_CdiGribIterator), intent(in) :: me_dummy - character(kind = c_char, len = *), intent(in) :: key_dummy - real(c_double), intent(inout) :: value_dummy - integer(c_size_t), intent(inout) :: array_size_dummy - character(kind = c_char) :: key_temp(len(key_dummy) + 1) - integer :: key_i - interface - function lib_cdiGribIterator_getDoubleArray(me_dummy, key_dummy,& - & value_dummy, array_size_dummy) bind(c, name =& - & 'cdiGribIterator_getDoubleArray') result(c_result) - import c_char, c_double, c_int, c_ptr, c_size_t - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - character(kind = c_char) :: key_dummy(*) - real(c_double), intent(inout) :: value_dummy - integer(c_size_t), intent(inout) :: array_size_dummy - end function lib_cdiGribIterator_getDoubleArray - end interface - do key_i = 1, len(key_dummy) - key_temp(key_i) = key_dummy(key_i:key_i) - end do - key_temp(len(key_dummy) + 1) = c_null_char - f_result = lib_cdiGribIterator_getDoubleArray(me_dummy%ptr, key_temp,& - & value_dummy, array_size_dummy) - end function cdiGribIterator_getDoubleArray - - function cdiGribIterator_inqEdition(me_dummy) result(f_result) - integer(c_int) :: f_result - type(t_CdiGribIterator), intent(in) :: me_dummy - interface - function lib_cdiGribIterator_inqEdition(me_dummy) bind(c, name =& - & 'cdiGribIterator_inqEdition') result(c_result) - import c_int, c_ptr - integer(c_int) :: c_result - type(c_ptr), value :: me_dummy - end function lib_cdiGribIterator_inqEdition - end interface - f_result = lib_cdiGribIterator_inqEdition(me_dummy%ptr) - end function cdiGribIterator_inqEdition - - function cdiGribIterator_inqLongValue(me_dummy, key_dummy) result(f_result) - integer(c_long) :: f_result - type(t_CdiGribIterator), intent(in) :: me_dummy - character(kind = c_char, len = *), intent(in) :: key_dummy - character(kind = c_char) :: key_temp(len(key_dummy) + 1) - integer :: key_i - interface - function lib_cdiGribIterator_inqLongValue(me_dummy, key_dummy) bind(c,& - & name = 'cdiGribIterator_inqLongValue') result(c_result) - import c_char, c_long, c_ptr - integer(c_long) :: c_result - type(c_ptr), value :: me_dummy - character(kind = c_char) :: key_dummy(*) - end function lib_cdiGribIterator_inqLongValue - end interface - do key_i = 1, len(key_dummy) - key_temp(key_i) = key_dummy(key_i:key_i) - end do - key_temp(len(key_dummy) + 1) = c_null_char - f_result = lib_cdiGribIterator_inqLongValue(me_dummy%ptr, key_temp) - end function cdiGribIterator_inqLongValue - - function cdiGribIterator_inqLongDefaultValue(me_dummy, key_dummy,& - & defaultValue_dummy) result(f_result) - integer(c_long) :: f_result - type(t_CdiGribIterator), intent(in) :: me_dummy - character(kind = c_char, len = *), intent(in) :: key_dummy - integer(c_long), value :: defaultValue_dummy - character(kind = c_char) :: key_temp(len(key_dummy) + 1) - integer :: key_i - interface - function lib_cdiGribIterator_inqLongDefaultValue(me_dummy, key_dummy,& - & defaultValue_dummy) bind(c, name =& - & 'cdiGribIterator_inqLongDefaultValue') result(c_result) - import c_char, c_long, c_ptr - integer(c_long) :: c_result - type(c_ptr), value :: me_dummy - character(kind = c_char) :: key_dummy(*) - integer(c_long), value :: defaultValue_dummy - end function lib_cdiGribIterator_inqLongDefaultValue - end interface - do key_i = 1, len(key_dummy) - key_temp(key_i) = key_dummy(key_i:key_i) - end do - key_temp(len(key_dummy) + 1) = c_null_char - f_result = lib_cdiGribIterator_inqLongDefaultValue(me_dummy%ptr, key_temp,& - & defaultValue_dummy) - end function cdiGribIterator_inqLongDefaultValue - - function cdiGribIterator_inqDoubleValue(me_dummy, key_dummy) result(f_result) - real(c_double) :: f_result - type(t_CdiGribIterator), intent(in) :: me_dummy - character(kind = c_char, len = *), intent(in) :: key_dummy - character(kind = c_char) :: key_temp(len(key_dummy) + 1) - integer :: key_i - interface - function lib_cdiGribIterator_inqDoubleValue(me_dummy, key_dummy) bind(c,& - & name = 'cdiGribIterator_inqDoubleValue') result(c_result) - import c_char, c_double, c_ptr - real(c_double) :: c_result - type(c_ptr), value :: me_dummy - character(kind = c_char) :: key_dummy(*) - end function lib_cdiGribIterator_inqDoubleValue - end interface - do key_i = 1, len(key_dummy) - key_temp(key_i) = key_dummy(key_i:key_i) - end do - key_temp(len(key_dummy) + 1) = c_null_char - f_result = lib_cdiGribIterator_inqDoubleValue(me_dummy%ptr, key_temp) - end function cdiGribIterator_inqDoubleValue - - function cdiGribIterator_inqDoubleDefaultValue(me_dummy, key_dummy,& - & defaultValue_dummy) result(f_result) - real(c_double) :: f_result - type(t_CdiGribIterator), intent(in) :: me_dummy - character(kind = c_char, len = *), intent(in) :: key_dummy - real(c_double), value :: defaultValue_dummy - character(kind = c_char) :: key_temp(len(key_dummy) + 1) - integer :: key_i - interface - function lib_cdiGribIterator_inqDoubleDefaultValue(me_dummy, key_dummy,& - & defaultValue_dummy) bind(c, name =& - & 'cdiGribIterator_inqDoubleDefaultValue') result(c_result) - import c_char, c_double, c_ptr - real(c_double) :: c_result - type(c_ptr), value :: me_dummy - character(kind = c_char) :: key_dummy(*) - real(c_double), value :: defaultValue_dummy - end function lib_cdiGribIterator_inqDoubleDefaultValue - end interface - do key_i = 1, len(key_dummy) - key_temp(key_i) = key_dummy(key_i:key_i) - end do - key_temp(len(key_dummy) + 1) = c_null_char - f_result = lib_cdiGribIterator_inqDoubleDefaultValue(me_dummy%ptr,& - & key_temp, defaultValue_dummy) - end function cdiGribIterator_inqDoubleDefaultValue - - function cdiGribIterator_inqStringValue(me_dummy, key_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - type(t_CdiGribIterator), intent(in) :: me_dummy - character(kind = c_char, len = *), intent(in) :: key_dummy - character(kind = c_char) :: key_temp(len(key_dummy) + 1) - integer :: key_i - type(c_ptr) :: cString - integer :: rv_shape(1) - character(kind = c_char), dimension(:), pointer :: temp - interface - function lib_cdiGribIterator_inqStringValue(me_dummy, key_dummy) bind(c,& - & name = 'cdiGribIterator_inqStringValue') result(c_result) - import c_char, c_ptr - type(c_ptr) :: c_result - type(c_ptr), value :: me_dummy - character(kind = c_char) :: key_dummy(*) - end function lib_cdiGribIterator_inqStringValue - end interface - do key_i = 1, len(key_dummy) - key_temp(key_i) = key_dummy(key_i:key_i) - end do - key_temp(len(key_dummy) + 1) = c_null_char - cString = lib_cdiGribIterator_inqStringValue(me_dummy%ptr, key_temp) - if(c_associated(cString)) then - rv_shape(1) = int(lib_strlen(cString)) - call c_f_pointer(cString, temp, rv_shape) - allocate(f_result(rv_shape(1))) - f_result = temp - call lib_free(cString) - else - f_result => null() - end if - end function cdiGribIterator_inqStringValue - - subroutine vlistDefVarName(vlistID_dummy, varID_dummy, name_dummy) - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - subroutine lib_vlistDefVarName(vlistID_dummy, varID_dummy, name_dummy)& - & bind(c, name = 'vlistDefVarName') - import c_char, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - end subroutine lib_vlistDefVarName - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - call lib_vlistDefVarName(vlistID_dummy, varID_dummy, name_temp) - end subroutine vlistDefVarName - - subroutine vlistInqVarName(vlistID_dummy, varID_dummy, name_dummy) - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(inout) :: name_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - subroutine lib_vlistInqVarName(vlistID_dummy, varID_dummy, name_dummy)& - & bind(c, name = 'vlistInqVarName') - import c_char, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - end subroutine lib_vlistInqVarName - end interface - name_temp(len(name_dummy) + 1) = c_null_char - do name_i = len(name_dummy), 1, -1 - if(name_dummy(name_i:name_i) /= ' ') exit - name_temp(name_i) = c_null_char - end do - do name_i = name_i, 1, -1 - name_temp(name_i) = name_dummy(name_i:name_i) - end do - call lib_vlistInqVarName(vlistID_dummy, varID_dummy, name_temp) - do name_i = 1, len(name_dummy) - if(name_temp(name_i) == c_null_char) exit - name_dummy(name_i:name_i) = name_temp(name_i) - end do - do name_i = name_i, len(name_dummy) - name_dummy(name_i:name_i) = ' ' - end do - end subroutine vlistInqVarName - - function vlistCopyVarName(vlistId_dummy, varId_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - integer(c_int), value :: vlistId_dummy - integer(c_int), value :: varId_dummy - type(c_ptr) :: cString - integer :: rv_shape(1) - character(kind = c_char), dimension(:), pointer :: temp - interface - function lib_vlistCopyVarName(vlistId_dummy, varId_dummy) bind(c, name =& - & 'vlistCopyVarName') result(c_result) - import c_int, c_ptr - type(c_ptr) :: c_result - integer(c_int), value :: vlistId_dummy - integer(c_int), value :: varId_dummy - end function lib_vlistCopyVarName - end interface - cString = lib_vlistCopyVarName(vlistId_dummy, varId_dummy) - if(c_associated(cString)) then - rv_shape(1) = int(lib_strlen(cString)) - call c_f_pointer(cString, temp, rv_shape) - allocate(f_result(rv_shape(1))) - f_result = temp - call lib_free(cString) - else - f_result => null() - end if - end function vlistCopyVarName - - subroutine vlistDefVarStdname(vlistID_dummy, varID_dummy, stdname_dummy) - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: stdname_dummy - character(kind = c_char) :: stdname_temp(len(stdname_dummy) + 1) - integer :: stdname_i - interface - subroutine lib_vlistDefVarStdname(vlistID_dummy, varID_dummy,& - & stdname_dummy) bind(c, name = 'vlistDefVarStdname') - import c_char, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: stdname_dummy(*) - end subroutine lib_vlistDefVarStdname - end interface - do stdname_i = 1, len(stdname_dummy) - stdname_temp(stdname_i) = stdname_dummy(stdname_i:stdname_i) - end do - stdname_temp(len(stdname_dummy) + 1) = c_null_char - call lib_vlistDefVarStdname(vlistID_dummy, varID_dummy, stdname_temp) - end subroutine vlistDefVarStdname - - subroutine vlistInqVarStdname(vlistID_dummy, varID_dummy, stdname_dummy) - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(inout) :: stdname_dummy - character(kind = c_char) :: stdname_temp(len(stdname_dummy) + 1) - integer :: stdname_i - interface - subroutine lib_vlistInqVarStdname(vlistID_dummy, varID_dummy,& - & stdname_dummy) bind(c, name = 'vlistInqVarStdname') - import c_char, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: stdname_dummy(*) - end subroutine lib_vlistInqVarStdname - end interface - stdname_temp(len(stdname_dummy) + 1) = c_null_char - do stdname_i = len(stdname_dummy), 1, -1 - if(stdname_dummy(stdname_i:stdname_i) /= ' ') exit - stdname_temp(stdname_i) = c_null_char - end do - do stdname_i = stdname_i, 1, -1 - stdname_temp(stdname_i) = stdname_dummy(stdname_i:stdname_i) - end do - call lib_vlistInqVarStdname(vlistID_dummy, varID_dummy, stdname_temp) - do stdname_i = 1, len(stdname_dummy) - if(stdname_temp(stdname_i) == c_null_char) exit - stdname_dummy(stdname_i:stdname_i) = stdname_temp(stdname_i) - end do - do stdname_i = stdname_i, len(stdname_dummy) - stdname_dummy(stdname_i:stdname_i) = ' ' - end do - end subroutine vlistInqVarStdname - - subroutine vlistDefVarLongname(vlistID_dummy, varID_dummy, longname_dummy) - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: longname_dummy - character(kind = c_char) :: longname_temp(len(longname_dummy) + 1) - integer :: longname_i - interface - subroutine lib_vlistDefVarLongname(vlistID_dummy, varID_dummy,& - & longname_dummy) bind(c, name = 'vlistDefVarLongname') - import c_char, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: longname_dummy(*) - end subroutine lib_vlistDefVarLongname - end interface - do longname_i = 1, len(longname_dummy) - longname_temp(longname_i) = longname_dummy(longname_i:longname_i) - end do - longname_temp(len(longname_dummy) + 1) = c_null_char - call lib_vlistDefVarLongname(vlistID_dummy, varID_dummy, longname_temp) - end subroutine vlistDefVarLongname - - subroutine vlistInqVarLongname(vlistID_dummy, varID_dummy, longname_dummy) - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(inout) :: longname_dummy - character(kind = c_char) :: longname_temp(len(longname_dummy) + 1) - integer :: longname_i - interface - subroutine lib_vlistInqVarLongname(vlistID_dummy, varID_dummy,& - & longname_dummy) bind(c, name = 'vlistInqVarLongname') - import c_char, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: longname_dummy(*) - end subroutine lib_vlistInqVarLongname - end interface - longname_temp(len(longname_dummy) + 1) = c_null_char - do longname_i = len(longname_dummy), 1, -1 - if(longname_dummy(longname_i:longname_i) /= ' ') exit - longname_temp(longname_i) = c_null_char - end do - do longname_i = longname_i, 1, -1 - longname_temp(longname_i) = longname_dummy(longname_i:longname_i) - end do - call lib_vlistInqVarLongname(vlistID_dummy, varID_dummy, longname_temp) - do longname_i = 1, len(longname_dummy) - if(longname_temp(longname_i) == c_null_char) exit - longname_dummy(longname_i:longname_i) = longname_temp(longname_i) - end do - do longname_i = longname_i, len(longname_dummy) - longname_dummy(longname_i:longname_i) = ' ' - end do - end subroutine vlistInqVarLongname - - subroutine vlistDefVarUnits(vlistID_dummy, varID_dummy, units_dummy) - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: units_dummy - character(kind = c_char) :: units_temp(len(units_dummy) + 1) - integer :: units_i - interface - subroutine lib_vlistDefVarUnits(vlistID_dummy, varID_dummy, units_dummy)& - & bind(c, name = 'vlistDefVarUnits') - import c_char, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: units_dummy(*) - end subroutine lib_vlistDefVarUnits - end interface - do units_i = 1, len(units_dummy) - units_temp(units_i) = units_dummy(units_i:units_i) - end do - units_temp(len(units_dummy) + 1) = c_null_char - call lib_vlistDefVarUnits(vlistID_dummy, varID_dummy, units_temp) - end subroutine vlistDefVarUnits - - subroutine vlistInqVarUnits(vlistID_dummy, varID_dummy, units_dummy) - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(inout) :: units_dummy - character(kind = c_char) :: units_temp(len(units_dummy) + 1) - integer :: units_i - interface - subroutine lib_vlistInqVarUnits(vlistID_dummy, varID_dummy, units_dummy)& - & bind(c, name = 'vlistInqVarUnits') - import c_char, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: units_dummy(*) - end subroutine lib_vlistInqVarUnits - end interface - units_temp(len(units_dummy) + 1) = c_null_char - do units_i = len(units_dummy), 1, -1 - if(units_dummy(units_i:units_i) /= ' ') exit - units_temp(units_i) = c_null_char - end do - do units_i = units_i, 1, -1 - units_temp(units_i) = units_dummy(units_i:units_i) - end do - call lib_vlistInqVarUnits(vlistID_dummy, varID_dummy, units_temp) - do units_i = 1, len(units_dummy) - if(units_temp(units_i) == c_null_char) exit - units_dummy(units_i:units_i) = units_temp(units_i) - end do - do units_i = units_i, len(units_dummy) - units_dummy(units_i:units_i) = ' ' - end do - end subroutine vlistInqVarUnits - - subroutine vlistDefVarExtra(vlistID_dummy, varID_dummy, extra_dummy) - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: extra_dummy - character(kind = c_char) :: extra_temp(len(extra_dummy) + 1) - integer :: extra_i - interface - subroutine lib_vlistDefVarExtra(vlistID_dummy, varID_dummy, extra_dummy)& - & bind(c, name = 'vlistDefVarExtra') - import c_char, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: extra_dummy(*) - end subroutine lib_vlistDefVarExtra - end interface - do extra_i = 1, len(extra_dummy) - extra_temp(extra_i) = extra_dummy(extra_i:extra_i) - end do - extra_temp(len(extra_dummy) + 1) = c_null_char - call lib_vlistDefVarExtra(vlistID_dummy, varID_dummy, extra_temp) - end subroutine vlistDefVarExtra - - subroutine vlistInqVarExtra(vlistID_dummy, varID_dummy, extra_dummy) - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(inout) :: extra_dummy - character(kind = c_char) :: extra_temp(len(extra_dummy) + 1) - integer :: extra_i - interface - subroutine lib_vlistInqVarExtra(vlistID_dummy, varID_dummy, extra_dummy)& - & bind(c, name = 'vlistInqVarExtra') - import c_char, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: extra_dummy(*) - end subroutine lib_vlistInqVarExtra - end interface - extra_temp(len(extra_dummy) + 1) = c_null_char - do extra_i = len(extra_dummy), 1, -1 - if(extra_dummy(extra_i:extra_i) /= ' ') exit - extra_temp(extra_i) = c_null_char - end do - do extra_i = extra_i, 1, -1 - extra_temp(extra_i) = extra_dummy(extra_i:extra_i) - end do - call lib_vlistInqVarExtra(vlistID_dummy, varID_dummy, extra_temp) - do extra_i = 1, len(extra_dummy) - if(extra_temp(extra_i) == c_null_char) exit - extra_dummy(extra_i:extra_i) = extra_temp(extra_i) - end do - do extra_i = extra_i, len(extra_dummy) - extra_dummy(extra_i:extra_i) = ' ' - end do - end subroutine vlistInqVarExtra - - subroutine cdiDefAdditionalKey(string_dummy) - character(kind = c_char, len = *), intent(in) :: string_dummy - character(kind = c_char) :: string_temp(len(string_dummy) + 1) - integer :: string_i - interface - subroutine lib_cdiDefAdditionalKey(string_dummy) bind(c, name =& - & 'cdiDefAdditionalKey') - import c_char - character(kind = c_char) :: string_dummy(*) - end subroutine lib_cdiDefAdditionalKey - end interface - do string_i = 1, len(string_dummy) - string_temp(string_i) = string_dummy(string_i:string_i) - end do - string_temp(len(string_dummy) + 1) = c_null_char - call lib_cdiDefAdditionalKey(string_temp) - end subroutine cdiDefAdditionalKey - - subroutine vlistDefVarIntKey(vlistID_dummy, varID_dummy, name_dummy,& - & value_dummy) - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - integer(c_int), value :: value_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - subroutine lib_vlistDefVarIntKey(vlistID_dummy, varID_dummy, name_dummy,& - & value_dummy) bind(c, name = 'vlistDefVarIntKey') - import c_char, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - integer(c_int), value :: value_dummy - end subroutine lib_vlistDefVarIntKey - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - call lib_vlistDefVarIntKey(vlistID_dummy, varID_dummy, name_temp,& - & value_dummy) - end subroutine vlistDefVarIntKey - - subroutine vlistDefVarDblKey(vlistID_dummy, varID_dummy, name_dummy,& - & value_dummy) - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - real(c_double), value :: value_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - subroutine lib_vlistDefVarDblKey(vlistID_dummy, varID_dummy, name_dummy,& - & value_dummy) bind(c, name = 'vlistDefVarDblKey') - import c_char, c_double, c_int - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - real(c_double), value :: value_dummy - end subroutine lib_vlistDefVarDblKey - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - call lib_vlistDefVarDblKey(vlistID_dummy, varID_dummy, name_temp,& - & value_dummy) - end subroutine vlistDefVarDblKey - - function vlistHasVarKey(vlistID_dummy, varID_dummy, name_dummy)& - & result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - function lib_vlistHasVarKey(vlistID_dummy, varID_dummy, name_dummy)& - & bind(c, name = 'vlistHasVarKey') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - end function lib_vlistHasVarKey - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - f_result = lib_vlistHasVarKey(vlistID_dummy, varID_dummy, name_temp) - end function vlistHasVarKey - - function vlistInqVarDblKey(vlistID_dummy, varID_dummy, name_dummy)& - & result(f_result) - real(c_double) :: f_result - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - function lib_vlistInqVarDblKey(vlistID_dummy, varID_dummy, name_dummy)& - & bind(c, name = 'vlistInqVarDblKey') result(c_result) - import c_char, c_double, c_int - real(c_double) :: c_result - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - end function lib_vlistInqVarDblKey - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - f_result = lib_vlistInqVarDblKey(vlistID_dummy, varID_dummy, name_temp) - end function vlistInqVarDblKey - - function vlistInqVarIntKey(vlistID_dummy, varID_dummy, name_dummy)& - & result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - function lib_vlistInqVarIntKey(vlistID_dummy, varID_dummy, name_dummy)& - & bind(c, name = 'vlistInqVarIntKey') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: vlistID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - end function lib_vlistInqVarIntKey - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - f_result = lib_vlistInqVarIntKey(vlistID_dummy, varID_dummy, name_temp) - end function vlistInqVarIntKey - - function cdiInqAtt(cdiID_dummy, varID_dummy, attrnum_dummy, name_dummy,& - & typep_dummy, lenp_dummy) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: attrnum_dummy - character(kind = c_char, len = *), intent(inout) :: name_dummy - integer(c_int), intent(inout) :: typep_dummy - integer(c_int), intent(inout) :: lenp_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - function lib_cdiInqAtt(cdiID_dummy, varID_dummy, attrnum_dummy,& - & name_dummy, typep_dummy, lenp_dummy) bind(c, name = 'cdiInqAtt')& - & result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: attrnum_dummy - character(kind = c_char) :: name_dummy(*) - integer(c_int), intent(inout) :: typep_dummy - integer(c_int), intent(inout) :: lenp_dummy - end function lib_cdiInqAtt - end interface - name_temp(len(name_dummy) + 1) = c_null_char - do name_i = len(name_dummy), 1, -1 - if(name_dummy(name_i:name_i) /= ' ') exit - name_temp(name_i) = c_null_char - end do - do name_i = name_i, 1, -1 - name_temp(name_i) = name_dummy(name_i:name_i) - end do - f_result = lib_cdiInqAtt(cdiID_dummy, varID_dummy, attrnum_dummy,& - & name_temp, typep_dummy, lenp_dummy) - do name_i = 1, len(name_dummy) - if(name_temp(name_i) == c_null_char) exit - name_dummy(name_i:name_i) = name_temp(name_i) - end do - do name_i = name_i, len(name_dummy) - name_dummy(name_i:name_i) = ' ' - end do - end function cdiInqAtt - - function cdiInqAttLen(cdiID_dummy, varID_dummy, name_dummy) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - function lib_cdiInqAttLen(cdiID_dummy, varID_dummy, name_dummy) bind(c,& - & name = 'cdiInqAttLen') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - end function lib_cdiInqAttLen - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - f_result = lib_cdiInqAttLen(cdiID_dummy, varID_dummy, name_temp) - end function cdiInqAttLen - - function cdiInqAttType(cdiID_dummy, varID_dummy, name_dummy) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - function lib_cdiInqAttType(cdiID_dummy, varID_dummy, name_dummy) bind(c,& - & name = 'cdiInqAttType') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - end function lib_cdiInqAttType - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - f_result = lib_cdiInqAttType(cdiID_dummy, varID_dummy, name_temp) - end function cdiInqAttType - - function cdiDelAtt(cdiID_dummy, varID_dummy, name_dummy) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - function lib_cdiDelAtt(cdiID_dummy, varID_dummy, name_dummy) bind(c, name& - & = 'cdiDelAtt') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - end function lib_cdiDelAtt - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - f_result = lib_cdiDelAtt(cdiID_dummy, varID_dummy, name_temp) - end function cdiDelAtt - - function cdiDefAttInt(cdiID_dummy, varID_dummy, name_dummy, type_dummy,& - & len_dummy, ip_dummy) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - integer(c_int), value :: type_dummy - integer(c_int), value :: len_dummy - integer(c_int), intent(in) :: ip_dummy(*) - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - function lib_cdiDefAttInt(cdiID_dummy, varID_dummy, name_dummy,& - & type_dummy, len_dummy, ip_dummy) bind(c, name = 'cdiDefAttInt')& - & result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - integer(c_int), value :: type_dummy - integer(c_int), value :: len_dummy - integer(c_int), intent(in) :: ip_dummy(*) - end function lib_cdiDefAttInt - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - f_result = lib_cdiDefAttInt(cdiID_dummy, varID_dummy, name_temp,& - & type_dummy, len_dummy, ip_dummy) - end function cdiDefAttInt - - function cdiDefAttFlt(cdiID_dummy, varID_dummy, name_dummy, type_dummy,& - & len_dummy, dp_dummy) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - integer(c_int), value :: type_dummy - integer(c_int), value :: len_dummy - real(c_double), intent(in) :: dp_dummy(*) - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - function lib_cdiDefAttFlt(cdiID_dummy, varID_dummy, name_dummy,& - & type_dummy, len_dummy, dp_dummy) bind(c, name = 'cdiDefAttFlt')& - & result(c_result) - import c_char, c_double, c_int - integer(c_int) :: c_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - integer(c_int), value :: type_dummy - integer(c_int), value :: len_dummy - real(c_double), intent(in) :: dp_dummy(*) - end function lib_cdiDefAttFlt - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - f_result = lib_cdiDefAttFlt(cdiID_dummy, varID_dummy, name_temp,& - & type_dummy, len_dummy, dp_dummy) - end function cdiDefAttFlt - - function cdiDefAttTxt(cdiID_dummy, varID_dummy, name_dummy, len_dummy,& - & tp_cbuf_dummy) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - integer(c_int), value :: len_dummy - character(kind = c_char, len = *), intent(in) :: tp_cbuf_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - character(kind = c_char) :: tp_cbuf_temp(len(tp_cbuf_dummy) + 1) - integer :: tp_cbuf_i - interface - function lib_cdiDefAttTxt(cdiID_dummy, varID_dummy, name_dummy,& - & len_dummy, tp_cbuf_dummy) bind(c, name = 'cdiDefAttTxt')& - & result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - integer(c_int), value :: len_dummy - character(kind = c_char) :: tp_cbuf_dummy(*) - end function lib_cdiDefAttTxt - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - do tp_cbuf_i = 1, len(tp_cbuf_dummy) - tp_cbuf_temp(tp_cbuf_i) = tp_cbuf_dummy(tp_cbuf_i:tp_cbuf_i) - end do - tp_cbuf_temp(len(tp_cbuf_dummy) + 1) = c_null_char - f_result = lib_cdiDefAttTxt(cdiID_dummy, varID_dummy, name_temp, len_dummy,& - & tp_cbuf_temp) - end function cdiDefAttTxt - - function cdiInqAttInt(cdiID_dummy, varID_dummy, name_dummy, mlen_dummy,& - & ip_dummy) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - integer(c_int), value :: mlen_dummy - integer(c_int), intent(inout) :: ip_dummy(*) - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - function lib_cdiInqAttInt(cdiID_dummy, varID_dummy, name_dummy,& - & mlen_dummy, ip_dummy) bind(c, name = 'cdiInqAttInt') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - integer(c_int), value :: mlen_dummy - integer(c_int), intent(inout) :: ip_dummy(*) - end function lib_cdiInqAttInt - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - f_result = lib_cdiInqAttInt(cdiID_dummy, varID_dummy, name_temp,& - & mlen_dummy, ip_dummy) - end function cdiInqAttInt - - function cdiInqAttFlt(cdiID_dummy, varID_dummy, name_dummy, mlen_dummy,& - & dp_dummy) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - integer(c_int), value :: mlen_dummy - real(c_double), intent(inout) :: dp_dummy(*) - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - function lib_cdiInqAttFlt(cdiID_dummy, varID_dummy, name_dummy,& - & mlen_dummy, dp_dummy) bind(c, name = 'cdiInqAttFlt') result(c_result) - import c_char, c_double, c_int - integer(c_int) :: c_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - integer(c_int), value :: mlen_dummy - real(c_double), intent(inout) :: dp_dummy(*) - end function lib_cdiInqAttFlt - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - f_result = lib_cdiInqAttFlt(cdiID_dummy, varID_dummy, name_temp,& - & mlen_dummy, dp_dummy) - end function cdiInqAttFlt - - function cdiInqAttTxt(cdiID_dummy, varID_dummy, name_dummy, mlen_dummy,& - & tp_cbuf_dummy) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - integer(c_int), value :: mlen_dummy - character(kind = c_char, len = *), intent(inout) :: tp_cbuf_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - character(kind = c_char) :: tp_cbuf_temp(len(tp_cbuf_dummy) + 1) - integer :: tp_cbuf_i - interface - function lib_cdiInqAttTxt(cdiID_dummy, varID_dummy, name_dummy,& - & mlen_dummy, tp_cbuf_dummy) bind(c, name = 'cdiInqAttTxt')& - & result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - character(kind = c_char) :: name_dummy(*) - integer(c_int), value :: mlen_dummy - character(kind = c_char) :: tp_cbuf_dummy(*) - end function lib_cdiInqAttTxt - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - tp_cbuf_temp(len(tp_cbuf_dummy) + 1) = c_null_char - do tp_cbuf_i = len(tp_cbuf_dummy), 1, -1 - if(tp_cbuf_dummy(tp_cbuf_i:tp_cbuf_i) /= ' ') exit - tp_cbuf_temp(tp_cbuf_i) = c_null_char - end do - do tp_cbuf_i = tp_cbuf_i, 1, -1 - tp_cbuf_temp(tp_cbuf_i) = tp_cbuf_dummy(tp_cbuf_i:tp_cbuf_i) - end do - f_result = lib_cdiInqAttTxt(cdiID_dummy, varID_dummy, name_temp,& - & mlen_dummy, tp_cbuf_temp) - do tp_cbuf_i = 1, len(tp_cbuf_dummy) - if(tp_cbuf_temp(tp_cbuf_i) == c_null_char) exit - tp_cbuf_dummy(tp_cbuf_i:tp_cbuf_i) = tp_cbuf_temp(tp_cbuf_i) - end do - do tp_cbuf_i = tp_cbuf_i, len(tp_cbuf_dummy) - tp_cbuf_dummy(tp_cbuf_i:tp_cbuf_i) = ' ' - end do - end function cdiInqAttTxt - - subroutine gridName(gridtype_dummy, gridname_dummy) - integer(c_int), value :: gridtype_dummy - character(kind = c_char, len = *), intent(inout) :: gridname_dummy - character(kind = c_char) :: gridname_temp(len(gridname_dummy) + 1) - integer :: gridname_i - interface - subroutine lib_gridName(gridtype_dummy, gridname_dummy) bind(c, name =& - & 'gridName') - import c_char, c_int - integer(c_int), value :: gridtype_dummy - character(kind = c_char) :: gridname_dummy(*) - end subroutine lib_gridName - end interface - gridname_temp(len(gridname_dummy) + 1) = c_null_char - do gridname_i = len(gridname_dummy), 1, -1 - if(gridname_dummy(gridname_i:gridname_i) /= ' ') exit - gridname_temp(gridname_i) = c_null_char - end do - do gridname_i = gridname_i, 1, -1 - gridname_temp(gridname_i) = gridname_dummy(gridname_i:gridname_i) - end do - call lib_gridName(gridtype_dummy, gridname_temp) - do gridname_i = 1, len(gridname_dummy) - if(gridname_temp(gridname_i) == c_null_char) exit - gridname_dummy(gridname_i:gridname_i) = gridname_temp(gridname_i) - end do - do gridname_i = gridname_i, len(gridname_dummy) - gridname_dummy(gridname_i:gridname_i) = ' ' - end do - end subroutine gridName - - function gridNamePtr(gridtype_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - integer(c_int), value :: gridtype_dummy - type(c_ptr) :: ptr - integer :: rv_shape(1) - interface - function lib_gridNamePtr(gridtype_dummy) bind(c, name = 'gridNamePtr')& - & result(c_result) - import c_int, c_ptr - type(c_ptr) :: c_result - integer(c_int), value :: gridtype_dummy - end function lib_gridNamePtr - end interface - f_result => null() - ptr = lib_gridNamePtr(gridtype_dummy) - if(c_associated(ptr)) then - rv_shape(1) = int(lib_strlen(ptr)) - call c_f_pointer(ptr, f_result, rv_shape) - end if - end function gridNamePtr - - function cdiDefKeyString(cdiID_dummy, varID_dummy, key_dummy, string_dummy)& - & result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: key_dummy - character(kind = c_char, len = *), intent(in) :: string_dummy - character(kind = c_char) :: string_temp(len(string_dummy) + 1) - integer :: string_i - interface - function lib_cdiDefKeyString(cdiID_dummy, varID_dummy, key_dummy,& - & string_dummy) bind(c, name = 'cdiDefKeyString') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: key_dummy - character(kind = c_char) :: string_dummy(*) - end function lib_cdiDefKeyString - end interface - do string_i = 1, len(string_dummy) - string_temp(string_i) = string_dummy(string_i:string_i) - end do - string_temp(len(string_dummy) + 1) = c_null_char - f_result = lib_cdiDefKeyString(cdiID_dummy, varID_dummy, key_dummy,& - & string_temp) - end function cdiDefKeyString - - function cdiInqKeyString(cdiID_dummy, varID_dummy, key_dummy, string_dummy,& - & length_dummy) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: key_dummy - character(kind = c_char, len = *), intent(inout) :: string_dummy - integer(c_int), intent(inout) :: length_dummy - character(kind = c_char) :: string_temp(len(string_dummy) + 1) - integer :: string_i - interface - function lib_cdiInqKeyString(cdiID_dummy, varID_dummy, key_dummy,& - & string_dummy, length_dummy) bind(c, name = 'cdiInqKeyString')& - & result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: cdiID_dummy - integer(c_int), value :: varID_dummy - integer(c_int), value :: key_dummy - character(kind = c_char) :: string_dummy(*) - integer(c_int), intent(inout) :: length_dummy - end function lib_cdiInqKeyString - end interface - string_temp(len(string_dummy) + 1) = c_null_char - do string_i = len(string_dummy), 1, -1 - if(string_dummy(string_i:string_i) /= ' ') exit - string_temp(string_i) = c_null_char - end do - do string_i = string_i, 1, -1 - string_temp(string_i) = string_dummy(string_i:string_i) - end do - f_result = lib_cdiInqKeyString(cdiID_dummy, varID_dummy, key_dummy,& - & string_temp, length_dummy) - do string_i = 1, len(string_dummy) - if(string_temp(string_i) == c_null_char) exit - string_dummy(string_i:string_i) = string_temp(string_i) - end do - do string_i = string_i, len(string_dummy) - string_dummy(string_i:string_i) = ' ' - end do - end function cdiInqKeyString - - subroutine gridDefXname(gridID_dummy, xname_dummy) - integer(c_int), value :: gridID_dummy - character(kind = c_char, len = *), intent(in) :: xname_dummy - character(kind = c_char) :: xname_temp(len(xname_dummy) + 1) - integer :: xname_i - interface - subroutine lib_gridDefXname(gridID_dummy, xname_dummy) bind(c, name =& - & 'gridDefXname') - import c_char, c_int - integer(c_int), value :: gridID_dummy - character(kind = c_char) :: xname_dummy(*) - end subroutine lib_gridDefXname - end interface - do xname_i = 1, len(xname_dummy) - xname_temp(xname_i) = xname_dummy(xname_i:xname_i) - end do - xname_temp(len(xname_dummy) + 1) = c_null_char - call lib_gridDefXname(gridID_dummy, xname_temp) - end subroutine gridDefXname - - subroutine gridInqXname(gridID_dummy, xname_dummy) - integer(c_int), value :: gridID_dummy - character(kind = c_char, len = *), intent(inout) :: xname_dummy - character(kind = c_char) :: xname_temp(len(xname_dummy) + 1) - integer :: xname_i - interface - subroutine lib_gridInqXname(gridID_dummy, xname_dummy) bind(c, name =& - & 'gridInqXname') - import c_char, c_int - integer(c_int), value :: gridID_dummy - character(kind = c_char) :: xname_dummy(*) - end subroutine lib_gridInqXname - end interface - xname_temp(len(xname_dummy) + 1) = c_null_char - do xname_i = len(xname_dummy), 1, -1 - if(xname_dummy(xname_i:xname_i) /= ' ') exit - xname_temp(xname_i) = c_null_char - end do - do xname_i = xname_i, 1, -1 - xname_temp(xname_i) = xname_dummy(xname_i:xname_i) - end do - call lib_gridInqXname(gridID_dummy, xname_temp) - do xname_i = 1, len(xname_dummy) - if(xname_temp(xname_i) == c_null_char) exit - xname_dummy(xname_i:xname_i) = xname_temp(xname_i) - end do - do xname_i = xname_i, len(xname_dummy) - xname_dummy(xname_i:xname_i) = ' ' - end do - end subroutine gridInqXname - - subroutine gridDefXlongname(gridID_dummy, xlongname_dummy) - integer(c_int), value :: gridID_dummy - character(kind = c_char, len = *), intent(in) :: xlongname_dummy - character(kind = c_char) :: xlongname_temp(len(xlongname_dummy) + 1) - integer :: xlongname_i - interface - subroutine lib_gridDefXlongname(gridID_dummy, xlongname_dummy) bind(c,& - & name = 'gridDefXlongname') - import c_char, c_int - integer(c_int), value :: gridID_dummy - character(kind = c_char) :: xlongname_dummy(*) - end subroutine lib_gridDefXlongname - end interface - do xlongname_i = 1, len(xlongname_dummy) - xlongname_temp(xlongname_i) = xlongname_dummy(xlongname_i:xlongname_i) - end do - xlongname_temp(len(xlongname_dummy) + 1) = c_null_char - call lib_gridDefXlongname(gridID_dummy, xlongname_temp) - end subroutine gridDefXlongname - - subroutine gridInqXlongname(gridID_dummy, xlongname_dummy) - integer(c_int), value :: gridID_dummy - character(kind = c_char, len = *), intent(inout) :: xlongname_dummy - character(kind = c_char) :: xlongname_temp(len(xlongname_dummy) + 1) - integer :: xlongname_i - interface - subroutine lib_gridInqXlongname(gridID_dummy, xlongname_dummy) bind(c,& - & name = 'gridInqXlongname') - import c_char, c_int - integer(c_int), value :: gridID_dummy - character(kind = c_char) :: xlongname_dummy(*) - end subroutine lib_gridInqXlongname - end interface - xlongname_temp(len(xlongname_dummy) + 1) = c_null_char - do xlongname_i = len(xlongname_dummy), 1, -1 - if(xlongname_dummy(xlongname_i:xlongname_i) /= ' ') exit - xlongname_temp(xlongname_i) = c_null_char - end do - do xlongname_i = xlongname_i, 1, -1 - xlongname_temp(xlongname_i) = xlongname_dummy(xlongname_i:xlongname_i) - end do - call lib_gridInqXlongname(gridID_dummy, xlongname_temp) - do xlongname_i = 1, len(xlongname_dummy) - if(xlongname_temp(xlongname_i) == c_null_char) exit - xlongname_dummy(xlongname_i:xlongname_i) = xlongname_temp(xlongname_i) - end do - do xlongname_i = xlongname_i, len(xlongname_dummy) - xlongname_dummy(xlongname_i:xlongname_i) = ' ' - end do - end subroutine gridInqXlongname - - subroutine gridDefXunits(gridID_dummy, xunits_dummy) - integer(c_int), value :: gridID_dummy - character(kind = c_char, len = *), intent(in) :: xunits_dummy - character(kind = c_char) :: xunits_temp(len(xunits_dummy) + 1) - integer :: xunits_i - interface - subroutine lib_gridDefXunits(gridID_dummy, xunits_dummy) bind(c, name =& - & 'gridDefXunits') - import c_char, c_int - integer(c_int), value :: gridID_dummy - character(kind = c_char) :: xunits_dummy(*) - end subroutine lib_gridDefXunits - end interface - do xunits_i = 1, len(xunits_dummy) - xunits_temp(xunits_i) = xunits_dummy(xunits_i:xunits_i) - end do - xunits_temp(len(xunits_dummy) + 1) = c_null_char - call lib_gridDefXunits(gridID_dummy, xunits_temp) - end subroutine gridDefXunits - - subroutine gridInqXunits(gridID_dummy, xunits_dummy) - integer(c_int), value :: gridID_dummy - character(kind = c_char, len = *), intent(inout) :: xunits_dummy - character(kind = c_char) :: xunits_temp(len(xunits_dummy) + 1) - integer :: xunits_i - interface - subroutine lib_gridInqXunits(gridID_dummy, xunits_dummy) bind(c, name =& - & 'gridInqXunits') - import c_char, c_int - integer(c_int), value :: gridID_dummy - character(kind = c_char) :: xunits_dummy(*) - end subroutine lib_gridInqXunits - end interface - xunits_temp(len(xunits_dummy) + 1) = c_null_char - do xunits_i = len(xunits_dummy), 1, -1 - if(xunits_dummy(xunits_i:xunits_i) /= ' ') exit - xunits_temp(xunits_i) = c_null_char - end do - do xunits_i = xunits_i, 1, -1 - xunits_temp(xunits_i) = xunits_dummy(xunits_i:xunits_i) - end do - call lib_gridInqXunits(gridID_dummy, xunits_temp) - do xunits_i = 1, len(xunits_dummy) - if(xunits_temp(xunits_i) == c_null_char) exit - xunits_dummy(xunits_i:xunits_i) = xunits_temp(xunits_i) - end do - do xunits_i = xunits_i, len(xunits_dummy) - xunits_dummy(xunits_i:xunits_i) = ' ' - end do - end subroutine gridInqXunits - - subroutine gridDefYname(gridID_dummy, yname_dummy) - integer(c_int), value :: gridID_dummy - character(kind = c_char, len = *), intent(in) :: yname_dummy - character(kind = c_char) :: yname_temp(len(yname_dummy) + 1) - integer :: yname_i - interface - subroutine lib_gridDefYname(gridID_dummy, yname_dummy) bind(c, name =& - & 'gridDefYname') - import c_char, c_int - integer(c_int), value :: gridID_dummy - character(kind = c_char) :: yname_dummy(*) - end subroutine lib_gridDefYname - end interface - do yname_i = 1, len(yname_dummy) - yname_temp(yname_i) = yname_dummy(yname_i:yname_i) - end do - yname_temp(len(yname_dummy) + 1) = c_null_char - call lib_gridDefYname(gridID_dummy, yname_temp) - end subroutine gridDefYname - - subroutine gridInqYname(gridID_dummy, yname_dummy) - integer(c_int), value :: gridID_dummy - character(kind = c_char, len = *), intent(inout) :: yname_dummy - character(kind = c_char) :: yname_temp(len(yname_dummy) + 1) - integer :: yname_i - interface - subroutine lib_gridInqYname(gridID_dummy, yname_dummy) bind(c, name =& - & 'gridInqYname') - import c_char, c_int - integer(c_int), value :: gridID_dummy - character(kind = c_char) :: yname_dummy(*) - end subroutine lib_gridInqYname - end interface - yname_temp(len(yname_dummy) + 1) = c_null_char - do yname_i = len(yname_dummy), 1, -1 - if(yname_dummy(yname_i:yname_i) /= ' ') exit - yname_temp(yname_i) = c_null_char - end do - do yname_i = yname_i, 1, -1 - yname_temp(yname_i) = yname_dummy(yname_i:yname_i) - end do - call lib_gridInqYname(gridID_dummy, yname_temp) - do yname_i = 1, len(yname_dummy) - if(yname_temp(yname_i) == c_null_char) exit - yname_dummy(yname_i:yname_i) = yname_temp(yname_i) - end do - do yname_i = yname_i, len(yname_dummy) - yname_dummy(yname_i:yname_i) = ' ' - end do - end subroutine gridInqYname - - subroutine gridDefYlongname(gridID_dummy, ylongname_dummy) - integer(c_int), value :: gridID_dummy - character(kind = c_char, len = *), intent(in) :: ylongname_dummy - character(kind = c_char) :: ylongname_temp(len(ylongname_dummy) + 1) - integer :: ylongname_i - interface - subroutine lib_gridDefYlongname(gridID_dummy, ylongname_dummy) bind(c,& - & name = 'gridDefYlongname') - import c_char, c_int - integer(c_int), value :: gridID_dummy - character(kind = c_char) :: ylongname_dummy(*) - end subroutine lib_gridDefYlongname - end interface - do ylongname_i = 1, len(ylongname_dummy) - ylongname_temp(ylongname_i) = ylongname_dummy(ylongname_i:ylongname_i) - end do - ylongname_temp(len(ylongname_dummy) + 1) = c_null_char - call lib_gridDefYlongname(gridID_dummy, ylongname_temp) - end subroutine gridDefYlongname - - subroutine gridInqYlongname(gridID_dummy, ylongname_dummy) - integer(c_int), value :: gridID_dummy - character(kind = c_char, len = *), intent(inout) :: ylongname_dummy - character(kind = c_char) :: ylongname_temp(len(ylongname_dummy) + 1) - integer :: ylongname_i - interface - subroutine lib_gridInqYlongname(gridID_dummy, ylongname_dummy) bind(c,& - & name = 'gridInqYlongname') - import c_char, c_int - integer(c_int), value :: gridID_dummy - character(kind = c_char) :: ylongname_dummy(*) - end subroutine lib_gridInqYlongname - end interface - ylongname_temp(len(ylongname_dummy) + 1) = c_null_char - do ylongname_i = len(ylongname_dummy), 1, -1 - if(ylongname_dummy(ylongname_i:ylongname_i) /= ' ') exit - ylongname_temp(ylongname_i) = c_null_char - end do - do ylongname_i = ylongname_i, 1, -1 - ylongname_temp(ylongname_i) = ylongname_dummy(ylongname_i:ylongname_i) - end do - call lib_gridInqYlongname(gridID_dummy, ylongname_temp) - do ylongname_i = 1, len(ylongname_dummy) - if(ylongname_temp(ylongname_i) == c_null_char) exit - ylongname_dummy(ylongname_i:ylongname_i) = ylongname_temp(ylongname_i) - end do - do ylongname_i = ylongname_i, len(ylongname_dummy) - ylongname_dummy(ylongname_i:ylongname_i) = ' ' - end do - end subroutine gridInqYlongname - - subroutine gridDefYunits(gridID_dummy, yunits_dummy) - integer(c_int), value :: gridID_dummy - character(kind = c_char, len = *), intent(in) :: yunits_dummy - character(kind = c_char) :: yunits_temp(len(yunits_dummy) + 1) - integer :: yunits_i - interface - subroutine lib_gridDefYunits(gridID_dummy, yunits_dummy) bind(c, name =& - & 'gridDefYunits') - import c_char, c_int - integer(c_int), value :: gridID_dummy - character(kind = c_char) :: yunits_dummy(*) - end subroutine lib_gridDefYunits - end interface - do yunits_i = 1, len(yunits_dummy) - yunits_temp(yunits_i) = yunits_dummy(yunits_i:yunits_i) - end do - yunits_temp(len(yunits_dummy) + 1) = c_null_char - call lib_gridDefYunits(gridID_dummy, yunits_temp) - end subroutine gridDefYunits - - subroutine gridInqYunits(gridID_dummy, yunits_dummy) - integer(c_int), value :: gridID_dummy - character(kind = c_char, len = *), intent(inout) :: yunits_dummy - character(kind = c_char) :: yunits_temp(len(yunits_dummy) + 1) - integer :: yunits_i - interface - subroutine lib_gridInqYunits(gridID_dummy, yunits_dummy) bind(c, name =& - & 'gridInqYunits') - import c_char, c_int - integer(c_int), value :: gridID_dummy - character(kind = c_char) :: yunits_dummy(*) - end subroutine lib_gridInqYunits - end interface - yunits_temp(len(yunits_dummy) + 1) = c_null_char - do yunits_i = len(yunits_dummy), 1, -1 - if(yunits_dummy(yunits_i:yunits_i) /= ' ') exit - yunits_temp(yunits_i) = c_null_char - end do - do yunits_i = yunits_i, 1, -1 - yunits_temp(yunits_i) = yunits_dummy(yunits_i:yunits_i) - end do - call lib_gridInqYunits(gridID_dummy, yunits_temp) - do yunits_i = 1, len(yunits_dummy) - if(yunits_temp(yunits_i) == c_null_char) exit - yunits_dummy(yunits_i:yunits_i) = yunits_temp(yunits_i) - end do - do yunits_i = yunits_i, len(yunits_dummy) - yunits_dummy(yunits_i:yunits_i) = ' ' - end do - end subroutine gridInqYunits - - subroutine gridDefReference(gridID_dummy, reference_dummy) - integer(c_int), value :: gridID_dummy - character(kind = c_char, len = *), intent(in) :: reference_dummy - character(kind = c_char) :: reference_temp(len(reference_dummy) + 1) - integer :: reference_i - interface - subroutine lib_gridDefReference(gridID_dummy, reference_dummy) bind(c,& - & name = 'gridDefReference') - import c_char, c_int - integer(c_int), value :: gridID_dummy - character(kind = c_char) :: reference_dummy(*) - end subroutine lib_gridDefReference - end interface - do reference_i = 1, len(reference_dummy) - reference_temp(reference_i) = reference_dummy(reference_i:reference_i) - end do - reference_temp(len(reference_dummy) + 1) = c_null_char - call lib_gridDefReference(gridID_dummy, reference_temp) - end subroutine gridDefReference - - function gridInqReference(gridID_dummy, reference_dummy) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: gridID_dummy - character(kind = c_char, len = *), intent(inout) :: reference_dummy - character(kind = c_char) :: reference_temp(len(reference_dummy) + 1) - integer :: reference_i - interface - function lib_gridInqReference(gridID_dummy, reference_dummy) bind(c, name& - & = 'gridInqReference') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: gridID_dummy - character(kind = c_char) :: reference_dummy(*) - end function lib_gridInqReference - end interface - reference_temp(len(reference_dummy) + 1) = c_null_char - do reference_i = len(reference_dummy), 1, -1 - if(reference_dummy(reference_i:reference_i) /= ' ') exit - reference_temp(reference_i) = c_null_char - end do - do reference_i = reference_i, 1, -1 - reference_temp(reference_i) = reference_dummy(reference_i:reference_i) - end do - f_result = lib_gridInqReference(gridID_dummy, reference_temp) - do reference_i = 1, len(reference_dummy) - if(reference_temp(reference_i) == c_null_char) exit - reference_dummy(reference_i:reference_i) = reference_temp(reference_i) - end do - do reference_i = reference_i, len(reference_dummy) - reference_dummy(reference_i:reference_i) = ' ' - end do - end function gridInqReference - - subroutine zaxisName(zaxistype_dummy, zaxisname_dummy) - integer(c_int), value :: zaxistype_dummy - character(kind = c_char, len = *), intent(inout) :: zaxisname_dummy - character(kind = c_char) :: zaxisname_temp(len(zaxisname_dummy) + 1) - integer :: zaxisname_i - interface - subroutine lib_zaxisName(zaxistype_dummy, zaxisname_dummy) bind(c, name =& - & 'zaxisName') - import c_char, c_int - integer(c_int), value :: zaxistype_dummy - character(kind = c_char) :: zaxisname_dummy(*) - end subroutine lib_zaxisName - end interface - zaxisname_temp(len(zaxisname_dummy) + 1) = c_null_char - do zaxisname_i = len(zaxisname_dummy), 1, -1 - if(zaxisname_dummy(zaxisname_i:zaxisname_i) /= ' ') exit - zaxisname_temp(zaxisname_i) = c_null_char - end do - do zaxisname_i = zaxisname_i, 1, -1 - zaxisname_temp(zaxisname_i) = zaxisname_dummy(zaxisname_i:zaxisname_i) - end do - call lib_zaxisName(zaxistype_dummy, zaxisname_temp) - do zaxisname_i = 1, len(zaxisname_dummy) - if(zaxisname_temp(zaxisname_i) == c_null_char) exit - zaxisname_dummy(zaxisname_i:zaxisname_i) = zaxisname_temp(zaxisname_i) - end do - do zaxisname_i = zaxisname_i, len(zaxisname_dummy) - zaxisname_dummy(zaxisname_i:zaxisname_i) = ' ' - end do - end subroutine zaxisName - - function zaxisNamePtr(leveltype_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - integer(c_int), value :: leveltype_dummy - type(c_ptr) :: ptr - integer :: rv_shape(1) - interface - function lib_zaxisNamePtr(leveltype_dummy) bind(c, name = 'zaxisNamePtr')& - & result(c_result) - import c_int, c_ptr - type(c_ptr) :: c_result - integer(c_int), value :: leveltype_dummy - end function lib_zaxisNamePtr - end interface - f_result => null() - ptr = lib_zaxisNamePtr(leveltype_dummy) - if(c_associated(ptr)) then - rv_shape(1) = int(lib_strlen(ptr)) - call c_f_pointer(ptr, f_result, rv_shape) - end if - end function zaxisNamePtr - - subroutine zaxisDefName(zaxisID_dummy, name) - integer(c_int), value :: zaxisID_dummy - character(kind = c_char, len = *), optional, intent(in) :: name - character(kind = c_char), allocatable, target :: name_temp(:) - integer :: name_i - type(c_ptr) :: name_cptr - interface - subroutine lib_zaxisDefName(zaxisID_dummy, name) bind(c, name =& - & 'zaxisDefName') - import c_int, c_ptr - integer(c_int), value :: zaxisID_dummy - type(c_ptr), value :: name - end subroutine lib_zaxisDefName - end interface - if (present(name)) then - allocate(name_temp(len(name) + 1)) - name_temp(len(name) + 1) = c_null_char - do name_i = len(name), 1, -1 - if(name(name_i:name_i) /= ' ') exit - name_temp(name_i) = c_null_char - end do - do name_i = name_i, 1, -1 - name_temp(name_i) = name(name_i:name_i) - end do - name_cptr = c_loc(name_temp) - else - name_cptr = c_null_ptr - end if - call lib_zaxisDefName(zaxisID_dummy, name_cptr) - end subroutine zaxisDefName - - subroutine zaxisInqName(zaxisID_dummy, name_dummy) - integer(c_int), value :: zaxisID_dummy - character(kind = c_char, len = *), intent(inout) :: name_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - subroutine lib_zaxisInqName(zaxisID_dummy, name_dummy) bind(c, name =& - & 'zaxisInqName') - import c_char, c_int - integer(c_int), value :: zaxisID_dummy - character(kind = c_char) :: name_dummy(*) - end subroutine lib_zaxisInqName - end interface - name_temp(len(name_dummy) + 1) = c_null_char - do name_i = len(name_dummy), 1, -1 - if(name_dummy(name_i:name_i) /= ' ') exit - name_temp(name_i) = c_null_char - end do - do name_i = name_i, 1, -1 - name_temp(name_i) = name_dummy(name_i:name_i) - end do - call lib_zaxisInqName(zaxisID_dummy, name_temp) - do name_i = 1, len(name_dummy) - if(name_temp(name_i) == c_null_char) exit - name_dummy(name_i:name_i) = name_temp(name_i) - end do - do name_i = name_i, len(name_dummy) - name_dummy(name_i:name_i) = ' ' - end do - end subroutine zaxisInqName - - subroutine zaxisDefLongname(zaxisID_dummy, longname) - integer(c_int), value :: zaxisID_dummy - character(kind = c_char, len = *), optional, intent(in) :: longname - character(kind = c_char), allocatable, target :: longname_temp(:) - integer :: longname_i - type(c_ptr) :: longname_cptr - interface - subroutine lib_zaxisDefLongname(zaxisID_dummy, longname) bind(c, name =& - & 'zaxisDefLongname') - import c_int, c_ptr - integer(c_int), value :: zaxisID_dummy - type(c_ptr), value :: longname - end subroutine lib_zaxisDefLongname - end interface - if (present(longname)) then - allocate(longname_temp(len(longname) + 1)) - longname_temp(len(longname) + 1) = c_null_char - do longname_i = len(longname), 1, -1 - if(longname(longname_i:longname_i) /= ' ') exit - longname_temp(longname_i) = c_null_char - end do - do longname_i = longname_i, 1, -1 - longname_temp(longname_i) = longname(longname_i:longname_i) - end do - longname_cptr = c_loc(longname_temp) - else - longname_cptr = c_null_ptr - end if - call lib_zaxisDefLongname(zaxisID_dummy, longname_cptr) - end subroutine zaxisDefLongname - - subroutine zaxisInqLongname(zaxisID_dummy, longname_dummy) - integer(c_int), value :: zaxisID_dummy - character(kind = c_char, len = *), intent(inout) :: longname_dummy - character(kind = c_char) :: longname_temp(len(longname_dummy) + 1) - integer :: longname_i - interface - subroutine lib_zaxisInqLongname(zaxisID_dummy, longname_dummy) bind(c,& - & name = 'zaxisInqLongname') - import c_char, c_int - integer(c_int), value :: zaxisID_dummy - character(kind = c_char) :: longname_dummy(*) - end subroutine lib_zaxisInqLongname - end interface - longname_temp(len(longname_dummy) + 1) = c_null_char - do longname_i = len(longname_dummy), 1, -1 - if(longname_dummy(longname_i:longname_i) /= ' ') exit - longname_temp(longname_i) = c_null_char - end do - do longname_i = longname_i, 1, -1 - longname_temp(longname_i) = longname_dummy(longname_i:longname_i) - end do - call lib_zaxisInqLongname(zaxisID_dummy, longname_temp) - do longname_i = 1, len(longname_dummy) - if(longname_temp(longname_i) == c_null_char) exit - longname_dummy(longname_i:longname_i) = longname_temp(longname_i) - end do - do longname_i = longname_i, len(longname_dummy) - longname_dummy(longname_i:longname_i) = ' ' - end do - end subroutine zaxisInqLongname - - subroutine zaxisDefUnits(zaxisID_dummy, units) - integer(c_int), value :: zaxisID_dummy - character(kind = c_char, len = *), optional, intent(in) :: units - character(kind = c_char), allocatable, target :: units_temp(:) - integer :: units_i - type(c_ptr) :: units_cptr - interface - subroutine lib_zaxisDefUnits(zaxisID_dummy, units) bind(c, name =& - & 'zaxisDefUnits') - import c_int, c_ptr - integer(c_int), value :: zaxisID_dummy - type(c_ptr), value :: units - end subroutine lib_zaxisDefUnits - end interface - if (present(units)) then - allocate(units_temp(len(units) + 1)) - units_temp(len(units) + 1) = c_null_char - do units_i = len(units), 1, -1 - if(units(units_i:units_i) /= ' ') exit - units_temp(units_i) = c_null_char - end do - do units_i = units_i, 1, -1 - units_temp(units_i) = units(units_i:units_i) - end do - units_cptr = c_loc(units_temp) - else - units_cptr = c_null_ptr - end if - call lib_zaxisDefUnits(zaxisID_dummy, units_cptr) - end subroutine zaxisDefUnits - - subroutine zaxisInqUnits(zaxisID_dummy, units_dummy) - integer(c_int), value :: zaxisID_dummy - character(kind = c_char, len = *), intent(inout) :: units_dummy - character(kind = c_char) :: units_temp(len(units_dummy) + 1) - integer :: units_i - interface - subroutine lib_zaxisInqUnits(zaxisID_dummy, units_dummy) bind(c, name =& - & 'zaxisInqUnits') - import c_char, c_int - integer(c_int), value :: zaxisID_dummy - character(kind = c_char) :: units_dummy(*) - end subroutine lib_zaxisInqUnits - end interface - units_temp(len(units_dummy) + 1) = c_null_char - do units_i = len(units_dummy), 1, -1 - if(units_dummy(units_i:units_i) /= ' ') exit - units_temp(units_i) = c_null_char - end do - do units_i = units_i, 1, -1 - units_temp(units_i) = units_dummy(units_i:units_i) - end do - call lib_zaxisInqUnits(zaxisID_dummy, units_temp) - do units_i = 1, len(units_dummy) - if(units_temp(units_i) == c_null_char) exit - units_dummy(units_i:units_i) = units_temp(units_i) - end do - do units_i = units_i, len(units_dummy) - units_dummy(units_i:units_i) = ' ' - end do - end subroutine zaxisInqUnits - - subroutine zaxisInqStdname(zaxisID_dummy, stdname_dummy) - integer(c_int), value :: zaxisID_dummy - character(kind = c_char, len = *), intent(inout) :: stdname_dummy - character(kind = c_char) :: stdname_temp(len(stdname_dummy) + 1) - integer :: stdname_i - interface - subroutine lib_zaxisInqStdname(zaxisID_dummy, stdname_dummy) bind(c, name& - & = 'zaxisInqStdname') - import c_char, c_int - integer(c_int), value :: zaxisID_dummy - character(kind = c_char) :: stdname_dummy(*) - end subroutine lib_zaxisInqStdname - end interface - stdname_temp(len(stdname_dummy) + 1) = c_null_char - do stdname_i = len(stdname_dummy), 1, -1 - if(stdname_dummy(stdname_i:stdname_i) /= ' ') exit - stdname_temp(stdname_i) = c_null_char - end do - do stdname_i = stdname_i, 1, -1 - stdname_temp(stdname_i) = stdname_dummy(stdname_i:stdname_i) - end do - call lib_zaxisInqStdname(zaxisID_dummy, stdname_temp) - do stdname_i = 1, len(stdname_dummy) - if(stdname_temp(stdname_i) == c_null_char) exit - stdname_dummy(stdname_i:stdname_i) = stdname_temp(stdname_i) - end do - do stdname_i = stdname_i, len(stdname_dummy) - stdname_dummy(stdname_i:stdname_i) = ' ' - end do - end subroutine zaxisInqStdname - - function zaxisInqLbounds(zaxisID_dummy, lbounds) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: zaxisID_dummy - real(c_double), target, optional, intent(inout) :: lbounds(*) - type(c_ptr) :: lbounds_cptr - interface - function lib_zaxisInqLbounds(zaxisID_dummy, lbounds) bind(c, name =& - & 'zaxisInqLbounds') result(c_result) - import c_int, c_ptr - integer(c_int) :: c_result - integer(c_int), value :: zaxisID_dummy - type(c_ptr), value :: lbounds - end function lib_zaxisInqLbounds - end interface - lbounds_cptr = c_null_ptr - if(present(lbounds)) lbounds_cptr = c_loc(lbounds) - f_result = lib_zaxisInqLbounds(zaxisID_dummy, lbounds_cptr) - end function zaxisInqLbounds - - function zaxisInqUbounds(zaxisID_dummy, ubounds) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: zaxisID_dummy - real(c_double), target, optional, intent(inout) :: ubounds(*) - type(c_ptr) :: ubounds_cptr - interface - function lib_zaxisInqUbounds(zaxisID_dummy, ubounds) bind(c, name =& - & 'zaxisInqUbounds') result(c_result) - import c_int, c_ptr - integer(c_int) :: c_result - integer(c_int), value :: zaxisID_dummy - type(c_ptr), value :: ubounds - end function lib_zaxisInqUbounds - end interface - ubounds_cptr = c_null_ptr - if(present(ubounds)) ubounds_cptr = c_loc(ubounds) - f_result = lib_zaxisInqUbounds(zaxisID_dummy, ubounds_cptr) - end function zaxisInqUbounds - - function zaxisInqWeights(zaxisID_dummy, weights) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: zaxisID_dummy - real(c_double), target, optional, intent(inout) :: weights(*) - type(c_ptr) :: weights_cptr - interface - function lib_zaxisInqWeights(zaxisID_dummy, weights) bind(c, name =& - & 'zaxisInqWeights') result(c_result) - import c_int, c_ptr - integer(c_int) :: c_result - integer(c_int), value :: zaxisID_dummy - type(c_ptr), value :: weights - end function lib_zaxisInqWeights - end interface - weights_cptr = c_null_ptr - if(present(weights)) weights_cptr = c_loc(weights) - f_result = lib_zaxisInqWeights(zaxisID_dummy, weights_cptr) - end function zaxisInqWeights - - function taxisNamePtr(taxisID_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - integer(c_int), value :: taxisID_dummy - type(c_ptr) :: ptr - integer :: rv_shape(1) - interface - function lib_taxisNamePtr(taxisID_dummy) bind(c, name = 'taxisNamePtr')& - & result(c_result) - import c_int, c_ptr - type(c_ptr) :: c_result - integer(c_int), value :: taxisID_dummy - end function lib_taxisNamePtr - end interface - f_result => null() - ptr = lib_taxisNamePtr(taxisID_dummy) - if(c_associated(ptr)) then - rv_shape(1) = int(lib_strlen(ptr)) - call c_f_pointer(ptr, f_result, rv_shape) - end if - end function taxisNamePtr - - function tunitNamePtr(tunitID_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - integer(c_int), value :: tunitID_dummy - type(c_ptr) :: ptr - integer :: rv_shape(1) - interface - function lib_tunitNamePtr(tunitID_dummy) bind(c, name = 'tunitNamePtr')& - & result(c_result) - import c_int, c_ptr - type(c_ptr) :: c_result - integer(c_int), value :: tunitID_dummy - end function lib_tunitNamePtr - end interface - f_result => null() - ptr = lib_tunitNamePtr(tunitID_dummy) - if(c_associated(ptr)) then - rv_shape(1) = int(lib_strlen(ptr)) - call c_f_pointer(ptr, f_result, rv_shape) - end if - end function tunitNamePtr - - function institutDef(center_dummy, subcenter_dummy, name_dummy,& - & longname_dummy) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: center_dummy - integer(c_int), value :: subcenter_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - character(kind = c_char, len = *), intent(in) :: longname_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - character(kind = c_char) :: longname_temp(len(longname_dummy) + 1) - integer :: longname_i - interface - function lib_institutDef(center_dummy, subcenter_dummy, name_dummy,& - & longname_dummy) bind(c, name = 'institutDef') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: center_dummy - integer(c_int), value :: subcenter_dummy - character(kind = c_char) :: name_dummy(*) - character(kind = c_char) :: longname_dummy(*) - end function lib_institutDef - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - do longname_i = 1, len(longname_dummy) - longname_temp(longname_i) = longname_dummy(longname_i:longname_i) - end do - longname_temp(len(longname_dummy) + 1) = c_null_char - f_result = lib_institutDef(center_dummy, subcenter_dummy, name_temp,& - & longname_temp) - end function institutDef - - function institutInq(center_dummy, subcenter_dummy, name_dummy,& - & longname_dummy) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: center_dummy - integer(c_int), value :: subcenter_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - character(kind = c_char, len = *), intent(in) :: longname_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - character(kind = c_char) :: longname_temp(len(longname_dummy) + 1) - integer :: longname_i - interface - function lib_institutInq(center_dummy, subcenter_dummy, name_dummy,& - & longname_dummy) bind(c, name = 'institutInq') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: center_dummy - integer(c_int), value :: subcenter_dummy - character(kind = c_char) :: name_dummy(*) - character(kind = c_char) :: longname_dummy(*) - end function lib_institutInq - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - do longname_i = 1, len(longname_dummy) - longname_temp(longname_i) = longname_dummy(longname_i:longname_i) - end do - longname_temp(len(longname_dummy) + 1) = c_null_char - f_result = lib_institutInq(center_dummy, subcenter_dummy, name_temp,& - & longname_temp) - end function institutInq - - function institutInqNamePtr(instID_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - integer(c_int), value :: instID_dummy - type(c_ptr) :: ptr - integer :: rv_shape(1) - interface - function lib_institutInqNamePtr(instID_dummy) bind(c, name =& - & 'institutInqNamePtr') result(c_result) - import c_int, c_ptr - type(c_ptr) :: c_result - integer(c_int), value :: instID_dummy - end function lib_institutInqNamePtr - end interface - f_result => null() - ptr = lib_institutInqNamePtr(instID_dummy) - if(c_associated(ptr)) then - rv_shape(1) = int(lib_strlen(ptr)) - call c_f_pointer(ptr, f_result, rv_shape) - end if - end function institutInqNamePtr - - function institutInqLongnamePtr(instID_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - integer(c_int), value :: instID_dummy - type(c_ptr) :: ptr - integer :: rv_shape(1) - interface - function lib_institutInqLongnamePtr(instID_dummy) bind(c, name =& - & 'institutInqLongnamePtr') result(c_result) - import c_int, c_ptr - type(c_ptr) :: c_result - integer(c_int), value :: instID_dummy - end function lib_institutInqLongnamePtr - end interface - f_result => null() - ptr = lib_institutInqLongnamePtr(instID_dummy) - if(c_associated(ptr)) then - rv_shape(1) = int(lib_strlen(ptr)) - call c_f_pointer(ptr, f_result, rv_shape) - end if - end function institutInqLongnamePtr - - function modelDef(instID_dummy, modelgribID_dummy, name_dummy)& - & result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: instID_dummy - integer(c_int), value :: modelgribID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - function lib_modelDef(instID_dummy, modelgribID_dummy, name_dummy)& - & bind(c, name = 'modelDef') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: instID_dummy - integer(c_int), value :: modelgribID_dummy - character(kind = c_char) :: name_dummy(*) - end function lib_modelDef - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - f_result = lib_modelDef(instID_dummy, modelgribID_dummy, name_temp) - end function modelDef - - function modelInq(instID_dummy, modelgribID_dummy, name_dummy)& - & result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: instID_dummy - integer(c_int), value :: modelgribID_dummy - character(kind = c_char, len = *), intent(in) :: name_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - interface - function lib_modelInq(instID_dummy, modelgribID_dummy, name_dummy)& - & bind(c, name = 'modelInq') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: instID_dummy - integer(c_int), value :: modelgribID_dummy - character(kind = c_char) :: name_dummy(*) - end function lib_modelInq - end interface - do name_i = 1, len(name_dummy) - name_temp(name_i) = name_dummy(name_i:name_i) - end do - name_temp(len(name_dummy) + 1) = c_null_char - f_result = lib_modelInq(instID_dummy, modelgribID_dummy, name_temp) - end function modelInq - - function modelInqNamePtr(modelID_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - integer(c_int), value :: modelID_dummy - type(c_ptr) :: ptr - integer :: rv_shape(1) - interface - function lib_modelInqNamePtr(modelID_dummy) bind(c, name =& - & 'modelInqNamePtr') result(c_result) - import c_int, c_ptr - type(c_ptr) :: c_result - integer(c_int), value :: modelID_dummy - end function lib_modelInqNamePtr - end interface - f_result => null() - ptr = lib_modelInqNamePtr(modelID_dummy) - if(c_associated(ptr)) then - rv_shape(1) = int(lib_strlen(ptr)) - call c_f_pointer(ptr, f_result, rv_shape) - end if - end function modelInqNamePtr - - subroutine tableWrite(filename_dummy, tableID_dummy) - character(kind = c_char, len = *), intent(in) :: filename_dummy - integer(c_int), value :: tableID_dummy - character(kind = c_char) :: filename_temp(len(filename_dummy) + 1) - integer :: filename_i - interface - subroutine lib_tableWrite(filename_dummy, tableID_dummy) bind(c, name =& - & 'tableWrite') - import c_char, c_int - character(kind = c_char) :: filename_dummy(*) - integer(c_int), value :: tableID_dummy - end subroutine lib_tableWrite - end interface - do filename_i = 1, len(filename_dummy) - filename_temp(filename_i) = filename_dummy(filename_i:filename_i) - end do - filename_temp(len(filename_dummy) + 1) = c_null_char - call lib_tableWrite(filename_temp, tableID_dummy) - end subroutine tableWrite - - function tableRead(tablefile_dummy) result(f_result) - integer(c_int) :: f_result - character(kind = c_char, len = *), intent(in) :: tablefile_dummy - character(kind = c_char) :: tablefile_temp(len(tablefile_dummy) + 1) - integer :: tablefile_i - interface - function lib_tableRead(tablefile_dummy) bind(c, name = 'tableRead')& - & result(c_result) - import c_char, c_int - integer(c_int) :: c_result - character(kind = c_char) :: tablefile_dummy(*) - end function lib_tableRead - end interface - do tablefile_i = 1, len(tablefile_dummy) - tablefile_temp(tablefile_i) = tablefile_dummy(tablefile_i:tablefile_i) - end do - tablefile_temp(len(tablefile_dummy) + 1) = c_null_char - f_result = lib_tableRead(tablefile_temp) - end function tableRead - - function tableDef(modelID_dummy, tablenum_dummy, tablename_dummy)& - & result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: modelID_dummy - integer(c_int), value :: tablenum_dummy - character(kind = c_char, len = *), intent(in) :: tablename_dummy - character(kind = c_char) :: tablename_temp(len(tablename_dummy) + 1) - integer :: tablename_i - interface - function lib_tableDef(modelID_dummy, tablenum_dummy, tablename_dummy)& - & bind(c, name = 'tableDef') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: modelID_dummy - integer(c_int), value :: tablenum_dummy - character(kind = c_char) :: tablename_dummy(*) - end function lib_tableDef - end interface - do tablename_i = 1, len(tablename_dummy) - tablename_temp(tablename_i) = tablename_dummy(tablename_i:tablename_i) - end do - tablename_temp(len(tablename_dummy) + 1) = c_null_char - f_result = lib_tableDef(modelID_dummy, tablenum_dummy, tablename_temp) - end function tableDef - - function tableInqNamePtr(tableID_dummy) result(f_result) - character(kind = c_char), dimension(:), pointer :: f_result - integer(c_int), value :: tableID_dummy - type(c_ptr) :: ptr - integer :: rv_shape(1) - interface - function lib_tableInqNamePtr(tableID_dummy) bind(c, name =& - & 'tableInqNamePtr') result(c_result) - import c_int, c_ptr - type(c_ptr) :: c_result - integer(c_int), value :: tableID_dummy - end function lib_tableInqNamePtr - end interface - f_result => null() - ptr = lib_tableInqNamePtr(tableID_dummy) - if(c_associated(ptr)) then - rv_shape(1) = int(lib_strlen(ptr)) - call c_f_pointer(ptr, f_result, rv_shape) - end if - end function tableInqNamePtr - - function tableInq(modelID_dummy, tablenum_dummy, tablename_dummy)& - & result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: modelID_dummy - integer(c_int), value :: tablenum_dummy - character(kind = c_char, len = *), intent(in) :: tablename_dummy - character(kind = c_char) :: tablename_temp(len(tablename_dummy) + 1) - integer :: tablename_i - interface - function lib_tableInq(modelID_dummy, tablenum_dummy, tablename_dummy)& - & bind(c, name = 'tableInq') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: modelID_dummy - integer(c_int), value :: tablenum_dummy - character(kind = c_char) :: tablename_dummy(*) - end function lib_tableInq - end interface - do tablename_i = 1, len(tablename_dummy) - tablename_temp(tablename_i) = tablename_dummy(tablename_i:tablename_i) - end do - tablename_temp(len(tablename_dummy) + 1) = c_null_char - f_result = lib_tableInq(modelID_dummy, tablenum_dummy, tablename_temp) - end function tableInq - - subroutine tableInqEntry(tableID_dummy, id_dummy, ltype_dummy, name_dummy,& - & longname_dummy, units_dummy) - integer(c_int), value :: tableID_dummy - integer(c_int), value :: id_dummy - integer(c_int), value :: ltype_dummy - character(kind = c_char, len = *), intent(inout) :: name_dummy - character(kind = c_char, len = *), intent(inout) :: longname_dummy - character(kind = c_char, len = *), intent(inout) :: units_dummy - character(kind = c_char) :: name_temp(len(name_dummy) + 1) - integer :: name_i - character(kind = c_char) :: longname_temp(len(longname_dummy) + 1) - integer :: longname_i - character(kind = c_char) :: units_temp(len(units_dummy) + 1) - integer :: units_i - interface - subroutine lib_tableInqEntry(tableID_dummy, id_dummy, ltype_dummy,& - & name_dummy, longname_dummy, units_dummy) bind(c, name =& - & 'tableInqEntry') - import c_char, c_int - integer(c_int), value :: tableID_dummy - integer(c_int), value :: id_dummy - integer(c_int), value :: ltype_dummy - character(kind = c_char) :: name_dummy(*) - character(kind = c_char) :: longname_dummy(*) - character(kind = c_char) :: units_dummy(*) - end subroutine lib_tableInqEntry - end interface - name_temp(len(name_dummy) + 1) = c_null_char - do name_i = len(name_dummy), 1, -1 - if(name_dummy(name_i:name_i) /= ' ') exit - name_temp(name_i) = c_null_char - end do - do name_i = name_i, 1, -1 - name_temp(name_i) = name_dummy(name_i:name_i) - end do - longname_temp(len(longname_dummy) + 1) = c_null_char - do longname_i = len(longname_dummy), 1, -1 - if(longname_dummy(longname_i:longname_i) /= ' ') exit - longname_temp(longname_i) = c_null_char - end do - do longname_i = longname_i, 1, -1 - longname_temp(longname_i) = longname_dummy(longname_i:longname_i) - end do - units_temp(len(units_dummy) + 1) = c_null_char - do units_i = len(units_dummy), 1, -1 - if(units_dummy(units_i:units_i) /= ' ') exit - units_temp(units_i) = c_null_char - end do - do units_i = units_i, 1, -1 - units_temp(units_i) = units_dummy(units_i:units_i) - end do - call lib_tableInqEntry(tableID_dummy, id_dummy, ltype_dummy, name_temp,& - & longname_temp, units_temp) - do name_i = 1, len(name_dummy) - if(name_temp(name_i) == c_null_char) exit - name_dummy(name_i:name_i) = name_temp(name_i) - end do - do name_i = name_i, len(name_dummy) - name_dummy(name_i:name_i) = ' ' - end do - do longname_i = 1, len(longname_dummy) - if(longname_temp(longname_i) == c_null_char) exit - longname_dummy(longname_i:longname_i) = longname_temp(longname_i) - end do - do longname_i = longname_i, len(longname_dummy) - longname_dummy(longname_i:longname_i) = ' ' - end do - do units_i = 1, len(units_dummy) - if(units_temp(units_i) == c_null_char) exit - units_dummy(units_i:units_i) = units_temp(units_i) - end do - do units_i = units_i, len(units_dummy) - units_dummy(units_i:units_i) = ' ' - end do - end subroutine tableInqEntry - - function subtypeInqAttribute(subtypeID_dummy, index_dummy, key_dummy,& - & outValue_dummy) result(f_result) - integer(c_int) :: f_result - integer(c_int), value :: subtypeID_dummy - integer(c_int), value :: index_dummy - character(kind = c_char, len = *), intent(in) :: key_dummy - integer(c_int), intent(inout) :: outValue_dummy - character(kind = c_char) :: key_temp(len(key_dummy) + 1) - integer :: key_i - interface - function lib_subtypeInqAttribute(subtypeID_dummy, index_dummy, key_dummy,& - & outValue_dummy) bind(c, name = 'subtypeInqAttribute') result(c_result) - import c_char, c_int - integer(c_int) :: c_result - integer(c_int), value :: subtypeID_dummy - integer(c_int), value :: index_dummy - character(kind = c_char) :: key_dummy(*) - integer(c_int), intent(inout) :: outValue_dummy - end function lib_subtypeInqAttribute - end interface - do key_i = 1, len(key_dummy) - key_temp(key_i) = key_dummy(key_i:key_i) - end do - key_temp(len(key_dummy) + 1) = c_null_char - f_result = lib_subtypeInqAttribute(subtypeID_dummy, index_dummy, key_temp,& - & outValue_dummy) - end function subtypeInqAttribute - -end module mo_cdi diff --git a/src/model.c b/src/model.c index 95887f2b95eb24bf7e93aa017303947b5348ed10..9cf80506230c7a017de5b0552f19eec101355093 100644 --- a/src/model.c +++ b/src/model.c @@ -15,14 +15,11 @@ typedef struct { int self; - int used; int instID; int modelgribID; char *name; } model_t; -static int MODEL_Debug = 0; /* If set to 1, debugging */ - static void modelInit(void); static int modelCompareP(void *modelptr1, void *modelptr2); @@ -30,7 +27,7 @@ static void modelDestroyP(void *modelptr); static void modelPrintP(void *modelptr, FILE *fp); static int modelGetSizeP(void *modelptr, void *context); static void modelPackP(void *modelptr, void *buff, int size, int *position, void *context); -static int modelTxCode(void); +static int modelTxCode(void *modelptr); static const resOps modelOps = { modelCompareP, modelDestroyP, modelPrintP, modelGetSizeP, modelPackP, modelTxCode }; @@ -38,7 +35,6 @@ static void modelDefaultValue(model_t *modelptr) { modelptr->self = CDI_UNDEFID; - modelptr->used = 0; modelptr->instID = CDI_UNDEFID; modelptr->modelgribID = CDI_UNDEFID; modelptr->name = NULL; @@ -56,7 +52,6 @@ modelNewEntry(cdiResH resH, int instID, int modelgribID, const char *name) modelptr->self = resH; reshReplace(resH, modelptr, &modelOps); } - modelptr->used = 1; modelptr->instID = instID; modelptr->modelgribID = modelgribID; if (name && *name) modelptr->name = strdupx(name); @@ -107,12 +102,7 @@ static void modelInit(void) { static bool modelInitialized = false; - if (modelInitialized) return; - - modelInitialized = true; - char *env = getenv("MODEL_DEBUG"); - if (env) MODEL_Debug = atoi(env); } struct modelLoc @@ -127,7 +117,7 @@ findModelByID(int resID, void *res, void *data) model_t *modelptr = (model_t *) res; struct modelLoc *ret = (struct modelLoc *) data; int instID = ret->instID, modelgribID = ret->modelgribID; - if (modelptr->used && modelptr->instID == instID && modelptr->modelgribID == modelgribID) + if (modelptr->instID == instID && modelptr->modelgribID == modelgribID) { ret->resID = resID; return CDI_APPLY_STOP; @@ -143,8 +133,7 @@ findModelByName(int resID, void *res, void *data) struct modelLoc *ret = (struct modelLoc *) data; int instID = ret->instID, modelgribID = ret->modelgribID; const char *name = ret->name; - if (modelptr->used && (instID == -1 || modelptr->instID == instID) && (modelgribID == 0 || modelptr->modelgribID == modelgribID) - && modelptr->name) + if ((instID == -1 || modelptr->instID == instID) && (modelgribID == 0 || modelptr->modelgribID == modelgribID) && modelptr->name) { const char *p = name, *q = modelptr->name; while (*p != '\0' && *p == *q) ++p, ++q; @@ -223,7 +212,7 @@ modelCompareP(void *modelptr1, void *modelptr2) { model_t *model1 = (model_t *) modelptr1, *model2 = (model_t *) modelptr2; int diff = (namespaceResHDecode(model1->instID).idx != namespaceResHDecode(model2->instID).idx) - | (model1->modelgribID != model2->modelgribID) | (strcmp(model1->name, model2->name) != 0); + | (model1->modelgribID != model2->modelgribID) | !str_is_equal(model1->name, model2->name); return diff; } @@ -239,36 +228,39 @@ void modelPrintP(void *modelptr, FILE *fp) { model_t *mp = (model_t *) modelptr; - - if (!mp) return; - - fprintf(fp, "#\n"); - fprintf(fp, "# modelID %d\n", mp->self); - fprintf(fp, "#\n"); - fprintf(fp, "self = %d\n", mp->self); - fprintf(fp, "used = %d\n", mp->used); - fprintf(fp, "instID = %d\n", mp->instID); - fprintf(fp, "modelgribID = %d\n", mp->modelgribID); - fprintf(fp, "name = %s\n", mp->name ? mp->name : "NN"); + fprintf(fp, + "#\n" + "# modelID %d\n" + "#\n" + "self = %d\n" + "instID = %d\n" + "modelgribID = %d\n" + "name = %s\n", + mp->self, mp->self, mp->instID, mp->modelgribID, mp->name ? mp->name : "NN"); } static int -modelTxCode(void) +modelTxCode(void *modelptr) { + (void) modelptr; return MODEL; } enum { - model_nints = 4, + MODEL_PACK_INT_SELF, + MODEL_PACK_INT_INSTID, + MODEL_PACK_INT_MODELGRIBID, + MODEL_PACK_INT_NAMELEN, + modelNints, }; static int modelGetSizeP(void *modelptr, void *context) { model_t *p = (model_t *) modelptr; - size_t txsize = (size_t) serializeGetSize(model_nints, CDI_DATATYPE_INT, context) - + (size_t) serializeGetSize(p->name ? (int) strlen(p->name) + 1 : 0, CDI_DATATYPE_TXT, context); + size_t txsize = (size_t) serializeGetSize(modelNints, CDI_DATATYPE_INT, context) + + (size_t) serializeGetSize(p->name ? (int) strlen(p->name) : 0, CDI_DATATYPE_TXT, context); xassert(txsize <= INT_MAX); return (int) txsize; } @@ -277,35 +269,40 @@ static void modelPackP(void *modelptr, void *buf, int size, int *position, void *context) { model_t *p = (model_t *) modelptr; - int tempbuf[model_nints]; - tempbuf[0] = p->self; - tempbuf[1] = p->instID; - tempbuf[2] = p->modelgribID; - tempbuf[3] = p->name ? (int) strlen(p->name) + 1 : 0; - serializePack(tempbuf, model_nints, CDI_DATATYPE_INT, buf, size, position, context); - if (p->name) serializePack(p->name, tempbuf[3], CDI_DATATYPE_TXT, buf, size, position, context); + int tempbuf[modelNints]; + tempbuf[MODEL_PACK_INT_SELF] = p->self; + tempbuf[MODEL_PACK_INT_INSTID] = p->instID; + tempbuf[MODEL_PACK_INT_MODELGRIBID] = p->modelgribID; + tempbuf[MODEL_PACK_INT_NAMELEN] = p->name ? (int) strlen(p->name) : 0; + serializePack(tempbuf, modelNints, CDI_DATATYPE_INT, buf, size, position, context); + if (p->name) serializePack(p->name, tempbuf[MODEL_PACK_INT_NAMELEN], CDI_DATATYPE_TXT, buf, size, position, context); } int modelUnpack(void *buf, int size, int *position, int originNamespace, void *context, int force_id) { - int tempbuf[model_nints]; +#define adaptKey(key) (namespaceAdaptKey((key), originNamespace)) + int tempbuf[modelNints]; char *name; - serializeUnpack(buf, size, position, tempbuf, model_nints, CDI_DATATYPE_INT, context); - if (tempbuf[3] != 0) + serializeUnpack(buf, size, position, tempbuf, modelNints, CDI_DATATYPE_INT, context); + if (tempbuf[MODEL_PACK_INT_NAMELEN] != 0) { - name = (char *) Malloc((size_t) tempbuf[3]); - serializeUnpack(buf, size, position, name, tempbuf[3], CDI_DATATYPE_TXT, context); + size_t len = (size_t) tempbuf[MODEL_PACK_INT_NAMELEN]; + name = (char *) Malloc(len + 1); + serializeUnpack(buf, size, position, name, tempbuf[MODEL_PACK_INT_NAMELEN], CDI_DATATYPE_TXT, context); + name[len] = '\0'; } else { name = (char *) ""; } - int targetID = namespaceAdaptKey(tempbuf[0], originNamespace); - model_t *mp = modelNewEntry(force_id ? targetID : CDI_UNDEFID, namespaceAdaptKey(tempbuf[1], originNamespace), tempbuf[2], name); - if (tempbuf[3] != 0) Free(name); - xassert(!force_id || (mp->self == namespaceAdaptKey(tempbuf[0], originNamespace))); + int targetID = adaptKey(tempbuf[MODEL_PACK_INT_SELF]); + model_t *mp = modelNewEntry(force_id ? targetID : CDI_UNDEFID, adaptKey(tempbuf[MODEL_PACK_INT_INSTID]), + tempbuf[MODEL_PACK_INT_MODELGRIBID], name); + if (tempbuf[MODEL_PACK_INT_NAMELEN] != 0) Free(name); + xassert(!force_id || (mp->self == adaptKey(tempbuf[0]))); reshSetStatus(mp->self, &modelOps, reshGetStatus(mp->self, &modelOps) & ~RESH_SYNC_BIT); +#undef adaptKey return mp->self; } diff --git a/src/namespace.c b/src/namespace.c index fa828e71fe1d5e9361b683d640d45387b026a13f..2fbba5bf2857623c3bf1f9c5737a7f56db2cc05f 100644 --- a/src/namespace.c +++ b/src/namespace.c @@ -10,52 +10,60 @@ #include <stdio.h> #include "cdi.h" +#include "cdi_int.h" #include "dmemory.h" #include "namespace.h" #include "resource_handle.h" #include "serialize.h" #include "error.h" -#include "cdf_int.h" #include "file.h" -#include "cdi_int.h" +#include "vlist.h" +#ifdef HAVE_LIBNETCDF +#include "cdf_int.h" #include "stream_cdf.h" +#include "stream_cdf_postdef.h" +#endif static unsigned nNamespaces = 1; static int activeNamespace = 0; #ifdef HAVE_LIBNETCDF // clang-format off -#define CDI_NETCDF_SWITCHES \ - { .func = (void (*)()) nc__create }, \ - { .func = (void (*)()) cdf_def_var_serial }, \ - { .func = (void (*)()) cdfDefTimestep }, \ - { .func = (void (*)()) cdfDefCoordinateVars } +#define CDI_NETCDF_SWITCHES \ + { .func = (void (*)(void)) nc__create }, \ + { .func = (void (*)(void)) cdf_def_var_serial }, \ + { .func = (void (*)(void)) cdi_nc_enddef_serial }, \ + { .func = (void (*)(void)) cdi_nc__enddef_serial }, \ + { .func = (void (*)(void)) cdfDefTimestep }, \ + { .func = (void (*)(void)) cdfDefCoordinateVars }, \ + { .func = (void (*)(void)) cdfPostDefActionGridProp } // clang-format on #else #define CDI_NETCDF_SWITCHES #endif // clang-format off -#define defaultSwitches { \ - { .func = (void (*)()) cdiAbortC_serial }, \ - { .func = (void (*)()) cdiWarning }, \ - { .func = (void (*)()) serializeGetSizeInCore }, \ - { .func = (void (*)()) serializePackInCore }, \ - { .func = (void (*)()) serializeUnpackInCore }, \ - { .func = (void (*)()) fileOpen_serial }, \ - { .func = (void (*)()) fileWrite }, \ - { .func = (void (*)()) fileClose_serial }, \ - { .func = (void (*)()) cdiStreamOpenDefaultDelegate }, \ - { .func = (void (*)()) cdiStreamDefVlist_ }, \ - { .func = (void (*)()) cdiStreamSetupVlist_ }, \ - { .func = (void (*)()) cdiStreamWriteVar_ }, \ - { .func = (void (*)()) cdiStreamWriteVarChunk_ }, \ - { .func = (void (*)()) 0 }, \ - { .func = (void (*)()) 0 }, \ - { .func = (void (*)()) cdiStreamCloseDefaultDelegate }, \ - { .func = (void (*)()) cdiStreamDefTimestep_ }, \ - { .func = (void (*)()) cdiStreamSync_ }, \ - CDI_NETCDF_SWITCHES \ +#define defaultSwitches { \ + { .func = (void (*)(void)) cdiAbortC_serial }, \ + { .func = (void (*)(void)) cdiWarning }, \ + { .func = (void (*)(void)) serializeGetSizeInCore }, \ + { .func = (void (*)(void)) serializePackInCore }, \ + { .func = (void (*)(void)) serializeUnpackInCore }, \ + { .func = (void (*)(void)) fileOpen_serial }, \ + { .func = (void (*)(void)) fileWrite }, \ + { .func = (void (*)(void)) fileClose_serial }, \ + { .func = (void (*)(void)) cdiStreamOpenDefaultDelegate }, \ + { .func = (void (*)(void)) cdiStreamDefVlist_ }, \ + { .func = (void (*)(void)) cdiStreamSetupVlist_ }, \ + { .func = (void (*)(void)) cdiStreamWriteVar_ }, \ + { .func = (void (*)(void)) cdiStreamWriteVarChunk_ }, \ + { .func = (void (*)(void)) 0 }, \ + { .func = (void (*)(void)) 0 }, \ + { .func = (void (*)(void)) cdiStreamCloseDefaultDelegate }, \ + { .func = (void (*)(void)) cdiStreamDefTimestep_ }, \ + { .func = (void (*)(void)) cdiStreamSync_ }, \ + { .func = (void (*)(void)) cdiVlistDestroy_ }, \ + CDI_NETCDF_SWITCHES \ } // clang-format on @@ -69,11 +77,14 @@ enum namespaceStatus NAMESPACE_STATUS_UNUSED, }; +static union namespaceSwitchValue initialSwitches[NUM_NAMESPACE_SWITCH] = defaultSwitches; + static struct Namespace { enum namespaceStatus resStage; - union namespaceSwitchValue switches[NUM_NAMESPACE_SWITCH]; -} initialNamespace = { .resStage = NAMESPACE_STATUS_INUSE, .switches = defaultSwitches }; + unsigned numSwitches; + union namespaceSwitchValue *switches; +} initialNamespace = { .resStage = NAMESPACE_STATUS_INUSE, .numSwitches = NUM_NAMESPACE_SWITCH, .switches = initialSwitches }; static struct Namespace *namespaces = &initialNamespace; @@ -191,11 +202,16 @@ namespaceNew() xassert(newNamespaceID >= 0 && newNamespaceID < NUM_NAMESPACES); ++nNamespaces; namespaces[newNamespaceID].resStage = NAMESPACE_STATUS_INUSE; + namespaces[newNamespaceID].numSwitches = NUM_NAMESPACE_SWITCH; + enum + { + initialNSSWSize = sizeof(union namespaceSwitchValue) * NUM_NAMESPACE_SWITCH + }; + namespaces[newNamespaceID].switches = (union namespaceSwitchValue *) Malloc(initialNSSWSize); #if defined(SX) || defined(__cplusplus) - memcpy(namespaces[newNamespaceID].switches, defaultSwitches_, sizeof(namespaces[newNamespaceID].switches)); + memcpy(namespaces[newNamespaceID].switches, defaultSwitches_, initialNSSWSize); #else - memcpy(namespaces[newNamespaceID].switches, (union namespaceSwitchValue[NUM_NAMESPACE_SWITCH]) defaultSwitches, - sizeof(namespaces[newNamespaceID].switches)); + memcpy(namespaces[newNamespaceID].switches, (union namespaceSwitchValue[NUM_NAMESPACE_SWITCH]) defaultSwitches, initialNSSWSize); #endif reshListCreate(newNamespaceID); NAMESPACE_UNLOCK(); @@ -209,6 +225,7 @@ namespaceDelete(int namespaceID) NAMESPACE_LOCK(); xassert(namespaceID >= 0 && (unsigned) namespaceID < namespacesSize && nNamespaces); reshListDestruct(namespaceID); + if (namespaces[namespaceID].switches != initialSwitches) Free(namespaces[namespaceID].switches); namespaces[namespaceID].resStage = NAMESPACE_STATUS_UNUSED; --nNamespaces; NAMESPACE_UNLOCK(); @@ -236,17 +253,12 @@ namespaceGetActive() int namespaceAdaptKey(int originResH, int originNamespace) { - namespaceTuple_t tin; - int nsp; - if (originResH == CDI_UNDEFID) return CDI_UNDEFID; - tin.idx = originResH & idxmask; - tin.nsp = (int) (((unsigned) (originResH & nspmask)) >> idxbits); - + namespaceTuple_t tin = { .idx = originResH & idxmask, .nsp = (int) (((unsigned) (originResH & nspmask)) >> idxbits) }; xassert(tin.nsp == originNamespace); - nsp = namespaceGetActive(); + int nsp = namespaceGetActive(); return namespaceIdxEncode2(nsp, tin.idx); } @@ -254,33 +266,62 @@ namespaceAdaptKey(int originResH, int originNamespace) int namespaceAdaptKey2(int originResH) { - namespaceTuple_t tin; - int nsp; if (originResH == CDI_UNDEFID) return CDI_UNDEFID; - tin.idx = originResH & idxmask; - tin.nsp = (int) (((unsigned) (originResH & nspmask)) >> idxbits); - - nsp = namespaceGetActive(); - + namespaceTuple_t tin = { .idx = originResH & idxmask, .nsp = (int) (((unsigned) (originResH & nspmask)) >> idxbits) }; + int nsp = namespaceGetActive(); return namespaceIdxEncode2(nsp, tin.idx); } void -namespaceSwitchSet(enum namespaceSwitch sw, union namespaceSwitchValue value) +namespaceSwitchSet(int sw, union namespaceSwitchValue value) { - xassert(sw > NSSWITCH_NO_SUCH_SWITCH && sw < NUM_NAMESPACE_SWITCH); + xassert(sw > NSSWITCH_NO_SUCH_SWITCH); int nsp = namespaceGetActive(); + NAMESPACE_LOCK(); + if (namespaces[nsp].numSwitches <= (unsigned) sw) + { + if (namespaces[nsp].switches != initialSwitches) + namespaces[nsp].switches + = (union namespaceSwitchValue *) Realloc(namespaces[nsp].switches, ((unsigned) sw + 1) * sizeof value); + else + { + void *temp = Malloc(((unsigned) sw + 1) * sizeof value); + memcpy(temp, (void *) namespaces[nsp].switches, namespaces[nsp].numSwitches * sizeof value); + namespaces[nsp].switches = (union namespaceSwitchValue *) temp; + } + namespaces[nsp].numSwitches = (unsigned) sw + 1; + } namespaces[nsp].switches[sw] = value; + NAMESPACE_UNLOCK(); } union namespaceSwitchValue -namespaceSwitchGet(enum namespaceSwitch sw) +namespaceSwitchGet(int sw) { - xassert(sw > NSSWITCH_NO_SUCH_SWITCH && sw < NUM_NAMESPACE_SWITCH); int nsp = namespaceGetActive(); - return namespaces[nsp].switches[sw]; + xassert(sw > NSSWITCH_NO_SUCH_SWITCH && (unsigned) sw < namespaces[nsp].numSwitches); + NAMESPACE_LOCK(); + union namespaceSwitchValue sw_val = namespaces[nsp].switches[sw]; + NAMESPACE_UNLOCK(); + return sw_val; +} + +int +cdiNamespaceSwitchNewKey(void) +{ + static unsigned reservedKeys = 0; +#if defined(HAVE_LIBPTHREAD) + static pthread_mutex_t keyMutex = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_lock(&keyMutex); +#endif + if (reservedKeys >= INT_MAX - NUM_NAMESPACE_SWITCH - 1) Error("pool of available namespace switch keys exhausted!"); + int newKey = (int) (reservedKeys++) + NUM_NAMESPACE_SWITCH; +#if defined(HAVE_LIBPTHREAD) + pthread_mutex_unlock(&keyMutex); +#endif + return newKey; } void diff --git a/src/namespace.h b/src/namespace.h index 58397075e380cf3216301cfcbdd6e3d87b1a2420..f1323a0b0ba5f8859d6f792d3c4cd17bcbf7c836 100644 --- a/src/namespace.h +++ b/src/namespace.h @@ -32,11 +32,15 @@ enum namespaceSwitch NSSWITCH_STREAM_CLOSE_BACKEND, NSSWITCH_STREAM_DEF_TIMESTEP_, NSSWITCH_STREAM_SYNC, + NSSWITCH_VLIST_DESTROY_, #ifdef HAVE_LIBNETCDF NSSWITCH_NC__CREATE, NSSWITCH_CDF_DEF_VAR, + NSSWITCH_NC_ENDDEF, + NSSWITCH_NC__ENDDEF, NSSWITCH_CDF_DEF_TIMESTEP, NSSWITCH_CDF_STREAM_SETUP, + NSSWITCH_CDF_POSTDEFACTION_GRID_PROP, #endif NUM_NAMESPACE_SWITCH, }; @@ -44,10 +48,10 @@ enum namespaceSwitch union namespaceSwitchValue { void *data; - void (*func)(); + void (*func)(void); }; -#define NSSW_FUNC(p) ((union namespaceSwitchValue){ .func = (void (*)())(p) }) +#define NSSW_FUNC(p) ((union namespaceSwitchValue){ .func = (void (*)(void))(p) }) #define NSSW_DATA(p) ((union namespaceSwitchValue){ .data = (void *) (p) }) // int namespaceNew(); @@ -61,8 +65,10 @@ int namespaceIdxEncode2(int, int); namespaceTuple_t namespaceResHDecode(int); int namespaceAdaptKey(int originResH, int originNamespace); int namespaceAdaptKey2(int); -void namespaceSwitchSet(enum namespaceSwitch sw, union namespaceSwitchValue value); -union namespaceSwitchValue namespaceSwitchGet(enum namespaceSwitch sw); +void namespaceSwitchSet(int sw, union namespaceSwitchValue value); +union namespaceSwitchValue namespaceSwitchGet(int sw); +/* reserve new dynamic key */ +int cdiNamespaceSwitchNewKey(void); #endif /* diff --git a/src/normalize_month.h b/src/normalize_month.h new file mode 100644 index 0000000000000000000000000000000000000000..d727de7bdf024c065cb0606a4206a283e4a8eb71 --- /dev/null +++ b/src/normalize_month.h @@ -0,0 +1,20 @@ +#ifndef NORMALIZE_MONTH_H +#define NORMALIZE_MONTH_H + +#include <stdlib.h> + +struct YearMonth +{ + int year, month; +}; + +/* normalizes month to range [1,12] and adjusts year accordingly */ +static inline struct YearMonth +normalize_month(int year, int month) +{ + div_t modres = div(month - 1, 12); + year += modres.quot - ((month < 1) & (modres.rem != 0)); + return (struct YearMonth){ .year = year, .month = (modres.rem + 12) % 12 + 1 }; +} + +#endif diff --git a/src/pio.c b/src/pio.c index 1b22869ec56818ec2856c9b2f400bab4d3e97f62..2f00cf71dfe4dcafe7de5cb9b44a26807499e546 100644 --- a/src/pio.c +++ b/src/pio.c @@ -2,13 +2,51 @@ #include "config.h" #endif +#include <sys/types.h> +#include <unistd.h> + +#include <mpi.h> + #include "cdi_int.h" #include "pio.h" #include "cdipio.h" #include "pio_impl.h" +#include "pio_util.h" + +const char *const cdiPioCmdStrTab[] = { + "IO_Open_file", "IO_Close_file", "IO_Set_fp", "IO_Send_buffer", "IO_Finalize", "IO_Sync_file", +}; + +int cdiPioExtraNSKeys[cdiPioExtraNSKeysSize]; + +MPI_Datatype cdiPioOffsetDt = MPI_DATATYPE_NULL; +MPI_Datatype cdiPioSyncMsgDt = MPI_DATATYPE_NULL; + +void +cdiPioLookupOffsetDt(void) +{ + xmpi(MPI_Type_match_size(MPI_TYPECLASS_INTEGER, (int) (sizeof(off_t)), &cdiPioOffsetDt)); +} + +void +cdiPioCreateSyncMsgDt(void) +{ + if (cdiPioOffsetDt == MPI_DATATYPE_NULL) cdiPioLookupOffsetDt(); + struct syncMsg dummy; + int bl[2] = { 1, 2 }; + MPI_Aint displ[2]; + displ[0] = 0; + displ[1] = (unsigned char *) &dummy.fileID - (unsigned char *) &dummy.amount; + MPI_Datatype dt[2] = { cdiPioOffsetDt, MPI_INT }; + xmpi(MPI_Type_create_struct(2, bl, displ, dt, &cdiPioSyncMsgDt)); + xmpi(MPI_Type_commit(&cdiPioSyncMsgDt)); +} -const char *const cdiPioCmdStrTab[] - = { "IO_Open_file", "IO_Close_file", "IO_Get_fp", "IO_Set_fp", "IO_Send_buffer", "IO_Finalize" }; +void +cdiPioDestroySyncMsgDt(void) +{ + MPI_Type_free(&cdiPioSyncMsgDt); +} /* * Local Variables: diff --git a/src/pio.h b/src/pio.h index 97c5bb2b13c339cc3b203a42f3ac8d44c9c646c6..a4c4e5dc15e7b1ecb7c2e827b6cfefa68ea461b3 100644 --- a/src/pio.h +++ b/src/pio.h @@ -1,5 +1,5 @@ -#ifndef _PIO_H -#define _PIO_H +#ifndef CDI_PIO_H +#define CDI_PIO_H #ifdef HAVE_CONFIG_H #include "config.h" @@ -8,7 +8,26 @@ #include <stdlib.h> #include <mpi.h> -extern void (*cdiPioFileWritingFinalize)(void); +#include "namespace.h" +#include "pio_conf.h" + +/* indices of extra keys put into cdiPioExtraNSKeys */ + +enum +{ + cdiPioEKFileWritingFinalize, + cdiPioEKConf, + cdiPioEKComms, + cdiPioExtraNSKeysSize +}; + +extern int cdiPioExtraNSKeys[cdiPioExtraNSKeysSize]; + +static inline struct cdiPioConf * +cdiPioGetConf(void) +{ + return (struct cdiPioConf *) namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKConf]).data; +} #endif /* diff --git a/src/pio_cdf_int.c b/src/pio_cdf_int.c index 64463e41f933cad57f3a6e41db50627f28ea0dfb..3f17b4feac8b56066c1c4c658cdb68ae56915eab 100644 --- a/src/pio_cdf_int.c +++ b/src/pio_cdf_int.c @@ -2,12 +2,20 @@ #include "config.h" #endif -#if defined(HAVE_NETCDF4) && defined(HAVE_PARALLEL_NC4) +#ifdef HAVE_LIBNETCDF + +#include <setjmp.h> +#include <stdbool.h> + +#include <mpi.h> #include <netcdf.h> -#ifdef HAVE_NETCDF_PAR_H +#if defined HAVE_PARALLEL_NC4 && defined HAVE_NETCDF_PAR_H #include <netcdf_par.h> #endif +#ifdef HAVE_NETCDF_META_H +#include <netcdf_meta.h> +#endif #include "namespace.h" #include "pio.h" @@ -17,20 +25,91 @@ #include "pio_util.h" #include "pio_cdf_int.h" +#include "pio_server.h" + +#if defined HAVE_PARALLEL_NC4 +#if !defined TLS && defined HAVE_PTHREAD +pthread_key_t cdiPioCdfJmpKey; +#else +TLS struct cdiPioNcCreateLongJmpRetBuf *cdiPioCdfJmpBuf; +#endif + +#if defined NC_HAS_PNETCDF && NC_HAS_PNETCDF +/* NetCDF 4.3.3 introduced the NC_HAS_PNETCDF define so we can deduce + * reliably in this and later versions if parallel opening of + * classic, 64bit-offset and CDF-5 files can even succeed at all. */ +#define CDI_PIO_TRY_PNETCDF 1 +#elif defined NC_PNETCDF && defined HAVE_NETCDF_PAR_PNETCDF +#define CDI_PIO_TRY_PNETCDF HAVE_NETCDF_PAR_PNETCDF +#else +#define CDI_PIO_TRY_PNETCDF 0 +#endif static int cdiPio_nc__create(const char *path, int cmode, size_t initialsz, size_t *chunksizehintp, int *ncidp) { - int status; - if (cmode & NC_NETCDF4 && commInqIOMode() != PIO_NONE) + int status = NC_EINVAL, ioMode = commInqIOMode(); + if (ioMode != PIO_NONE) { - cmode |= NC_MPIPOSIX; - status = nc_create_par(path, cmode, commInqCommColl(), MPI_INFO_NULL, ncidp); - } - else if (cmode & (NC_64BIT_OFFSET | NC_CLASSIC_MODEL) && commInqIOMode() != PIO_NONE) - { - /* FIXME: improve handling of pnetcdf here */ - abort(); +#if CDI_PIO_TRY_PNETCDF +#if !defined TLS && defined HAVE_PTHREAD + struct cdiPioNcCreateLongJmpRetBuf *cdiPioCdfJmpBuf = pthread_getspecific(cdiPioCdfJmpKey); +#endif +#endif + if (cmode & NC_NETCDF4) + { + cmode |= NC_MPIPOSIX; + status = nc_create_par(path, cmode, commInqCommColl(), MPI_INFO_NULL, ncidp); + if (status == NC_NOERR) cdiPioCdfJmpBuf->openRank = CDI_PIO_COLLECTIVE_OPEN; + } + else + { + int rank = commInqRankColl(); +#if CDI_PIO_TRY_PNETCDF + /* which combination of cmode flags has already been tested? */ + static bool pnetcdfWontWork[] = { + false, /* CDF-1 */ + false, /* CDF-2 */ + false /* CDF-5 */ + }; + static const char cdfVers[] = { '1', '2', '5' }; + size_t cdfIdx; + if (cmode & NC_64BIT_OFFSET) + cdfIdx = 1; + else if (cmode & NC_CLASSIC_MODEL) + cdfIdx = 0; + else + cdfIdx = 2; + MPI_Comm collComm = commInqCommColl(); + cmode |= NC_PNETCDF; + if (!pnetcdfWontWork[cdfIdx]) + { + status = nc_create_par(path, cmode, collComm, MPI_INFO_NULL, ncidp); + if (status == NC_EINVAL) + { + if (rank == 0) + fprintf(stderr, + "warning: parallel create not implemented" + " for cdf-%c format!\n", + cdfVers[cdfIdx]); + pnetcdfWontWork[cdfIdx] = true; + } + else if (status == NC_NOERR) + cdiPioCdfJmpBuf->openRank = CDI_PIO_COLLECTIVE_OPEN; + } + if (pnetcdfWontWork[cdfIdx]) + { + /* no pnetcdf is implied if not even NC_PNETCDF is defined */ + cmode &= ~NC_PNETCDF; +#endif + if (rank == cdiPioCdfJmpBuf->openRank) + status = nc__create(path, cmode, initialsz, chunksizehintp, ncidp); + else + longjmp(cdiPioCdfJmpBuf->jmpBuf, 1); +#if CDI_PIO_TRY_PNETCDF + } +#endif + } } else status = nc__create(path, cmode, initialsz, chunksizehintp, ncidp); @@ -41,7 +120,10 @@ static void cdiPioCdfDefVar(int ncid, const char *name, nc_type xtype, int ndims, const int dimids[], int *varidp) { cdf_def_var_serial(ncid, name, xtype, ndims, dimids, varidp); - if (commInqIOMode() != PIO_NONE) + int cf_format; + int status = nc_inq_format(ncid, &cf_format); + if (status != NC_NOERR) Error("%s", nc_strerror(status)); + if (commInqIOMode() != PIO_NONE && cf_format == NC_FORMAT_NETCDF4) { xdebug("%s", "calling nc_var_par_access"); int status = nc_var_par_access(ncid, *varidp, NC_COLLECTIVE); @@ -49,14 +131,84 @@ cdiPioCdfDefVar(int ncid, const char *name, nc_type xtype, int ndims, const int } } +#if CDI_PIO_TRY_PNETCDF +static void +cdiPio_enable_nc_par_access(int ncid, int streamID) +{ + bool setVarParAccess; +#if HAVE_DECL_NC_INQ_FORMAT_EXTENDED + int formatNC, modeNC; + int statusInq = nc_inq_format_extended(ncid, &formatNC, &modeNC); + if (statusInq != NC_NOERR) Error("%s", nc_strerror(statusInq)); + setVarParAccess = (modeNC & NC_PNETCDF); + (void) streamID; +#else + int cf_format, owner = cdiPioStream2Owner(streamID); + int statusInq = nc_inq_format(ncid, &cf_format); + if (statusInq != NC_NOERR) Error("%s", nc_strerror(statusInq)); + setVarParAccess = (owner == CDI_PIO_COLLECTIVE_OPEN && cf_format != NC_FORMAT_NETCDF4); +#endif + if (setVarParAccess) + { + int nvars; + cdf_inq_nvars(ncid, &nvars); + for (int i = 0; i < nvars; ++i) + { + int statusParAcc = nc_var_par_access(ncid, i, NC_COLLECTIVE); + if (statusParAcc != NC_NOERR) Warning("cannot set collective access for variable %d, %s", i, nc_strerror(statusParAcc)); + } + } +} + +static int +cdiPio_nc_enddef(int ncid, int streamID) +{ + int statusEndDef = nc_enddef(ncid); + if (statusEndDef == NC_NOERR) cdiPio_enable_nc_par_access(ncid, streamID); + return statusEndDef; +} + +static int +cdiPio_nc__enddef(int ncid, int streamID, size_t hdr_pad, size_t v_align, size_t v_minfree, size_t r_align) +{ + int statusEndDef = nc__enddef(ncid, hdr_pad, v_align, v_minfree, r_align); + if (statusEndDef == NC_NOERR) cdiPio_enable_nc_par_access(ncid, streamID); + return statusEndDef; +} +#endif /* CDI_PIO_TRY_PNETCDF */ + void cdiPioEnableNetCDFParAccess(void) { namespaceSwitchSet(NSSWITCH_NC__CREATE, NSSW_FUNC(cdiPio_nc__create)); +#if CDI_PIO_TRY_PNETCDF + namespaceSwitchSet(NSSWITCH_NC_ENDDEF, NSSW_FUNC(cdiPio_nc_enddef)); + namespaceSwitchSet(NSSWITCH_NC__ENDDEF, NSSW_FUNC(cdiPio_nc__enddef)); +#endif namespaceSwitchSet(NSSWITCH_CDF_DEF_VAR, NSSW_FUNC(cdiPioCdfDefVar)); +#if !defined TLS && defined HAVE_PTHREAD + int ierror = pthread_key_create(&cdiPioCdfJmpKey, NULL); + if (ierror) + { + Error("%s: error creating pthread key: %s\n", __func__, strerror(ierror)); + } +#endif +} + +void +cdiPioDisableNetCDFParAccess(void) +{ +#if !defined TLS && defined HAVE_PTHREAD + int ierror = pthread_key_delete(cdiPioCdfJmpKey); + if (ierror) + { + Error("%s: error deleting pthread key: %s\n", __func__, strerror(ierror)); + } +#endif } +#endif /* ifdef HAVE_PARALLEL_NC4 */ -#endif /* defined (HAVE_NETCDF4) && defined (HAVE_PARALLEL_NC4) */ +#endif /* ifdef HAVE_LIBNETCDF */ /* * Local Variables: * c-file-style: "Java" diff --git a/src/pio_cdf_int.h b/src/pio_cdf_int.h index 3539a62c4074c12f018e6a20c70da111391cbf1b..42b0b80bd7808fcdc3cd7dd758e5f4dc182b01b5 100644 --- a/src/pio_cdf_int.h +++ b/src/pio_cdf_int.h @@ -5,13 +5,32 @@ #include "config.h" #endif -#ifdef HAVE_LIBNETCDF +#ifdef HAVE_PARALLEL_NC4 +#include <setjmp.h> + #include "cdf_int.h" -void cdiPioEnableNetCDFParAccess(void); +enum +{ + CDI_PIO_COLLECTIVE_OPEN = -1, +}; +struct cdiPioNcCreateLongJmpRetBuf +{ + sigjmp_buf jmpBuf; + int openRank; +}; + +#if !defined TLS && defined HAVE_PTHREAD +extern pthread_key_t cdiPioCdfJmpKey; +#else +extern TLS struct cdiPioNcCreateLongJmpRetBuf *cdiPioCdfJmpBuf; #endif -#endif + +void cdiPioEnableNetCDFParAccess(void); + +#endif /* HAVE_PARALLEL_NC4 */ +#endif /* PIO_CDF_INT_H */ /* * Local Variables: diff --git a/src/pio_client.c b/src/pio_client.c index 58f04ac72b810371da374f84d32fa080822b7bfc..e56f14b988fd579bfb47d68f963221d40d09a883 100644 --- a/src/pio_client.c +++ b/src/pio_client.c @@ -3,24 +3,73 @@ #endif #include <ctype.h> +#include <errno.h> +#include <stdbool.h> +#include <mpi.h> #include <yaxt.h> #include "cdi.h" #include "cdi_int.h" #include "dmemory.h" +#ifdef HAVE_LIBGRIB +#include "gribapi.h" +#endif #include "namespace.h" #include "taxis.h" +#include "vlist.h" #include "cdipio.h" #include "pio.h" #include "pio_client.h" +#include "pio_dist_grid.h" #include "pio_comm.h" +#include "pio_id_set.h" +#include "pio_idxlist_cache.h" #include "pio_interface.h" #include "pio_rpc.h" #include "pio_util.h" #include "pio_serialize.h" +struct ResHListUpdate +{ + unsigned char *msgBuffer; + MPI_Comm comm; + int numClients, clientRank, numColl, collRank, groupLeader; + int msgSize, msgPos; + bool sendRPCData; +}; + +static struct ResHListUpdate +cdiPioClientUpdateResHList() +{ + MPI_Comm comm = cdiPioInqInterComm(); + int clientRank = commInqRankModel(), numClients = cdiPioCommInqSizeClients(), numColl = commInqSizeColl(), + collRank = cdiPioCollRank(clientRank, numClients, numColl); + int groupLeader = cdiPioClientRangeStart(collRank, numClients, numColl); + int sendRPCData = (clientRank == groupLeader); + char *msgBuffer = NULL; + int msgSize = 0, msgBufPos = 0; + if (sendRPCData) + { + msgBufPos = reshPackBufferCreate(&msgBuffer, &msgSize, &comm); + } +#ifdef HAVE_PPM_DIST_ARRAY_H + else + cdiPioDistGridPackAssist(); +#endif + return (struct ResHListUpdate){ .msgBuffer = (unsigned char *) msgBuffer, + .comm = comm, + .numClients = numClients, + .clientRank = clientRank, + .groupLeader = groupLeader, + .numColl = numColl, + .collRank = collRank, + .msgSize = msgSize, + .msgPos = msgBufPos, + .sendRPCData = sendRPCData }; +} + static int cdiPioClientStreamOpen(const char *filename, char filemode, int filetype, stream_t *streamptr, int recordBufIsToBeCreated) { @@ -29,19 +78,18 @@ cdiPioClientStreamOpen(const char *filename, char filemode, int filetype, stream int fileID = 0; if (filemode == 'w') { - MPI_Comm comm = cdiPioInqInterComm(); - int clientRank = commInqRankModel(), numClients = cdiPioCommInqSizeClients(), numColl = commInqSizeColl(), - collRank = cdiPioCollRank(clientRank, numClients, numColl); int streamID = streamptr->self; - if (clientRank == cdiPioClientRangeStart(collRank, numClients, numColl)) + reshSetStatus(streamID, &streamOps, reshGetStatus(streamID, &streamOps) & ~RESH_SYNC_BIT); + struct ResHListUpdate rup = cdiPioClientUpdateResHList(); + MPI_Comm comm = rup.comm; + int collRank = rup.collRank; + if (rup.sendRPCData) { - reshSetStatus(streamID, &streamOps, reshGetStatus(streamID, &streamOps) & ~RESH_SYNC_BIT); - char *msgBuffer; - int msgSize = 0; - int msgBufPos = reshPackBufferCreate(&msgBuffer, &msgSize, &comm); + unsigned char *msgBuffer = rup.msgBuffer; + int msgSize = rup.msgSize; int size; size_t filename_len = strlen(filename); - xassert(filename_len < (size_t) (INT_MAX - msgBufPos)); + xassert(filename_len < (size_t) (INT_MAX - rup.msgPos)); int soHdr[3] = { streamptr->self, filetype, (int) filename_len }; xmpi(MPI_Pack_size(3, MPI_INT, comm, &size)); msgSize += size; @@ -50,16 +98,18 @@ cdiPioClientStreamOpen(const char *filename, char filemode, int filetype, stream xmpi(MPI_Pack_size((int) filename_len, MPI_CHAR, comm, &size)); msgSize += size; /* optimize to pos + size */ - msgBuffer = (char *) Realloc(msgBuffer, (size_t) msgSize); - xmpi(MPI_Pack(soHdr, 3, MPI_INT, msgBuffer, msgSize, &msgBufPos, comm)); - xmpi(MPI_Pack(&filemode, 1, MPI_CHAR, msgBuffer, msgSize, &msgBufPos, comm)); - xmpi(MPI_Pack((void *) filename, (int) filename_len, MPI_CHAR, msgBuffer, msgSize, &msgBufPos, comm)); + msgBuffer = Realloc(msgBuffer, (size_t) msgSize); + xmpi(MPI_Pack(soHdr, 3, MPI_INT, msgBuffer, msgSize, &rup.msgPos, comm)); + xmpi(MPI_Pack(&filemode, 1, MPI_CHAR, msgBuffer, msgSize, &rup.msgPos, comm)); + xmpi(MPI_Pack((void *) filename, (int) filename_len, MPI_CHAR, msgBuffer, msgSize, &rup.msgPos, comm)); xmpi(MPI_Sendrecv(msgBuffer, msgSize, MPI_PACKED, collRank, STREAMOPEN, &fileID, 1, MPI_INT, collRank, STREAMOPEN, comm, MPI_STATUS_IGNORE)); Free(msgBuffer); } else - xmpi(MPI_Recv(&fileID, 1, MPI_INT, collRank, STREAMOPEN, comm, MPI_STATUS_IGNORE)); + { + xmpi(MPI_Recv(&fileID, 1, MPI_INT, collRank, STREAMOPEN, comm, MPI_STATUS_IGNORE)); + } if (fileID >= 0) { streamptr->filetype = filetype; @@ -72,86 +122,242 @@ cdiPioClientStreamOpen(const char *filename, char filemode, int filetype, stream } static void -cdiPioClientStreamDefVlist_(int streamID, int vlistID) +checkVlistForPIO(int vlistID) +{ + int nVars = vlistNvars(vlistID); + int varShape[3]; + for (int varID = 0; varID < nVars; ++varID) + { + cdiPioQueryVarDims(varShape, vlistID, varID); + intmax_t size = 1; + for (size_t i = 0; i < 3; ++i) size *= varShape[i]; + if (size > XT_INT_MAX) + { + errno = EOVERFLOW; + SysError("CDI Variable too large for YAXT," + " use configure with larger index type\n" + "vlistID=%d, varID=%d, variable size=%zu", + vlistID, varID, (size_t) size); + } + } +} + +static void +cdiPioClientStreamDefVlistCommon(int streamID, int vlistID) { + checkVlistForPIO(vlistID); cdiStreamDefVlist_(streamID, vlistID); - int clientRank = commInqRankModel(), numClients = cdiPioCommInqSizeClients(), numColl = commInqSizeColl(), - collRank = cdiPioCollRank(clientRank, numClients, numColl); - int sendRPCData = (clientRank == cdiPioClientRangeStart(collRank, numClients, numColl)); - if (sendRPCData) + reshSetStatus(streamID, &streamOps, reshGetStatus(streamID, &streamOps) & ~RESH_SYNC_BIT); +} + +static void +cdiPioClientStreamDefVlist_(int streamID, int vlistID) +{ + cdiPioClientStreamDefVlistCommon(streamID, vlistID); + struct ResHListUpdate rup = cdiPioClientUpdateResHList(); + if (rup.sendRPCData) { - MPI_Comm comm = cdiPioInqInterComm(); - reshSetStatus(streamID, &streamOps, reshGetStatus(streamID, &streamOps) & ~RESH_SYNC_BIT); - char *msgBuffer; - int msgSize = 0; - int msgBufPos = reshPackBufferCreate(&msgBuffer, &msgSize, &comm); + MPI_Comm comm = rup.comm; + unsigned char *msgBuffer = rup.msgBuffer; + /* optimize: pos + size */ + int msgSize = rup.msgSize; { int size; xmpi(MPI_Pack_size(defVlistNInts, MPI_INT, comm, &size)); msgSize += size; } - /* optimize: pos + size */ msgBuffer = Realloc(msgBuffer, (size_t) msgSize); int msgData[defVlistNInts] = { streamID, streamInqVlist(streamID) }; - xmpi(MPI_Pack(&msgData, defVlistNInts, MPI_INT, msgBuffer, msgSize, &msgBufPos, comm)); - xmpi(MPI_Send(msgBuffer, msgBufPos, MPI_PACKED, collRank, STREAMDEFVLIST, comm)); + xmpi(MPI_Pack(&msgData, defVlistNInts, MPI_INT, msgBuffer, msgSize, &rup.msgPos, comm)); + xmpi(MPI_Send(msgBuffer, rup.msgPos, MPI_PACKED, rup.collRank, STREAMDEFVLIST, comm)); Free(msgBuffer); } - struct collSpec cspec = { .numClients = numClients, .numServers = numColl, .sendRPCData = sendRPCData }; + struct collSpec cspec = { + .numClients = rup.numClients, .numServers = rup.numColl, .sendRPCData = rup.sendRPCData, .partDesc = NULL, .conversion = NULL + }; cdiPioClientStreamWinCreate(streamID, &cspec); } -/* If we're not using GNU C, elide __attribute__ */ -#if !defined __GNUC__ && !defined __attribute__ -#define __attribute__(x) /*NOTHING*/ -#endif +static int +sizePartDescPresetPack(size_t nVars, const struct partDescPreset clientDeco, bool *isDuplicate, MPI_Comm comm) +{ + int packSize = 0; + const Xt_uid *uids = clientDeco.uids; + Xt_idxlist *partDesc = clientDeco.lists; + { + int sizeXtUID; + xmpi(MPI_Pack_size(1, YAXT_UID_DT, comm, &sizeXtUID)); + packSize += (int) nVars * sizeXtUID; + } + for (size_t varIdx = 0; varIdx < nVars; ++varIdx) + { + Xt_uid uid = uids[varIdx]; + for (size_t j = 0; j < varIdx; ++j) + if (uids[j] != uid) + ; + else + { + isDuplicate[varIdx] = true; + goto next_index_list; + } + isDuplicate[varIdx] = false; + packSize += (int) xt_idxlist_get_pack_size(partDesc[varIdx], comm); + next_index_list:; + } + return packSize; +} -static void cdiPioClientStreamWriteVar_(int streamID, int varID, int memtype, const void *data, size_t nmiss) - __attribute__((noreturn)); +static int +packPartDescPreset(void *packBuf, int bufSize, size_t nVars, struct partDescPreset clientDeco, const bool *isDuplicate, + MPI_Comm comm) +{ + const Xt_uid *uids = clientDeco.uids; + Xt_idxlist *partDesc = clientDeco.lists; + int position = 0; + for (size_t varIdx = 0; varIdx < nVars; ++varIdx) + { + xmpi(MPI_Pack((void *) (uids + varIdx), 1, YAXT_UID_DT, packBuf, bufSize, &position, comm)); + if (!isDuplicate[varIdx]) xt_idxlist_pack(partDesc[varIdx], packBuf, bufSize, &position, comm); + } + return position; +} + +void +cdiPioStreamDefDecomposedVlist(int streamID, int vlistID, const Xt_idxlist partDesc[], const int conversion[]) +{ + cdiPioClientStreamDefVlistCommon(streamID, vlistID); + struct ResHListUpdate rup = cdiPioClientUpdateResHList(); + MPI_Comm comm = rup.comm; + int collRank = rup.collRank; + size_t nVars = (size_t) (vlistNvars(vlistID)); + MPI_Comm aggComm = cdiPioInqCollClientIntraComm(); + cdiPioAssertConsistentIntVec(nVars, conversion, aggComm, rup.clientRank, 0, rup.numClients); + cdiPioSetStreamPartDescPreset(streamID, nVars, partDesc, conversion); + int lastClientInGroup = cdiPioClientRangeStart(collRank + 1, rup.numClients, rup.numColl) - 1, clientRank = rup.clientRank, + numClientsInGroup = lastClientInGroup - clientRank + 1; + struct partDescPreset clientDeco = cdiPioGetStreamPartDescPreset(streamID); + bool *partDescDuplicates = Malloc(nVars * sizeof(*partDescDuplicates)); + int listPackSizeTotal = sizePartDescPresetPack(nVars, clientDeco, partDescDuplicates, comm); + if (rup.sendRPCData) + { + unsigned char *msgBuffer = rup.msgBuffer; + /* optimize: pos + size */ + int msgSize = rup.msgSize; + /* TODO: find size of idxlists for packing */ + int(*listPackSizes) = Malloc((size_t) numClientsInGroup * sizeof(*listPackSizes)); + listPackSizes[0] = listPackSizeTotal; + MPI_Request *req = (numClientsInGroup - 1) ? Malloc((size_t) (numClientsInGroup - 1) * sizeof(*req)) : NULL; + for (int rank = rup.clientRank + 1; rank <= lastClientInGroup; ++rank) + { + size_t rankOfs = (size_t) (rank - clientRank); + xmpi(MPI_Irecv(listPackSizes + rankOfs, 1, MPI_INT, rank, IDXLIST_PRESET_SIZE, aggComm, req + rankOfs - 1)); + } + xmpi(MPI_Waitall(numClientsInGroup - 1, req, MPI_STATUSES_IGNORE)); + for (int rank = rup.clientRank; rank <= lastClientInGroup; ++rank) + { + size_t rankOfs = (size_t) (rank - clientRank); + msgSize += listPackSizes[rankOfs]; + } + { + int size; + xmpi(MPI_Pack_size(defVlistNInts + (int) nVars, MPI_INT, comm, &size)); + msgSize += size; + } + /* size of extra packaging: */ + msgBuffer = Realloc(msgBuffer, (size_t) msgSize); + int msgData[defVlistNInts] = { streamID, streamInqVlist(streamID) }; + xmpi(MPI_Pack(&msgData, defVlistNInts, MPI_INT, msgBuffer, msgSize, &rup.msgPos, comm)); + xmpi(MPI_Pack((int *) conversion, (int) nVars, MPI_INT, msgBuffer, msgSize, &rup.msgPos, comm)); + rup.msgPos += packPartDescPreset(msgBuffer + rup.msgPos, listPackSizeTotal, nVars, clientDeco, partDescDuplicates, comm); + for (int rank = rup.clientRank + 1; rank <= lastClientInGroup; ++rank) + { + size_t rankOfs = (size_t) (rank - clientRank); + int clientPackSize = listPackSizes[rankOfs]; + xmpi(MPI_Irecv(msgBuffer + rup.msgPos, clientPackSize, MPI_PACKED, rank, IDXLIST_PRESET, aggComm, req + rankOfs - 1)); + rup.msgPos += clientPackSize; + } + xmpi(MPI_Waitall(numClientsInGroup - 1, req, MPI_STATUSES_IGNORE)); + xmpi(MPI_Send(msgBuffer, rup.msgPos, MPI_PACKED, collRank, STREAM_DEF_DECOMPOSED_VLIST, comm)); + Free(msgBuffer); + Free(req); + Free(listPackSizes); + } + else + { + int groupLeader = rup.groupLeader; + MPI_Request req[2]; + unsigned char *ilPackBuf = Malloc((size_t) listPackSizeTotal); + int position = packPartDescPreset(ilPackBuf, listPackSizeTotal, nVars, clientDeco, partDescDuplicates, comm); + xmpi(MPI_Isend(&position, 1, MPI_INT, groupLeader, IDXLIST_PRESET_SIZE, aggComm, req)); + xmpi(MPI_Isend(ilPackBuf, position, MPI_PACKED, groupLeader, IDXLIST_PRESET, aggComm, req + 1)); + xmpi(MPI_Waitall(2, req, MPI_STATUSES_IGNORE)); + Free(ilPackBuf); + } + Free(partDescDuplicates); + struct collSpec cspec = { .numClients = rup.numClients, + .numServers = rup.numColl, + .sendRPCData = rup.sendRPCData, + .partDesc = partDesc, + .conversion = (int *) conversion }; + cdiPioClientStreamWinCreate(streamID, &cspec); +} static void cdiPioClientStreamWriteVar_(int streamID, int varID, int memtype, const void *data, size_t nmiss) { - (void) streamID; - (void) varID; - (void) memtype; - (void) data; - (void) nmiss; - xabort("parallel writing requires explicit partition information," - " use streamWriteVarPart!"); + struct partDescPreset clientDeco = cdiPioGetStreamPartDescPreset(streamID); + int vlistID = streamInqVlist(streamID); + size_t nVars = (size_t) (vlistNvars(vlistID)); + if (varID < 0 || (size_t) varID > nVars) xabort("invalid variable ID %d for stream %d requested!", varID, streamID); + if (!clientDeco.uids) + xabort("parallel writing requires explicit partition information," + " use either streamWriteVarPart or cdiPioStreamDefDecomposedVlist!"); + if (clientDeco.conversion && memtype != clientDeco.conversion[varID]) + xabort("data type does not match pre-declared conversion for stream %d," + " variable ID %d!", + streamID, varID); + cdiPioStreamWriteVarPart_(streamID, varID, memtype, data, nmiss, clientDeco.lists[varID]); } +static struct cdiPioIdxlistCache *clientIdxlistCache; +static size_t neededClientIdxlistCacheSize; +static struct idList seenStreamWriteVarChunk; + static void cdiPioClientStreamWriteVarChunk_(int streamID, int varID, int memtype, const int rect[][2], const void *data, size_t nmiss) { - /* todo: handle transmission of float data */ - if (memtype != MEMTYPE_DOUBLE) Error("Writing of non-double type data not implemented!"); + if (memtype != MEMTYPE_DOUBLE && memtype != MEMTYPE_FLOAT) Error("Writing of type data %d not implemented!", memtype); int vlistID = streamInqVlist(streamID); + if (indexOfID(&seenStreamWriteVarChunk, vlistID) == SIZE_MAX) + { + insertID(&seenStreamWriteVarChunk, vlistID); + int nvars = vlistNvars(vlistID); + neededClientIdxlistCacheSize += (size_t) nvars; + clientIdxlistCache = cdiPioIdxlistCacheResize(clientIdxlistCache, neededClientIdxlistCacheSize); + } int size = vlistInqVarSize(vlistID, varID), varShape[3]; - unsigned ndims = (unsigned) cdiPioQueryVarDims(varShape, vlistID, varID); + int ndims = cdiPioQueryVarDims(varShape, vlistID, varID); Xt_int varShapeXt[3], origin[3] = { 0, 0, 0 }; int chunkShape[3] = { 1, 1, 1 }; - /* FIXME: verify xt_int ranges are good enough */ - for (unsigned i = 0; i < 3; ++i) varShapeXt[i] = varShape[i]; - for (unsigned i = 0; i < ndims; ++i) chunkShape[i] = rect[i][1] - rect[i][0] + 1; - int varSize = varShape[0] * varShape[1] * varShape[2]; - xassert(varSize == size); - Xt_idxlist chunkDesc = xt_idxsection_new(0, (int) ndims, varShapeXt, chunkShape, origin); - pioBufferPartData(streamID, varID, data, nmiss, chunkDesc); - xt_idxlist_delete(chunkDesc); -} - -static void -cdiPioClientStreamWriteVarPart(int streamID, int varID, const void *data, size_t nmiss, Xt_idxlist partDesc) -{ - pioBufferPartData(streamID, varID, data, nmiss, partDesc); -} - -static void -cdiPioClientStreamWriteScatteredVarPart(int streamID, int varID, const void *data, int numBlocks, const int blocklengths[], - const int displacements[], size_t nmiss, Xt_idxlist partDesc) -{ - cdiPioBufferPartDataGather(streamID, varID, data, numBlocks, blocklengths, displacements, nmiss, partDesc); + if (ndims == 3) + for (int i = 0; i < 3; ++i) varShapeXt[i] = varShape[i]; + else + { + varShapeXt[0] = varShape[0]; + varShapeXt[1] = varShape[2]; + } + for (int i = 0; i < ndims; ++i) chunkShape[i] = rect[i][1] - rect[i][0] + 1; + size_t varSize = (size_t) varShape[0] * (size_t) varShape[1] * (size_t) varShape[2]; + xassert(varSize == (size_t) size); + if (clientIdxlistCache) + ; + else + clientIdxlistCache = cdiPioIdxlistCacheNew(31); + Xt_idxlist (*cacheSection)(struct cdiPioIdxlistCache * cache, const Xt_int wholeShape[], const Xt_int sliceOrigin[], + const int sliceShape[]) + = (ndims == 3) ? cdiPioIdxlistCacheAddSection3D : cdiPioIdxlistCacheAddSection2D; + Xt_idxlist chunkDesc = cacheSection(clientIdxlistCache, varShapeXt, origin, chunkShape); + cdiPioBufferPartData(streamID, varID, memtype, data, nmiss, chunkDesc); } #if defined HAVE_LIBNETCDF @@ -172,17 +378,17 @@ cdiPioClientStreamNOP(stream_t *streamptr) static void cdiPioClientStreamClose(stream_t *streamptr, int recordBufIsToBeDeleted) { - (void) recordBufIsToBeDeleted; int streamID = streamptr->self; int clientRank = commInqRankModel(), numClients = cdiPioCommInqSizeClients(), numColl = commInqSizeColl(), collRank = cdiPioCollRank(clientRank, numClients, numColl); - if (clientRank == cdiPioClientRangeStart(collRank, numClients, numColl)) + reshSetStatus(streamID, &streamOps, reshGetStatus(streamID, &streamOps) & ~RESH_SYNC_BIT); + struct ResHListUpdate rup = cdiPioClientUpdateResHList(); + bool needsFlush = cdiPioClientStreamNeedsFlush(streamID); + if (rup.sendRPCData) { - MPI_Comm comm = cdiPioInqInterComm(); - reshSetStatus(streamID, &streamOps, reshGetStatus(streamID, &streamOps) & ~RESH_SYNC_BIT); - char *msgBuffer; - int msgSize = 0; - int msgBufPos = reshPackBufferCreate(&msgBuffer, &msgSize, &comm); + MPI_Comm comm = rup.comm; + unsigned char *msgBuffer = rup.msgBuffer; + int msgSize = rup.msgSize; { int size; xmpi(MPI_Pack_size(1, MPI_INT, comm, &size)); @@ -190,11 +396,20 @@ cdiPioClientStreamClose(stream_t *streamptr, int recordBufIsToBeDeleted) } /* optimize: pos + size */ msgBuffer = Realloc(msgBuffer, (size_t) msgSize); - xmpi(MPI_Pack(&streamptr->self, 1, MPI_INT, msgBuffer, msgSize, &msgBufPos, comm)); - xmpi(MPI_Send(msgBuffer, msgBufPos, MPI_PACKED, collRank, STREAMCLOSE, comm)); + xmpi(MPI_Pack(&streamptr->self, 1, MPI_INT, msgBuffer, msgSize, &rup.msgPos, comm)); + int tag = needsFlush ? STREAMFLUSHCLOSE : STREAMCLOSE; + xmpi(MPI_Send(msgBuffer, rup.msgPos, MPI_PACKED, collRank, tag, comm)); Free(msgBuffer); } + if (needsFlush) cdiPioClientStreamWinPost(streamID); cdiPioClientStreamWinDestroy(streamID); + if (recordBufIsToBeDeleted) switch (streamptr->filetype) + { +#ifdef HAVE_LIBGRIB + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: gribContainersDelete(streamptr); break; +#endif + } } static void @@ -208,19 +423,31 @@ static int cdiPioClientStreamDefTimestep_(stream_t *streamptr, int tsID) { int taxisID = vlistInqTaxis(streamptr->vlistID); - struct winHeaderEntry header - = (struct winHeaderEntry){ .id = STREAMDEFTIMESTEP, .specific.funcArgs.streamNewTimestep = { streamptr->self, tsID } }; + struct winHeaderEntry header = { .id = STREAMDEFTIMESTEP, .specific.funcArgs.streamNewTimestep = { streamptr->self, tsID } }; xassert(sizeof(void *) >= sizeof(int)); pioBufferFuncCall(streamptr->self, header, (void *) (intptr_t) taxisID, cdiPioTaxisPackWrap); return cdiStreamDefTimestep_(streamptr, tsID); } +static void +cdiPioClientVlistDestroy_(int vlistID, bool assertInternal) +{ + if (indexOfID(&seenStreamWriteVarChunk, vlistID) != SIZE_MAX) + { + int nvars = vlistNvars(vlistID); + neededClientIdxlistCacheSize -= (size_t) nvars; + clientIdxlistCache = cdiPioIdxlistCacheResize(clientIdxlistCache, neededClientIdxlistCacheSize); + removeID(&seenStreamWriteVarChunk, vlistID); + } + cdiVlistDestroy_(vlistID, assertInternal); +} + void -cdiPioClientSetup(int *pioNamespace_, int *pioNamespace) +cdiPioClientSetup(int pioNamespace, struct cdiPioConf *conf) { - *pioNamespace_ = *pioNamespace = namespaceNew(); int callerCDINamespace = namespaceGetActive(); - namespaceSetActive(*pioNamespace_); + namespaceSetActive(pioNamespace); + namespaceSwitchSet(cdiPioExtraNSKeys[cdiPioEKConf], NSSW_DATA(conf)); cdiPioSerializeSetMPI(); namespaceSwitchSet(NSSWITCH_ABORT, NSSW_FUNC(cdiAbortC_MPI)); namespaceSwitchSet(NSSWITCH_WARNING, NSSW_FUNC(cdiPioWarning)); @@ -228,11 +455,12 @@ cdiPioClientSetup(int *pioNamespace_, int *pioNamespace) namespaceSwitchSet(NSSWITCH_STREAM_DEF_VLIST_, NSSW_FUNC(cdiPioClientStreamDefVlist_)); namespaceSwitchSet(NSSWITCH_STREAM_WRITE_VAR_, NSSW_FUNC(cdiPioClientStreamWriteVar_)); namespaceSwitchSet(NSSWITCH_STREAM_WRITE_VAR_CHUNK_, NSSW_FUNC(cdiPioClientStreamWriteVarChunk_)); - namespaceSwitchSet(NSSWITCH_STREAM_WRITE_VAR_PART_, NSSW_FUNC(cdiPioClientStreamWriteVarPart)); - namespaceSwitchSet(NSSWITCH_STREAM_WRITE_SCATTERED_VAR_PART_, NSSW_FUNC(cdiPioClientStreamWriteScatteredVarPart)); + namespaceSwitchSet(NSSWITCH_STREAM_WRITE_VAR_PART_, NSSW_FUNC(cdiPioBufferPartData)); + namespaceSwitchSet(NSSWITCH_STREAM_WRITE_SCATTERED_VAR_PART_, NSSW_FUNC(cdiPioBufferPartDataGather)); namespaceSwitchSet(NSSWITCH_STREAM_CLOSE_BACKEND, NSSW_FUNC(cdiPioClientStreamClose)); namespaceSwitchSet(NSSWITCH_STREAM_DEF_TIMESTEP_, NSSW_FUNC(cdiPioClientStreamDefTimestep_)); namespaceSwitchSet(NSSWITCH_STREAM_SYNC, NSSW_FUNC(cdiPioClientStreamNOP)); + namespaceSwitchSet(NSSWITCH_VLIST_DESTROY_, NSSW_FUNC(cdiPioClientVlistDestroy_)); #ifdef HAVE_LIBNETCDF namespaceSwitchSet(NSSWITCH_CDF_DEF_TIMESTEP, NSSW_FUNC(cdiPioCdfDefTimestepNOP)); namespaceSwitchSet(NSSWITCH_CDF_STREAM_SETUP, NSSW_FUNC(cdiPioClientStreamNOP)); diff --git a/src/pio_client.h b/src/pio_client.h index 4d819e6674036f9f277ed12827e799ac3716e819..0b789da2b39ea8d0940471a7004be3f71c82c850 100644 --- a/src/pio_client.h +++ b/src/pio_client.h @@ -1,7 +1,9 @@ #ifndef PIO_CLIENT_H #define PIO_CLIENT_H -void cdiPioClientSetup(int *pioNamespace_, int *pioNamespace); +#include <pio_conf.h> + +void cdiPioClientSetup(int pioNamespace, struct cdiPioConf *conf); #endif diff --git a/src/pio_comm.c b/src/pio_comm.c index 5ad2c35337530641421e57f13d2e1213aa3dbce8..6a6d73abbc559c49d1935def481deffe5ff0ebd8 100644 --- a/src/pio_comm.c +++ b/src/pio_comm.c @@ -5,14 +5,19 @@ #include <stdio.h> #include <stdlib.h> -#include "pio_comm.h" +#include <mpi.h> +#include <yaxt.h> + #include "cdi.h" #include "dmemory.h" + +#include "pio.h" +#include "pio_comm.h" #include "pio_util.h" #include "cdipio.h" -typedef struct +struct cdiPioComms { int IOMode; int isProcIO; @@ -56,17 +61,14 @@ typedef struct * sequence they have on their own communicator. */ MPI_Comm collClientIntraComm; -} pioInfo_t; - -static pioInfo_t *info = NULL; +}; -static void setupCollectorInterComm(pioInfo_t *p, int isCollector, MPI_Comm localGroupComm, int globRankOfGroupLeader[2]); +static void setupCollectorInterComm(struct cdiPioComms *p, int isCollector, MPI_Comm localGroupComm, int globRankOfGroupLeader[2]); static void -pioInfoInit(pioInfo_t *p, MPI_Comm commGlob, int clientServerRole) +pioInfoInit(struct cdiPioComms *p, MPI_Comm commGlob, int clientServerRole) { - xassert(info != NULL && commGlob != MPI_COMM_NULL); - p->IOMode = -1; + xassert(p && commGlob != MPI_COMM_NULL); xmpi(MPI_Comm_dup(commGlob, &p->commGlob)); xmpi(MPI_Comm_size(p->commGlob, &p->sizeGlob)); @@ -133,7 +135,11 @@ pioInfoInit(pioInfo_t *p, MPI_Comm commGlob, int clientServerRole) xmpi(MPI_Comm_group(p->commPio, &pioGroup)); xmpi(MPI_Group_range_incl(pioGroup, 1, collRange, &collGroup)); xmpi(MPI_Comm_create(p->commPio, collGroup, &temp)); - if (isCollector) xmpi(MPI_Comm_rank(temp, &p->rankColl)); + if (isCollector) + { + xmpi(MPI_Comm_rank(temp, &p->rankColl)); + xt_mpi_comm_mark_exclusive(temp); + } xmpi(MPI_Group_free(&pioGroup)); xmpi(MPI_Group_free(&collGroup)); p->commColl = temp; @@ -146,12 +152,19 @@ pioInfoInit(pioInfo_t *p, MPI_Comm commGlob, int clientServerRole) p->collClientIntraComm = MPI_COMM_NULL; p->remoteGroup = MPI_GROUP_NULL; } + + /* match output method and process distribution */ + int IOMode = p->IOMode, sizeGlob = p->sizeGlob; + if (((IOMode != PIO_NONE && (nProcsIO <= 0 || nProcsIO > sizeGlob - 1))) || (IOMode == PIO_NONE && nProcsIO != 1)) + xabort("DISTRIBUTION OF TASKS ON PROCS IS NOT VALID.\n" + "nProcsIO=%d, sizeGlob=%d\n", + nProcsIO, sizeGlob); } } /* create client <-> collector intercomm and fill-in related information */ static void -setupCollectorInterComm(pioInfo_t *p, int isCollector, MPI_Comm localGroupComm, int globRankOfGroupLeader[2]) +setupCollectorInterComm(struct cdiPioComms *p, int isCollector, MPI_Comm localGroupComm, int globRankOfGroupLeader[2]) { xmpi(MPI_Intercomm_create(localGroupComm, 0, p->commGlob, globRankOfGroupLeader[isCollector], 1, &p->pioInterComm)); xmpi(MPI_Intercomm_merge(p->pioInterComm, isCollector, &p->collClientIntraComm)); @@ -176,195 +189,200 @@ setupCollectorInterComm(pioInfo_t *p, int isCollector, MPI_Comm localGroupComm, xmpi(MPI_Group_free(&collClientGroup)); } -int +void cdiPioCommInit(MPI_Comm commGlob, int IOMode, int clientServerRole) { - xassert(info == NULL && IOMode >= PIO_MINIOMODE && IOMode <= PIO_MAXIOMODE); - info = Malloc(sizeof(*info)); - pioInfoInit(info, commGlob, clientServerRole); + xassert(IOMode >= PIO_MINIOMODE && IOMode <= PIO_MAXIOMODE); + if (cdiPioExtraNSKeys[cdiPioEKComms] == 0) cdiPioExtraNSKeys[cdiPioEKComms] = cdiNamespaceSwitchNewKey(); + struct cdiPioComms *info = Malloc(sizeof(*info)); + namespaceSwitchSet(cdiPioExtraNSKeys[cdiPioEKComms], NSSW_DATA(info)); info->IOMode = IOMode; - return info->sizePio; + pioInfoInit(info, commGlob, clientServerRole); } void cdiPioCommFinalize(void) { - xassert(info != NULL); + xassert(cdiPioExtraNSKeys[cdiPioEKComms] != 0); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; - MPI_Comm *comms[] - = { &info->commGlob, &info->commPio, &info->commColl, &info->commCalc, &info->pioInterComm, &info->collClientIntraComm }; + { + MPI_Comm *comms[] + = { &info->commGlob, &info->commPio, &info->commColl, &info->commCalc, &info->pioInterComm, &info->collClientIntraComm }; - for (size_t i = 0; i < sizeof(comms) / sizeof(comms[0]); ++i) - if (*comms[i] != MPI_COMM_NULL) xmpi(MPI_Comm_free(comms[i])); + for (size_t i = 0; i < sizeof(comms) / sizeof(comms[0]); ++i) + if (*comms[i] != MPI_COMM_NULL) xmpi(MPI_Comm_free(comms[i])); + } - MPI_Group *groups[] = { &info->remoteGroup }; - for (size_t i = 0; i < sizeof(groups) / sizeof(groups[0]); ++i) - if (*groups[i] != MPI_GROUP_NULL) xmpi(MPI_Group_free(groups[i])); + { + MPI_Group *groups[] = { &info->remoteGroup }; + for (size_t i = 0; i < sizeof(groups) / sizeof(groups[0]); ++i) + if (*groups[i] != MPI_GROUP_NULL) xmpi(MPI_Group_free(groups[i])); + } Free(info); - info = NULL; + namespaceSwitchSet(cdiPioExtraNSKeys[cdiPioEKComms], NSSW_DATA(NULL)); } MPI_Comm commInqCommGlob(void) { - xassert(info != NULL && info->commGlob != MPI_COMM_NULL); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info && info->commGlob != MPI_COMM_NULL); return info->commGlob; } int commInqSizeGlob(void) { - xassert(info != NULL && info->sizeGlob != CDI_UNDEFID); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info && info->sizeGlob != CDI_UNDEFID); return info->sizeGlob; } int commInqRankGlob(void) { - xassert(info != NULL && info->rankGlob != CDI_UNDEFID); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info && info->rankGlob != -1); return info->rankGlob; } -int -commInqRootGlob(void) -{ - xassert(info != NULL && info->root != CDI_UNDEFID); - return info->root; -} - -int -cdiPioInqCollectorOfClient(void) -{ - xassert(info != NULL); - int clientRank = commInqRankModel(), numClients = cdiPioCommInqSizeClients(), numServers = commInqSizeColl(), - numClientsPerServer = (numClients + numServers - 1) / numServers, collRank = clientRank / numClientsPerServer; - return (!info->isProcIO) ? collRank : -1; -} - MPI_Group cdiPioInqRemoteGroup(void) { - xassert(info != NULL); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info); return info->remoteGroup; } int commInqIsProcIO(void) { - xassert(info != NULL && info->isProcIO != CDI_UNDEFID); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info && info->isProcIO != CDI_UNDEFID); return info->isProcIO; } int commInqIOMode(void) { + struct cdiPioComms *info + = cdiPioExtraNSKeys[cdiPioEKComms] == 0 ? NULL : namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; return info != NULL ? info->IOMode : PIO_NONE; } MPI_Comm commInqCommPio(void) { - xassert(info != NULL && info->commPio != MPI_COMM_NULL && info->isProcIO == 1); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info && info->commPio != MPI_COMM_NULL && info->isProcIO == 1); return info->commPio; } int commInqSizePio(void) { - xassert(info != NULL && info->sizePio > 0); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info && info->sizePio > 0); return info->sizePio; } MPI_Comm commInqCommModel(void) { - xassert(info != NULL && info->commCalc != MPI_COMM_NULL && info->isProcIO == 0); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info && info->commCalc != MPI_COMM_NULL && info->isProcIO == 0); return info->commCalc; } int commInqRankPio(void) { - xassert(info != NULL && info->rankPio >= 0 && info->isProcIO == 1); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info && info->rankPio >= 0 && info->isProcIO == 1); return info->rankPio; } int commInqRankModel(void) { - xassert(info != NULL && info->rankCalc >= 0 && info->isProcIO == 0); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info && info->rankCalc >= 0 && info->isProcIO == 0); return info->rankCalc; } int cdiPioCommInqSizeClients(void) { - xassert(info != NULL && info->sizeCalc >= 0); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info && info->sizeCalc >= 0); return info->sizeCalc; } MPI_Comm commInqCommColl(void) { - xassert(info != NULL && info->commColl != MPI_COMM_NULL); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info && info->commColl != MPI_COMM_NULL); return info->commColl; } int commInqSizeColl(void) { - xassert(info != NULL && info->sizeColl >= 0); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info && info->sizeColl >= 0); return info->sizeColl; } int commInqRankColl(void) { - xassert(info != NULL); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info); return info->rankColl; } MPI_Comm cdiPioInqInterComm(void) { - xassert(info != NULL); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info); return info->pioInterComm; } MPI_Comm cdiPioInqCollClientIntraComm(void) { - xassert(info != NULL); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info); return info->collClientIntraComm; } int commInqSpecialRank(void) { - xassert(info != NULL); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info); return info->sizeColl; } MPI_Comm commInqCommCalc(void) { - xassert(info != NULL && info->commCalc != MPI_COMM_NULL); + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info && info->commCalc != MPI_COMM_NULL); return info->commCalc; } -int -commInqNProcsColl(void) -{ - xassert(info != NULL && info->sizeColl != CDI_UNDEFID); - return info->sizeColl; -} - void commPrint(FILE *fp) { if (ddebug == 0) return; + struct cdiPioComms *info = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKComms]).data; + xassert(info != NULL); fprintf(fp, "\n"); @@ -376,7 +394,6 @@ commPrint(FILE *fp) fprintf(fp, "# commGlob = %d\n", (int) MPI_Comm_c2f(info->commGlob)); fprintf(fp, "# sizeGlob = %d\n", info->sizeGlob); fprintf(fp, "# rankGlob = %d\n", info->rankGlob); - fprintf(fp, "# root = %d\n", info->root); fprintf(fp, "#\n"); fprintf(fp, "# commPio = %d\n", (int) MPI_Comm_c2f(info->commPio)); fprintf(fp, "# sizePio = %d\n", info->sizePio); diff --git a/src/pio_comm.h b/src/pio_comm.h index 0461ab8c040161872718755b0a78b87e41ecce26..b247b217086f652e805ea1f8309f616687e55c9d 100644 --- a/src/pio_comm.h +++ b/src/pio_comm.h @@ -8,13 +8,12 @@ #include <mpi.h> #include <stdio.h> -int cdiPioCommInit(MPI_Comm commGlob, int IOMode, int clientServerRole); +void cdiPioCommInit(MPI_Comm commGlob, int IOMode, int clientServerRole); void cdiPioCommFinalize(void); MPI_Comm commInqCommGlob(void); int commInqSizeGlob(void); int commInqRankGlob(void); -int commInqRootGlob(void); /* returns the inter-communicator used to connect from * client to server group */ @@ -34,21 +33,15 @@ int cdiPioCommInqSizeClients(void); int commInqSpecialRank(void); -void commDefCommColl(int); +/* query communicator of processes active in collection of data */ MPI_Comm commInqCommColl(void); int commRankGlob2CollID(int rankGlob); int commInqSizeColl(void); int commInqRankColl(void); MPI_Comm commInqCommCalc(void); -int commInqNProcsColl(void); void commPrint(FILE *); -/* query rank of collector responsible for client on inter-communicator - * returns -1 on server processes. - */ -int cdiPioInqCollectorOfClient(void); - /* query communicator containing clients and collectors, * the collectors occupy the top-ranks */ diff --git a/src/pio_conf.c b/src/pio_conf.c index 4706f2f3af5ef0f14102b275e3a9df28c2d628c2..ac0e9ece6805e40730d0dc80a1b895329fcd2e7a 100644 --- a/src/pio_conf.c +++ b/src/pio_conf.c @@ -1,3 +1,4 @@ +#include <errno.h> #include <limits.h> #include <stdlib.h> #include <string.h> @@ -108,8 +109,10 @@ static int cdiPioConfCompareP(void *p1, void *p2) { struct cdiPioConf *a = p1, *b = p2; + bool callBackDifference = false; + for (size_t i = 0; i < CDIPIO_NUM_CALLBACKS; ++i) callBackDifference |= (a->callbacks[i] != b->callbacks[i]); return (a->IOMode != b->IOMode) | (a->clientServerRole != b->clientServerRole) | (a->partInflate != b->partInflate) - | (a->postCommSetupActions != b->postCommSetupActions); + | callBackDifference; } static void @@ -132,9 +135,34 @@ cdiPioConfPrintP(void *cdiPioConfPtr, FILE *fp) "part data imbalance = %f\n" "aligning of block buffers to large pages is %sabled\n" "record aggregation buffer size %zu\n" + "write aggregation buffer size %zu\n" + "stripe conversion of index lists is %sabled\n" + "caching of YAXT redists is %sabled\n" + "caching of YAXT xmaps is %sabled\n" "callback after setup of communication = %p\n", cdiPioConfPtr, iomodeStr, CSRoleStr, conf->partInflate, conf->largePageAlign ? "en" : "dis", - (size_t) conf->recordAggBufLimMB * 1024 * 1024, (void *) conf->postCommSetupActions); + (size_t) conf->recordAggBufLimMB * 1024 * 1024, conf->writeAggBufLim, conf->stripify ? "en" : "dis", + conf->cacheRedists ? "en" : "dis", conf->cacheXmaps ? "en" : "dis", + (void *) conf->callbacks[CDIPIO_CALLBACK_POSTCOMMSETUP]); +} + +static inline size_t +findWriteAccumBufsize() +{ + size_t buffersize = (size_t) 16 * 1024 * 1024; + const char *p = getenv("BUFSIZE"); + if (p) + { + char *end; + long temp = strtol(p, &end, 0); + if ((errno == ERANGE && (temp == LONG_MAX || temp == LONG_MIN)) || (errno != 0 && temp == 0)) + { + perror("failed to parse BUFSIZE environment variable"); + } + else if (temp > 0 && (unsigned long) temp > buffersize) + buffersize = (unsigned long) temp; + } + return buffersize; } int @@ -144,12 +172,16 @@ cdiPioConfCreate(void) conf->IOMode = PIO_NONE; conf->clientServerRole = PIO_ROLE_CLIENT; conf->partInflate = 1.1f; - conf->postCommSetupActions = cdiPioNoPostCommSetup; + for (size_t i = 0; i < CDIPIO_NUM_CALLBACKS; ++i) conf->callbacks[i] = cdiPioNoPostCommSetup; conf->largePageAlign = false; - conf->cacheRedists = true; + conf->cacheRedists = conf->cacheXmaps = true; conf->recordAggBufLimMB = 128; + conf->writeAggBufLim = findWriteAccumBufsize(); + conf->maxPathLen = 2 * (size_t) PATH_MAX; + conf->aioQueueDepth = 4U; conf->xmap_new = xt_xmap_dist_dir_new; conf->stripify = true; + conf->batchedRMA = true; int resH = reshPut(conf, &cdiPioConfOps); /* configuration objects are never forwarded */ reshSetStatus(resH, &cdiPioConfOps, reshGetStatus(resH, &cdiPioConfOps) & ~RESH_SYNC_BIT); @@ -208,16 +240,39 @@ cdiPioConfGetCSRole(int confResH) } void -cdiPioConfSetPostCommSetupActions(int confResH, void (*postCommSetupActions)(void)) +cdiPioConfSetCallBackActions(int confResH, int trigger, void (*callback)(void)) { struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps); - conf->postCommSetupActions = postCommSetupActions; + if (trigger >= 0 && trigger < CDIPIO_NUM_CALLBACKS) + { + conf->callbacks[trigger] = callback; + } + else + Error("invalid trigger callback query: %d", trigger); } -void (*cdiPioConfGetPostCommSetupActions(int confResH))(void) +void (*cdiPioConfGetCallBackActions(int confResH, int trigger))(void) { + void (*callback)(void) = (void (*)(void)) 0; struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps); - return conf->postCommSetupActions; + if (trigger >= 0 && trigger < CDIPIO_NUM_CALLBACKS) + { + callback = conf->callbacks[trigger]; + } + else + Error("invalid trigger callback query: %d", trigger); + return callback; +} + +void +cdiPioConfSetPostCommSetupActions(int confResH, void (*postCommSetupActions)(void)) +{ + cdiPioConfSetCallBackActions(confResH, CDIPIO_CALLBACK_POSTCOMMSETUP, postCommSetupActions); +} + +void (*cdiPioConfGetPostCommSetupActions(int confResH))(void) +{ + return cdiPioConfGetCallBackActions(confResH, CDIPIO_CALLBACK_POSTCOMMSETUP); } void @@ -248,6 +303,20 @@ cdiPioConfGetRedistCache(int confResH) return conf->cacheRedists; } +void +cdiPioConfSetXmapCache(int confResH, int doCache) +{ + struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps); + conf->cacheXmaps = doCache; +} + +int +cdiPioConfGetXmapCache(int confResH) +{ + struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps); + return conf->cacheXmaps; +} + void cdiPioConfSetRecordAggBufLim(int confResH, int lim_mb) { @@ -265,6 +334,57 @@ cdiPioConfGetRecordAggBufLim(int confResH) return (int) conf->recordAggBufLimMB; } +void +cdiPioConfSetWriteAggBufLim(int confResH, int lim_mb) +{ + struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps); + if (lim_mb > 0) + conf->writeAggBufLim = (size_t) lim_mb * 1024 * 1024; + else + Error("unexpected negative buffer size value %d requested", lim_mb); +} + +int +cdiPioConfGetWriteAggBufLim(int confResH) +{ + struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps); + return (int) (conf->recordAggBufLimMB / (1024 * 1024)); +} + +void +cdiPioConfSetAioQueueDepth(int confResH, int queue_depth) +{ + struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps); + if (queue_depth >= 1 && queue_depth <= USHRT_MAX) + conf->aioQueueDepth = (unsigned short) queue_depth; + else + Error("out of range AIO queue size value %d requested (MIN: 1, MAX: %d)", queue_depth, USHRT_MAX); +} + +int +cdiPioConfGetAioQueueDepth(int confResH) +{ + struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps); + return conf->aioQueueDepth; +} + +void +cdiPioConfSetMaxPathLen(int confResH, int max_path_len) +{ + struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps); + if (max_path_len >= 1) + conf->maxPathLen = max_path_len; + else + Error("negative value %d for maximum path length requested", max_path_len); +} + +int +cdiPioConfGetMaxPathLen(int confResH) +{ + struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps); + return conf->maxPathLen; +} + void cdiPioConfSetXmapNew(int confResH, xmap_new_func_ptr xmap_new) { @@ -292,3 +412,27 @@ cdiPioConfGetStripeConversion(int confResH) struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps); return conf->stripify; } + +void +cdiPioConfSetBatchedRMA(int confResH, int doBatchedRMA) +{ + struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps); + conf->batchedRMA = doBatchedRMA; +} + +int +cdiPioConfGetBatchedRMA(int confResH) +{ + struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps); + return conf->batchedRMA; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ diff --git a/src/pio_conf.h b/src/pio_conf.h index 93f66129561d3635aecb0116477c22f55eb5b8e0..288ce35b1e5766b2144af1142f089624e097406b 100644 --- a/src/pio_conf.h +++ b/src/pio_conf.h @@ -14,6 +14,11 @@ typedef Xt_xmap (*xmap_new_func_ptr)(Xt_idxlist src_idxlist, Xt_idxlist dst_idxlist, MPI_Comm comm); +enum +{ + CDIPIO_NUM_CALLBACKS = 3, +}; + /* * cdiPioConf is meant to be internal to the library and not to be * used directly if possible, CDI-PIO users should rely on the @@ -25,11 +30,15 @@ struct cdiPioConf int clientServerRole; float partInflate; unsigned recordAggBufLimMB; - void (*postCommSetupActions)(void); + size_t writeAggBufLim; + void (*callbacks[CDIPIO_NUM_CALLBACKS])(void); xmap_new_func_ptr xmap_new; + int maxPathLen; + unsigned short aioQueueDepth; bool largePageAlign; - bool cacheRedists; + bool cacheRedists, cacheXmaps; bool stripify; + bool batchedRMA; }; extern const resOps cdiPioConfOps; @@ -66,10 +75,26 @@ void cdiPioConfSetRedistCache(int confResH, int doCache); int cdiPioConfGetRedistCache(int confResH); +void cdiPioConfSetXmapCache(int confResH, int doCache); + +int cdiPioConfGetXmapCache(int confResH); + void cdiPioConfSetRecordAggBufLim(int confResH, int lim_mb); int cdiPioConfGetRecordAggBufLim(int confResH); +void cdiPioConfSetWriteAggBufLim(int confResH, int lim_mb); + +int cdiPioConfGetWriteAggBufLim(int confResH); + +void cdiPioConfSetAioQueueDepth(int confResH, int queue_depth); + +int cdiPioConfGetAioQueueDepth(int confResH); + +void cdiPioConfSetMaxPathLen(int confResH, int max_path_len); + +int cdiPioConfGetMaxPathLen(int confResH); + void cdiPioConfSetXmapNew(int confResH, xmap_new_func_ptr xmap_new); xmap_new_func_ptr cdiPioConfGetXmapNew(int confResH); @@ -78,4 +103,8 @@ void cdiPioConfSetStripeConversion(int confResH, int doConversion); int cdiPioConfGetStripeConversion(int confResH); +void cdiPioConfSetBatchedRMA(int confResH, int doBatchedRMA); + +int cdiPioConfGetBatchedRMA(int confResH); + #endif diff --git a/src/pio_dbuffer.c b/src/pio_dbuffer.c index 7dd93e8e4f9cca17408f969bda6938cf1df3abcb..35d6aa484ebe3f2ccbce1aba16fbac0002ed612f 100644 --- a/src/pio_dbuffer.c +++ b/src/pio_dbuffer.c @@ -6,6 +6,7 @@ #define _XOPEN_SOURCE 600 #endif +#include <assert.h> #include <stdlib.h> #include <stdio.h> #include <stdbool.h> @@ -15,148 +16,73 @@ #include "dmemory.h" -#include "pio_impl.h" +#include "pio_dbuffer.h" #include "pio_util.h" -static bool localDebug = false; - -int -dbuffer_init(struct dBuffer **dbuffer, size_t size) +void +cdiPioDbufferInit(struct dBuffer *db, size_t bufSize) { - struct dBuffer *db; - int status; - size_t pagesize; + assert(db); + db->wr_pointer = 0; #ifndef _SX - pagesize = (size_t) sysconf(_SC_PAGESIZE); - - if (localDebug) fprintf(stdout, "dbuffer_init(): pagesize = %zu bytes, size = %zu \n", pagesize, size); - - if (dbuffer == NULL || size < pagesize) - { - - fprintf(stdout, "dbuffer_init: dbuffer=NULL\n"); - return 1; - } - db = (struct dBuffer *) malloc(sizeof(struct dBuffer)); - - if (db == NULL) - { - perror("Not enough memory"); - return 1; - } - - db->size = pagesize; - while (db->size < size) - { - db->size <<= 1; - if (localDebug) fprintf(stdout, "size correction: %zu\n", db->size); - } + size_t pagesize = (size_t) (sysconf(_SC_PAGESIZE)); - db->wr_pointer = 0; + xdebug("cdiPioDbufferInit(): pagesize = %zu bytes, size = %zu", pagesize, bufSize); - if ((status = posix_memalign((void **) &db->buffer, pagesize, sizeof(char) * (db->size))) != 0) + db->size = bufSize = (bufSize + pagesize - 1) / pagesize * pagesize; + void *buf = NULL; + int status; + if ((status = posix_memalign(&buf, pagesize, bufSize)) != 0) { switch (status) { case EINVAL: - fprintf(stderr, "The alignment argument was not a power of two, or was not a multiple of sizeof(void *).\n"); + xabort("The alignment argument was not a power of two," + " or was not a multiple of sizeof(void *)."); +#ifndef __GNUC__ break; - case ENOMEM: fprintf(stderr, "There was insufficient memory to fulfill the allocation request.\n"); break; +#endif + case ENOMEM: + xabort("There was insufficient memory to fulfill the" + " allocation request."); +#ifndef __GNUC__ + break; +#endif } } + db->buffer = (unsigned char *) buf; #else - - if (dbuffer == NULL) - { - fprintf(stdout, "dbuffer_init: dbuffer=NULL\n"); - return 1; - } - - db = (struct dBuffer *) malloc(sizeof(struct dBuffer)); - - if (db == NULL) - { - perror("Not enough memory"); - return 1; - } - - db->size = size; - - db->wr_pointer = 0; - - db->buffer = (unsigned char *) malloc(sizeof(unsigned char) * (db->size)); - if (db->buffer == NULL) - { - perror("Not enough memory"); - free(db); - return 1; - } + db->size = bufSize; + db->buffer = (unsigned char *) Malloc(bufSize); #endif - - *dbuffer = db; - - return 0; } void -dbuffer_cleanup(struct dBuffer **dbuffer) -{ - struct dBuffer *db; - - db = *dbuffer; - - Free(db->buffer); - Free(db); - - return; -} - -size_t -dbuffer_data_size(struct dBuffer *dbuffer) +cdiPioDbufferDestroy(struct dBuffer *db) { - size_t data_size; - - data_size = (size_t) (dbuffer->wr_pointer & (dbuffer->size - 1)); - - return data_size; + free(db->buffer); } static size_t -dbuffer_freesize(struct dBuffer *dbuffer) +dbufferFreesize(struct dBuffer *dbuffer) { - size_t free_size; - - free_size = (size_t) (dbuffer->size - 1 - dbuffer_data_size(dbuffer)); - + size_t free_size = (size_t) (dbuffer->size - cdiPioDbufferGetPos(dbuffer)); return free_size; } -int -dbuffer_reset(struct dBuffer *dbuffer) +bool +cdiPioDbufferAppend(struct dBuffer *dbuffer, const void *data, size_t dataLen) { - dbuffer->wr_pointer = 0; - - return 0; -} - -int -dbuffer_push(struct dBuffer *dbuffer, const void *buffer, size_t len) -{ - size_t space_left; - size_t wr_ptr; - - space_left = dbuffer_freesize(dbuffer); - if (len > space_left) + size_t space_left = dbufferFreesize(dbuffer); + bool enoughSpaceLeft = dataLen <= space_left; + if (dataLen <= space_left) { - return 1; /* not enough space left */ + size_t wr_ptr = dbuffer->wr_pointer; + memcpy(dbuffer->buffer + wr_ptr, data, dataLen); + dbuffer->wr_pointer = wr_ptr + dataLen; } - - wr_ptr = dbuffer->wr_pointer; - memcpy(dbuffer->buffer + wr_ptr, buffer, len); - dbuffer->wr_pointer = wr_ptr + len; - - return 0; + return !enoughSpaceLeft; } /* diff --git a/src/pio_dbuffer.h b/src/pio_dbuffer.h new file mode 100644 index 0000000000000000000000000000000000000000..8cea9463853f88f770813aaa85b70743587e3883 --- /dev/null +++ b/src/pio_dbuffer.h @@ -0,0 +1,41 @@ +#ifndef CDI_PIO_DBUFFER_H +#define CDI_PIO_DBUFFER_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +struct dBuffer +{ + size_t wr_pointer; + size_t size; + unsigned char *buffer; +}; + +void cdiPioDbufferInit(struct dBuffer *dbuffer, size_t bufSize); +bool cdiPioDbufferAppend(struct dBuffer *dbuffer, const void *data, size_t dataLen); +void cdiPioDbufferDestroy(struct dBuffer *dbuffer); + +static inline int +cdiPioDbufferReset(struct dBuffer *dbuffer) +{ + dbuffer->wr_pointer = 0; + return 0; +} + +static inline size_t +cdiPioDbufferGetPos(struct dBuffer *dbuffer) +{ + return dbuffer->wr_pointer; +} + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ diff --git a/src/pio_dist_grid.c b/src/pio_dist_grid.c new file mode 100644 index 0000000000000000000000000000000000000000..b31e1662c07859b9b5eb772e975309a9f13e78f6 --- /dev/null +++ b/src/pio_dist_grid.c @@ -0,0 +1,1685 @@ +/* + * since curvilinear and irregular (icosahedral, finite elements etc.) + * grids can themselves represent large chunks of data, this file + * provides the necessary code to construct decomposed grids. + */ +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include <assert.h> +#include <math.h> +#include <stdlib.h> +#include <string.h> + +#include <mpi.h> +#include <yaxt.h> +#ifdef HAVE_PPM_CORE +#include <ppm/ppm_uniform_partition.h> +#endif +#include <cdi.h> +#include <cdipio.h> + +#include "cdi_int.h" +#include "dmemory.h" +#include "error.h" +#include "grid.h" +#include "namespace.h" +#include "resource_handle.h" +#include "resource_unpack.h" +#include "serialize.h" + +#include "pio.h" +#include "pio_cdf_int.h" +#include "pio_comm.h" +#include "pio_conf.h" +#include "pio_dist_grid.h" +#include "pio_rpc.h" +#include "pio_server.h" +#include "pio_util.h" + +#ifdef HAVE_PPM_DIST_ARRAY_H +#include <ppm/dist_array.h> +#ifdef HAVE_LIBNETCDF +#include "stream_cdf_postdef.h" +#include "cdf_int.h" +#endif + +static struct gridVirtTable cdiPioDistGridVtable; + +enum cdiPioGDsa +{ + cdiPioGDsaXVals, + cdiPioGDsaYVals, + cdiPioGDsaXBounds, + cdiPioGDsaYBounds, + cdiPioGDsaArea, + cdiPioGDsaMask, + cdiPioGDsaMaskGME, + cdiPioGDsaNum +}; + +enum cdiPioGDdistType +{ + cdiPioGDdtX, + cdiPioGDdtY, + cdiPioGDdt2D, + cdiPioGDdtNum +}; + +/* table of distribution used for each sub-array: for irregular + * grids, everything is full size, for regular grids, only area and + * mask are on xsize*ysize arrays but x/y values and bounds are of the + * size of their respective axis. Note that the decomposition of + * bounds has an undecomposed nvertex dimension. + */ +static const enum cdiPioGDdistType cdiPioGridDist[2][cdiPioGDsaNum] = { { + [cdiPioGDsaXVals] = cdiPioGDdt2D, + [cdiPioGDsaYVals] = cdiPioGDdt2D, + [cdiPioGDsaXBounds] = cdiPioGDdt2D, + [cdiPioGDsaYBounds] = cdiPioGDdt2D, + [cdiPioGDsaArea] = cdiPioGDdt2D, + [cdiPioGDsaMask] = cdiPioGDdt2D, + [cdiPioGDsaMaskGME] = cdiPioGDdt2D, + }, + { + [cdiPioGDsaXVals] = cdiPioGDdtX, + [cdiPioGDsaYVals] = cdiPioGDdtY, + [cdiPioGDsaXBounds] = cdiPioGDdtX, + [cdiPioGDsaYBounds] = cdiPioGDdtY, + [cdiPioGDsaArea] = cdiPioGDdt2D, + [cdiPioGDsaMask] = cdiPioGDdt2D, + [cdiPioGDsaMaskGME] = cdiPioGDdt2D, + } }; + +static const size_t cdiPioDistArrayElemSize[cdiPioGDsaNum] + = { [cdiPioGDsaXVals] = sizeof(double), [cdiPioGDsaYVals] = sizeof(double), [cdiPioGDsaXBounds] = sizeof(double), + [cdiPioGDsaYBounds] = sizeof(double), [cdiPioGDsaArea] = sizeof(double), [cdiPioGDsaMask] = sizeof(unsigned char), + [cdiPioGDsaMaskGME] = sizeof(unsigned char) }; + +static const int cdiPioDistArrayCDIDt[cdiPioGDsaNum] = { + [cdiPioGDsaXVals] = CDI_DATATYPE_FLT, [cdiPioGDsaYVals] = CDI_DATATYPE_FLT, [cdiPioGDsaXBounds] = CDI_DATATYPE_FLT, + [cdiPioGDsaYBounds] = CDI_DATATYPE_FLT, [cdiPioGDsaArea] = CDI_DATATYPE_FLT, [cdiPioGDsaMask] = CDI_DATATYPE_UCHAR, + [cdiPioGDsaMaskGME] = CDI_DATATYPE_UCHAR, +}; + +/* useful bits to compute often-used grid properties for X- and Y-axis, + * specifically needed to reconstruct increment and */ +struct axisReduction +{ + double first, last; + int ownerRankFirst, ownerRankLast; + Xt_redist dist2scanRedist; +}; + +enum +{ + cdiPioGDsaMaxRank = 2 +}; +struct cdiPioDistGridExtraData +{ + Xt_idxlist partDesc[cdiPioGDdtNum], distList[cdiPioGDdtNum]; + Xt_xmap defXmaps[cdiPioGDdtNum]; + Xt_redist defRedists[cdiPioGDsaNum]; + const enum cdiPioGDdistType *distTypes; + const struct gridVirtTable *baseVtable; + struct PPM_dist_mult_array *distData; + struct axisReduction aReduce[2]; + struct PPM_extent local_chunks[cdiPioGDsaNum * cdiPioGDsaMaxRank]; + struct PPM_global_array_desc sub_arrays[cdiPioGDsaNum]; + bool rmaEnabled; +}; + +#endif + +#ifdef HAVE_PPM_DIST_ARRAY_H +static void cdiPioDistGridInit(grid_t *gridptr, int gridtype, int size, int xsize, int ysize, int nvertex, + const int (*xy_decomposition)[2], Xt_idxlist partDesc2D, Xt_idxlist partDescX, Xt_idxlist partDescY); +#endif + +cdiResH +cdiPioDistGridCreate(int gridtype, int size, int xsize, int ysize, int nvertex, const int xy_decomposition[][2], + Xt_idxlist partDesc2D, Xt_idxlist partDescX, Xt_idxlist partDescY) +{ +#ifdef HAVE_PPM_DIST_ARRAY_H + int gridID = gridCreate(gridtype, size); + if (gridtype != GRID_UNSTRUCTURED) + { + gridDefXsize(gridID, xsize); + gridDefYsize(gridID, ysize); + } + gridDefNvertex(gridID, nvertex); + grid_t *gridptr = grid_to_pointer(gridID); + cdiPioDistGridInit(gridptr, gridtype, size, xsize, ysize, nvertex, xy_decomposition, partDesc2D, partDescX, partDescY); + return gridID; +#else + (void) gridtype; + (void) size; + (void) xsize; + (void) ysize; + (void) nvertex; + (void) xy_decomposition; + (void) partDesc2D; + (void) partDescX; + (void) partDescY; + Error("PPM distributed array is needed for distributed grids"); + return CDI_UNDEFID; +#endif +} + +#ifdef HAVE_PPM_DIST_ARRAY_H +static bool +cdiPioDistGridSwitchSyncMode(int gridID, int mode) +{ + bool switched = false; + grid_t *gridptr = grid_to_pointer(gridID); + if (gridptr->vtable == &cdiPioDistGridVtable) + { + struct cdiPioDistGridExtraData *extraData = (struct cdiPioDistGridExtraData *) gridptr->extraData; + PPM_dist_mult_array_set_sync_mode(extraData->distData, (enum PPM_dma_sync_mode) mode, 0); + bool dataDefined = gridptr->x.vals || gridptr->y.vals || gridptr->x.bounds || gridptr->y.bounds || gridptr->area + || gridptr->mask || gridptr->mask_gme; + if (dataDefined) PPM_dist_mult_array_expose(extraData->distData); + extraData->rmaEnabled = mode == PPM_dma_sync_mode_passive_target; + switched = true; + } + return switched; +} +#endif + +void +cdiPioDistGridEnableIndividualQueries(int gridID) +{ +#ifdef HAVE_PPM_DIST_ARRAY_H + bool switched = cdiPioDistGridSwitchSyncMode(gridID, PPM_dma_sync_mode_passive_target); +#else + (void) gridID; + bool switched = false; +#endif + if (!switched) Error("called for non-distributed grid gridID=%d", gridID); +} + +void +cdiPioDistGridDisableIndividualQueries(int gridID) +{ +#ifdef HAVE_PPM_DIST_ARRAY_H + bool switched = cdiPioDistGridSwitchSyncMode(gridID, PPM_dma_sync_mode_local_only); +#else + bool switched = false; +#endif + if (!switched) Error("called for non-distributed grid gridID=%d", gridID); +} + +bool +cdiPioDistGridIndividualQueriesEnabled(int gridID) +{ + bool enabled = true; +#ifdef HAVE_PPM_DIST_ARRAY_H + grid_t *gridptr = grid_to_pointer(gridID); + if (gridptr->vtable == &cdiPioDistGridVtable) enabled = ((struct cdiPioDistGridExtraData *) gridptr->extraData)->rmaEnabled; +#endif + return enabled; +} + +#ifdef HAVE_PPM_DIST_ARRAY_H + +#ifdef HAVE_LIBNETCDF +#ifdef HAVE_PARALLEL_NC4 +/* maximal spatial rank of variable */ +enum +{ + maxCdfVarRank = 3 +}; +struct cdfPostDefPutVarADouble +{ + int fileID, ncvarid; + size_t start[maxCdfVarRank], count[maxCdfVarRank]; + const double *values; +}; + +static void +cdiPioDistGridCdfDelayedPutVarDouble(void *data) +{ + struct cdfPostDefPutVarADouble *put = (struct cdfPostDefPutVarADouble *) data; + cdf_put_vara_double(put->fileID, put->ncvarid, put->start, put->count, put->values); +} +#endif + +static void +cdiPioParCdfPostDefActionGridProp(stream_t *streamptr, int gridID, int ncvarid, enum gridPropInq gridProp, + struct cdfPostDefActionList **delayed) +{ + grid_t *gridptr = grid_to_pointer(gridID); + int fileID = streamptr->fileID; +#ifdef HAVE_PARALLEL_NC4 + int ownerRank = cdiPioStream2Owner(streamptr->self); + if (gridptr->vtable == &cdiPioDistGridVtable && ownerRank == CDI_PIO_COLLECTIVE_OPEN) + { + struct cdfPostDefPutVarADouble *put = (struct cdfPostDefPutVarADouble *) Malloc(sizeof(*put)); + put->fileID = fileID; + put->ncvarid = ncvarid; + const struct cdiPioDistGridExtraData *extraData = (struct cdiPioDistGridExtraData *) gridptr->extraData; + size_t saMaxRank = gridptr->type == GRID_UNSTRUCTURED ? 1 : 2; + const struct PPM_extent(*local_chunks)[saMaxRank] = (const struct PPM_extent(*)[saMaxRank]) extraData->local_chunks; + size_t saIdx = 0; + switch (gridProp) + { + case GRID_PROP_XVALS: + put->values = gridptr->x.vals; + saIdx = cdiPioGDsaXVals; + break; + case GRID_PROP_YVALS: + put->values = gridptr->y.vals; + saIdx = cdiPioGDsaYVals; + break; + case GRID_PROP_XBOUNDS: + put->values = gridptr->x.bounds; + saIdx = cdiPioGDsaXBounds; + break; + case GRID_PROP_YBOUNDS: + put->values = gridptr->y.bounds; + saIdx = cdiPioGDsaYBounds; + break; + case GRID_PROP_AREA: + put->values = gridptr->area; + saIdx = cdiPioGDsaArea; + break; + case GRID_PROP_MASK: + case GRID_PROP_MASK_GME: Error("unsupported key: %d", (int) gridProp); break; + } + size_t aRank = extraData->sub_arrays[saIdx].a_rank; + for (size_t dim = 0; dim < aRank; ++dim) + { + put->start[dim] = (size_t) local_chunks[saIdx][dim].first; + put->count[dim] = (size_t) local_chunks[saIdx][dim].size; + } + if (gridProp == GRID_PROP_XBOUNDS || gridProp == GRID_PROP_YBOUNDS) + { + /* on NetCDF-level, bounds have an extra dimension that's + * indirectly represent in the distributed multi-array, where the + * nvertex dimension is replaced by a contiguous MPI datatype */ + put->start[aRank] = 0; + put->count[aRank] = (size_t) gridptr->nvertex; + } + struct cdfPostDefAction addendum; + addendum.data = put; + addendum.action = cdiPioDistGridCdfDelayedPutVarDouble; + addendum.cleanup = (void (*)(void *))(void (*)(void)) memFree; + *delayed = cdfPostDefActionAdd(*delayed, addendum); + } + else +#endif + if (gridptr->vtable == &cdiPioDistGridVtable) + { + const struct cdiPioDistGridExtraData *extraData = (struct cdiPioDistGridExtraData *) gridptr->extraData; + /* + * size_t saMaxRank = gridptr->type == GRID_UNSTRUCTURED ? 1 : 2; + * const struct PPM_extent (*local_chunks)[saMaxRank] + * = (const struct PPM_extent (*)[saMaxRank])extraData->local_chunks; + */ + const struct PPM_global_array_desc *sub_arrays = extraData->sub_arrays; + struct PPM_dist_mult_array *distData = extraData->distData; + size_t saIdx = 0; + size_t stride = (gridProp == GRID_PROP_XBOUNDS || gridProp == GRID_PROP_YBOUNDS) ? (size_t) gridptr->nvertex : 1; + switch (gridProp) + { + case GRID_PROP_XVALS: saIdx = cdiPioGDsaXVals; break; + case GRID_PROP_YVALS: saIdx = cdiPioGDsaYVals; break; + case GRID_PROP_AREA: saIdx = cdiPioGDsaArea; break; + case GRID_PROP_XBOUNDS: saIdx = cdiPioGDsaXBounds; break; + case GRID_PROP_YBOUNDS: saIdx = cdiPioGDsaYBounds; break; + case GRID_PROP_MASK: + case GRID_PROP_MASK_GME: Error("unsupported key: %d", (int) gridProp); break; + } + size_t aRank = sub_arrays[saIdx].a_rank; + double *values = (double *) Malloc(sizeof(*values) * stride * (size_t) (PPM_extents_size(aRank, sub_arrays[saIdx].rect))); + int32_t coord[cdiPioGDsaMaxRank]; + if (aRank == 2) + { + size_t xsize = (size_t) gridptr->x.size, ysize = (size_t) gridptr->y.size; + for (size_t j = 0; j < ysize; ++j) + { + coord[0] = (int32_t) j; + for (size_t i = 0; i < xsize; ++i) + { + coord[1] = (int32_t) i; + PPM_dist_mult_array_get(distData, saIdx, coord, values + (j * xsize + i) * stride); + } + } + } + else /* aRank == 1 */ + { + size_t dimsize = (size_t) sub_arrays[saIdx].rect[0].size; + for (size_t i = 0; i < dimsize; ++i) + { + coord[0] = (int32_t) i; + PPM_dist_mult_array_get(distData, saIdx, coord, values + i * stride); + } + } + cdfPostDefActionAddPutVal(delayed, fileID, ncvarid, values, cdfDelayedPutVarDeepCleanup); + } + else + cdfPostDefActionGridProp(streamptr, gridID, ncvarid, gridProp, delayed); +} + +#endif + +/* TODO: virtualize with namespaces */ +static MPI_Comm cdiPioDistGridComm = MPI_COMM_NULL; + +static void +cdiPioDistGridInitOnce(void) +{ + cdiPioDistGridVtable.copyScalarFields = cdiGridVtable.copyScalarFields; + cdiPioDistGridVtable.compareXYAO = cdiGridVtable.compareXYAO; + cdiPioDistGridVtable.getPackSize = cdiGridVtable.getPackSize; + cdiPioDistGridVtable.getPackSizeScalars = cdiGridVtable.getPackSizeScalars; + cdiPioDistGridVtable.unpackScalars = cdiGridVtable.unpackScalars; + cdiPioDistGridVtable.pack = cdiGridVtable.pack; + cdiPioDistGridVtable.packScalars = cdiGridVtable.packScalars; + cdiPioDistGridVtable.inqPropPresence = cdiGridVtable.inqPropPresence; + bool inClientGroup = !commInqIsProcIO(); + MPI_Comm comm = inClientGroup ? commInqCommModel() : commInqCommColl(); + if (inClientGroup) + { + xmpi(MPI_Comm_dup(comm, &cdiPioDistGridComm)); + /* our copy of the client communicator is fine to be used by + * yaxt directly, since no conflicting use can happen */ + xt_mpi_comm_mark_exclusive(cdiPioDistGridComm); + } + else + cdiPioDistGridComm = comm; +#ifdef HAVE_LIBNETCDF + namespaceSwitchSet(NSSWITCH_CDF_POSTDEFACTION_GRID_PROP, NSSW_FUNC(cdiPioParCdfPostDefActionGridProp)); +#endif +} + +void +cdiPioDistGridFinalizeOnce(int namespace) +{ + (void) namespace; + bool inClientGroup = !commInqIsProcIO(); + if (inClientGroup && cdiPioDistGridComm != MPI_COMM_NULL) xmpi(MPI_Comm_free(&cdiPioDistGridComm)); +} + +#ifdef HAVE_LIBPTHREAD +#include <pthread.h> +static pthread_once_t cdiPioDistGridInitOnceState = PTHREAD_ONCE_INIT; +#define CDI_PIO_DIST_GRID_INIT_ONCE() pthread_once(&cdiPioDistGridInitOnceState, cdiPioDistGridInitOnce) +#else +static bool cdiPioDistGridInitOnceState = false; +#define CDI_PIO_DIST_GRID_INIT_ONCE() \ + do \ + { \ + if (!cdiPioDistGridInitOnceState) \ + { \ + cdiPioDistGridInitOnce(); \ + cdiPioDistGridInitOnceState = true; \ + } \ + } \ + while (0) +#endif + +static void +cdiPioDistGridInit(grid_t *gridptr, int gridtype, int size, int xsize, int ysize, int nvertex, const int (*xy_decomposition)[2], + Xt_idxlist partDesc2D, Xt_idxlist partDescX, Xt_idxlist partDescY) +{ + CDI_PIO_DIST_GRID_INIT_ONCE(); + struct cdiPioDistGridExtraData *extraData = (struct cdiPioDistGridExtraData *) (gridptr->extraData = Malloc(sizeof(*extraData))); + extraData->rmaEnabled = false; + struct PPM_global_array_desc *sub_arrays = extraData->sub_arrays; + sub_arrays[cdiPioGDsaXVals].element_dt = MPI_DOUBLE; + sub_arrays[cdiPioGDsaYVals].element_dt = MPI_DOUBLE; + xmpi(MPI_Type_contiguous(nvertex, MPI_DOUBLE, &sub_arrays[cdiPioGDsaXBounds].element_dt)); + xmpi(MPI_Type_commit(&sub_arrays[cdiPioGDsaXBounds].element_dt)); + sub_arrays[cdiPioGDsaYBounds].element_dt = sub_arrays[cdiPioGDsaXBounds].element_dt; + sub_arrays[cdiPioGDsaArea].element_dt = MPI_DOUBLE; + sub_arrays[cdiPioGDsaMask].element_dt = MPI_UNSIGNED_CHAR; + sub_arrays[cdiPioGDsaMaskGME].element_dt = MPI_UNSIGNED_CHAR; + + bool irregular = false; + size_t saMaxRank = 0; + switch (gridtype) + { + case GRID_CURVILINEAR: + saMaxRank = 2; + for (size_t saIdx = 0; saIdx < cdiPioGDsaNum; ++saIdx) + { + sub_arrays[saIdx].a_rank = 2; + sub_arrays[saIdx].rect[0].first = 0; + sub_arrays[saIdx].rect[0].size = ysize; + sub_arrays[saIdx].rect[1].first = 0; + sub_arrays[saIdx].rect[1].size = xsize; + extraData->defRedists[saIdx] = NULL; + } + irregular = true; + break; + case GRID_UNSTRUCTURED: + for (size_t saIdx = 0; saIdx < cdiPioGDsaNum; ++saIdx) sub_arrays[saIdx].rect[0].size = size; + irregular = true; + /*-fallthrough*/ + case GRID_GENERIC: + case GRID_GAUSSIAN: + case GRID_LONLAT: + case GRID_SPECTRAL: + case GRID_FOURIER: + case GRID_GME: + case GRID_TRAJECTORY: + case CDI_PROJ_LCC: + case GRID_PROJECTION: + saMaxRank = 1; + for (size_t saIdx = 0; saIdx < cdiPioGDsaNum; ++saIdx) + { + sub_arrays[saIdx].rect[0].first = 0; + sub_arrays[saIdx].a_rank = 1; + extraData->defRedists[saIdx] = NULL; + } + if (irregular) break; + /* FIXME: make the following three 2D */ + sub_arrays[cdiPioGDsaArea].rect[0].size = size; + sub_arrays[cdiPioGDsaMask].rect[0].size = size; + sub_arrays[cdiPioGDsaMaskGME].rect[0].size = size; + sub_arrays[cdiPioGDsaXVals].rect[0].size = xsize; + sub_arrays[cdiPioGDsaYVals].rect[0].size = ysize; + sub_arrays[cdiPioGDsaXBounds].rect[0].size = xsize; + sub_arrays[cdiPioGDsaYBounds].rect[0].size = ysize; + break; + case GRID_GAUSSIAN_REDUCED: + default: Error("Unexpected or unsupported grid type %d", gridtype); + } + + extraData->distTypes = cdiPioGridDist[!irregular]; + for (size_t i = 0; i < cdiPioGDdtNum; ++i) + { + extraData->distList[i] = NULL; + extraData->defXmaps[i] = NULL; + } + + bool inClientGroup = !commInqIsProcIO(); + int (*rankQuery)(void) = inClientGroup ? commInqRankModel : commInqRankColl; + int commRank = rankQuery(); + { + struct PPM_extent(*local_chunks)[saMaxRank] = (struct PPM_extent(*)[saMaxRank]) extraData->local_chunks; + /* improve automatic finding of partitioning if saMaxRank == 2 */ + if (!xy_decomposition) + { + int (*commSizeQuery)(void) = inClientGroup ? cdiPioCommInqSizeClients : commInqSizeColl; + int numClients = commSizeQuery(); + for (size_t j = 0; j < cdiPioGDsaNum; ++j) + { + size_t aRank = (size_t) sub_arrays[j].a_rank; + local_chunks[j][0] = PPM_uniform_partition(sub_arrays[j].rect[0], numClients, commRank); + for (size_t i = 1; i < aRank; ++i) local_chunks[j][i] = sub_arrays[j].rect[i]; + } + } + else + { + /* check if hints are in range */ + static const char dimName[2] = { 'X', 'Y' }, caller[] = "cdiPioDistGridCreate"; + for (size_t aRank = 0; aRank < saMaxRank; ++aRank) + { + int32_t dimUB = sub_arrays[cdiPioGDsaArea].rect[aRank].first + sub_arrays[cdiPioGDsaArea].rect[aRank].size; + if (xy_decomposition[aRank][0] < 0 || xy_decomposition[aRank][0] > dimUB) + Errorc("decomposition hint for %c start out " + "of range [0,%d]\n", + dimName[aRank], (int) dimUB - 1); + if (xy_decomposition[aRank][1] < 0 || (xy_decomposition[aRank][0] + xy_decomposition[aRank][1] > dimUB)) + Errorc("decomposition hint value %d for %c size out " + "of range [0,%d]\n", + (int) xy_decomposition[aRank][1], dimName[aRank], (int) dimUB - xy_decomposition[aRank][0]); + } + if (irregular) /* for irregular grids, all arrays are decomposed identically */ + for (size_t j = 0; j < cdiPioGDsaNum; ++j) + for (size_t i = 0; i < saMaxRank; ++i) + { + local_chunks[j][i].first = (int32_t) xy_decomposition[i][0]; + local_chunks[j][i].size = (int32_t) xy_decomposition[i][1]; + } + else + { + /* handle 1d-decomposed arrays first */ + for (size_t saIdx = 0; saIdx < cdiPioGDsaArea; ++saIdx) + { + /* for the first 4 arrays, disttype is alternatively + * cdiPioGDdtX==0 and cdiPioGDdtY==1 */ + int distType = extraData->distTypes[saIdx]; + local_chunks[saIdx][0].first = (int32_t) xy_decomposition[distType][0]; + local_chunks[saIdx][0].size = (int32_t) xy_decomposition[distType][1]; + } + /* then rest of 2D-decomposed parts */ + for (size_t saIdx = cdiPioGDsaArea; saIdx < cdiPioGDsaNum; ++saIdx) + for (size_t dim = 0; dim < 2; ++dim) + { + local_chunks[saIdx][dim].first = (int32_t) xy_decomposition[dim][0]; + local_chunks[saIdx][dim].size = (int32_t) xy_decomposition[dim][1]; + } + } + } + extraData->distData = PPM_dist_mult_array_new(cdiPioGDsaNum, sub_arrays, (struct PPM_extent *) local_chunks, cdiPioDistGridComm, + 0, PPM_dma_sync_mode_local_only); + } + + extraData->partDesc[cdiPioGDdt2D] = xt_idxlist_copy(partDesc2D); + /* TODO: force x/y part desc presence for regular grids */ + extraData->partDesc[cdiPioGDdtX] = partDescX ? xt_idxlist_copy(partDescX) : NULL; + extraData->partDesc[cdiPioGDdtY] = partDescY ? xt_idxlist_copy(partDescY) : NULL; + extraData->baseVtable = gridptr->vtable; + gridptr->vtable = &cdiPioDistGridVtable; + /* determine from where to cache xfirst,xlast,yfirst,ylast from on + * calls to gridDef[XY]Vals */ + { + const struct PPM_extent(*local_chunks)[saMaxRank] = (const struct PPM_extent(*)[saMaxRank]) extraData->local_chunks; + int32_t coord[cdiPioGDsaMaxRank]; + enum + { + IDX_FIRST, + IDX_LAST, + NUM_IDX + }; + enum + { + NUM_COORD = cdiPioGDsaYVals - cdiPioGDsaXVals + 1 + }; + bool haveCoord[NUM_COORD][NUM_IDX]; + for (size_t saIdx = cdiPioGDsaXVals; saIdx <= cdiPioGDsaYVals; ++saIdx) + { + size_t a_rank = sub_arrays[saIdx].a_rank; + for (size_t dim = 0; dim < a_rank; ++dim) coord[dim] = sub_arrays[saIdx].rect[dim].first; + haveCoord[saIdx][IDX_FIRST] = PPM_coord_is_contained_in_extents(a_rank, coord, local_chunks[saIdx]); + for (size_t dim = 0; dim < a_rank; ++dim) coord[dim] += sub_arrays[cdiPioGDsaXVals].rect[dim].size - 1; + haveCoord[saIdx][IDX_LAST] = PPM_coord_is_contained_in_extents(a_rank, coord, local_chunks[saIdx]); + } + { + int ownerRanks[NUM_COORD][NUM_IDX]; + for (size_t saIdx = cdiPioGDsaXVals; saIdx <= cdiPioGDsaYVals; ++saIdx) + for (size_t i = 0; i < NUM_IDX; ++i) ownerRanks[saIdx][i] = haveCoord[saIdx][i] ? commRank : -1; + enum + { + REDUCE_COUNT = NUM_COORD * NUM_IDX + }; + xmpi(MPI_Allreduce(MPI_IN_PLACE, ownerRanks, REDUCE_COUNT, MPI_INT, MPI_MAX, cdiPioDistGridComm)); + for (size_t saIdx = cdiPioGDsaXVals; saIdx <= cdiPioGDsaYVals; ++saIdx) + { + extraData->aReduce[saIdx].ownerRankFirst = ownerRanks[saIdx][IDX_FIRST]; + extraData->aReduce[saIdx].ownerRankLast = ownerRanks[saIdx][IDX_LAST]; + extraData->aReduce[saIdx].first = (double) NAN; + extraData->aReduce[saIdx].last = (double) NAN; + extraData->aReduce[saIdx].dist2scanRedist = NULL; + } + } + } +} + +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + +static Xt_redist +cdiPioDistGridLazyRedistCreate(grid_t *gridptr, enum cdiPioGDsa saIdx) +{ + struct cdiPioDistGridExtraData *restrict extraData = (struct cdiPioDistGridExtraData *) gridptr->extraData; + enum cdiPioGDdistType distType = extraData->distTypes[saIdx]; + Xt_idxlist distList = extraData->distList[distType]; + Xt_xmap defXmap = extraData->defXmaps[distType]; + Xt_redist defRedist = extraData->defRedists[saIdx]; + const struct PPM_global_array_desc *sub_arrays = extraData->sub_arrays; + if (!distList) + { + size_t saMaxRank = gridptr->type == GRID_UNSTRUCTURED ? 1 : 2; + const struct PPM_extent(*local_chunks)[saMaxRank] = (const struct PPM_extent(*)[saMaxRank]) extraData->local_chunks; + if (sub_arrays[saIdx].a_rank == 1) + { + struct Xt_stripe stripe = { .start = local_chunks[saIdx][0].first, .stride = 1, .nstrides = local_chunks[saIdx][0].size }; + distList = xt_idxstripes_new(&stripe, 1); + } + else /* sub_arrays[saIdx].a_rank > 1 */ + { + size_t aRank = sub_arrays[saIdx].a_rank; + Xt_int global_size[cdiPioGDsaMaxRank], local_start[cdiPioGDsaMaxRank]; + int local_size[cdiPioGDsaMaxRank]; + for (size_t i = 0; i < aRank; ++i) + { + global_size[i] = sub_arrays[saIdx].rect[i].size; + local_start[i] = (Xt_int) local_chunks[saIdx][i].first; + local_size[i] = (int) local_chunks[saIdx][i].size; + } + distList = xt_idxsection_new(0, (int) aRank, global_size, local_size, local_start); + } + extraData->distList[distType] = distList; + } + if (!defXmap) + { + MPI_Comm comm = cdiPioDistGridComm; + xmap_new_func_ptr xmapNew = cdiPioGetConf()->xmap_new; + extraData->defXmaps[distType] = defXmap = xmapNew(extraData->partDesc[distType], distList, comm); + } + + if (!defRedist) + { + switch (saIdx) + { + case cdiPioGDsaXVals: + case cdiPioGDsaMask: + case cdiPioGDsaXBounds: defRedist = xt_redist_p2p_new(defXmap, sub_arrays[saIdx].element_dt); break; + case cdiPioGDsaYVals: + case cdiPioGDsaArea: + if (distType == extraData->distTypes[cdiPioGDsaXVals]) + defRedist = cdiPioDistGridLazyRedistCreate(gridptr, cdiPioGDsaXVals); + else + defRedist = xt_redist_p2p_new(defXmap, MPI_DOUBLE); + break; + case cdiPioGDsaYBounds: defRedist = cdiPioDistGridLazyRedistCreate(gridptr, cdiPioGDsaXBounds); break; + case cdiPioGDsaMaskGME: defRedist = cdiPioDistGridLazyRedistCreate(gridptr, cdiPioGDsaMask); break; + default: abort(); + } + extraData->defRedists[saIdx] = defRedist; + } + return defRedist; +} + +static void +cdiPioDistGridDestroy(grid_t *gridptr) +{ + struct cdiPioDistGridExtraData *restrict extraData = (struct cdiPioDistGridExtraData *) gridptr->extraData; + PPM_dist_mult_array_delete(extraData->distData); + gridptr->x.vals = NULL; + gridptr->y.vals = NULL; + gridptr->x.bounds = NULL; + gridptr->y.bounds = NULL; + gridptr->area = NULL; + gridptr->mask = NULL; + gridptr->mask_gme = NULL; + if (extraData->partDesc[cdiPioGDdtX]) xt_idxlist_delete(extraData->partDesc[cdiPioGDdtX]); + if (extraData->partDesc[cdiPioGDdtY]) xt_idxlist_delete(extraData->partDesc[cdiPioGDdtY]); + xt_idxlist_delete(extraData->partDesc[cdiPioGDdt2D]); + xmpi(MPI_Type_free(&extraData->sub_arrays[cdiPioGDsaXBounds].element_dt)); + for (size_t i = 0; i < cdiPioGDdtNum; ++i) + { + if (extraData->defXmaps[i]) + { + Xt_xmap xmap = extraData->defXmaps[i]; + xt_xmap_delete(xmap); + } + if (extraData->distList[i]) + { + xt_idxlist_delete(extraData->distList[i]); + } + } + for (size_t i = 0; i < cdiPioGDsaNum; ++i) + if (extraData->defRedists[i]) + { + Xt_redist redist = extraData->defRedists[i]; + extraData->defRedists[i] = NULL; + xt_redist_delete(redist); + for (size_t j = i + 1; j < cdiPioGDsaNum; ++j) + if (extraData->defRedists[j] == redist) extraData->defRedists[j] = NULL; + } + for (size_t saIdx = cdiPioGDsaXVals; saIdx <= cdiPioGDsaYVals; ++saIdx) + if (extraData->aReduce[saIdx].dist2scanRedist) xt_redist_delete(extraData->aReduce[saIdx].dist2scanRedist); + gridptr->extraData = NULL; + void (*baseDestroy)(grid_t * gridptr) = extraData->baseVtable->destroy; + Free(extraData); + baseDestroy(gridptr); +} + +static grid_t * +cdiPioDistGridCopy(grid_t *gridptr) +{ + grid_t *gridptrDup = cdiGridVtable.copy(gridptr); + struct cdiPioDistGridExtraData *restrict extraData = (struct cdiPioDistGridExtraData *) Malloc(sizeof(*extraData)); + memcpy(extraData, gridptr->extraData, sizeof(*extraData)); + for (size_t i = 0; i < cdiPioGDdtNum; ++i) + { + if (extraData->partDesc[i]) extraData->partDesc[i] = xt_idxlist_copy(extraData->partDesc[i]); + if (extraData->distList[i]) extraData->distList[i] = xt_idxlist_copy(extraData->distList[i]); + if (extraData->defXmaps[i]) extraData->defXmaps[i] = xt_xmap_copy(extraData->defXmaps[i]); + } + { + bool nodup[cdiPioGDsaNum]; + for (size_t i = 0; i < cdiPioGDsaNum; ++i) nodup[i] = true; + for (size_t i = 0; i < cdiPioGDsaNum; ++i) + if (extraData->defRedists[i] && nodup[i]) + { + Xt_redist redist = extraData->defRedists[i]; + extraData->defRedists[i] = xt_redist_copy(redist); + for (size_t j = i + 1; j < cdiPioGDsaNum; ++j) + if (extraData->defRedists[j] == redist) + { + extraData->defRedists[j] = extraData->defRedists[i]; + nodup[j] = false; + } + } + } + gridptrDup->extraData = extraData; + gridptr->vtable->copyArrayFields(gridptr, gridptrDup); + return gridptrDup; +} + +static void +cdiPioDistGridCopyArrays(grid_t *gridptrOrig, grid_t *gridptrDup) +{ + /* TODO: develop scheme for distributed reducedPoints data */ + size_t reducedPointsSize = (size_t) gridptrOrig->reducedPointsSize; + struct cdiPioDistGridExtraData *extraDataOrig = (struct cdiPioDistGridExtraData *) gridptrOrig->extraData, + *extraDataDup + = (struct cdiPioDistGridExtraData *) (gridptrDup->extraData = Malloc(sizeof(*extraDataDup))); + for (size_t i = 0; i < cdiPioGDdtNum; ++i) extraDataDup->partDesc[i] = xt_idxlist_copy(extraDataOrig->partDesc[i]); + extraDataDup->baseVtable = extraDataOrig->baseVtable; + struct PPM_global_array_desc *sub_arrays = extraDataDup->sub_arrays; + size_t saMaxRank = gridptrOrig->type == GRID_UNSTRUCTURED ? 1 : 2; + struct PPM_extent(*local_chunks)[saMaxRank] = (struct PPM_extent(*)[saMaxRank]) extraDataDup->local_chunks; + memcpy(sub_arrays, &extraDataOrig->sub_arrays, sizeof(extraDataDup->sub_arrays)); + memcpy(local_chunks, &extraDataOrig->local_chunks, sizeof(extraDataDup->local_chunks)); + extraDataDup->distData = PPM_dist_mult_array_new(cdiPioGDsaNum, sub_arrays, (struct PPM_extent *) local_chunks, + commInqCommModel(), 0, PPM_dma_sync_mode_passive_target); + + if (reducedPointsSize) + { + gridptrDup->reducedPoints = (int *) Malloc(reducedPointsSize * sizeof(int)); + memcpy(gridptrDup->reducedPoints, gridptrOrig->reducedPoints, reducedPointsSize * sizeof(int)); + } + + void *saPtr[cdiPioGDsaNum] = { [cdiPioGDsaXVals] = gridptrOrig->x.vals, [cdiPioGDsaYVals] = gridptrOrig->y.vals, + [cdiPioGDsaXBounds] = gridptrOrig->x.bounds, [cdiPioGDsaYBounds] = gridptrOrig->y.bounds, + [cdiPioGDsaArea] = gridptrOrig->area, [cdiPioGDsaMask] = gridptrOrig->mask, + [cdiPioGDsaMaskGME] = gridptrOrig->mask_gme }; + + size_t nvertex = (size_t) gridptrOrig->nvertex; + for (size_t saIdx = 0; saIdx < cdiPioGDsaNum; ++saIdx) + if (saPtr[saIdx]) + { + size_t size = (size_t) (PPM_extents_size(sub_arrays[saIdx].a_rank, local_chunks[saIdx])); + void *src = PPM_dist_mult_array_local_ptr(extraDataOrig->distData, saIdx), + *dest = PPM_dist_mult_array_local_ptr(extraDataDup->distData, saIdx); + if (saIdx == cdiPioGDsaXBounds || saIdx == cdiPioGDsaYBounds) size *= nvertex; + memcpy(dest, src, size * cdiPioDistArrayElemSize[saIdx]); + saPtr[saIdx] = dest; + } + + gridptrDup->x.vals = saPtr[cdiPioGDsaXVals]; + gridptrDup->y.vals = saPtr[cdiPioGDsaYVals]; + gridptrDup->x.bounds = saPtr[cdiPioGDsaXBounds]; + gridptrDup->y.bounds = saPtr[cdiPioGDsaYBounds]; + gridptrDup->area = saPtr[cdiPioGDsaArea]; + gridptrDup->mask = saPtr[cdiPioGDsaMask]; + gridptrDup->mask_gme = saPtr[cdiPioGDsaMaskGME]; +} + +static void * +defDistData(grid_t *gridptr, const void *indata, enum cdiPioGDsa saIdx) +{ + struct cdiPioDistGridExtraData *restrict extraData = (struct cdiPioDistGridExtraData *) gridptr->extraData; + Xt_redist redist = cdiPioDistGridLazyRedistCreate(gridptr, saIdx); + bool dataDefined = gridptr->x.vals || gridptr->y.vals || gridptr->x.bounds || gridptr->y.bounds || gridptr->area || gridptr->mask + || gridptr->mask_gme; + if (dataDefined) PPM_dist_mult_array_unexpose(extraData->distData); + void *redistData = PPM_dist_mult_array_local_ptr(extraData->distData, saIdx); + xt_redist_s_exchange1(redist, indata, redistData); + PPM_dist_mult_array_expose(extraData->distData); + return redistData; +} + +#if 0 +/* TODO: develop scheme for distributed reducedPoints data */ +static void +cdiPioDistGridDefReducedPoints(int gridID, int reducedPointsSize, const int reducedPoints[]) +{ +} + + +static void +distGridInqReducedPoints(int gridID, int *reducedPoints) +{ +} +#endif + +static int +cdiPioDistGridGetPart(grid_t *gridptr, enum cdiPioGDsa saIdx, void *out, size_t elem_size) +{ + struct cdiPioDistGridExtraData *extraData = (struct cdiPioDistGridExtraData *) gridptr->extraData; + enum cdiPioGDdistType distType = extraData->distTypes[saIdx]; + Xt_idxlist partDesc = extraData->partDesc[distType]; + size_t num_vals = (size_t) xt_idxlist_get_num_indices(partDesc); + if (out) + { + Xt_int *indices = (Xt_int *) Malloc(num_vals * sizeof(indices[0])); + xt_idxlist_get_indices(partDesc, indices); + struct PPM_dist_mult_array *distData = extraData->distData; + int32_t coord[cdiPioGDsaMaxRank]; + const struct PPM_global_array_desc *sub_array_desc = extraData->sub_arrays + saIdx; + if (sub_array_desc->a_rank == 1) + for (size_t i = 0; i < num_vals; ++i) + { + coord[0] = (int32_t) indices[i]; + PPM_dist_mult_array_get(distData, saIdx, coord, (unsigned char *) out + elem_size * i); + } + else + { + int xsize = (int) sub_array_desc->rect[1].size; + for (size_t i = 0; i < num_vals; ++i) + { + coord[0] = (int32_t) (indices[i] / xsize); + coord[1] = (int32_t) (indices[i] % xsize); + PPM_dist_mult_array_get(distData, saIdx, coord, (unsigned char *) out + elem_size * i); + } + } + Free(indices); + } + return (int) num_vals; +} + +static int +inqMaskData(grid_t *gridptr, enum cdiPioGDsa saIdx, mask_t **localMaskData, int *mask) +{ + (void) saIdx; + int size = 0; + if (*localMaskData) + { + struct cdiPioDistGridExtraData *extraData = (struct cdiPioDistGridExtraData *) gridptr->extraData; + size = xt_idxlist_get_num_indices(extraData->partDesc[cdiPioGDdt2D]); + if (mask) + { + size_t numLocalMaskVals = (size_t) size; + mask_t *convMask = Malloc(numLocalMaskVals * sizeof(*convMask)); +#ifndef NDEBUG + int getSize = cdiPioDistGridGetPart(gridptr, saIdx, convMask, sizeof(convMask[0])); +#endif + assert(getSize == size); + for (size_t i = 0; i < numLocalMaskVals; ++i) mask[i] = (int) convMask[i]; + Free(convMask); + } + } + return size; +} + +static mask_t * +defMaskData(grid_t *gridptr, const int *mask, enum cdiPioGDsa saIdx) +{ + mask_t *maskPtr; + if (mask) + { + struct cdiPioDistGridExtraData *extraData = (struct cdiPioDistGridExtraData *) gridptr->extraData; + size_t numLocalMaskVals = (size_t) xt_idxlist_get_num_indices(extraData->partDesc[cdiPioGDdt2D]); + mask_t *convMask = Malloc(numLocalMaskVals * sizeof(*convMask)); + for (size_t i = 0; i < numLocalMaskVals; ++i) convMask[i] = (mask_t) (mask[i] != 0); + maskPtr = defDistData(gridptr, convMask, saIdx); + Free(convMask); + } + else + maskPtr = NULL; + return maskPtr; +} + +static void +cdiPioDistGridDefMask(grid_t *gridptr, const int *mask) +{ + gridptr->mask = defMaskData(gridptr, mask, cdiPioGDsaMask); +} + +static int +cdiPioDistGridInqMask(grid_t *gridptr, int *mask) +{ + return inqMaskData(gridptr, cdiPioGDsaMask, &gridptr->mask, mask); +} + +static void +cdiPioDistGridDefMaskGME(grid_t *gridptr, const int *mask) +{ + gridptr->mask_gme = defMaskData(gridptr, mask, cdiPioGDsaMaskGME); +} + +static int +cdiPioDistGridInqMaskGME(grid_t *gridptr, int *mask) +{ + return inqMaskData(gridptr, cdiPioGDsaMaskGME, &gridptr->mask_gme, mask); +} + +static int +cdiPioDistGridInqXVals(grid_t *gridptr, double *xvals) +{ + return gridptr->x.vals ? cdiPioDistGridGetPart(gridptr, cdiPioGDsaXVals, xvals, sizeof(xvals[0])) : 0; +} + +static double +cdiPioDistGridDefAReductions(grid_t *gridptr, size_t saIdx) +{ + struct cdiPioDistGridExtraData *extraData = gridptr->extraData; + struct PPM_dist_mult_array *distData = extraData->distData; + const struct PPM_global_array_desc *sub_arrays = extraData->sub_arrays; + size_t aRank = sub_arrays[saIdx].a_rank; + struct axisReduction *aReduce = extraData->aReduce + saIdx; + bool inClientGroup = !commInqIsProcIO(); + int (*rankQuery)(void) = inClientGroup ? commInqRankModel : commInqRankColl; + int commRank = rankQuery(); + if (commRank == aReduce->ownerRankFirst) + { + int coord[cdiPioGDsaMaxRank]; + for (size_t dim = 0; dim < aRank; ++dim) coord[dim] = sub_arrays[saIdx].rect[dim].first; + PPM_dist_mult_array_get(distData, saIdx, coord, &aReduce->first); + } + else + aReduce->first = (double) NAN; + if (commRank == aReduce->ownerRankLast) + { + int coord[cdiPioGDsaMaxRank]; + for (size_t dim = 0; dim < aRank; ++dim) + coord[dim] = sub_arrays[saIdx].rect[dim].first + sub_arrays[saIdx].rect[dim].size - 1; + PPM_dist_mult_array_get(distData, saIdx, coord, &aReduce->last); + } + else + aReduce->last = (double) NAN; + xmpi(MPI_Bcast(&aReduce->first, 1, MPI_DOUBLE, aReduce->ownerRankFirst, cdiPioDistGridComm)); + xmpi(MPI_Bcast(&aReduce->last, 1, MPI_DOUBLE, aReduce->ownerRankLast, cdiPioDistGridComm)); + Xt_int gsize = (Xt_int) PPM_extents_size(aRank, sub_arrays[saIdx].rect); + double refInc = 0.0; + if (gsize > 1) + { + int (*commSizeQuery)(void) = inClientGroup ? cdiPioCommInqSizeClients : commInqSizeColl; + int commSize = commSizeQuery(); + struct PPM_extent gridScanChunk + = PPM_uniform_partition((struct PPM_extent){ .first = 0, .size = (int32_t) gsize }, commSize, commRank); + Xt_redist dist2scanRedist; + if (!(dist2scanRedist = aReduce->dist2scanRedist)) + { + struct Xt_stripe stripes[2]; + int numStripes = 1; + stripes[0] = (struct Xt_stripe){ .start = gridScanChunk.first, .stride = 1, .nstrides = gridScanChunk.size }; + if (commRank == 0) + { + stripes[numStripes++] = (struct Xt_stripe){ .start = gsize - (Xt_int) 1, .stride = 1, .nstrides = 1 }; + int nstrides = stripes[0].nstrides; + gridScanChunk.size = stripes[0].nstrides = nstrides > 0 ? nstrides : 1; + } + else + { + stripes[0].start = (Xt_int) (stripes[0].start - 1); + /* add predecessor reference if there is something to + * compare it to */ + stripes[0].nstrides += stripes[0].nstrides > 0; + gridScanChunk.size = stripes[0].nstrides; + } + Xt_idxlist scanList = xt_idxstripes_new(stripes, numStripes); + enum cdiPioGDdistType distType = extraData->distTypes[saIdx]; + Xt_idxlist distList = extraData->distList[distType]; + xmap_new_func_ptr xmapNew = cdiPioGetConf()->xmap_new; + Xt_xmap scanXmap = xmapNew(distList, scanList, cdiPioDistGridComm); + xt_idxlist_delete(scanList); + dist2scanRedist = aReduce->dist2scanRedist = xt_redist_p2p_new(scanXmap, MPI_DOUBLE); + xt_xmap_delete(scanXmap); + } + size_t lsize = (size_t) gridScanChunk.size; + double *restrict scanVals = Malloc((lsize + (size_t) (commRank == 0)) * sizeof(*scanVals)); + { + double *distVals = PPM_dist_mult_array_local_ptr(distData, saIdx); + xt_redist_s_exchange1(dist2scanRedist, distVals, scanVals); + } + if (commRank == 0) + { + if (saIdx == cdiPioGDsaXVals) + { + double xval0 = scanVals[0], xvalW = scanVals[lsize]; + refInc = (fabs(xvalW) - fabs(xval0)) / (double) (gsize - 1); + } + else if (saIdx == cdiPioGDsaYVals) + { + double yval0 = scanVals[0], yval1 = scanVals[1]; + refInc = yval1 - yval0; + } + else + xabort("Internal error"); + } + else + refInc = (double) NAN; + xmpi(MPI_Bcast(&refInc, 1, MPI_DOUBLE, 0, cdiPioDistGridComm)); + if (lsize > 1) + { + if (saIdx == cdiPioGDsaXVals) + { + double eps = 0.01 * refInc; + for (size_t i = 1; i < lsize; i++) + if (fabs(fabs(scanVals[i] - scanVals[i - 1]) - refInc) > eps) + { + refInc = 0; + break; + } + } + else if (saIdx == cdiPioGDsaYVals) + { + double absYinc = fabs(refInc), eps = 0.01 * absYinc; + for (size_t i = 2; i < lsize; ++i) + if (fabs(fabs(scanVals[i] - scanVals[i - 1]) - absYinc) > eps) + { + refInc = 0; + break; + } + } + } + Free(scanVals); + xmpi(MPI_Allreduce(MPI_IN_PLACE, &refInc, 1, MPI_DOUBLE, MPI_MIN, cdiPioDistGridComm)); + } + return refInc; +} + +static void +cdiPioDistGridDefXVals(grid_t *gridptr, const double *xvals) +{ + gridptr->x.vals = defDistData(gridptr, xvals, cdiPioGDsaXVals); + gridptr->y.inc = cdiPioDistGridDefAReductions(gridptr, cdiPioGDsaXVals); +} + +static int +cdiPioDistGridInqYVals(grid_t *gridptr, double *yvals) +{ + return gridptr->y.vals ? cdiPioDistGridGetPart(gridptr, cdiPioGDsaYVals, yvals, sizeof(yvals[0])) : 0; +} + +static void +cdiPioDistGridDefYVals(grid_t *gridptr, const double *yvals) +{ + gridptr->y.vals = defDistData(gridptr, yvals, cdiPioGDsaYVals); + gridptr->y.inc = cdiPioDistGridDefAReductions(gridptr, cdiPioGDsaYVals); +} + +static double +cdiPioDistGridInqXorYVal(grid_t *gridptr, enum cdiPioGDsa saIdx, const double *vals, int index) +{ + double val = 0; + if (vals) + { + struct cdiPioDistGridExtraData *extraData = (struct cdiPioDistGridExtraData *) gridptr->extraData; + if (index == 0) + { + struct axisReduction *aReduce = extraData->aReduce + saIdx; + return aReduce->first; + } + else if (index == gridptr->size - 1) + { + struct axisReduction *aReduce = extraData->aReduce + saIdx; + return aReduce->last; + } + const struct PPM_global_array_desc *sub_array_desc = extraData->sub_arrays + saIdx; + int32_t coord[cdiPioGDsaMaxRank]; + if (sub_array_desc->a_rank == 1) + coord[0] = index; + else + { + /* 2D decomposition */ + int32_t xsize = sub_array_desc->rect[1].size; + coord[0] = index / xsize; + coord[1] = index % xsize; + } + PPM_dist_mult_array_get(extraData->distData, saIdx, coord, &val); + } + return val; +} + +static double +cdiPioDistGridInqXVal(grid_t *gridptr, int index) +{ + return cdiPioDistGridInqXorYVal(gridptr, cdiPioGDsaXVals, gridptr->x.vals, index); +} + +static double +cdiPioDistGridInqYVal(grid_t *gridptr, int index) +{ + return cdiPioDistGridInqXorYVal(gridptr, cdiPioGDsaYVals, gridptr->y.vals, index); +} + +static double +cdiPioDistGridInqXInc(grid_t *gridptr) +{ + /* since for distributed grids, x.inc is precomputed on gridDefXvals, + * the value in x.inc is directly usable */ + return gridptr->x.inc; +} + +static double +cdiPioDistGridInqYInc(grid_t *gridptr) +{ + /* since for distributed grids, y.inc is precomputed on gridDefYvals, + * the value in y.inc is directly usable */ + return gridptr->y.inc; +} + +#if 0 +static void +dist_grid_check_cyclic(grid_t *gridptr) +{ +} + +static int +grid_cmp_xvals(const grid_t *gridID1, const grid_t *gridID2); + +static int +grid_cmp_yvals(const grid_t *gridID1, const grid_t *gridID2); + +int distGridGenerate(const grid_t *grid) +{ +} + + +static void +distGridCompress(int gridID) +{ +} + +#endif + +static void +cdiPioDistGridInqArea(grid_t *gridptr, double *area) +{ + if (gridptr->area) cdiPioDistGridGetPart(gridptr, cdiPioGDsaArea, area, sizeof(area[0])); +} + +static void +cdiPioDistGridDefArea(grid_t *gridptr, const double *area) +{ + gridptr->area = defDistData(gridptr, area, cdiPioGDsaArea); +} + +static const double * +cdiPioDistGridInqUnavailableDblPtr(grid_t *gridptr) +{ + (void) gridptr; + Error("gridInq{Area|[XY]vals|[XY]bounds}Ptr unavailable for" + " distributed grids"); + return NULL; +} + +static void +cdiPioDistGridDefXBounds(grid_t *gridptr, const double *xbounds) +{ + gridptr->x.bounds = defDistData(gridptr, xbounds, cdiPioGDsaXBounds); +} + +/* + * static int + * inqBounds(grid_t *gridptr, enum cdiPioGDsa saIdx, double *bounds) + * { + * struct cdiPioDistGridExtraData *extraData + * = (struct cdiPioDistGridExtraData *)gridptr->extraData; + * enum cdiPioGDdistType distType = extraData->distTypes[saIdx]; + * Xt_idxlist partDesc = extraData->partDesc[distType]; + * size_t num_vals = (size_t)xt_idxlist_get_num_indices(partDesc), + * num_vertices = (size_t)gridptr->nvertex; + * int *indices = (int *)Malloc(num_vals * sizeof (indices[0])); + * xt_idxlist_get_indices(partDesc, indices); + * struct PPM_dist_mult_array *distData = extraData->distData; + * int32_t coord[2]; + * const struct PPM_global_array_desc *sub_array_desc + * = extraData->sub_arrays + saIdx; + * if (sub_array_desc->a_rank == 2) + * { + * int xsize = (int)sub_array_desc->rect[1].size; + * for (size_t j = 0; j < num_vals; ++j) + * { + * coord[0] = (int32_t)(indices[j] / xsize); + * coord[1] = (int32_t)(indices[j] % xsize); + * PPM_dist_mult_array_get(distData, saIdx, + * coord, bounds + num_vertices * j); + * } + * } + * else + * for (size_t j = 0; j < num_vals; ++j) + * { + * coord[0] = (int32_t)indices[j]; + * PPM_dist_mult_array_get(distData, saIdx, + * coord, bounds + num_vertices * j); + * } + * free(indices); + * return (int)(num_vals * num_vertices); + * } + */ + +static int +cdiPioDistGridInqXBounds(grid_t *gridptr, double *xbounds) +{ + size_t vertStride = (size_t) gridptr->nvertex * sizeof(*xbounds); + return gridptr->x.bounds ? cdiPioDistGridGetPart(gridptr, cdiPioGDsaXBounds, xbounds, vertStride) : 0; +} + +static void +cdiPioDistGridDefYBounds(grid_t *gridptr, const double *ybounds) +{ + gridptr->y.bounds = defDistData(gridptr, ybounds, cdiPioGDsaYBounds); +} + +static int +cdiPioDistGridInqYBounds(grid_t *gridptr, double *ybounds) +{ + size_t vertStride = (size_t) gridptr->nvertex * sizeof(*ybounds); + return gridptr->y.bounds ? cdiPioDistGridGetPart(gridptr, cdiPioGDsaYBounds, ybounds, vertStride) : 0; +} + +#if 0 +void distGridPrintMask(grid_t * gridptr, int index, int opt, FILE *fp) +{ +} +#endif + +static int +cdiPioDistGridPackSizeArrays(grid_t *gridptr, void *context) +{ + int clientRank = commInqRankModel(), numClients = cdiPioCommInqSizeClients(), numColl = commInqSizeColl(), + collRank = cdiPioCollRank(clientRank, numClients, numColl); + int packBufferSize = 0; + if (clientRank == cdiPioClientRangeStart(collRank, numClients, numColl)) + { + /* encode present flags in 1 int and number of aggregated ranks + * in another */ + packBufferSize += serializeGetSize(2, CDI_DATATYPE_INT, context); + struct cdiPioDistGridExtraData *extraData = (struct cdiPioDistGridExtraData *) gridptr->extraData; + bool presence[cdiPioGDsaNum] + = { [cdiPioGDsaXVals] = gridptr->x.vals != NULL, [cdiPioGDsaYVals] = gridptr->y.vals != NULL, + [cdiPioGDsaXBounds] = gridptr->x.bounds != NULL, [cdiPioGDsaYBounds] = gridptr->y.bounds != NULL, + [cdiPioGDsaArea] = gridptr->area != NULL, [cdiPioGDsaMask] = gridptr->mask != NULL, + [cdiPioGDsaMaskGME] = gridptr->mask_gme != NULL }; + int lastClientInGroup = cdiPioClientRangeStart(collRank + 1, numClients, numColl) - 1, + numClientsInGroup = lastClientInGroup - clientRank + 1; + struct PPM_dist_mult_array *distData = extraData->distData; + const struct PPM_global_array_desc *sub_arrays = extraData->sub_arrays; + size_t saMaxRank = gridptr->type == GRID_UNSTRUCTURED ? 1 : 2; + { + packBufferSize += + /* description of outermost dimension chunks for all sending + * ranks, 2D decomposition for both, regular and irregular grids + * plus x-/y- axis decomposition for regular grids + */ + serializeGetSize(numClientsInGroup * 2 * (int) saMaxRank, CDI_DATATYPE_INT32, context); + } + int nvertex = gridptr->nvertex; + int extraDimLen[cdiPioGDsaNum] = { + [cdiPioGDsaXVals] = 1, [cdiPioGDsaYVals] = 1, [cdiPioGDsaXBounds] = nvertex, [cdiPioGDsaYBounds] = nvertex, + [cdiPioGDsaArea] = 1, [cdiPioGDsaMask] = 1, [cdiPioGDsaMaskGME] = 1, + }; + + struct PPM_extent(*local_chunks)[saMaxRank] = (struct PPM_extent(*)[saMaxRank]) extraData->local_chunks; + for (size_t saIdx = 0; saIdx < cdiPioGDsaNum; ++saIdx) + if (presence[saIdx]) + { + size_t aRank = sub_arrays[saIdx].a_rank; + int numElem = (int) (PPM_extents_size(aRank, local_chunks[saIdx])); + for (int rank = clientRank + 1; rank <= lastClientInGroup; ++rank) + { + struct PPM_extent rankChunk[cdiPioGDsaMaxRank]; + PPM_dist_mult_array_rank_rect(distData, saIdx, rank, rankChunk); + numElem += (int) (PPM_extents_size(aRank, rankChunk)); + } + numElem *= extraDimLen[saIdx]; + packBufferSize += + /* data of chunks in client group for collector */ + +serializeGetSize(numElem, cdiPioDistArrayCDIDt[saIdx], context) + /* check-sum of chunks */ + + serializeGetSize(1, CDI_DATATYPE_UINT32, context); + } + } + return packBufferSize; +} + +static void +cdiPioDistGridPackArrays(grid_t *gridptr, int memberMask, void *packBuffer, int packBufferSize, int *packBufferPos, void *context) +{ + (void) memberMask; + int clientRank = commInqRankModel(), numClients = cdiPioCommInqSizeClients(), numColl = commInqSizeColl(), + collRank = cdiPioCollRank(clientRank, numClients, numColl); + + const void *saPtr[cdiPioGDsaNum] + = { [cdiPioGDsaXVals] = gridptr->x.vals, [cdiPioGDsaYVals] = gridptr->y.vals, [cdiPioGDsaXBounds] = gridptr->x.bounds, + [cdiPioGDsaYBounds] = gridptr->y.bounds, [cdiPioGDsaArea] = gridptr->area, [cdiPioGDsaMask] = gridptr->mask, + [cdiPioGDsaMaskGME] = gridptr->mask_gme }; + struct cdiPioDistGridExtraData *extraData = (struct cdiPioDistGridExtraData *) gridptr->extraData; + struct PPM_global_array_desc *sub_arrays = extraData->sub_arrays; + int groupLeader = cdiPioClientRangeStart(collRank, numClients, numColl); + MPI_Comm aggComm = cdiPioInqCollClientIntraComm(); + int nvertex = gridptr->nvertex; + int extraDimLen[cdiPioGDsaNum] = { + [cdiPioGDsaXVals] = 1, [cdiPioGDsaYVals] = 1, [cdiPioGDsaXBounds] = nvertex, [cdiPioGDsaYBounds] = nvertex, + [cdiPioGDsaArea] = 1, [cdiPioGDsaMask] = 1, [cdiPioGDsaMaskGME] = 1, + }; + int type = gridptr->type; + size_t saMaxRank = type == GRID_UNSTRUCTURED ? 1 : 2; + const struct PPM_extent(*local_chunks)[saMaxRank] = (const struct PPM_extent(*)[saMaxRank]) extraData->local_chunks; + if (clientRank == groupLeader) + { + { + int presentFlags = 0; + for (size_t saIdx = 0; saIdx < cdiPioGDsaNum; ++saIdx) presentFlags |= ((saPtr[saIdx] != NULL) << saIdx); + serializePack(&presentFlags, 1, CDI_DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context); + } + int lastClientInGroup = cdiPioClientRangeStart(collRank + 1, numClients, numColl) - 1, + numClientsInGroup = lastClientInGroup - clientRank + 1; + serializePack(&numClientsInGroup, 1, CDI_DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context); + struct PPM_dist_mult_array *distData = extraData->distData; + struct PPM_extent *chunks; + { + size_t numChunksForGroup = saMaxRank * (size_t) numClientsInGroup; + chunks = (struct PPM_extent *) (Malloc(numChunksForGroup * sizeof(*chunks))); + /* area is always fully decomposed (only x-axis if grid is + * unstructured, but then saMaxRank = 1) */ + memcpy(chunks, local_chunks[cdiPioGDsaArea], saMaxRank * sizeof(*chunks)); + for (int rank = clientRank + 1, rankOfs = 1; rank <= lastClientInGroup; ++rank, ++rankOfs) + /* area is always 2D-decomposed */ + PPM_dist_mult_array_rank_rect(distData, cdiPioGDsaArea, rank, chunks + saMaxRank * (size_t) rankOfs); + serializePack(chunks, 2 * (int) numChunksForGroup, CDI_DATATYPE_INT32, packBuffer, packBufferSize, packBufferPos, context); + } + int *shardSize = (int *) (Malloc((size_t) numClientsInGroup * sizeof(*shardSize))); + const enum cdiPioGDdistType *distTypes = extraData->distTypes; + void *shardBuf = NULL; + for (size_t saIdx = 0; saIdx < cdiPioGDsaNum; ++saIdx) + if (saPtr[saIdx] != NULL) + { + size_t elemSize = cdiPioDistArrayElemSize[saIdx]; + size_t aRank = sub_arrays[saIdx].a_rank; + int numElem = PPM_extents_size(aRank, local_chunks[saIdx]); + shardSize[0] = numElem; + int maxShardSize = 0; + size_t distOfs = (size_t) distTypes[saIdx] & (size_t) 1; + for (int rank = clientRank + 1; rank <= lastClientInGroup; ++rank) + { + size_t rankOfs = (size_t) (rank - clientRank); + /* 0 for x and 2d decomposed data, 1 for y-decompositions */ + struct PPM_extent *rankChunk = chunks + saMaxRank * rankOfs + distOfs; + numElem += (shardSize[rankOfs] = (int) (PPM_extents_size(aRank, rankChunk))); + maxShardSize = MAX(shardSize[rankOfs], maxShardSize); + } + if (maxShardSize > 0) shardBuf = Realloc(shardBuf, elemSize * (size_t) maxShardSize * (size_t) extraDimLen[saIdx]); + struct cdiCheckSumState crcState; + cdiCheckSumRStart(&crcState); + /* pack own shard */ + serializePack(saPtr[saIdx], shardSize[0] * extraDimLen[saIdx], cdiPioDistArrayCDIDt[saIdx], packBuffer, packBufferSize, + packBufferPos, context); + cdiCheckSumRAdd(&crcState, cdiPioDistArrayCDIDt[saIdx], shardSize[0] * extraDimLen[saIdx], saPtr[saIdx]); + /* recv and pack other shards in client group */ + for (int rank = clientRank + 1; rank <= lastClientInGroup; ++rank) + { + size_t rankOfs = (size_t) (rank - clientRank); + xmpi(MPI_Recv(shardBuf, shardSize[rankOfs], sub_arrays[saIdx].element_dt, rank, DIST_DATA_AGG, aggComm, + MPI_STATUS_IGNORE)); + serializePack(shardBuf, shardSize[rankOfs] * extraDimLen[saIdx], cdiPioDistArrayCDIDt[saIdx], packBuffer, + packBufferSize, packBufferPos, context); + cdiCheckSumRAdd(&crcState, cdiPioDistArrayCDIDt[saIdx], shardSize[rankOfs] * extraDimLen[saIdx], shardBuf); + } + uint32_t d = cdiCheckSumRValue(crcState); + /* append check-sum of shards to packed data */ + serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); + } + Free(shardSize); + Free(chunks); + Free(shardBuf); + } + else + for (size_t saIdx = 0; saIdx < cdiPioGDsaNum; ++saIdx) + if (saPtr[saIdx] != NULL) + { + size_t aRank = sub_arrays[saIdx].a_rank; + int numElem = PPM_extents_size(aRank, local_chunks[saIdx]); + xmpi(MPI_Send((void *) saPtr[saIdx], numElem, sub_arrays[saIdx].element_dt, groupLeader, DIST_DATA_AGG, aggComm)); + } +} + +static enum cdiApplyRet +cdiPioDistGridPackAssistFunc(int id, void *res, void *data) +{ + UNUSED(id); + UNUSED(data); + grid_t *gridptr = (grid_t *) res; + int resStatus = reshGetStatus(id, NULL); + if (gridptr->vtable == &cdiPioDistGridVtable && (resStatus & RESH_SYNC_BIT)) + { + cdiPioDistGridPackArrays(gridptr, 0, NULL, 0, NULL, NULL); + reshSetStatus(id, NULL, resStatus & ~RESH_SYNC_BIT); + } + return CDI_APPLY_GO_ON; +} + +void +cdiPioDistGridPackAssist(void) +{ + cdiGridApply(cdiPioDistGridPackAssistFunc, NULL); +} + +int +cdiPioDistGridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, + int force_id) +{ + CDI_PIO_DIST_GRID_INIT_ONCE(); + int memberMask; + grid_t *gridP = cdiPioDistGridVtable.unpackScalars(unpackBuffer, unpackBufferSize, unpackBufferPos, originNamespace, context, + force_id, &memberMask); + cdiPioDistGridVtable.unpackArrays(gridP, memberMask, unpackBuffer, unpackBufferSize, unpackBufferPos, originNamespace, context); + reshSetStatus(gridP->self, NULL, reshGetStatus(gridP->self, NULL) & ~RESH_SYNC_BIT); + return gridP->self; +} + +static void +cdiPioDistGridUnpackArrays(grid_t *gridptr, int memberMask, char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, + int originNamespace, void *context) +{ + UNUSED(originNamespace); + UNUSED(memberMask); + int presentFlags, numClientsInGroup; + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &presentFlags, 1, CDI_DATATYPE_INT, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &numClientsInGroup, 1, CDI_DATATYPE_INT, context); + int type = gridptr->type; + bool irregular = (type == GRID_CURVILINEAR || type == GRID_UNSTRUCTURED); + size_t saMaxRank = type == GRID_UNSTRUCTURED ? 1 : 2; + size_t chunksPerRank = saMaxRank, numChunksForGroup = chunksPerRank * (size_t) numClientsInGroup; + struct PPM_extent *chunks = (struct PPM_extent *) (Malloc(numChunksForGroup * sizeof(*chunks))); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, chunks, 2 * (int) numChunksForGroup, CDI_DATATYPE_INT32, + context); + int nvertex = gridptr->nvertex; + { + Xt_idxlist partDesc2D, partDescX, partDescY; + if (type == GRID_UNSTRUCTURED) + { + struct Xt_stripe *stripes = (struct Xt_stripe *) (Malloc((size_t) numClientsInGroup * sizeof(*stripes))); + for (size_t rankOfs = 0; rankOfs < (size_t) numClientsInGroup; ++rankOfs) + stripes[rankOfs] + = (struct Xt_stripe){ .start = (Xt_int) chunks[rankOfs].first, .stride = 1, .nstrides = (int) chunks[rankOfs].size }; + partDesc2D = xt_idxstripes_new(stripes, numClientsInGroup); + partDescY = partDescX = NULL; + Free(stripes); + } + else if (type == GRID_CURVILINEAR) + { + Xt_int global_size[cdiPioGDsaMaxRank] = { gridptr->y.size, gridptr->x.size }, local_start[cdiPioGDsaMaxRank]; + int local_size[cdiPioGDsaMaxRank]; + Xt_idxlist *partDescClient2D = (Xt_idxlist *) (Malloc((size_t) numClientsInGroup * sizeof(*partDescClient2D))); + for (size_t rankOfs = 0; rankOfs < (size_t) numClientsInGroup; ++rankOfs) + { + for (size_t dim = 0; dim < cdiPioGDsaMaxRank; ++dim) + { + local_size[dim] = chunks[cdiPioGDsaMaxRank * rankOfs + dim].size; + local_start[dim] = (Xt_int) chunks[cdiPioGDsaMaxRank * rankOfs + dim].first; + } + partDescClient2D[rankOfs] = xt_idxsection_new(0, cdiPioGDsaMaxRank, global_size, local_size, local_start); + } + partDesc2D = xt_idxlist_collection_new(partDescClient2D, numClientsInGroup); + partDescY = partDescX = NULL; + for (size_t rankOfs = 0; rankOfs < (size_t) numClientsInGroup; ++rankOfs) xt_idxlist_delete(partDescClient2D[rankOfs]); + Free(partDescClient2D); + } + else + { + Xt_int global_size[cdiPioGDsaMaxRank] = { gridptr->y.size, gridptr->x.size }, local_start[cdiPioGDsaMaxRank]; + int local_size[cdiPioGDsaMaxRank]; + /* describe 2D decomposition via section for later collection + * construction */ + Xt_idxlist *partDescClient2D = (Xt_idxlist *) (Malloc((size_t) numClientsInGroup * sizeof(*partDescClient2D))); + /* describe x- and y-decomposition via stripes */ + struct Xt_stripe(*stripes)[numClientsInGroup] + = (struct Xt_stripe(*)[numClientsInGroup])(Malloc((size_t) numClientsInGroup * 2 * sizeof(*stripes))); + for (size_t rankOfs = 0; rankOfs < (size_t) numClientsInGroup; ++rankOfs) + { + for (size_t dim = 0; dim < cdiPioGDsaMaxRank; ++dim) + { + size_t chunkDimRankOfs = cdiPioGDsaMaxRank * rankOfs + dim; + local_size[dim] = chunks[chunkDimRankOfs].size; + local_start[dim] = (Xt_int) chunks[chunkDimRankOfs].first; + } + partDescClient2D[rankOfs] = xt_idxsection_new(0, cdiPioGDsaMaxRank, global_size, local_size, local_start); + for (size_t i = cdiPioGDdtX; i <= cdiPioGDdtY; ++i) + stripes[i][rankOfs] = (struct Xt_stripe){ .start = (Xt_int) chunks[cdiPioGDsaMaxRank * rankOfs + i].first, + .stride = 1, + .nstrides = (int) chunks[cdiPioGDsaMaxRank * rankOfs + i].size }; + } + partDesc2D = xt_idxlist_collection_new(partDescClient2D, numClientsInGroup); + partDescX = xt_idxstripes_new(stripes[cdiPioGDdtX], numClientsInGroup); + partDescY = xt_idxstripes_new(stripes[cdiPioGDdtY], numClientsInGroup); + Free(stripes); + Free(partDescClient2D); + } + cdiPioDistGridInit(gridptr, type, gridptr->size, gridptr->x.size, gridptr->y.size, nvertex, NULL, partDesc2D, partDescX, + partDescY); + if (!irregular) + { + xt_idxlist_delete(partDescY); + xt_idxlist_delete(partDescX); + } + xt_idxlist_delete(partDesc2D); + } + void *buf = NULL; + int extraDimLen[cdiPioGDsaNum] = { + [cdiPioGDsaXVals] = 1, [cdiPioGDsaYVals] = 1, [cdiPioGDsaXBounds] = nvertex, [cdiPioGDsaYBounds] = nvertex, + [cdiPioGDsaArea] = 1, [cdiPioGDsaMask] = 1, [cdiPioGDsaMaskGME] = 1, + }; + /* since we count on Fortran interoperability in other places, void * + * will have a compatible representation to any type */ + typedef void (*saDefFuncType)(grid_t *, void *); + static const saDefFuncType saDefFunc[cdiPioGDsaNum] = { + [cdiPioGDsaXVals] = (saDefFuncType) cdiPioDistGridDefXVals, [cdiPioGDsaYVals] = (saDefFuncType) cdiPioDistGridDefYVals, + [cdiPioGDsaXBounds] = (saDefFuncType) cdiPioDistGridDefXBounds, [cdiPioGDsaYBounds] = (saDefFuncType) cdiPioDistGridDefYBounds, + [cdiPioGDsaArea] = (saDefFuncType) cdiPioDistGridDefArea, [cdiPioGDsaMask] = (saDefFuncType) cdiPioDistGridDefMask, + [cdiPioGDsaMaskGME] = (saDefFuncType) cdiPioDistGridDefMaskGME, + }; + const enum cdiPioGDdistType *distTypes = cdiPioGridDist[!irregular]; + struct cdiPioDistGridExtraData *extraData = (struct cdiPioDistGridExtraData *) gridptr->extraData; + struct PPM_global_array_desc *sub_arrays = extraData->sub_arrays; + for (size_t saIdx = 0; saIdx < cdiPioGDsaNum; ++saIdx) + if (presentFlags & (1 << saIdx)) + { + /* choose chunks to use by decomposition for saIdx */ + size_t decoOfs = (size_t) distTypes[saIdx] % (size_t) 2; + /* sum chunk sizes aggregated on this collector */ + size_t aRank = sub_arrays[saIdx].a_rank; + int numElem = 0; + for (size_t rankOfs = 0; rankOfs < (size_t) numClientsInGroup; ++rankOfs) + numElem += PPM_extents_size(aRank, chunks + decoOfs + chunksPerRank * rankOfs); + numElem *= extraDimLen[saIdx]; + size_t elemSize = cdiPioDistArrayElemSize[saIdx]; + buf = Realloc(buf, (size_t) numElem * elemSize); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, buf, numElem, cdiPioDistArrayCDIDt[saIdx], context); + uint32_t d = cdiCheckSum(cdiPioDistArrayCDIDt[saIdx], numElem, buf), dRef; + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &dRef, 1, CDI_DATATYPE_UINT32, context); + xassert(d == dRef); + saDefFunc[saIdx](gridptr, buf); + } + Free(chunks); + Free(buf); +} + +static inline bool +compareGridVals(size_t numVals, const double *restrict valsRef, const double *restrict valsTest) +{ + bool differ = false; + for (size_t i = 0; i < numVals; ++i) + if (fabs(valsTest[i] - valsRef[i]) > 1.e-10) + { + differ = true; + break; + } + return differ; +} + +static bool +cdiPioDistGridCompareXYvals(grid_t *gridRef, grid_t *gridTest) +{ + bool differ = false; + int xsizeTest = gridTest->x.size, ysizeTest = gridTest->y.size; + if (gridRef->vtable == &cdiPioDistGridVtable && gridTest->vtable == &cdiPioDistGridVtable) + { + if (!differ && xsizeTest > 0 && xsizeTest == gridRef->vtable->inqXVals(gridRef, NULL)) + { + const double *restrict xvalsRef = gridRef->x.vals, *restrict xvalsTest = gridTest->x.vals; + differ = compareGridVals((size_t) xsizeTest, xvalsRef, xvalsTest); + } + + if (!differ && ysizeTest > 0 && ysizeTest == gridRef->vtable->inqYVals(gridRef, NULL)) + { + const double *restrict yvalsRef = gridRef->y.vals, *restrict yvalsTest = gridTest->y.vals; + differ = compareGridVals((size_t) ysizeTest, yvalsRef, yvalsTest); + } + int differReduce = differ; + xmpi(MPI_Allreduce(MPI_IN_PLACE, &differReduce, 1, MPI_INT, MPI_LOR, commInqCommCalc())); + differ = differReduce; + } + else + { + if (xsizeTest != gridRef->vtable->inqXVals(gridRef, NULL) || ysizeTest != gridRef->vtable->inqYVals(gridRef, NULL)) + { + differ = true; + } + else + { + /* warn about grid compare of distributed vs. undistributed grid */ + Warning("efficiency: comparing data of distributed " + "vs. non-distributed grid!"); + double *valsRefCopy = Malloc((size_t) MAX(xsizeTest, ysizeTest) * sizeof(double)); + /* fetch X data */ + gridRef->vtable->inqXVals(gridRef, valsRefCopy); + differ = compareGridVals((size_t) xsizeTest, valsRefCopy, gridTest->vtable->inqXValsPtr(gridTest)); + if (!differ) + { + gridRef->vtable->inqYVals(gridRef, valsRefCopy); + differ = compareGridVals((size_t) ysizeTest, valsRefCopy, gridTest->vtable->inqYValsPtr(gridTest)); + } + /* todo: handle this collectively, i.e. only compare + * indices from chunk and allreduce result */ + Free(valsRefCopy); + } + } + return differ; +} + +static struct gridVirtTable cdiPioDistGridVtable = { + .destroy = cdiPioDistGridDestroy, + .copy = cdiPioDistGridCopy, + .copyArrayFields = cdiPioDistGridCopyArrays, + .defXVals = cdiPioDistGridDefXVals, + .defYVals = cdiPioDistGridDefYVals, + .defMask = cdiPioDistGridDefMask, + .defMaskGME = cdiPioDistGridDefMaskGME, + .defXBounds = cdiPioDistGridDefXBounds, + .defYBounds = cdiPioDistGridDefYBounds, + .defArea = cdiPioDistGridDefArea, + .inqXVal = cdiPioDistGridInqXVal, + .inqYVal = cdiPioDistGridInqYVal, + .inqXVals = cdiPioDistGridInqXVals, + .inqYVals = cdiPioDistGridInqYVals, + .inqXValsPtr = cdiPioDistGridInqUnavailableDblPtr, + .inqYValsPtr = cdiPioDistGridInqUnavailableDblPtr, + .inqXInc = cdiPioDistGridInqXInc, + .inqYInc = cdiPioDistGridInqYInc, + .inqArea = cdiPioDistGridInqArea, + .inqAreaPtr = cdiPioDistGridInqUnavailableDblPtr, + .inqMask = cdiPioDistGridInqMask, + .inqMaskGME = cdiPioDistGridInqMaskGME, + .inqXBounds = cdiPioDistGridInqXBounds, + .inqYBounds = cdiPioDistGridInqYBounds, + .inqXBoundsPtr = cdiPioDistGridInqUnavailableDblPtr, + .inqYBoundsPtr = cdiPioDistGridInqUnavailableDblPtr, + .compareXYFull = cdiPioDistGridCompareXYvals, + .txCode = DIST_GRID, + .getPackSizeArrays = cdiPioDistGridPackSizeArrays, + .packArrays = cdiPioDistGridPackArrays, + .unpack = cdiPioDistGridUnpack, + .unpackArrays = cdiPioDistGridUnpackArrays, +}; +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ diff --git a/src/pio_dist_grid.h b/src/pio_dist_grid.h new file mode 100644 index 0000000000000000000000000000000000000000..6976e3ec8d8e6bd1571bda8ec60c22a388b5207d --- /dev/null +++ b/src/pio_dist_grid.h @@ -0,0 +1,18 @@ +#ifndef PIO_DIST_GRID_H +#define PIO_DIST_GRID_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_PPM_DIST_ARRAY_H +void cdiPioDistGridPackAssist(void); + +int cdiPioDistGridUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, + int force_id); + +void cdiPioDistGridFinalizeOnce(int namespace); + +#endif + +#endif diff --git a/src/pio_id_set.h b/src/pio_id_set.h index 8cd677dd6d1214ff117d864965138933f6a289bc..4960b1a383457905682ad3d1ed9f8e0ad6252a6e 100644 --- a/src/pio_id_set.h +++ b/src/pio_id_set.h @@ -9,6 +9,7 @@ #include <stdlib.h> #include "cdi.h" +#include "error.h" #include "dmemory.h" struct idList diff --git a/src/pio_idxlist_cache.c b/src/pio_idxlist_cache.c new file mode 100644 index 0000000000000000000000000000000000000000..6b1c735b0f4052f315c6990adad88afe2ecaf1c8 --- /dev/null +++ b/src/pio_idxlist_cache.c @@ -0,0 +1,211 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <limits.h> +#include <stdlib.h> + +#include <yaxt.h> + +#include "dmemory.h" +#include "error.h" +#include "pio_idxlist_cache.h" + +enum +{ + LRAND48_BITS = 31, +}; +#define MAX_CACHE_SIZE ((((size_t) 1) << LRAND48_BITS) - 1) + +enum cdiPioIdxlistType +{ + CDIPIO_IDXLISTTYPE_EMPTY, + CDIPIO_IDXLISTTYPE_SECTION2D, + CDIPIO_IDXLISTTYPE_SECTION3D, + CDIPIO_IDXLISTTYPE_STRIPES1, +}; + +struct sectionNDDesc +{ + Xt_int wholeShape[3], sliceOrigin[3]; + int sliceShape[3]; +}; + +struct stripes1Desc +{ + Xt_int start; + int nstrides; +}; + +struct idxlistDesc +{ + enum cdiPioIdxlistType type; + union + { + struct sectionNDDesc sectionND; + struct stripes1Desc stripes1; + } desc; + Xt_idxlist idxlist; +}; + +struct cdiPioIdxlistCache +{ + size_t size, numEntries; + struct idxlistDesc entries[]; +}; + +struct cdiPioIdxlistCache * +cdiPioIdxlistCacheNew(size_t sizeEntries) +{ + if (sizeEntries > MAX_CACHE_SIZE) xabort("cache cannot hold more than %zu entries", MAX_CACHE_SIZE); + struct cdiPioIdxlistCache *cache = Malloc(sizeof(struct cdiPioIdxlistCache) + sizeof(struct idxlistDesc) * sizeEntries); + cache->size = sizeEntries; + cache->numEntries = 0; + struct idxlistDesc *restrict entries = cache->entries; + for (size_t i = 0; i < sizeEntries; ++i) entries[i].type = CDIPIO_IDXLISTTYPE_EMPTY; + return cache; +} + +size_t +cdiPioIdxlistCacheGetSize(struct cdiPioIdxlistCache *cache) +{ + return cache ? cache->size : 0; +} + +struct cdiPioIdxlistCache * +cdiPioIdxlistCacheResize(struct cdiPioIdxlistCache *cache, size_t sizeEntries) +{ + size_t cacheSize = cache ? cache->size : 0; + if (sizeEntries > MAX_CACHE_SIZE) xabort("cache cannot hold more than %zu entries", MAX_CACHE_SIZE); + struct cdiPioIdxlistCache *newCache; + if (sizeEntries < cacheSize) + { + struct idxlistDesc *restrict entries = cache->entries; + size_t numEntries = cache->numEntries; + for (size_t i = sizeEntries; i < numEntries; ++i) xt_idxlist_delete(entries[i].idxlist); + cache->numEntries = numEntries > sizeEntries ? sizeEntries : numEntries; + cache->size = sizeEntries; + newCache = Realloc(cache, (sizeEntries ? sizeof(struct cdiPioIdxlistCache) : 0) + sizeof(struct idxlistDesc) * sizeEntries); + } + else if (sizeEntries > cacheSize) + { + newCache = Realloc(cache, sizeof(struct cdiPioIdxlistCache) + sizeof(struct idxlistDesc) * sizeEntries); + if (!cache) newCache->numEntries = 0; + newCache->size = sizeEntries; + struct idxlistDesc *restrict entries = newCache->entries; + for (size_t i = cacheSize; i < sizeEntries; ++i) entries[i].type = CDIPIO_IDXLISTTYPE_EMPTY; + } + else + newCache = cache; + return newCache; +} + +void +cdiPioIdxlistCacheDelete(struct cdiPioIdxlistCache *cache) +{ + if (cache) + { + size_t numEntries = cache->numEntries; + struct idxlistDesc *restrict entries = cache->entries; + for (size_t i = 0; i < numEntries; ++i) xt_idxlist_delete(entries[i].idxlist); + Free(cache); + } +} + +static Xt_idxlist +cdiPioIdxlistCacheAddSectionND(struct cdiPioIdxlistCache *cache, enum cdiPioIdxlistType type, size_t ndims, + const Xt_int wholeShape[], const Xt_int sliceOrigin[], const int sliceShape[]) +{ + size_t cacheSize = cache->size, cacheFill = cache->numEntries, cacheInsertPos; + struct idxlistDesc *restrict entries = cache->entries; + for (size_t i = 0; i < cacheFill; ++i) + if (entries[i].type == type) + { + bool equal = true; + for (size_t j = 0; j < ndims; ++j) + equal &= ((entries[i].desc.sectionND.wholeShape[j] == wholeShape[j]) + & (entries[i].desc.sectionND.sliceOrigin[j] == sliceOrigin[j]) + & (entries[i].desc.sectionND.sliceShape[j] == sliceShape[j])); + if (equal) return entries[i].idxlist; + } + /* at this point it's definite that the requested section is not + * in the cache, determine to replace or append is next */ + if (cacheFill < cacheSize) + { + cacheInsertPos = cacheFill; + cache->numEntries = ++cacheFill; + } + else + { + /* we use lrand48 because it's guaranteed to generate 31 bits + * per call */ + cacheInsertPos = (size_t) (lrand48()); + cacheInsertPos %= cacheSize; + xt_idxlist_delete(entries[cacheInsertPos].idxlist); + } + entries[cacheInsertPos].type = type; + for (size_t j = 0; j < ndims; ++j) + { + entries[cacheInsertPos].desc.sectionND.wholeShape[j] = wholeShape[j]; + entries[cacheInsertPos].desc.sectionND.sliceOrigin[j] = sliceOrigin[j]; + entries[cacheInsertPos].desc.sectionND.sliceShape[j] = sliceShape[j]; + } + entries[cacheInsertPos].idxlist = xt_idxsection_new(0, (int) ndims, wholeShape, sliceShape, sliceOrigin); + return entries[cacheInsertPos].idxlist; +} + +Xt_idxlist +cdiPioIdxlistCacheAddSection2D(struct cdiPioIdxlistCache *cache, const Xt_int wholeShape[2], const Xt_int sliceOrigin[2], + const int sliceShape[2]) +{ + return cdiPioIdxlistCacheAddSectionND(cache, CDIPIO_IDXLISTTYPE_SECTION2D, 2, wholeShape, sliceOrigin, sliceShape); +} + +Xt_idxlist +cdiPioIdxlistCacheAddSection3D(struct cdiPioIdxlistCache *cache, const Xt_int wholeShape[3], const Xt_int sliceOrigin[3], + const int sliceShape[3]) +{ + return cdiPioIdxlistCacheAddSectionND(cache, CDIPIO_IDXLISTTYPE_SECTION3D, 3, wholeShape, sliceOrigin, sliceShape); +} + +Xt_idxlist +cdiPioIdxlistCacheAddStripes1(struct cdiPioIdxlistCache *cache, Xt_int start, int nstrides) +{ + size_t cacheSize = cache->size, cacheFill = cache->numEntries, cacheInsertPos; + struct idxlistDesc *restrict entries = cache->entries; + for (size_t i = 0; i < cacheFill; ++i) + if (entries[i].type == CDIPIO_IDXLISTTYPE_STRIPES1 && entries[i].desc.stripes1.start == start + && entries[i].desc.stripes1.nstrides == nstrides) + return entries[i].idxlist; + /* at this point it's definite that the requested section is not + * in the cache, determine to replace or append is next */ + if (cacheFill < cacheSize) + { + cacheInsertPos = cacheFill; + cache->numEntries = ++cacheFill; + } + else + { + /* we use lrand48 because it's guaranteed to generate 31 bits + * per call */ + cacheInsertPos = (size_t) (lrand48()); + cacheInsertPos %= cacheSize; + xt_idxlist_delete(entries[cacheInsertPos].idxlist); + } + entries[cacheInsertPos].type = CDIPIO_IDXLISTTYPE_STRIPES1; + entries[cacheInsertPos].desc.stripes1.start = start; + entries[cacheInsertPos].desc.stripes1.nstrides = nstrides; + struct Xt_stripe stripe = { .start = start, .stride = 1, .nstrides = nstrides }; + entries[cacheInsertPos].idxlist = xt_idxstripes_new(&stripe, 1); + return entries[cacheInsertPos].idxlist; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ diff --git a/src/pio_idxlist_cache.h b/src/pio_idxlist_cache.h new file mode 100644 index 0000000000000000000000000000000000000000..33a228f37f33118bf7edaea7717d8103766a4461 --- /dev/null +++ b/src/pio_idxlist_cache.h @@ -0,0 +1,36 @@ +#ifndef CDI_PIO_IDXLIST_CACHE_H +#define CDI_PIO_IDXLIST_CACHE_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdlib.h> + +struct cdiPioIdxlistCache *cdiPioIdxlistCacheNew(size_t sizeEntries); + +size_t cdiPioIdxlistCacheGetSize(struct cdiPioIdxlistCache *cache); + +struct cdiPioIdxlistCache *cdiPioIdxlistCacheResize(struct cdiPioIdxlistCache *cache, size_t sizeEntries); + +void cdiPioIdxlistCacheDelete(struct cdiPioIdxlistCache *cache); + +Xt_idxlist cdiPioIdxlistCacheAddSection2D(struct cdiPioIdxlistCache *cache, const Xt_int wholeShape[2], const Xt_int sliceOrigin[2], + const int sliceShape[2]); + +Xt_idxlist cdiPioIdxlistCacheAddSection3D(struct cdiPioIdxlistCache *cache, const Xt_int wholeShape[3], const Xt_int sliceOrigin[3], + const int sliceShape[3]); + +Xt_idxlist cdiPioIdxlistCacheAddStripes1(struct cdiPioIdxlistCache *cache, Xt_int start, int nstrides); + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ diff --git a/src/pio_impl.h b/src/pio_impl.h index 0f0d3cf66139b46296294fa9f00b3be957952645..f3a910975877b35373a31b94c16072e36b07ab8f 100644 --- a/src/pio_impl.h +++ b/src/pio_impl.h @@ -1,11 +1,13 @@ -#ifndef _PIO_IMPL_H -#define _PIO_IMPL_H +#ifndef CDI_PIO_IMPL_H +#define CDI_PIO_IMPL_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <stdbool.h> +#include <sys/types.h> +#include <unistd.h> #include <mpi.h> @@ -15,37 +17,30 @@ enum IO_Server_command { IO_Open_file, IO_Close_file, - IO_Get_fp, IO_Set_fp, IO_Send_buffer, IO_Finalize, + IO_Sync_file, tagKey = 8, /* should be power of 2, must be * larger than IO_Finalize */ }; extern const char *const cdiPioCmdStrTab[]; -static inline size_t -findWriteAccumBufsize() +struct syncMsg { - unsigned long initial_buffersize = 16UL * 1024UL * 1024UL; - const char *p = getenv("BUFSIZE"); - long temp = p ? atol(p) : -1; - unsigned long buffersize = (temp > 0 && (unsigned long) temp > initial_buffersize) ? (unsigned long) temp : initial_buffersize; - return buffersize; -} - -struct dBuffer -{ - size_t wr_pointer; - size_t size; - unsigned char *buffer; + off_t amount; + int fileID, command; }; -typedef int (*valDestroyFunction)(void *); -typedef bool (*eqPredicate)(void *, void *); +/* datatype to communicate an off_t */ +extern MPI_Datatype cdiPioOffsetDt; +/* datatype to communicate a sync message */ +extern MPI_Datatype cdiPioSyncMsgDt; -typedef struct listSet listSet; +void cdiPioLookupOffsetDt(void); +void cdiPioCreateSyncMsgDt(void); +void cdiPioDestroySyncMsgDt(void); struct fileOpTag { @@ -67,24 +62,6 @@ decodeFileOpTag(int tag) return rtag; } -/* pio_dbuffer.c */ -int dbuffer_init(struct dBuffer **, size_t); -int dbuffer_push(struct dBuffer *, const void *, size_t); -size_t dbuffer_data_size(struct dBuffer *); -int dbuffer_reset(struct dBuffer *); -void dbuffer_cleanup(struct dBuffer **); - -/* pio_list_set.c */ -listSet *listSetNew(valDestroyFunction, eqPredicate); -void listSetDelete(listSet *); -int listSetAdd(listSet *, void *); -bool listSetIsEmpty(listSet *); -int listSetRemove(listSet *, int (*predicate)(void *, void *), void *data); -void *listSetGet(listSet *q, int (*predicate)(void *, void *), void *data); - -typedef void (*elemOp)(void *elem, void *data); -void listSetForeach(listSet *q, elemOp func, void *data); - /* pio_mpinonb.c */ void initMPINONB(void); @@ -95,13 +72,13 @@ void cdiPioFileWriteOrderedInit(void); void cdiPioFileWriteAtAllInit(void); /* pio_mpi_fw_at_reblock.c */ -void cdiPioFileWriteAtReblockInit(const struct cdiPioConf *conf); +void cdiPioFileWriteAtReblockInit(void); /* common functionality for file split between collectors and writer(s) */ void pioSendInitialize(void); /* pio_posixasynch.c */ -#ifndef _SX +#ifdef _POSIX_ASYNCHRONOUS_IO void pioWriterAIO(void); #endif diff --git a/src/pio_interface.c b/src/pio_interface.c index 3dbdf3c10a8042dc8464211420e74e8d0146a5ca..32c88efe95290d734a7455ee7cf9c0708e06ad04 100644 --- a/src/pio_interface.c +++ b/src/pio_interface.c @@ -7,10 +7,15 @@ #include <stdbool.h> #include <stdlib.h> #include <stdio.h> +#include <unistd.h> #include <mpi.h> #include <yaxt.h> +#ifdef HAVE_PPM_CORE +#include <ppm/ppm.h> +#endif + #include "cdi.h" #include "cdipio.h" #include "cdi_int.h" @@ -19,6 +24,7 @@ #include "pio.h" #include "pio_client.h" #include "pio_conf.h" +#include "pio_dist_grid.h" #include "pio_id_set.h" #include "pio_impl.h" #include "pio_serialize.h" @@ -28,6 +34,7 @@ #include "pio_server.h" #include "pio_util.h" #include "resource_handle.h" +#include "resource_unpack.h" #include "vlist.h" #include "vlist_var.h" @@ -40,6 +47,7 @@ static struct rdmaWin bool postSet, refuseFuncCall; /** data or meta-data updates on this stream are to be communicated */ bool pendingUpdate; + struct partDescPreset clientDeco; } *txWin = NULL; static struct idList openStreams; @@ -74,15 +82,6 @@ memcpyPackFunc(void *dataDesc, void *buf, int size, int *pos, void *context) /****************************************************/ -struct clientBufferSetup -{ - struct collSpec collectData; - struct clientBufSize *bufSizes; - size_t bufSizesCount; -}; - -/************************************************************************/ - static void modelWinFlushBuffer(size_t streamIdx) { @@ -90,7 +89,15 @@ modelWinFlushBuffer(size_t streamIdx) xassert(streamIdx < numStreams && openStreams.entries[streamIdx] != CDI_UNDEFID && txWin != NULL && txWin[streamIdx].buffer != NULL); - memset(txWin[streamIdx].buffer, 0, txWin[streamIdx].size); +#if 0 + /* for debugging purposes it might be smart to set the whole buffer + * to 0 */ + size_t clearSize = txWin[streamIdx].size; + memset(txWin[streamIdx].buffer, 0, clearSize); +#else + /* but normally, setting the first header record to zero will + * suffice (see below) */ +#endif txWin[streamIdx].head = txWin[streamIdx].buffer + (size_t) txWin[streamIdx].dictSize * sizeof(struct winHeaderEntry); txWin[streamIdx].refuseFuncCall = 0; txWin[streamIdx].dictDataUsed = 1; @@ -113,6 +120,9 @@ cdiPioClientStreamWinInit(int streamID) txWin[streamIdx].win = MPI_WIN_NULL; txWin[streamIdx].buffer = NULL; txWin[streamIdx].postSet = false; + txWin[streamIdx].clientDeco.lists = NULL; + txWin[streamIdx].clientDeco.uids = NULL; + txWin[streamIdx].clientDeco.conversion = NULL; } void @@ -123,12 +133,51 @@ cdiPioClientStreamWinDestroy(int streamID) */ collWaitAll(); size_t streamIdx = indexOfID(&openStreams, streamID); + if (txWin[streamIdx].clientDeco.lists) + { + size_t nVars = (size_t) (vlistNvars(streamInqVlist(streamID))); + cdiPioDestroyPartDescPreset(1, nVars, &txWin[streamIdx].clientDeco); + } if (txWin[streamIdx].postSet) xmpi(MPI_Win_wait(txWin[streamIdx].win)); if (txWin[streamIdx].win != MPI_WIN_NULL) xmpi(MPI_Win_free(&txWin[streamIdx].win)); if (txWin[streamIdx].buffer) xmpi(MPI_Free_mem(txWin[streamIdx].buffer)); removeID(&openStreams, streamID); } +void +cdiPioSetStreamPartDescPreset(int streamID, size_t nVars, const Xt_idxlist *restrict partDesc, const int *restrict conversion) +{ + size_t streamIdx = indexOfID(&openStreams, streamID); + Xt_idxlist *restrict partDescCopy = Malloc(nVars * sizeof(Xt_idxlist)); + Xt_uid *restrict partDescUID = Malloc(nVars * sizeof(Xt_uid)); + for (size_t i = 0; i < nVars; ++i) + { + Xt_uid uid = partDescUID[i] = xt_idxlist_get_uid(partDesc[i]); + for (size_t j = 0; j < i; ++j) + if (partDescUID[j] != uid) + ; + else + { + partDescCopy[i] = partDescCopy[j]; + goto next_index_list; + } + partDescCopy[i] = xt_idxlist_copy(partDesc[i]); + next_index_list:; + } + txWin[streamIdx].clientDeco.uids = partDescUID; + txWin[streamIdx].clientDeco.lists = partDescCopy; + int *restrict conversionCopy = Malloc(nVars * sizeof(*conversion)); + memcpy(conversionCopy, conversion, nVars * sizeof(*conversion)); + txWin[streamIdx].clientDeco.conversion = conversionCopy; +} + +struct partDescPreset +cdiPioGetStreamPartDescPreset(int streamID) +{ + size_t streamIdx = indexOfID(&openStreams, streamID); + return txWin[streamIdx].clientDeco; +} + void cdiPioClientStreamWinCreate(int streamID, struct collSpec *cspec) { @@ -154,6 +203,14 @@ cdiPioClientStreamWinCreate(int streamID, struct collSpec *cspec) xmpi(MPI_Info_free(&no_locks_info)); } +bool +cdiPioClientStreamNeedsFlush(int streamID) +{ + size_t streamIdx = indexOfID(&openStreams, streamID); + xassert(streamIdx != SIZE_MAX); + return txWin[streamIdx].pendingUpdate & !txWin[streamIdx].postSet; +} + /************************************************************************/ static void @@ -167,8 +224,8 @@ modelWinEnqueue(size_t streamIdx, struct winHeaderEntry header, const void *data targetEntry = txWin[streamIdx].dictSize - ++(txWin[streamIdx].dictRPCUsed); if (header.id > 0) { - int offset = header.offset - = (int) roundUpToMultiple((size_t) (txWin[streamIdx].head - txWin[streamIdx].buffer), sizeof(double)); + size_t alignTo = header.id == DATA_HEADER_DOUBLE ? sizeof(double) : sizeof(float); + int offset = header.offset = (int) roundUpToMultiple((size_t) (txWin[streamIdx].head - txWin[streamIdx].buffer), alignTo); MPI_Comm comm = cdiPioInqInterComm(); packFunc((void *) data, txWin[streamIdx].buffer, (int) txWin[streamIdx].size, &offset, &comm); txWin[streamIdx].head = txWin[streamIdx].buffer + offset; @@ -176,19 +233,20 @@ modelWinEnqueue(size_t streamIdx, struct winHeaderEntry header, const void *data else if (header.id == PARTDESCMARKER) { Xt_uid uid = unpackXTUID(header.specific.partDesc.packedUID); - int offset = -1; - /* search if same uid entry has already been enqueued */ - for (int entry = 2; entry < targetEntry; entry += 2) + Xt_idxlist(*restrict partDescPreset) = txWin[streamIdx].clientDeco.lists; + if (!partDescPreset) { - xassert(winDict[entry].id == PARTDESCMARKER); - if (unpackXTUID(winDict[entry].specific.partDesc.packedUID) == uid) + /* search if same uid entry has already been enqueued */ + for (int entry = 2; entry < targetEntry; entry += 2) { - offset = winDict[entry].offset; - break; + xassert(winDict[entry].id == PARTDESCMARKER); + if (unpackXTUID(winDict[entry].specific.partDesc.packedUID) == uid) + { + /* duplicate entries are copied only once per timestep */ + header.offset = winDict[entry].offset; + goto partDescHeaderFinished; + } } - } - if (offset == -1) - { /* not yet used partition descriptor, serialize at * current position */ int position = header.offset = (int) (txWin[streamIdx].head - txWin[streamIdx].buffer); @@ -197,8 +255,15 @@ modelWinEnqueue(size_t streamIdx, struct winHeaderEntry header, const void *data txWin[streamIdx].head = txWin[streamIdx].buffer + position; } else - /* duplicate entries are copied only once per timestep */ - header.offset = offset; + { + int varID = winDict[targetEntry - 1].specific.dataRecord.varID; + Xt_uid(*restrict uids) = txWin[streamIdx].clientDeco.uids; + if (uid != uids[varID] && data != partDescPreset[varID]) + xabort("error: incorrect index list passed to streamWriteVarPart" + " or streamWriteVarPartF!"); + header.offset = -1; + } + partDescHeaderFinished:; } else { @@ -248,30 +313,38 @@ cdiPioRDMAProgress(void) } static void -pioBufferPartData_(int streamID, int varID, const void *packData, valPackFunc packDataFunc, size_t nmiss, Xt_idxlist partDesc) +cdiPioBufferPartData_(int streamID, int varID, int memtype, const void *packData, valPackFunc packDataFunc, size_t nmiss, + Xt_idxlist partDesc) { size_t streamIdx = indexOfID(&openStreams, streamID); xassert(streamIdx != SIZE_MAX); xassert(varID >= 0 && varID < streamInqNvars(streamID)); collWaitAll(); - - struct winHeaderEntry dataHeader = { .id = streamID, .specific.dataRecord = { varID, nmiss }, .offset = -1 }; + int dataHeaderID = memtype == MEMTYPE_DOUBLE ? DATA_HEADER_DOUBLE : DATA_HEADER_FLOAT; + struct winHeaderEntry dataHeader = { .id = dataHeaderID, .specific.dataRecord = { varID, nmiss }, .offset = -1 }; modelWinEnqueue(streamIdx, dataHeader, packData, packDataFunc); { struct winHeaderEntry partHeader = { .id = PARTDESCMARKER, .offset = 0 }; - packXTUID(partHeader.specific.partDesc.packedUID, xt_idxlist_get_uid(partDesc)); + Xt_uid uid = xt_idxlist_get_uid(partDesc); + packXTUID(partHeader.specific.partDesc.packedUID, uid); modelWinEnqueue(streamIdx, partHeader, partDesc, cdiPio_xt_idxlist_pack_wrap); } txWin[streamIdx].refuseFuncCall = 1; } +static inline size_t +memtype2ElemSize(int memtype) +{ + return memtype == MEMTYPE_DOUBLE ? sizeof(double) : sizeof(float); +} + void -pioBufferPartData(int streamID, int varID, const double *data, size_t nmiss, Xt_idxlist partDesc) +cdiPioBufferPartData(int streamID, int varID, int memtype, const void *data, size_t nmiss, Xt_idxlist partDesc) { - int chunk = xt_idxlist_get_num_indices(partDesc); - xassert(chunk <= INT_MAX); - pioBufferPartData_(streamID, varID, &(struct memCpyDataDesc){ data, (size_t) chunk * sizeof(data[0]) }, memcpyPackFunc, nmiss, - partDesc); + size_t chunk = (size_t) (xt_idxlist_get_num_indices(partDesc)); + size_t elemSize = memtype2ElemSize(memtype); + cdiPioBufferPartData_(streamID, varID, memtype, &(struct memCpyDataDesc){ data, chunk * elemSize }, memcpyPackFunc, nmiss, + partDesc); } struct scatterGatherDesc @@ -316,18 +389,18 @@ scatterGatherPackFunc(void *dataDesc, void *buf, int size, int *pos, void *conte } void -cdiPioBufferPartDataGather(int streamID, int varID, const double *data, int numBlocks, const int blocklengths[], +cdiPioBufferPartDataGather(int streamID, int varID, int memtype, const void *data, int numBlocks, const int blocklengths[], const int displacements[], size_t nmiss, Xt_idxlist partDesc) { xassert(numBlocks >= 0); - pioBufferPartData_(streamID, varID, - &(struct scatterGatherDesc){ .data = (void *) data, - .blocklengths = blocklengths, - .displacements = displacements, - .elemSize = sizeof(data[0]), - .numBlocks = (unsigned) numBlocks, - .numElems = (unsigned) xt_idxlist_get_num_indices(partDesc) }, - scatterGatherPackFunc, nmiss, partDesc); + cdiPioBufferPartData_(streamID, varID, memtype, + &(struct scatterGatherDesc){ .data = (void *) data, + .blocklengths = blocklengths, + .displacements = displacements, + .elemSize = memtype2ElemSize(memtype), + .numBlocks = (unsigned) numBlocks, + .numElems = (unsigned) xt_idxlist_get_num_indices(partDesc) }, + scatterGatherPackFunc, nmiss, partDesc); } /************************************************************************/ @@ -363,8 +436,10 @@ cdiPioNoPostCommSetup(void) /*****************************************************************************/ -static int pioNamespace_ = -1; static int xtInitByCDI = 0; +#ifdef HAVE_PPM_CORE +static int ppmInitByCDI = 0; +#endif /* pioInit definition must currently compile even in non-MPI configurations */ /** @@ -402,70 +477,135 @@ pioInit(MPI_Comm commGlob, int nProcsIO, int IOMode, int *pioNamespace, float pa return retcomm; } -static void cdiPioFileWritingInit(const struct cdiPioConf *conf); +static void cdiPioFileWritingInit(void); MPI_Comm cdiPioInit(MPI_Comm commGlob, int confResH, int *pioNamespace) { - int sizeGlob; - namespaceSwitchSet(NSSWITCH_ABORT, NSSW_FUNC(cdiAbortC_MPI)); namespaceSwitchSet(NSSWITCH_WARNING, NSSW_FUNC(cdiPioWarning)); struct cdiPioConf *conf = reshGetVal(confResH, &cdiPioConfOps); + + if (cdiPioExtraNSKeys[cdiPioEKConf] == 0) cdiPioExtraNSKeys[cdiPioEKConf] = cdiNamespaceSwitchNewKey(); + namespaceSwitchSet(cdiPioExtraNSKeys[cdiPioEKConf], NSSW_DATA(conf)); + + /* check I/O method plausibility */ int IOMode = conf->IOMode; if (IOMode < PIO_MINIOMODE || IOMode > PIO_MAXIOMODE) xabort("IOMODE IS NOT VALID."); -#ifdef _SX - if (IOMode == PIO_ASYNCH) xabort("PIO_ASYNCH DOES NOT WORK ON SX."); + if ( +#ifdef _POSIX_ASYNCHRONOUS_IO + !sysconf(_SC_ASYNCHRONOUS_IO) && #endif + IOMode == PIO_ASYNCH) + xabort("CDI-PIO Output method PIO_ASYNCH is unsupported on this system!"); + /* initialize libraries */ +#ifdef HAVE_PPM_CORE + if ((ppmInitByCDI = (!PPM_initialized() || PPM_finalized()))) PPM_initialize(&commGlob, NULL, NULL); +#endif if ((xtInitByCDI = (!xt_initialized() || xt_finalized()))) xt_initialize(commGlob); - int nProcsIO = cdiPioCommInit(commGlob, IOMode, conf->clientServerRole); - sizeGlob = commInqSizeGlob(); - if (((IOMode != PIO_NONE && (nProcsIO <= 0 || nProcsIO > sizeGlob - 1))) || (IOMode == PIO_NONE && nProcsIO != 1)) - xabort("DISTRIBUTION OF TASKS ON PROCS IS NOT VALID.\n" - "nProcsIO=%d, sizeGlob=%d\n", - nProcsIO, sizeGlob); + int pioNamespace_ = namespaceNew(); + int prevNamespace = namespaceGetActive(); + namespaceSetActive(pioNamespace_); + + /* setup communication */ + cdiPioCommInit(commGlob, IOMode, conf->clientServerRole); + int sizeGlob = commInqSizeGlob(); cdiPIOpartInflate_ = conf->partInflate; + namespaceSetActive(prevNamespace); // JUST FOR TEST CASES WITH ONLY ONE MPI TASK - if (commInqSizeGlob() == 1) + if (sizeGlob == 1) { - pioNamespace_ = *pioNamespace = namespaceNew(); + *pioNamespace = pioNamespace_; return commInqCommGlob(); } - reshRemove(confResH, &cdiPioConfOps); + namespaceSetActive(pioNamespace_); + +#ifdef HAVE_PPM_DIST_ARRAY_H + reshDistGridUnpack = cdiPioDistGridUnpack; +#endif + + /* check write buffer size consistency */ + { +#ifdef MPI_SIZE_T + size_t writeAggBufLim = conf->writeAggBufLim; + xmpi(MPI_Allreduce(MPI_IN_PLACE, &conf->writeAggBufLim, 1, MPI_SIZE_T, MPI_MAX, commGlob)); +#else + unsigned long writeAggBufLim = conf->writeAggBufLim; + xmpi(MPI_Allreduce(MPI_IN_PLACE, &writeAggBufLim, 1, MPI_UNSIGNED_LONG, MPI_MAX, commGlob)); +#endif + if (conf->writeAggBufLim != writeAggBufLim) + fprintf(stderr, + "inconsistent write buffer size detected: %zu vs. " +#ifdef MPI_SIZE_T + "%lu\n", +#else + "%zu\n", +#endif + conf->writeAggBufLim, writeAggBufLim); +#ifndef MPI_SIZE_T + conf->writeAggBufLim = writeAggBufLim; +#endif + } + MPI_Comm modelComm; if (commInqIsProcIO()) { + int serverNamespace = pioNamespace_; + namespaceSetActive(serverNamespace); + namespaceSwitchSet(cdiPioExtraNSKeys[cdiPioEKConf], NSSW_DATA(conf)); cdiPioSerializeSetMPI(); - conf->postCommSetupActions(); - cdiPioFileWritingInit(conf); + conf->callbacks[CDIPIO_CALLBACK_POSTCOMMSETUP](); + cdiPioFileWritingInit(); if (commInqRankColl() >= 0) { - cdiPioCollectorMessageLoop(conf); + cdiPioCollectorMessageLoop(); + void (*cdiPioFileWritingFinalize)(void) = namespaceSwitchGet(cdiPioExtraNSKeys[cdiPioEKFileWritingFinalize]).func; cdiPioFileWritingFinalize(); } + reshListDestruct(serverNamespace); +#ifdef HAVE_PPM_DIST_ARRAY_H + if (commInqRankColl() >= 0) cdiPioDistGridFinalizeOnce(serverNamespace); +#endif cdiPioCommFinalize(); if (xtInitByCDI) xt_finalize(); - reshReplace(confResH, conf, &cdiPioConfOps); - return MPI_COMM_NULL; +#ifdef HAVE_PPM_CORE + if (ppmInitByCDI) PPM_finalize(); +#endif + modelComm = MPI_COMM_NULL; + namespaceSetActive(prevNamespace); + namespaceDelete(serverNamespace); } else - cdiPioClientSetup(&pioNamespace_, pioNamespace); - + { + *pioNamespace = pioNamespace_; + cdiPioClientSetup(pioNamespace_, conf); + modelComm = commInqCommModel(); + } + namespaceSetActive(prevNamespace); reshReplace(confResH, conf, &cdiPioConfOps); - xdebug("nProcsGlob=%d, RETURN", sizeGlob); - return commInqCommModel(); + return modelComm; +} + +static void +cdiPioFileWritingFinalizeDefault(void) +{ + xabort("error: failed to setup file writing finalization function!"); } static void -cdiPioFileWritingInit(const struct cdiPioConf *conf) +cdiPioFileWritingInit(void) { + if (cdiPioExtraNSKeys[cdiPioEKFileWritingFinalize] == 0) + cdiPioExtraNSKeys[cdiPioEKFileWritingFinalize] = cdiNamespaceSwitchNewKey(); + + namespaceSwitchSet(cdiPioExtraNSKeys[cdiPioEKFileWritingFinalize], NSSW_FUNC(cdiPioFileWritingFinalizeDefault)); int IOMode = commInqIOMode(); xassert(IOMode != PIO_NONE || commInqSizeGlob() == 1); @@ -474,25 +614,15 @@ cdiPioFileWritingInit(const struct cdiPioConf *conf) { case PIO_NONE: break; case PIO_MPI: initMPINONB(); break; -#ifndef _SX case PIO_ASYNCH: -#endif case PIO_WRITER: pioSendInitialize(); break; case PIO_FPGUARD: initPOSIXFPGUARDSENDRECV(); break; case PIO_MPI_FW_ORDERED: cdiPioFileWriteOrderedInit(); break; case PIO_MPI_FW_AT_ALL: cdiPioFileWriteAtAllInit(); break; - case PIO_MPI_FW_AT_REBLOCK: cdiPioFileWriteAtReblockInit(conf); break; + case PIO_MPI_FW_AT_REBLOCK: cdiPioFileWriteAtReblockInit(); break; } } -static void -cdiPioFileWritingFinalizeDefault(void) -{ - xabort("error: failed to setup file writing finalization function!"); -} - -void (*cdiPioFileWritingFinalize)(void) = cdiPioFileWritingFinalizeDefault; - /*****************************************************************************/ void @@ -510,6 +640,10 @@ pioEndDef(void) xmpi(MPI_Send(buffer, bufferSize, MPI_PACKED, collRank, RESOURCES, comm)); reshPackBufferDestroy(&buffer); } +#if HAVE_PPM_DIST_ARRAY_H + else + cdiPioDistGridPackAssist(); +#endif } /************************************************************************/ @@ -530,10 +664,13 @@ pioFinalize(void) { xdebug("%s", "START"); - /* pioNamespace_ is unchanged on I/O servers */ - if (pioNamespace_ == -1) return; - namespaceDelete(pioNamespace_); - + /* namespace is unchanged on I/O servers */ + int pioNamespace = namespaceGetActive(); + if (pioNamespace == 0) return; + reshListDestruct(pioNamespace); +#ifdef HAVE_PPM_DIST_ARRAY_H + cdiPioDistGridFinalizeOnce(pioNamespace); +#endif int clientRank = commInqRankModel(), numClients = cdiPioCommInqSizeClients(), numColl = commInqSizeColl(), collRank = cdiPioCollRank(clientRank, numClients, numColl); @@ -544,11 +681,35 @@ pioFinalize(void) cdiPioCommFinalize(); idSetDestroy(&openStreams); if (xtInitByCDI) xt_finalize(); +#ifdef HAVE_PPM_CORE + if (ppmInitByCDI) PPM_finalize(); +#endif + namespaceDelete(pioNamespace); xdebug("%s", "RETURN"); } /************************************************************************/ +static void +cdiPioClientStreamIdxWinPost(size_t streamIdx, MPI_Group remoteGroup) +{ + struct winHeaderEntry header = { .id = HEADERSIZEMARKER, + .specific.headerSize = { .numDataEntries = txWin[streamIdx].dictDataUsed, + .numRPCEntries = txWin[streamIdx].dictRPCUsed } }; + struct winHeaderEntry *winDict = (struct winHeaderEntry *) (void *) txWin[streamIdx].buffer; + winDict[0] = header; + xmpi(MPI_Win_post(remoteGroup, MPI_MODE_NOPUT, txWin[streamIdx].win)); + txWin[streamIdx].postSet = true; +} + +void +cdiPioClientStreamWinPost(int streamID) +{ + MPI_Group remoteGroup = cdiPioInqRemoteGroup(); + size_t streamIdx = indexOfID(&openStreams, streamID); + cdiPioClientStreamIdxWinPost(streamIdx, remoteGroup); +} + void pioWriteTimestep(void) { @@ -574,59 +735,73 @@ pioWriteTimestep(void) MPI_Group remoteGroup = cdiPioInqRemoteGroup(); for (size_t streamIdx = 0; streamIdx < nStreams; ++streamIdx) - { - if (openStreams.entries[streamIdx] != CDI_UNDEFID && hasUpdates[streamIdx]) - { - } - else - continue; - struct winHeaderEntry header = { .id = HEADERSIZEMARKER, - .specific.headerSize = { .numDataEntries = txWin[streamIdx].dictDataUsed, - .numRPCEntries = txWin[streamIdx].dictRPCUsed } }; - struct winHeaderEntry *winDict = (struct winHeaderEntry *) (void *) txWin[streamIdx].buffer; - winDict[0] = header; - xmpi(MPI_Win_post(remoteGroup, MPI_MODE_NOPUT, txWin[streamIdx].win)); - txWin[streamIdx].postSet = true; - } + if (openStreams.entries[streamIdx] != CDI_UNDEFID && hasUpdates[streamIdx]) + cdiPioClientStreamIdxWinPost(streamIdx, remoteGroup); Free(hasUpdates); xdebug("%s", "RETURN. messages sent, windows posted"); } void -streamWriteVarPart(int streamID, int varID, const void *data, size_t nmiss, Xt_idxlist partDesc) +cdiPioStreamWriteVarPart_(int streamID, int varID, int memtype, const void *data, int nmiss, Xt_idxlist partDesc) { if (CDI_Debug) Message("streamID = %d varID = %d", streamID, varID); int chunk = xt_idxlist_get_num_indices(partDesc); xassert(chunk == 0 || data); - void (*myStreamWriteVarPart)(int streamID, int varID, const void *data, size_t nmiss, Xt_idxlist partDesc) - = (void (*)(int, int, const void *, int, Xt_idxlist)) namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_PART_).func; + void (*myStreamWriteVarPart)(int streamID, int varID, int memtype, const void *data, int nmiss, Xt_idxlist partDesc) + = (void (*)(int, int, int, const void *, int, Xt_idxlist)) namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_PART_).func; if (!myStreamWriteVarPart) xabort("local part writing is unsupported!"); - myStreamWriteVarPart(streamID, varID, data, nmiss, partDesc); + myStreamWriteVarPart(streamID, varID, memtype, data, nmiss, partDesc); +} + +void +streamWriteVarPart(int streamID, int varID, const double *data, int nmiss, Xt_idxlist partDesc) +{ + cdiPioStreamWriteVarPart_(streamID, varID, MEMTYPE_DOUBLE, data, nmiss, partDesc); } void -streamWriteScatteredVarPart(int streamID, int varID, const void *data, int numBlocks, const int blocklengths[], - const int displacements[], size_t nmiss, Xt_idxlist partDesc) +streamWriteVarPartF(int streamID, int varID, const float *data, int nmiss, Xt_idxlist partDesc) +{ + cdiPioStreamWriteVarPart_(streamID, varID, MEMTYPE_FLOAT, data, nmiss, partDesc); +} + +static void +streamWriteScatteredVarPart_(int streamID, int varID, int memtype, const void *data, int numBlocks, const int blocklengths[], + const int displacements[], int nmiss, Xt_idxlist partDesc) { if (CDI_Debug) Message("streamID = %d varID = %d", streamID, varID); int chunk = xt_idxlist_get_num_indices(partDesc); xassert(chunk == 0 || data); - void (*myStreamWriteScatteredVarPart)(int streamID, int varID, const void *data, int numBlocks, const int blocklengths[], - const int displacements[], size_t nmiss, Xt_idxlist partDesc) - = (void (*)(int, int, const void *, int, const int[], const int[], int, Xt_idxlist)) namespaceSwitchGet( + void (*myStreamWriteScatteredVarPart)(int streamID, int varID, int memtype, const void *data, int numBlocks, + const int blocklengths[], const int displacements[], int nmiss, Xt_idxlist partDesc) + = (void (*)(int, int, int, const void *, int, const int[], const int[], int, Xt_idxlist)) namespaceSwitchGet( NSSWITCH_STREAM_WRITE_SCATTERED_VAR_PART_) .func; if (!myStreamWriteScatteredVarPart) xabort("local part writing is unsupported!"); - myStreamWriteScatteredVarPart(streamID, varID, data, numBlocks, blocklengths, displacements, nmiss, partDesc); + myStreamWriteScatteredVarPart(streamID, varID, memtype, data, numBlocks, blocklengths, displacements, nmiss, partDesc); +} + +void +streamWriteScatteredVarPart(int streamID, int varID, const double *data, int numBlocks, const int blocklengths[], + const int displacements[], int nmiss, Xt_idxlist partDesc) +{ + streamWriteScatteredVarPart_(streamID, varID, MEMTYPE_DOUBLE, data, numBlocks, blocklengths, displacements, nmiss, partDesc); +} + +void +streamWriteScatteredVarPartF(int streamID, int varID, const float *data, int numBlocks, const int blocklengths[], + const int displacements[], int nmiss, Xt_idxlist partDesc) +{ + streamWriteScatteredVarPart_(streamID, varID, MEMTYPE_FLOAT, data, numBlocks, blocklengths, displacements, nmiss, partDesc); } /* diff --git a/src/pio_interface.h b/src/pio_interface.h index 1bf23f9f282ab4de373afd16e9bb418203e9168d..24c6b548e13ba11ce5058fc49a154114e1e8ad9f 100644 --- a/src/pio_interface.h +++ b/src/pio_interface.h @@ -11,8 +11,8 @@ #include "resource_handle.h" #include "pio_rpc.h" -void pioBufferPartData(int streamID, int varID, const double *data, size_t nmiss, Xt_idxlist partDesc); -void cdiPioBufferPartDataGather(int streamID, int varID, const double *data, int numBlocks, const int blocklengths[], +void cdiPioBufferPartData(int streamID, int varID, int memtype, const void *data, size_t nmiss, Xt_idxlist partDesc); +void cdiPioBufferPartDataGather(int streamID, int varID, int memtype, const void *data, int numBlocks, const int blocklengths[], const int displacements[], size_t nmiss, Xt_idxlist partDesc); void pioBufferFuncCall(int streamID, struct winHeaderEntry header, const void *data, valPackFunc dataPackFunc); @@ -27,9 +27,16 @@ void memcpyPackFunc(void *dataDesc, void *buf, int size, int *pos, void *context extern float cdiPIOpartInflate_; +void cdiPioStreamWriteVarPart_(int streamID, int varID, int memtype, const void *data, int nmiss, Xt_idxlist partDesc); + void cdiPioClientStreamWinInit(int streamID); void cdiPioClientStreamWinCreate(int streamID, struct collSpec *cspec); void cdiPioClientStreamWinDestroy(int streamID); +bool cdiPioClientStreamNeedsFlush(int streamID); +void cdiPioClientStreamWinPost(int streamID); + +void cdiPioSetStreamPartDescPreset(int streamID, size_t nVars, const Xt_idxlist partDesc[], const int conversion[]); +struct partDescPreset cdiPioGetStreamPartDescPreset(int streamID); #endif /* diff --git a/src/pio_list_set.c b/src/pio_list_set.c deleted file mode 100644 index 13dafbc39dbfa0b830be7552ee236caf3ef93448..0000000000000000000000000000000000000000 --- a/src/pio_list_set.c +++ /dev/null @@ -1,152 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> - -#include "cdi.h" -#include "dmemory.h" - -#include "pio_impl.h" -#include "pio_util.h" - -struct cons -{ - void *val; - struct cons *next; -}; - -struct listSet -{ - struct cons *head, *tail; - valDestroyFunction valDestroy; - eqPredicate keyCompare; - int count; -}; - -listSet * -listSetNew(valDestroyFunction vD, eqPredicate kC) -{ - listSet *myq; - - myq = (listSet *) Malloc(sizeof(listSet)); - - myq->head = NULL; - myq->tail = NULL; - myq->valDestroy = vD; - myq->keyCompare = kC; - myq->count = 0; - - return myq; -} - -void -listSetDelete(listSet *q) -{ - struct cons *curr, *succ; - - if (q->head) - { - curr = q->head; - - while (curr) - { - succ = curr->next; - (*(q->valDestroy))(curr->val); - Free(curr); - curr = succ; - } - } - - Free(q); - - return; -} - -int -listSetAdd(listSet *q, void *v) -{ - struct cons *newCons; - - { - struct cons *p; - for (p = q->head; p; p = p->next) - // ensure unique keys - if (q->keyCompare(v, p->val)) return -1; - } - - if ((newCons = (struct cons *) Malloc(sizeof(struct cons))) == NULL) - { - perror("pio_listSet: listSetAdd (): Not enough memory"); - /* FIXME: why not abort? */ - return 1; - } - - newCons->val = v; - newCons->next = NULL; - - if (q->tail != NULL) - q->tail->next = newCons; - else - q->head = newCons; - - q->tail = newCons; - - return q->count++; -} - -int -listSetRemove(listSet *q, int (*predicate)(void *, void *), void *data) -{ - struct cons **p; - - for (p = &q->head; *p; p = &(*p)->next) - if (predicate((*p)->val, data)) - { - struct cons *rem = *p; - if (rem == q->tail) q->tail = NULL; - int iret = q->valDestroy(rem->val); - *p = rem->next; - q->count--; - Free(rem); - return iret; - } - return -1; -} - -void * -listSetGet(listSet *q, int (*predicate)(void *, void *), void *data) -{ - struct cons *p; - xassert(q && predicate); - for (p = q->head; p; p = p->next) - if (predicate(p->val, data)) return p->val; - return NULL; -} - -bool -listSetIsEmpty(listSet *q) -{ - return q->head == NULL; -} - -void -listSetForeach(listSet *q, void (*func)(void *elem, void *data), void *data) -{ - struct cons *p; - for (p = q->head; p; p = p->next) func(p->val, data); -} - -/* - * Local Variables: - * c-file-style: "Java" - * c-basic-offset: 2 - * indent-tabs-mode: nil - * show-trailing-whitespace: t - * require-trailing-newline: t - * End: - */ diff --git a/src/pio_mpi_fw_at_all.c b/src/pio_mpi_fw_at_all.c index d0756e03ad0e5c15aed5db6b9c320fff89ca80dc..12b6ce3797091f6bf083c6f2bb72ee4a44383aa0 100644 --- a/src/pio_mpi_fw_at_all.c +++ b/src/pio_mpi_fw_at_all.c @@ -2,6 +2,7 @@ #include "config.h" #endif +#include <assert.h> #include <inttypes.h> #include <limits.h> #include <stdbool.h> @@ -17,33 +18,28 @@ #include "pio_impl.h" #include "pio_util.h" -typedef struct +struct fileMPIFWAA { + char *name; MPI_File fh; int fileID; MPI_Offset pos; - char *name; - int collWriteSize[]; -} aFiledataM; + int *collWriteSize; +}; -static listSet *bibAFiledataM; - -static int -fileIDTest(void *a, void *fileID) -{ - return ((aFiledataM *) a)->fileID == (int) (intptr_t) fileID; -} +static struct fileMPIFWAA *openFiles; +static unsigned openFilesSize, openFilesFill; /***************************************************************/ -static aFiledataM * -initAFiledataFileWriteAtAll(const char *filename, size_t bs) +static void +initAFiledataFileWriteAtAll(struct fileMPIFWAA *of, const char *filename, size_t bs) { MPI_Comm commPio = commInqCommPio(); int sizePio = commInqSizePio(); size_t nameSize = strlen(filename) + 1; - aFiledataM *of = Malloc(sizeof(*of) + sizeof(of->collWriteSize[0]) * (size_t) sizePio + nameSize); - of->name = (char *) ((unsigned char *) of + sizeof(*of) + sizeof(of->collWriteSize[0]) * (size_t) sizePio); + of->collWriteSize = Malloc(sizeof(of->collWriteSize[0]) * (size_t) sizePio); + of->name = Malloc(nameSize); memcpy(of->name, filename, nameSize); MPI_Info open_info = MPI_INFO_NULL; @@ -60,17 +56,13 @@ initAFiledataFileWriteAtAll(const char *filename, size_t bs) xmpi(MPI_File_open(commPio, of->name, MPI_MODE_CREATE | MPI_MODE_WRONLY | MPI_MODE_UNIQUE_OPEN, open_info, &of->fh)); xmpi(MPI_Info_free(&open_info)); of->pos = 0; - - return of; } /***************************************************************/ static int -destroyAFiledataFileWriteAtAll(void *v) +destroyAFiledataFileWriteAtAll(struct fileMPIFWAA *of) { - aFiledataM *of = v; - /* close file */ MPI_Offset endpos, fsize; endpos = of->pos; @@ -81,28 +73,21 @@ destroyAFiledataFileWriteAtAll(void *v) xmpi(MPI_Allreduce(MPI_IN_PLACE, &trailingOctets, 1, MPI_INT, MPI_LOR, commPio)); if (trailingOctets) xmpi(MPI_File_set_size(of->fh, endpos)); int iret = MPI_File_close(&of->fh); - - Free(of); + Free(of->collWriteSize); + Free(of->name); + of->name = NULL; return iret == MPI_SUCCESS ? 0 : -1; } /***************************************************************/ -static bool -compareNamesFileWriteAtAll(void *v1, void *v2) -{ - aFiledataM *afm1 = v1, *afm2 = v2; - return !strcmp(afm1->name, afm2->name); -} - -/***************************************************************/ - static size_t fwFileWriteAtAll(int fileID, const void *buffer, size_t len) { - aFiledataM *of = listSetGet(bibAFiledataM, fileIDTest, (void *) (intptr_t) fileID); - xassert(of && len <= INT_MAX); + assert(fileID >= 0 && (size_t) fileID < openFilesSize && openFiles[fileID].name); + struct fileMPIFWAA *of = openFiles + fileID; + xassert(len <= INT_MAX); MPI_Comm commPio = commInqCommPio(); int sizePio = commInqSizePio(), rankPio = commInqRankPio(); /* find position to write to */ @@ -113,7 +98,6 @@ fwFileWriteAtAll(int fileID, const void *buffer, size_t len) nextWritePos = myPos; for (size_t i = (size_t) rankPio; i < (size_t) sizePio; ++i) nextWritePos += of->collWriteSize[i]; /* write buffer */ - xassert(len <= INT_MAX); xmpi(MPI_File_write_at_all(of->fh, myPos, (void *) buffer, (int) len, MPI_UNSIGNED_CHAR, MPI_STATUS_IGNORE)); of->pos = nextWritePos; return len; @@ -124,54 +108,56 @@ fwFileWriteAtAll(int fileID, const void *buffer, size_t len) static int fcFileWriteAtAll(int fileID) { - aFiledataM *of = listSetGet(bibAFiledataM, fileIDTest, (void *) (intptr_t) fileID); - if (!of) xabort("listSet, fileID=%d not found", fileID); - int iret = listSetRemove(bibAFiledataM, fileIDTest, (void *) (intptr_t) fileID); + assert(fileID >= 0 && (size_t) fileID < openFilesSize && openFiles[fileID].name); + struct fileMPIFWAA *of = openFiles + fileID; + int iret = destroyAFiledataFileWriteAtAll(of); + --openFilesFill; return iret; } /***************************************************************/ -static void -elemCheck(void *q, void *nm) -{ - aFiledataM *afm = q; - const char *name = nm; - - if (!strcmp(name, afm->name)) xabort("Filename %s has already been added to set\n", name); -} static int fowFileWriteAtAll(const char *filename, const char *mode) { - static unsigned long buffersize = 0; - int id; - enum - { - bcastRoot = 0 - }; - MPI_Comm commPio = commInqCommPio(); - int rankPio = commInqRankPio(); - if ((mode[0] != 'w' && mode[0] != 'W') || mode[0] == 0 || mode[1] != 0) xabort("Unsupported mode \"%s\" in parallel file open.", mode); - /* broadcast buffersize to collectors ( just once, for all files )*/ + struct cdiPioConf *conf = cdiPioGetConf(); + + for (size_t i = 0; i < openFilesSize; ++i) + if (openFiles[i].name && !strcmp(openFiles[i].name, filename)) + { + Warning("filename %s is already open!" + " CDI-PIO does not support concurrent access" + " through different filehandles.", + filename); + return CDI_EINVAL; + } - if (!buffersize) + size_t fileID = SIZE_MAX; + if (openFilesSize == openFilesFill) { - if (rankPio == bcastRoot) buffersize = findWriteAccumBufsize(); - xmpi(MPI_Bcast(&buffersize, 1, MPI_UNSIGNED_LONG, bcastRoot, commPio)); + fileID = openFilesSize; + if (openFilesSize == (size_t) INT_MAX + 1) return CDI_ELIMIT; + openFilesSize = openFilesSize ? openFilesSize * 2 : 4; + if (openFilesSize > (size_t) INT_MAX + 1) openFilesSize = (size_t) INT_MAX + 1; + openFiles = Realloc(openFiles, sizeof(*openFiles) * openFilesSize); + for (size_t i = fileID; i < openFilesSize; ++i) openFiles[i].name = NULL; } - - xdebug("buffersize=%lu", buffersize); - - listSetForeach(bibAFiledataM, elemCheck, (void *) filename); - aFiledataM *of = initAFiledataFileWriteAtAll(filename, (size_t) buffersize); - - if ((id = listSetAdd(bibAFiledataM, of)) < 0) xabort("filename %s not unique", of->name); - - of->fileID = id; - return id; + else + { + for (size_t i = 0; i < openFilesSize; ++i) + if (openFiles[i].name == NULL) + { + fileID = i; + break; + } + } + struct fileMPIFWAA *of = openFiles + fileID; + ++openFilesFill; + initAFiledataFileWriteAtAll(of, filename, conf->writeAggBufLim); + return (int) fileID; } /***************************************************************/ @@ -179,13 +165,10 @@ fowFileWriteAtAll(const char *filename, const char *mode) static void finalizeFileWriteAtAll(void) { - if (!listSetIsEmpty(bibAFiledataM)) - xabort("set bibAFiledataM not empty"); + if (openFilesFill) + xabort("files still open on exit!"); else - { - xdebug("%s", "destroy set"); - listSetDelete(bibAFiledataM); - } + Free(openFiles); } /***************************************************************/ @@ -193,14 +176,10 @@ finalizeFileWriteAtAll(void) void cdiPioFileWriteAtAllInit(void) { - bibAFiledataM = listSetNew(destroyAFiledataFileWriteAtAll, compareNamesFileWriteAtAll); - namespaceSwitchSet(NSSWITCH_FILE_OPEN, NSSW_FUNC(fowFileWriteAtAll)); namespaceSwitchSet(NSSWITCH_FILE_CLOSE, NSSW_FUNC(fcFileWriteAtAll)); namespaceSwitchSet(NSSWITCH_FILE_WRITE, NSSW_FUNC(fwFileWriteAtAll)); - cdiPioFileWritingFinalize = finalizeFileWriteAtAll; - - if (bibAFiledataM == NULL) xabort("listSetNew did not succeed"); + namespaceSwitchSet(cdiPioExtraNSKeys[cdiPioEKFileWritingFinalize], NSSW_FUNC(finalizeFileWriteAtAll)); } /* diff --git a/src/pio_mpi_fw_at_reblock.c b/src/pio_mpi_fw_at_reblock.c index a99385d0a7a59212cdb532fa0b4ec169465c53cf..014a8a0433603ef661ee242da221cde9ab24a6d5 100644 --- a/src/pio_mpi_fw_at_reblock.c +++ b/src/pio_mpi_fw_at_reblock.c @@ -50,10 +50,9 @@ struct pendingBufWrite int incoming; }; -typedef struct +struct fileMPIFWAR { MPI_File fh; - int fileID; int numMsg; MPI_Offset pos; char *name; @@ -69,22 +68,17 @@ typedef struct int msgSize; struct IOmsg *msgs; MPI_Request *reqs; - long collWriteSize[]; /* used to allgather sizes of writes - * on different processes */ -} aFiledataM; - -static listSet *bibAFiledataM; + long *collWriteSize; /* used to allgather sizes of writes + * on different processes */ +}; -static int -fileIDTest(void *a, void *fileID) -{ - return ((aFiledataM *) a)->fileID == (int) (intptr_t) fileID; -} +static struct fileMPIFWAR *openFiles; +static unsigned openFilesSize, openFilesFill; /***************************************************************/ static inline void -initReblockPendingMsg(aFiledataM *of, size_t i) +initReblockPendingMsg(struct fileMPIFWAR *of, size_t i) { of->msgs[i].pos = -1; of->msgs[i].len = -1; @@ -112,8 +106,6 @@ lcm(size_t a, size_t b) return a / gcd(a, b) * b; } -static bool largePageAlign; - static size_t getXferBufAlign(const char *path) { @@ -132,8 +124,8 @@ getXferBufAlign(const char *path) return (size_t) align; } -static aFiledataM * -initAFiledataFileWriteAtReblock(const char *filename, size_t bufSize) +static void +initAFiledataFileWriteAtReblock(struct fileMPIFWAR *of, const char *filename, const struct cdiPioConf *conf) { MPI_Comm commPio = commInqCommPio(); int sizePio = commInqSizePio(); @@ -167,12 +159,12 @@ initAFiledataFileWriteAtReblock(const char *filename, size_t bufSize) #undef MINBLOCKSIZE /* ensure block size also meets page and direct I/O buffer * alignment requirements */ - size_t pageSize = cdiGetPageSize(largePageAlign), IOAlign = getXferBufAlign(filename); + size_t pageSize = cdiGetPageSize(conf->largePageAlign), IOAlign = getXferBufAlign(filename); bufBlockAlign = lcm(pageSize, IOAlign); blockSize = lcm(blockSize, bufBlockAlign); } /* round bufSize to next multiple of block size and I/O alignment */ - bufSize = roundUpToMultiple(bufSize, blockSize); + size_t bufSize = roundUpToMultiple(conf->writeAggBufLim, blockSize); size_t numBlockBuf = bufSize / blockSize; assert(blockSize <= INT_MAX && numBlockBuf <= INT_MAX); /* never go less than double-buffering */ @@ -181,12 +173,12 @@ initAFiledataFileWriteAtReblock(const char *filename, size_t bufSize) numBlockBuf = 2; bufSize = blockSize * 2; } - aFiledataM *of = Malloc(sizeof(*of) + sizeof(of->collWriteSize[0]) * (size_t) sizePio + nameSize); + of->collWriteSize = Malloc(sizeof(of->collWriteSize[0]) * (size_t) sizePio); of->fh = fh; - of->name = (char *) ((unsigned char *) of + sizeof(*of) + sizeof(of->collWriteSize[0]) * (size_t) sizePio); + of->name = Malloc(nameSize); memcpy(of->name, filename, nameSize); { - void *ptr; + void *ptr = NULL; int err = posix_memalign(&ptr, bufBlockAlign, bufSize); if (!err) of->blockBuf = ptr; @@ -211,18 +203,15 @@ initAFiledataFileWriteAtReblock(const char *filename, size_t bufSize) for (size_t i = 0; i < (size_t) msgSize; ++i) initReblockPendingMsg(of, i); of->pos = 0; of->numMsg = 0; - return of; } /***************************************************************/ -static void flushReblockBuffer(aFiledataM *of, int blockBufIdx); +static void flushReblockBuffer(struct fileMPIFWAR *of, int blockBufIdx); static int -destroyAFiledataFileWriteAtReblock(void *v) +destroyAFiledataFileWriteAtReblock(struct fileMPIFWAR *restrict of) { - aFiledataM *of = v; - size_t numBlockBuf = (size_t) of->numBlockBuf; /* flush pending buffers */ /** 1. handle all outstanding messages */ @@ -248,22 +237,15 @@ destroyAFiledataFileWriteAtReblock(void *v) Free(of->msgs); Free(of->reqs); Free(of->pending); - Free(of); + Free(of->collWriteSize); + Free(of->name); + of->name = NULL; return iret == MPI_SUCCESS ? 0 : -1; } /***************************************************************/ -static bool -compareNamesFileWriteAtReblock(void *v1, void *v2) -{ - aFiledataM *afm1 = v1, *afm2 = v2; - return !strcmp(afm1->name, afm2->name); -} - -/***************************************************************/ - static inline long lmin(long a, long b) { @@ -271,7 +253,7 @@ lmin(long a, long b) } static void -flushReblockBuffer(aFiledataM *of, int blockBufIdx) +flushReblockBuffer(struct fileMPIFWAR *of, int blockBufIdx) { int blockSize = of->blockSize; unsigned char *blockBuf = of->blockBuf + blockSize * blockBufIdx; @@ -299,14 +281,14 @@ flushReblockBuffer(aFiledataM *of, int blockBufIdx) MPI_Offset ofs = (MPI_Offset) blockSize * (((MPI_Offset) of->pending[blockBufIdx].pass * (MPI_Offset) sizePio * of->numBlockBuf) + (MPI_Offset) blockBufIdx * (MPI_Offset) sizePio + (MPI_Offset) rankPio); - int wsize = of->pos >= ofs + blockSize ? blockSize : (int) (of->pos - ofs); + int wsize = (of->pos >= ofs + blockSize) ? blockSize : (int) (of->pos - ofs); xmpi(MPI_File_write_at(of->fh, ofs, blockBuf, wsize, MPI_UNSIGNED_CHAR, MPI_STATUS_IGNORE)); of->pending[blockBufIdx].pass = -1; of->numMsg = numMsg; } static void -reblockMoreMsgs(aFiledataM *of, int numMsg) +reblockMoreMsgs(struct fileMPIFWAR *of, int numMsg) { /* optimize with MPI_Testsome */ if (of->msgSize == numMsg) @@ -323,8 +305,9 @@ reblockMoreMsgs(aFiledataM *of, int numMsg) static size_t fwFileWriteAtReblock(int fileID, const void *buffer, size_t len) { - aFiledataM *of = listSetGet(bibAFiledataM, fileIDTest, (void *) (intptr_t) fileID); - xassert(of && len <= INT_MAX); + assert(fileID >= 0 && (size_t) fileID < openFilesSize && openFiles[fileID].name); + struct fileMPIFWAR *of = openFiles + fileID; + xassert(len <= INT_MAX); MPI_Comm commPio = commInqCommPio(); int sizePio = commInqSizePio(), rankPio = commInqRankPio(); /* find position to write to */ @@ -431,54 +414,56 @@ fwFileWriteAtReblock(int fileID, const void *buffer, size_t len) static int fcFileWriteAtReblock(int fileID) { - aFiledataM *of = listSetGet(bibAFiledataM, fileIDTest, (void *) (intptr_t) fileID); - if (!of) xabort("listSet, fileID=%d not found", fileID); - int iret = listSetRemove(bibAFiledataM, fileIDTest, (void *) (intptr_t) fileID); + assert(fileID >= 0 && (size_t) fileID < openFilesSize && openFiles[fileID].name); + struct fileMPIFWAR *of = openFiles + fileID; + int iret = destroyAFiledataFileWriteAtReblock(of); + --openFilesFill; return iret; } /***************************************************************/ -static void -elemCheck(void *q, void *nm) -{ - aFiledataM *afm = q; - const char *name = nm; - - if (!strcmp(name, afm->name)) xabort("Filename %s has already been added to set\n", name); -} static int fowFileWriteAtReblock(const char *filename, const char *mode) { - static unsigned long buffersize = 0; - int id; - enum - { - bcastRoot = 0 - }; - MPI_Comm commPio = commInqCommPio(); - int rankPio = commInqRankPio(); - if ((mode[0] != 'w' && mode[0] != 'W') || mode[0] == 0 || mode[1] != 0) xabort("Unsupported mode \"%s\" in parallel file open.", mode); - /* broadcast buffersize to collectors ( just once, for all files )*/ + const struct cdiPioConf *conf = cdiPioGetConf(); + + for (size_t i = 0; i < openFilesSize; ++i) + if (openFiles[i].name && !strcmp(openFiles[i].name, filename)) + { + Warning("filename %s is already open!" + " CDI-PIO does not support concurrent access" + " through different filehandles.", + filename); + return CDI_EINVAL; + } - if (!buffersize) + size_t fileID = SIZE_MAX; + if (openFilesSize == openFilesFill) { - if (rankPio == bcastRoot) buffersize = findWriteAccumBufsize(); - xmpi(MPI_Bcast(&buffersize, 1, MPI_UNSIGNED_LONG, bcastRoot, commPio)); + fileID = openFilesSize; + if (openFilesSize == (size_t) INT_MAX + 1) return CDI_ELIMIT; + openFilesSize = openFilesSize ? openFilesSize * 2 : 4; + if (openFilesSize > (size_t) INT_MAX + 1) openFilesSize = (size_t) INT_MAX + 1; + openFiles = Realloc(openFiles, sizeof(*openFiles) * openFilesSize); + for (size_t i = fileID; i < openFilesSize; ++i) openFiles[i].name = NULL; } - - xdebug("buffersize=%lu", buffersize); - - listSetForeach(bibAFiledataM, elemCheck, (void *) filename); - aFiledataM *of = initAFiledataFileWriteAtReblock(filename, (size_t) buffersize); - - if ((id = listSetAdd(bibAFiledataM, of)) < 0) xabort("filename %s not unique", of->name); - - of->fileID = id; - return id; + else + { + for (size_t i = 0; i < openFilesSize; ++i) + if (openFiles[i].name == NULL) + { + fileID = i; + break; + } + } + struct fileMPIFWAR *of = openFiles + fileID; + ++openFilesFill; + initAFiledataFileWriteAtReblock(of, filename, conf); + return (int) fileID; } /***************************************************************/ @@ -486,29 +471,21 @@ fowFileWriteAtReblock(const char *filename, const char *mode) static void finalizeFileWriteAtReblock(void) { - if (!listSetIsEmpty(bibAFiledataM)) - xabort("set bibAFiledataM not empty"); + if (openFilesFill) + xabort("files still open on exit!"); else - { - xdebug("%s", "destroy set"); - listSetDelete(bibAFiledataM); - } + Free(openFiles); } /***************************************************************/ void -cdiPioFileWriteAtReblockInit(const struct cdiPioConf *conf) +cdiPioFileWriteAtReblockInit(void) { - bibAFiledataM = listSetNew(destroyAFiledataFileWriteAtReblock, compareNamesFileWriteAtReblock); namespaceSwitchSet(NSSWITCH_FILE_OPEN, NSSW_FUNC(fowFileWriteAtReblock)); namespaceSwitchSet(NSSWITCH_FILE_CLOSE, NSSW_FUNC(fcFileWriteAtReblock)); namespaceSwitchSet(NSSWITCH_FILE_WRITE, NSSW_FUNC(fwFileWriteAtReblock)); - cdiPioFileWritingFinalize = finalizeFileWriteAtReblock; - - largePageAlign = conf->largePageAlign; - - if (bibAFiledataM == NULL) xabort("listSetNew did not succeed"); + namespaceSwitchSet(cdiPioExtraNSKeys[cdiPioEKFileWritingFinalize], NSSW_FUNC(finalizeFileWriteAtReblock)); } /* diff --git a/src/pio_mpi_fw_ordered.c b/src/pio_mpi_fw_ordered.c index a9061789148704a43ebcfd50ab1aa1635bda0b82..1944da001bc27841b0f1d4781b530b6a63f7c595 100644 --- a/src/pio_mpi_fw_ordered.c +++ b/src/pio_mpi_fw_ordered.c @@ -2,6 +2,7 @@ #include "config.h" #endif +#include <assert.h> #include <inttypes.h> #include <limits.h> #include <stdbool.h> @@ -17,29 +18,24 @@ #include "pio_impl.h" #include "pio_util.h" -typedef struct +struct fileMPIFWO { + char *name; MPI_File fh; int fileID; - char name[]; -} aFiledataM; +}; -static listSet *bibAFiledataM; - -static int -fileIDTest(void *a, void *fileID) -{ - return ((aFiledataM *) a)->fileID == (int) (intptr_t) fileID; -} +static struct fileMPIFWO *openFiles; +static unsigned openFilesSize, openFilesFill; /***************************************************************/ -static aFiledataM * -initAFiledataFileWriteOrdered(const char *filename, size_t bs) +static void +initAFiledataFileWriteOrdered(struct fileMPIFWO *of, const char *filename, size_t bs) { MPI_Comm commPio = commInqCommPio(); - aFiledataM *of = Malloc(sizeof(*of) + strlen(filename) + 1); - + size_t nameSize = strlen(filename) + 1; + of->name = Malloc(nameSize); strcpy(of->name, filename); MPI_Info open_info = MPI_INFO_NULL; @@ -55,16 +51,13 @@ initAFiledataFileWriteOrdered(const char *filename, size_t bs) } xmpi(MPI_File_open(commPio, of->name, MPI_MODE_CREATE | MPI_MODE_WRONLY | MPI_MODE_UNIQUE_OPEN, open_info, &of->fh)); xmpi(MPI_Info_free(&open_info)); - - return of; } /***************************************************************/ static int -destroyAFiledataFileWriteOrdered(void *v) +destroyAFiledataFileWriteOrdered(struct fileMPIFWO *of) { - aFiledataM *of = v; /* close file */ MPI_Offset endpos, fsize; xmpi(MPI_File_get_position_shared(of->fh, &endpos)); @@ -75,28 +68,19 @@ destroyAFiledataFileWriteOrdered(void *v) xmpi(MPI_Allreduce(MPI_IN_PLACE, &trailingOctets, 1, MPI_INT, MPI_LOR, commPio)); if (trailingOctets) xmpi(MPI_File_set_size(of->fh, endpos)); int iret = MPI_File_close(&of->fh); - - Free(of); + Free(of->name); + of->name = NULL; return iret == MPI_SUCCESS ? 0 : -1; } /***************************************************************/ -static bool -compareNamesFileWriteOrdered(void *v1, void *v2) -{ - aFiledataM *afm1 = v1, *afm2 = v2; - return !strcmp(afm1->name, afm2->name); -} - -/***************************************************************/ - static size_t fwFileWriteOrdered(int fileID, const void *buffer, size_t len) { - aFiledataM *of = listSetGet(bibAFiledataM, fileIDTest, (void *) (intptr_t) fileID); - xassert(of); + assert(fileID >= 0 && (size_t) fileID < openFilesSize && openFiles[fileID].name); + struct fileMPIFWO *of = openFiles + fileID; /* write buffer */ xassert(len <= INT_MAX); @@ -110,54 +94,46 @@ fwFileWriteOrdered(int fileID, const void *buffer, size_t len) static int fcFileWriteOrdered(int fileID) { - aFiledataM *of = listSetGet(bibAFiledataM, fileIDTest, (void *) (intptr_t) fileID); - if (!of) xabort("listSet, fileID=%d not found", fileID); - int iret = listSetRemove(bibAFiledataM, fileIDTest, (void *) (intptr_t) fileID); + assert(fileID >= 0 && (size_t) fileID < openFilesSize && openFiles[fileID].name); + struct fileMPIFWO *of = openFiles + fileID; + int iret = destroyAFiledataFileWriteOrdered(of); + --openFilesFill; return iret; } /***************************************************************/ -static void -elemCheck(void *q, void *nm) -{ - aFiledataM *afm = q; - const char *name = nm; - - if (!strcmp(name, afm->name)) xabort("Filename %s has already been added to set\n", name); -} static int fowFileWriteOrdered(const char *filename, const char *mode) { - static unsigned long buffersize = 0; - int id; - enum - { - bcastRoot = 0 - }; - MPI_Comm commPio = commInqCommPio(); - int rankPio = commInqRankPio(); - if ((mode[0] != 'w' && mode[0] != 'W') || mode[0] == 0 || mode[1] != 0) xabort("Unsupported mode \"%s\" in parallel file open.", mode); - /* broadcast buffersize to collectors ( just once, for all files )*/ + struct cdiPioConf *conf = cdiPioGetConf(); - if (!buffersize) + size_t fileID = SIZE_MAX; + if (openFilesSize == openFilesFill) { - if (rankPio == bcastRoot) buffersize = findWriteAccumBufsize(); - xmpi(MPI_Bcast(&buffersize, 1, MPI_UNSIGNED_LONG, bcastRoot, commPio)); + fileID = openFilesSize; + if (openFilesSize == (size_t) INT_MAX + 1) return CDI_ELIMIT; + openFilesSize = openFilesSize ? openFilesSize * 2 : 4; + if (openFilesSize > (size_t) INT_MAX + 1) openFilesSize = (size_t) INT_MAX + 1; + openFiles = Realloc(openFiles, sizeof(*openFiles) * openFilesSize); + for (size_t i = fileID; i < openFilesSize; ++i) openFiles[i].name = NULL; } - - xdebug("buffersize=%lu", buffersize); - - listSetForeach(bibAFiledataM, elemCheck, (void *) filename); - aFiledataM *of = initAFiledataFileWriteOrdered(filename, (size_t) buffersize); - - if ((id = listSetAdd(bibAFiledataM, of)) < 0) xabort("filename %s not unique", of->name); - - of->fileID = id; - return id; + else + { + for (size_t i = 0; i < openFilesSize; ++i) + if (openFiles[i].name == NULL) + { + fileID = i; + break; + } + } + struct fileMPIFWO *of = openFiles + fileID; + ++openFilesFill; + initAFiledataFileWriteOrdered(of, filename, conf->writeAggBufLim); + return (int) fileID; } /***************************************************************/ @@ -165,13 +141,10 @@ fowFileWriteOrdered(const char *filename, const char *mode) static void finalizeFileWriteOrdered(void) { - if (!listSetIsEmpty(bibAFiledataM)) - xabort("set bibAFiledataM not empty"); + if (openFilesFill) + xabort("files still open on exit!"); else - { - xdebug("%s", "destroy set"); - listSetDelete(bibAFiledataM); - } + Free(openFiles); } /***************************************************************/ @@ -179,14 +152,10 @@ finalizeFileWriteOrdered(void) void cdiPioFileWriteOrderedInit(void) { - bibAFiledataM = listSetNew(destroyAFiledataFileWriteOrdered, compareNamesFileWriteOrdered); - namespaceSwitchSet(NSSWITCH_FILE_OPEN, NSSW_FUNC(fowFileWriteOrdered)); namespaceSwitchSet(NSSWITCH_FILE_CLOSE, NSSW_FUNC(fcFileWriteOrdered)); namespaceSwitchSet(NSSWITCH_FILE_WRITE, NSSW_FUNC(fwFileWriteOrdered)); - cdiPioFileWritingFinalize = finalizeFileWriteOrdered; - - if (bibAFiledataM == NULL) xabort("listSetNew did not succeed"); + namespaceSwitchSet(cdiPioExtraNSKeys[cdiPioEKFileWritingFinalize], NSSW_FUNC(finalizeFileWriteOrdered)); } /* diff --git a/src/pio_mpinonb.c b/src/pio_mpinonb.c index f4a09018abeb553b9ba3ed8a57db96d9e4ff9a91..bd04792ddbf29e7924580e2a3cf38cc9930935ff 100644 --- a/src/pio_mpinonb.c +++ b/src/pio_mpinonb.c @@ -2,6 +2,7 @@ #include "config.h" #endif +#include <assert.h> #include <inttypes.h> #include <limits.h> #include <stdbool.h> @@ -14,87 +15,93 @@ #include "namespace.h" #include "pio.h" #include "pio_comm.h" +#include "pio_dbuffer.h" #include "pio_impl.h" #include "pio_util.h" -typedef struct +struct fileMPIFWS { - size_t size; - struct dBuffer *db1; - struct dBuffer *db2; - struct dBuffer *db; + char *name; + struct dBuffer db[2]; MPI_File fh; MPI_Request request; - int fileID; int tsID; - bool finished; - char name[]; -} aFiledataM; - -static listSet *bibAFiledataM; - -static int -fileIDTest(void *a, void *fileID) -{ - return ((aFiledataM *) a)->fileID == (int) (intptr_t) fileID; -} + unsigned dbufIdx; +}; + +static struct fileMPIFWS *openFiles; +static unsigned openFilesSize, openFilesFill; + +/* Open MPI 2.0.2 forgets to set request to MPI_REQUEST_NULL */ +#ifdef OMPI_MINOR_VERSION +#if OMPI_MAJOR_VERSION == 2 && OMPI_MINOR_VERSION == 0 && OMPI_RELEASE_VERSION == 2 +#define POSTWAIT_WORKAROUND(req) req = MPI_REQUEST_NULL +#else +#define POSTWAIT_WORKAROUND(req) +#endif +#else +#define POSTWAIT_WORKAROUND(req) +#endif /***************************************************************/ -static aFiledataM * -initAFiledataMPINONB(const char *filename, size_t bs) +static void +initAFiledataMPINONB(struct fileMPIFWS *of, const char *filename, size_t bufSize) { MPI_Comm commPio = commInqCommPio(); - aFiledataM *of = (aFiledataM *) Malloc(sizeof(*of) + strlen(filename) + 1); - - strcpy(of->name, filename); - of->size = bs; - of->db1 = NULL; - of->db2 = NULL; + { + size_t nameSize = strlen(filename) + 1; + char *name = of->name = Malloc(nameSize); + memcpy(name, filename, nameSize); + } /* init output buffer */ - int iret = dbuffer_init(&(of->db1), of->size); - iret += dbuffer_init(&(of->db2), of->size); - - if (iret > 0) xabort("dbuffer_init did not succeed"); + for (size_t dbufIdx = 0; dbufIdx < 2; ++dbufIdx) cdiPioDbufferInit(of->db + dbufIdx, bufSize); - of->db = of->db1; + of->dbufIdx = 0; - of->tsID = CDI_UNDEFID; + of->tsID = -1; MPI_Info open_info = MPI_INFO_NULL; /* tell IBM PE to buffer just as much as one buffer holds */ { xmpi(MPI_Info_create(&open_info)); char buf_size_str[3 * sizeof(size_t) * CHAR_BIT / 8 + 1]; - snprintf(buf_size_str, sizeof(buf_size_str), "%zu", bs); + snprintf(buf_size_str, sizeof(buf_size_str), "%zu", bufSize); xmpi(MPI_Info_set(open_info, "IBM_io_buffer_size", buf_size_str)); xmpi(MPI_Info_set(open_info, "IBM_largeblock_io", "true")); } xmpi(MPI_File_open(commPio, of->name, MPI_MODE_CREATE | MPI_MODE_WRONLY, open_info, &of->fh)); xmpi(MPI_Info_free(&open_info)); +#ifdef OMPI_MINOR_VERSION + /* Bull X MPI 1.2.x has a defective shared file pointer that can be + * righted with a collective operation, thus we write zero bytes + * from all tasks iff we detect that this is Bull X MPI, which + * fortunately can be found from a mismatch in MPI and OMPI versions. */ +#if OMPI_MAJOR_VERSION == 1 && OMPI_MINOR_VERSION == 2 && MPI_SUBVERSION == 1 +#warning "implementing Bull X MPI work-around" + { + MPI_Status status; + xmpiStat(MPI_File_write_ordered(of->fh, filename, 0, MPI_BYTE, &status), &status); + } +#endif +#endif of->request = MPI_REQUEST_NULL; - of->finished = false; - - return of; } /***************************************************************/ static int -destroyAFiledataMPINONB(void *v) +destroyAFiledataMPINONB(struct fileMPIFWS *of) { int iret = 0; - aFiledataM *of; MPI_Status status; MPI_Offset endpos; - of = (aFiledataM *) v; - - xdebug("IOPE%d: close file %d, name=\"%s\"", commInqRankGlob(), of->fileID, of->name); + xdebug("IOPE%d: close file %d, name=\"%s\"", commInqRankGlob(), (int) (of - openFiles), of->name); /* close file */ - xmpi(MPI_Wait(&of->request, &status)); + xmpiStat(MPI_Wait(&of->request, &status), &status); xmpi(MPI_Barrier(commInqCommPio())); xmpi(MPI_File_get_position_shared(of->fh, &endpos)); xmpi(MPI_File_set_size(of->fh, endpos)); @@ -102,10 +109,10 @@ destroyAFiledataMPINONB(void *v) /* file closed, cleanup */ - dbuffer_cleanup(&(of->db1)); - dbuffer_cleanup(&(of->db2)); - - Free(of); + cdiPioDbufferDestroy(of->db); + cdiPioDbufferDestroy(of->db + 1); + Free(of->name); + of->name = NULL; xdebug("IOPE%d: closed file, cleaned up, return", commInqRankGlob()); @@ -114,50 +121,28 @@ destroyAFiledataMPINONB(void *v) /***************************************************************/ -static bool -compareNamesMPINONB(void *v1, void *v2) -{ - aFiledataM *afm1 = v1, *afm2 = v2; - return !strcmp(afm1->name, afm2->name); -} - -/***************************************************************/ - static void -writeMPINONB(aFiledataM *of) +writeMPINONB(struct fileMPIFWS *of) { - int amount; MPI_Status status; - int fileID = of->fileID; + int fileID = (int) (of - openFiles); /* write buffer */ - - amount = (int) dbuffer_data_size(of->db); + size_t dbufIdx = of->dbufIdx; + int amount = (int) cdiPioDbufferGetPos(of->db + dbufIdx); if (amount == 0) return; xdebug3("IOPI%d: Write buffer, size %d bytes, in", commInqRankGlob(), amount); - xmpi(MPI_Wait(&(of->request), &status)); - xmpi(MPI_File_iwrite_shared(of->fh, of->db->buffer, amount, MPI_UNSIGNED_CHAR, &of->request)); + xmpiStat(MPI_Wait(&of->request, &status), &status); + xmpi(MPI_File_iwrite_shared(of->fh, of->db[dbufIdx].buffer, amount, MPI_UNSIGNED_CHAR, &of->request)); xdebug("%d bytes written for fileID=%d", amount, fileID); /* change outputBuffer */ - dbuffer_reset(of->db); - - if (of->db == of->db1) - { - xdebug3("IOPE%d: fileID=%d, change to buffer 2 ...", commInqRankGlob(), fileID); - of->db = of->db2; - } - else - { - xdebug3("IOPE%d: fileID=%d, change to buffer 1 ...", commInqRankGlob(), fileID); - of->db = of->db1; - } - - return; + cdiPioDbufferReset(of->db + dbufIdx); + of->dbufIdx = (unsigned) (dbufIdx ^ 1); } /***************************************************************/ @@ -165,32 +150,30 @@ writeMPINONB(aFiledataM *of) static size_t fwMPINONB(int fileID, const void *buffer, size_t len, int tsID) { - int error = 0; - int filled = 0; - aFiledataM *of; - int rankPio = commInqRankPio(); - - of = listSetGet(bibAFiledataM, fileIDTest, (void *) (intptr_t) fileID); - xassert(of); + assert(fileID >= 0 && (size_t) fileID < openFilesSize && openFiles[fileID].name); + struct fileMPIFWS *of = openFiles + fileID; bool flush = tsID != of->tsID; if (flush) { - xdebug3("IOPE%d: tsID = %d, flush buffer", rankPio, tsID); + xdebug3("IOPE%d: tsID = %d, flush buffer", commInqRankPio(), tsID); writeMPINONB(of); of->tsID = tsID; MPI_Status status; - xmpi(MPI_Wait(&(of->request), &status)); + xmpiStat(MPI_Wait(&of->request, &status), &status); + POSTWAIT_WORKAROUND(of->request); xmpi(MPI_Barrier(commInqCommPio())); } - filled = dbuffer_push(of->db, (unsigned char *) buffer, len); + size_t dbufIdx = of->dbufIdx; + int filled = cdiPioDbufferAppend(of->db + dbufIdx, buffer, len); xdebug3("IOPE%d: fileID = %d, tsID = %d," " pushed data on buffer, filled = %d", - rankPio, fileID, tsID, filled); + commInqRankPio(), fileID, tsID, filled); + int error = 0; if (filled == 1) { if (flush) @@ -198,8 +181,8 @@ fwMPINONB(int fileID, const void *buffer, size_t len, int tsID) else { writeMPINONB(of); - - error = dbuffer_push(of->db, (unsigned char *) buffer, len); + dbufIdx ^= 1; + error = cdiPioDbufferAppend(of->db + dbufIdx, buffer, len); } } @@ -213,63 +196,64 @@ fwMPINONB(int fileID, const void *buffer, size_t len, int tsID) static int fcMPINONB(int fileID) { - aFiledataM *of; - xdebug("IOPE%d: write buffer, close file and cleanup, in %d", commInqRankPio(), fileID); - if (!(of = listSetGet(bibAFiledataM, fileIDTest, (void *) (intptr_t) fileID))) xabort("listSet, fileID=%d not found", fileID); + assert(fileID >= 0 && (size_t) fileID < openFilesSize && openFiles[fileID].name); + struct fileMPIFWS *of = openFiles + fileID; writeMPINONB(of); MPI_Status status; - xmpi(MPI_Wait(&(of->request), &status)); + xmpiStat(MPI_Wait(&(of->request), &status), &status); + POSTWAIT_WORKAROUND(of->request); /* remove file element */ - int iret = listSetRemove(bibAFiledataM, fileIDTest, (void *) (intptr_t) fileID); + int iret = destroyAFiledataMPINONB(of); + --openFilesFill; return iret; } /***************************************************************/ -static void -elemCheck(void *q, void *nm) -{ - aFiledataM *afm = q; - const char *name = nm; - - if (!strcmp(name, afm->name)) xabort("Filename %s has already been added to set\n", name); -} static int fowMPINONB(const char *filename, const char *mode) { - static unsigned long buffersize = 0; - int id; - enum - { - bcastRoot = 0 - }; - MPI_Comm commPio = commInqCommPio(); - int rankPio = commInqRankPio(); - if ((mode[0] != 'w' && mode[0] != 'W') || mode[0] == 0 || mode[1] != 0) xabort("Unsupported mode \"%s\" in parallel file open.", mode); - /* broadcast buffersize to collectors ( just once, for all files )*/ + struct cdiPioConf *conf = cdiPioGetConf(); + + for (size_t i = 0; i < openFilesSize; ++i) + if (openFiles[i].name && !strcmp(openFiles[i].name, filename)) + { + Warning("filename %s is already open!" + " CDI-PIO does not support concurrent access" + " through different filehandles.", + filename); + return CDI_EINVAL; + } - if (!buffersize) + size_t fileID = SIZE_MAX; + if (openFilesSize == openFilesFill) { - if (rankPio == bcastRoot) buffersize = findWriteAccumBufsize(); - xmpi(MPI_Bcast(&buffersize, 1, MPI_UNSIGNED_LONG, bcastRoot, commPio)); + fileID = openFilesSize; + if (openFilesSize == (size_t) INT_MAX + 1) return CDI_ELIMIT; + openFilesSize = openFilesSize ? openFilesSize * 2 : 4; + if (openFilesSize > (size_t) INT_MAX + 1) openFilesSize = (size_t) INT_MAX + 1; + openFiles = Realloc(openFiles, sizeof(*openFiles) * openFilesSize); + for (size_t i = fileID; i < openFilesSize; ++i) openFiles[i].name = NULL; } - - xdebug("buffersize=%ld", buffersize); - - listSetForeach(bibAFiledataM, elemCheck, (void *) filename); - aFiledataM *of = initAFiledataMPINONB(filename, (size_t) buffersize); - - if ((id = listSetAdd(bibAFiledataM, of)) < 0) xabort("filename %s not unique", of->name); - - xdebug("IOPE%d: name=%s, init and added aFiledataM, return id = %d", rankPio, filename, id); - of->fileID = id; - return id; + else + { + for (size_t i = 0; i < openFilesSize; ++i) + if (openFiles[i].name == NULL) + { + fileID = i; + break; + } + } + struct fileMPIFWS *of = openFiles + fileID; + ++openFilesFill; + initAFiledataMPINONB(of, filename, conf->writeAggBufLim); + return (int) fileID; } /***************************************************************/ @@ -277,13 +261,8 @@ fowMPINONB(const char *filename, const char *mode) static void finalizeMPINONB(void) { - if (!listSetIsEmpty(bibAFiledataM)) - xabort("set bibAFiledataM not empty"); - else - { - xdebug("%s", "destroy set"); - listSetDelete(bibAFiledataM); - } + if (openFilesFill) xabort("files still open on exit!"); + Free(openFiles); } /***************************************************************/ @@ -291,14 +270,10 @@ finalizeMPINONB(void) void initMPINONB(void) { - bibAFiledataM = listSetNew(destroyAFiledataMPINONB, compareNamesMPINONB); - namespaceSwitchSet(NSSWITCH_FILE_OPEN, NSSW_FUNC(fowMPINONB)); namespaceSwitchSet(NSSWITCH_FILE_CLOSE, NSSW_FUNC(fcMPINONB)); namespaceSwitchSet(NSSWITCH_FILE_WRITE, NSSW_FUNC(fwMPINONB)); - cdiPioFileWritingFinalize = finalizeMPINONB; - - if (bibAFiledataM == NULL) xabort("listSetNew did not succeed"); + namespaceSwitchSet(cdiPioExtraNSKeys[cdiPioEKFileWritingFinalize], NSSW_FUNC(finalizeMPINONB)); } /* diff --git a/src/pio_posixasynch.c b/src/pio_posixasynch.c index 47bf441bb9eb8651275b86ad700374609045afa0..82c474eb4096fba2778180ac82b342aa28b014c9 100644 --- a/src/pio_posixasynch.c +++ b/src/pio_posixasynch.c @@ -6,334 +6,557 @@ #include "config.h" #endif -#ifndef _SX +#include <unistd.h> +#ifdef _POSIX_ASYNCHRONOUS_IO #include <aio.h> +#include <assert.h> #include <errno.h> #include <fcntl.h> #include <stdbool.h> +#include <stddef.h> #include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> -#include <unistd.h> #include <mpi.h> #include "pio.h" #include "pio_comm.h" +#include "pio_dbuffer.h" #include "pio_impl.h" #include "pio_util.h" #include "dmemory.h" -typedef struct +#define BUF_UNUSED ((unsigned) -1) +struct fileFunnelAIO { - struct dBuffer *fb; + char *name; + struct dBuffer fb; struct aiocb *ctrlBlks; - off_t offset; - int currOpIndex; - int nextOpIndex; - int prefIndex; - int activeCollectors; - int handle, fileID; - char name[]; -} bFiledataPA; - -static int -fileIDTest(void *a, void *fileID) -{ - return ((bFiledataPA *) a)->fileID == (int) (intptr_t) fileID; -} - -static int nPrefStreams = 4; + struct aiocb **cBP; + /* if bufAssign[i] == BUF_UNUSED, the buffer comprising the bytes in + * fb.buffer[i*writeAggBufLim..(i+1)*writeAggBufLim) are + * available, values 0..aioQueueDepth-1 denote active aio_write + * buffers and higher values in range + * aioQueueDepth..(aioQueueDepth+numCollectors-1) denote active + * receive buffers + */ + unsigned *bufAssign; + off_t *perCollAmounts, offset, syncOffset; + unsigned aioQueueDepth; + unsigned numQueuedWrites; + int activeCollectors, outstandingSync; + int handle; +}; /***************************************************************/ -static bFiledataPA * -initBFiledataPA(char *filename, size_t bs, int nc) +static void +initBFiledataPA(struct fileFunnelAIO *bfd, const char *filename, const struct cdiPioConf *conf, size_t nc) { - bFiledataPA *bfd; - - xdebug("filename=%s, buffersize=%zu, ncollectors=%d, nPrefetchStreams=%d", filename, bs, nc, nPrefStreams); - - bfd = (bFiledataPA *) Malloc(sizeof(*bfd) + strlen(filename) + 1); - strcpy(bfd->name, filename); + size_t bufSize = conf->writeAggBufLim; + size_t aioQueueDepth = conf->aioQueueDepth; + xdebug("filename=%s, buffersize=%zu, ncollectors=%zu, AIO queue depth=%zu", filename, bufSize, nc, aioQueueDepth); + + { + size_t nameSize = strlen(filename) + 1; + off_t *restrict perCollAmounts = bfd->perCollAmounts = Malloc(nc * sizeof(*perCollAmounts) * 2 + nameSize); + char *name = bfd->name = (char *) (bfd->perCollAmounts + nc * 2); + memcpy(name, filename, nameSize); + for (size_t i = 0; i < nc; ++i) + { + perCollAmounts[i] = 0; + perCollAmounts[nc + i] = -1; + } + } if ((bfd->handle = open(bfd->name, O_CREAT | O_WRONLY, 0666)) == -1) xabort("Failed to open %s", bfd->name); - dbuffer_init(&(bfd->fb), (size_t) nPrefStreams * bs); + size_t numBuf = nc + aioQueueDepth; + cdiPioDbufferInit(&bfd->fb, numBuf * bufSize); + unsigned *bufAssign = bfd->bufAssign = Malloc(numBuf * sizeof(*bufAssign)); + for (size_t i = 0; i < numBuf; ++i) bufAssign[i] = BUF_UNUSED; + struct aiocb *ctrlBlks = bfd->ctrlBlks = Calloc(aioQueueDepth, sizeof(*ctrlBlks)), + **cBP = bfd->cBP = Malloc(aioQueueDepth * sizeof(*cBP)); - bfd->ctrlBlks = Calloc((size_t) nPrefStreams, sizeof(bfd->ctrlBlks[0])); - - for (int i = 0; i < nPrefStreams; i++) + for (size_t i = 0; i < aioQueueDepth; i++) { - bfd->ctrlBlks[i].aio_fildes = bfd->handle; - bfd->ctrlBlks[i].aio_buf = bfd->fb->buffer + (size_t) i * bs; - bfd->ctrlBlks[i].aio_reqprio = 0; - bfd->ctrlBlks[i].aio_sigevent.sigev_notify = SIGEV_NONE; + ctrlBlks[i].aio_fildes = bfd->handle; + ctrlBlks[i].aio_reqprio = 0; + ctrlBlks[i].aio_sigevent.sigev_notify = SIGEV_NONE; + cBP[i] = ctrlBlks + i; } - bfd->nextOpIndex = 0; - bfd->prefIndex = 0; + bfd->aioQueueDepth = (unsigned) aioQueueDepth; + bfd->numQueuedWrites = 0; bfd->offset = 0; - bfd->activeCollectors = nc; + bfd->syncOffset = 0; + bfd->activeCollectors = (int) nc; + bfd->outstandingSync = (int) nc; xdebug("filename=%s, opened file, return", bfd->name); - - return bfd; } /***************************************************************/ static int -destroyBFiledataPA(void *v) +destroyBFiledataPA(struct fileFunnelAIO *bfd) { - bFiledataPA *bfd = (bFiledataPA *) v; - const struct aiocb *ccBP[1]; int iret = 0; - ssize_t ssiret; - int nextFinishOp = (bfd->nextOpIndex - bfd->prefIndex + nPrefStreams) % nPrefStreams; + size_t aioQueueDepth = bfd->aioQueueDepth; + size_t numQueuedWrites = bfd->numQueuedWrites; xdebug("filename=%s, cleanup and close file", bfd->name); /* close file */ - - for (; bfd->prefIndex > 0; --(bfd->prefIndex)) + struct aiocb *ctrlBlks = bfd->ctrlBlks, **cBP = bfd->cBP; + while (numQueuedWrites > 0) { - xdebug("file: %s, prefIndex=%d", bfd->name, (int) bfd->prefIndex); - ccBP[0] = (bfd->ctrlBlks + nextFinishOp); + size_t numCBP = 0; + for (size_t i = 0; i < aioQueueDepth; ++i) + if (ctrlBlks[i].aio_buf != NULL) cBP[numCBP++] = ctrlBlks + i; + assert(numCBP == numQueuedWrites); + xdebug("file: %s, numQueuedWrites=%zu", bfd->name, numQueuedWrites); do { - iret = aio_suspend(ccBP, 1, NULL); - if (iret < 0 && errno != EINTR) xabort("aio_suspend () failed"); + iret = aio_suspend((const struct aiocb **) cBP, (int) numQueuedWrites, NULL); + if (iret < 0 && errno != EINTR) xabort("aio_suspend(2) failed"); } while (iret != 0); - - iret = aio_error(bfd->ctrlBlks + nextFinishOp); - if ((ssiret = aio_return(bfd->ctrlBlks + nextFinishOp)) == -1) xabort("aio_return () failed: %s", strerror(iret)); - - nextFinishOp = (nextFinishOp + 1) % nPrefStreams; + for (size_t i = 0; i < numQueuedWrites; ++i) + if ((iret = aio_error(cBP[i])) == 0) + { + if (aio_return(cBP[i]) == -1) + { + errno = iret; + SysError("aio_write(2) failed"); + } + --numQueuedWrites; + cBP[i]->aio_buf = NULL; + } + else if (iret > 0 && iret != EINPROGRESS) + SysError("aio_write(2) failed"); } + bfd->numQueuedWrites = (unsigned) numQueuedWrites; if ((iret = ftruncate(bfd->handle, bfd->offset)) == -1) xabort("failed to truncate file %s: %s", bfd->name, strerror(errno)); - if ((iret = close(bfd->handle)) == -1) xabort("failed to close %s", bfd->name); + if ((iret = close(bfd->handle)) == -1) + { + iret = errno; + Warning("failed to close %s", bfd->name); + } /* file closed, cleanup */ - dbuffer_cleanup(&(bfd->fb)); - + cdiPioDbufferDestroy(&bfd->fb); + Free(bfd->perCollAmounts); + bfd->name = NULL; Free(bfd->ctrlBlks); - Free(bfd); + Free(bfd->cBP); + Free(bfd->bufAssign); xdebug("%s", "closed file and cleaned up, return"); return iret; } -/***************************************************************/ - -static bool -compareNamesBPA(void *v1, void *v2) +struct awComplete { - bFiledataPA *bfd1 = v1, *bfd2 = v2; + size_t bufIdx, cbIdx; +}; - return !strcmp(bfd1->name, bfd2->name); +static struct awComplete +completeSomeAIOWrites(struct fileFunnelAIO *bfd, const struct cdiPioConf *conf) +{ + size_t aioQueueDepth = bfd->aioQueueDepth, numQueuedWrites = bfd->numQueuedWrites; + assert(aioQueueDepth == numQueuedWrites); + /* complete aio_write of at least one control block */ + int iret; + do + { + iret = aio_suspend((const struct aiocb **) bfd->cBP, (int) aioQueueDepth, NULL); + if (iret < 0 && errno != EINTR) xabort("aio_suspend(2) failed"); + } + while (iret != 0); + struct aiocb *ctrlBlks = bfd->ctrlBlks; + size_t bufSize = conf->writeAggBufLim; + /* only initialized to silence the compiler, the semantics of + * aio_suspend guarantee for the loop to find at least one + * completed operation at this point. */ + size_t cbBufIdx = SIZE_MAX, cbIdx = SIZE_MAX; + /* inspect all control blocks for completion */ + unsigned *bufAssign = bfd->bufAssign; + for (size_t i = 0; i < aioQueueDepth; ++i) + if ((iret = aio_error(ctrlBlks + i)) == 0) + { + if (aio_return(ctrlBlks + i) == -1) + { + errno = iret; + SysError("failed aio_write"); + } + --numQueuedWrites; + cbIdx = i; + cbBufIdx = (size_t) (ptrdiff_t) ((unsigned char *) ctrlBlks[i].aio_buf - (unsigned char *) bfd->fb.buffer) / bufSize; + bufAssign[cbBufIdx] = BUF_UNUSED; + ctrlBlks[i].aio_buf = NULL; + } + else if (iret > 0 && iret != EINPROGRESS) + SysError("failed aio_write"); + bfd->numQueuedWrites = (unsigned) numQueuedWrites; + return (struct awComplete){ .bufIdx = cbBufIdx, .cbIdx = cbIdx }; } /***************************************************************/ -static void -writePA(bFiledataPA *bfd, size_t amount) +static size_t +writePA(struct fileFunnelAIO *bfd, int source, size_t nProcsColl, size_t amount, const struct cdiPioConf *conf) { - const struct aiocb *ccBP[1]; - ssize_t iret; + size_t aioQueueDepth = bfd->aioQueueDepth, numQueuedWrites = bfd->numQueuedWrites, numBuf = aioQueueDepth + nProcsColl; xdebug("file %s, in", bfd->name); - bfd->ctrlBlks[bfd->currOpIndex].aio_nbytes = amount; - bfd->ctrlBlks[bfd->currOpIndex].aio_offset = bfd->offset; - - xdebug(" before aio_write(), file %s, aio_nbytes=%zu, aio_offset=%zu", bfd->name, bfd->ctrlBlks[bfd->currOpIndex].aio_nbytes, - bfd->ctrlBlks[bfd->currOpIndex].aio_offset); + struct aiocb *ctrlBlks = bfd->ctrlBlks; + struct awComplete bufReUse; + unsigned *bufAssign = bfd->bufAssign; + if (numQueuedWrites >= aioQueueDepth) + bufReUse = completeSomeAIOWrites(bfd, conf); + else + { + /* silence compiler uninitialized warning */ + bufReUse = (struct awComplete){ SIZE_MAX, SIZE_MAX }; + for (size_t i = 0; i < aioQueueDepth; ++i) + if (ctrlBlks[i].aio_buf == NULL) + { + bufReUse.cbIdx = i; + break; + } + for (size_t i = 0; i < numBuf; ++i) + if (bufAssign[i] == BUF_UNUSED) + { + bufReUse.bufIdx = i; + break; + } + } - iret = aio_write(bfd->ctrlBlks + bfd->currOpIndex); + size_t sourceBufIdx = SIZE_MAX; + for (size_t i = 0; i < numBuf; ++i) + if (bufAssign[i] == (unsigned) ((unsigned) source + aioQueueDepth)) + { + sourceBufIdx = i; + break; + } + assert(sourceBufIdx != SIZE_MAX); + size_t cbIdx = bufReUse.cbIdx, bufSize = conf->writeAggBufLim; + ctrlBlks[cbIdx].aio_buf = bfd->fb.buffer + bufSize * sourceBufIdx; + ctrlBlks[cbIdx].aio_nbytes = amount; + ctrlBlks[cbIdx].aio_offset = bfd->offset; + bufAssign[sourceBufIdx] = (unsigned) cbIdx; + + xdebug("before aio_write(), file %s, aio_nbytes=%zu, aio_offset=%zu", bfd->name, ctrlBlks[cbIdx].aio_nbytes, + ctrlBlks[cbIdx].aio_offset); + + ssize_t iret = aio_write(bfd->ctrlBlks + cbIdx); xdebug("after aio_write(), file %s, aio_nbytes=%zu, aio_offset=%zu," "iret=aio_write()=%d", - bfd->name, bfd->ctrlBlks[bfd->currOpIndex].aio_nbytes, bfd->ctrlBlks[bfd->currOpIndex].aio_offset, (int) iret); + bfd->name, bfd->ctrlBlks[cbIdx].aio_nbytes, bfd->ctrlBlks[cbIdx].aio_offset, (int) iret); if (iret == -1) { - xabort("did not succeed writing buffer"); + SysError("did not succeed writing buffer"); } else xdebug("buffer written to %s", bfd->name); bfd->offset += (off_t) amount; - bfd->prefIndex++; + bfd->perCollAmounts[source] += (off_t) amount; + ++bfd->numQueuedWrites; - if (bfd->prefIndex >= nPrefStreams) - { - ccBP[0] = (bfd->ctrlBlks + bfd->nextOpIndex); - do - { - iret = aio_suspend(ccBP, 1, NULL); - if (iret < 0 && errno != EINTR) xabort("aio_suspend () failed"); - } - while (iret != 0); - - if ((iret = aio_return(bfd->ctrlBlks + bfd->nextOpIndex)) == -1) xabort("aio_return () failed"); - - bfd->prefIndex--; - } + xdebug("filename=%s, numQueuedWrites=%u, return", bfd->name, bfd->numQueuedWrites); + return bufReUse.bufIdx; +} - xdebug("filename=%s, prefIndex=%d, return", bfd->name, bfd->prefIndex); +static size_t +getNextFreeBuf(struct fileFunnelAIO *bfd, size_t nProcsColl, const struct cdiPioConf *conf) +{ + size_t aioQueueDepth = bfd->aioQueueDepth, numQueuedWrites = bfd->numQueuedWrites, numBuf = aioQueueDepth + nProcsColl; + unsigned *bufAssign = bfd->bufAssign; + if (numQueuedWrites < aioQueueDepth) + for (size_t i = 0; i < numBuf; ++i) + if (bufAssign[i] == BUF_UNUSED) return i; + return completeSomeAIOWrites(bfd, conf).bufIdx; } /***************************************************************/ + +enum +{ + /* meta operation indices */ + MOOpenRx, + MOSyncRx, + MOSyncTx, + numMetaOp = 3 +}; + static void -elemCheck(void *q, void *nm) +sendCollSync(struct fileFunnelAIO *bfd, int fileID, MPI_Comm commPio, int nProcsColl, MPI_Request (*req)[nProcsColl], + size_t *numOpenSends, MPI_Status *statui) { - bFiledataPA *bfd = q; - const char *name = nm; + if (*numOpenSends) /* make sure previous sync sends completed */ + xmpiStats(MPI_Waitall(nProcsColl, req[MOSyncTx], statui), nProcsColl, statui); + int sync2CollTag = encodeFileOpTag(fileID, IO_Sync_file); + for (size_t i = 0; i < (size_t) nProcsColl; ++i) + xmpi(MPI_Isend(NULL, 0, MPI_INT, (int) i, sync2CollTag, commPio, req[MOSyncTx] + i)); + *numOpenSends = (size_t) (bfd->outstandingSync = nProcsColl); + bfd->syncOffset = 0; +} - if (!strcmp(name, bfd->name)) xabort("Filename %s has already been inserted\n", name); +static void +funnelFileCleanup(struct fileFunnelAIO *openFileFunnels, int fileID, size_t *openFileFunnelsFill, size_t *maxOpenFileIDp1, + size_t *numOpenRequests, MPI_Comm commPio, int nProcsColl) +{ + xdebug("all are finished with file %d, delete file table entry", fileID); + struct fileFunnelAIO *bfd = openFileFunnels + fileID; + assert(bfd->syncOffset == bfd->offset); + int retval = destroyBFiledataPA(bfd); + --(*openFileFunnelsFill); + if ((size_t) fileID + 1 == *maxOpenFileIDp1) + { + size_t j = (size_t) fileID + 1; + while (j > 0 && !openFileFunnels[j - 1].name) --j; + *maxOpenFileIDp1 = j; + *numOpenRequests = (size_t) nProcsColl * (numMetaOp + *maxOpenFileIDp1); + } + xmpi(MPI_Bcast(&retval, 1, MPI_INT, nProcsColl, commPio)); } -/***************************************************************/ +static inline void +reinstallListenReq(struct fileFunnelAIO *bfd, int fileID, int source, size_t nProcsColl, size_t bufSize, unsigned aioQueueDepth, + MPI_Request (*req)[nProcsColl], MPI_Comm commPio, const struct cdiPioConf *conf) +{ + size_t bufIdx = getNextFreeBuf(bfd, nProcsColl, conf); + int tag = encodeFileOpTag(fileID, IO_Send_buffer); + xmpi(MPI_Irecv(bfd->fb.buffer + bufIdx * bufSize, (int) bufSize, MPI_UNSIGNED_CHAR, source, tag, commPio, + req[numMetaOp + fileID] + source)); + bfd->bufAssign[bufIdx] = aioQueueDepth + (unsigned) source; +} void pioWriterAIO(void) { - bFiledataPA *bfd; - listSet *bibBFiledataPA; + size_t openFileFunnelsSize = 1, openFileFunnelsFill = 0; + struct fileFunnelAIO *openFileFunnels = Malloc(sizeof(*openFileFunnels) * openFileFunnelsSize); + for (size_t i = 0; i < openFileFunnelsSize; ++i) openFileFunnels[i].name = NULL; MPI_Comm commPio = commInqCommPio(); int nProcsColl = commInqSizeColl(); + const struct cdiPioConf *conf = cdiPioGetConf(); + unsigned aioQueueDepth = conf->aioQueueDepth; + size_t bufSize = conf->writeAggBufLim; - if (nPrefStreams < 1) xabort("USAGE: # PREFETCH STREAMS >= 1"); + assert(aioQueueDepth >= 1); xdebug("nProcsColl=%d ", nProcsColl); - bibBFiledataPA = listSetNew(destroyBFiledataPA, compareNamesBPA); - bool *sentFinalize = Calloc((size_t) nProcsColl, sizeof(sentFinalize[0])); + int outstandingFinalizations = nProcsColl; + + int intPackSize; + xmpi(MPI_Pack_size(2, MPI_INT, commPio, &intPackSize)); + size_t maxPathLen = (size_t) conf->maxPathLen, openMsgSize = (size_t) intPackSize + maxPathLen; + assert(openMsgSize <= INT_MAX); + unsigned char *restrict openReqBuffer = Malloc((size_t) nProcsColl * openMsgSize + maxPathLen + 1); + char *filename = (char *) (openReqBuffer + (size_t) nProcsColl * openMsgSize); + struct syncMsg *syncMsgs = Malloc((size_t) nProcsColl * sizeof(*syncMsgs)); + /* array of requests first one open request per collector, then one + * sync receive (close, finalize) request per collector and one for + * sending sync messages, i.e. 3 rows of fixed meaning followed by + * one request per file and collector, i.e. number of open files + * rows. This array essentially describes all the messages + * concurrently in flight: open/sync/close/shutdown requests and + * data record aggregates for each file */ + MPI_Request(*req)[nProcsColl] = Malloc(sizeof(*req) * (numMetaOp + openFileFunnelsSize)); + MPI_Status *statui = Malloc(sizeof(*statui) * (size_t) nProcsColl * (numMetaOp + openFileFunnelsSize)), + *wstats = Malloc(sizeof(*wstats) * (size_t) nProcsColl); + int numCompleted, *completed = Malloc(sizeof(*completed) * (size_t) nProcsColl * (numMetaOp + openFileFunnelsSize)); + size_t numOpenSends = 0, maxOpenFileIDp1 = 0, numOpenRequests = (size_t) nProcsColl * (numMetaOp + maxOpenFileIDp1); + for (size_t i = 0; i < (size_t) nProcsColl; ++i) + { + xmpi(MPI_Irecv(openReqBuffer + i * openMsgSize, (int) openMsgSize, MPI_PACKED, (int) i, IO_Open_file, commPio, + req[MOOpenRx] + i)); + xmpi(MPI_Irecv(syncMsgs + i, 1, cdiPioSyncMsgDt, (int) i, IO_Sync_file, commPio, req[MOSyncRx] + i)); + req[MOSyncTx][i] = MPI_REQUEST_NULL; + } + for (size_t j = 0; j < openFileFunnelsSize; ++j) + for (size_t i = 0; i < (size_t) nProcsColl; ++i) req[numMetaOp + j][i] = MPI_REQUEST_NULL; for (;;) { - MPI_Status status; - xmpiStat(MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, commPio, &status), &status); - - int source = status.MPI_SOURCE; - int tag = status.MPI_TAG; - struct fileOpTag rtag = decodeFileOpTag(tag); - - int messagesize; - xmpi(MPI_Get_count(&status, MPI_UNSIGNED_CHAR, &messagesize)); - - xdebug("receive message from source=%d, id=%d, command=%d ( %s ), " - "messagesize=%d", - source, rtag.id, rtag.command, cdiPioCmdStrTab[rtag.command], messagesize); - - switch (rtag.command) + assert(numOpenRequests <= INT_MAX); + xmpiStats(MPI_Waitsome((int) numOpenRequests, *req, &numCompleted, completed, statui), numCompleted, statui); + for (size_t cmpltIdx = 0; cmpltIdx < (size_t) numCompleted; ++cmpltIdx) { - case IO_Open_file: - { - unsigned char *messageBuffer = Malloc((size_t) messagesize * sizeof(messageBuffer[0])), *pMB = messageBuffer; - - xmpi(MPI_Recv(messageBuffer, messagesize, MPI_UNSIGNED_CHAR, source, tag, commPio, &status)); - - char *filename = (char *) pMB; - pMB += (strlen(filename) + 1); - char *temp = (char *) pMB; - long buffersize = strtol(temp, NULL, 16); - pMB += (strlen(temp) + 1); - size_t amount = (size_t) (messageBuffer + messagesize - pMB); + int rcvIdx = completed[cmpltIdx]; + int source = rcvIdx % nProcsColl; + int command; + switch (rcvIdx / nProcsColl) + { + case MOOpenRx: command = IO_Open_file; break; + case MOSyncRx: command = syncMsgs[source].command; break; + case MOSyncTx: --numOpenSends; continue; + default: command = IO_Send_buffer; + } - xdebug("command %s, filename=%s, buffersize=%ld, amount=%zd", cdiPioCmdStrTab[rtag.command], filename, buffersize, - amount); + xdebug("receive message from source=%d, command=%d (%s)", source, command, cdiPioCmdStrTab[command]); - if (!(bfd = listSetGet(bibBFiledataPA, fileIDTest, (void *) (intptr_t) rtag.id))) + switch (command) + { + case IO_Open_file: { - listSetForeach(bibBFiledataPA, elemCheck, filename); - bfd = initBFiledataPA(filename, (size_t) buffersize, nProcsColl); - int id; - if ((id = listSetAdd(bibBFiledataPA, bfd)) < 0) xabort("fileID=%d not unique", rtag.id); - bfd->fileID = id; + int openMsgHdr[2]; + int position = 0; + unsigned char *reqBuffer = openReqBuffer + (size_t) source * openMsgSize; + xmpi(MPI_Unpack(reqBuffer, (int) openMsgSize, &position, openMsgHdr, 2, MPI_INT, commPio)); + size_t len = (size_t) openMsgHdr[1]; + assert(len <= maxPathLen); + xmpi(MPI_Unpack(reqBuffer, (int) openMsgSize, &position, filename, openMsgHdr[1], MPI_CHAR, commPio)); + filename[len] = '\0'; + size_t buffersize = conf->writeAggBufLim; + xdebug("command %s, filename=%s, buffersize=%zu", cdiPioCmdStrTab[command], filename, buffersize); + + int fileID = openMsgHdr[0]; + size_t prevOpenFileFunnelsSize = openFileFunnelsSize; + if (openFileFunnelsSize <= (unsigned) fileID) + { + while (openFileFunnelsSize <= (unsigned) fileID) openFileFunnelsSize *= 2; + if (openFileFunnelsSize > (unsigned) INT_MAX + 1) openFileFunnelsSize = (unsigned) INT_MAX + 1; + openFileFunnels = Realloc(openFileFunnels, sizeof(*openFileFunnels) * openFileFunnelsSize); + for (size_t i = prevOpenFileFunnelsSize; i < openFileFunnelsSize; ++i) openFileFunnels[i].name = NULL; + req = Realloc(req, sizeof(*req) * (openFileFunnelsSize + numMetaOp)); + statui = Realloc(statui, sizeof(*statui) * (size_t) nProcsColl * (openFileFunnelsSize + numMetaOp)); + completed = Realloc(completed, sizeof(*completed) * (size_t) nProcsColl * (openFileFunnelsSize + numMetaOp)); + for (size_t j = prevOpenFileFunnelsSize; j < openFileFunnelsSize; ++j) + for (size_t i = 0; i < (size_t) nProcsColl; ++i) req[numMetaOp + j][i] = MPI_REQUEST_NULL; + maxOpenFileIDp1 = (size_t) fileID + 1; + } + else if (maxOpenFileIDp1 < (size_t) fileID + 1) + maxOpenFileIDp1 = (size_t) fileID + 1; + struct fileFunnelAIO *bfd = openFileFunnels + fileID; + if (!bfd->name) + { + for (size_t i = 0; i < prevOpenFileFunnelsSize; ++i) + if (openFileFunnels[i].name && !strcmp(openFileFunnels[i].name, filename)) + xabort("filename %s is already open!" + " CDI-PIO does not support concurrent access" + " through different filehandles.", + filename); + initBFiledataPA(bfd, filename, conf, (size_t) nProcsColl); + ++openFileFunnelsFill; + } + else if (strcmp(filename, bfd->name) != 0) + xabort("filename is not consistent, fileID=%d," + " \"%s\" vs. \"%s\"", + fileID, filename, bfd->name); + reinstallListenReq(bfd, fileID, source, (size_t) nProcsColl, bufSize, aioQueueDepth, req, commPio, conf); + xmpi(MPI_Irecv(reqBuffer, (int) openMsgSize, MPI_PACKED, source, IO_Open_file, commPio, req[MOOpenRx] + source)); + numOpenRequests = (size_t) nProcsColl * (numMetaOp + maxOpenFileIDp1); } - else if (strcmp(filename, bfd->name) != 0) - xabort("filename is not consistent, fileID=%d", rtag.id); - - bfd->currOpIndex = bfd->nextOpIndex; - bfd->nextOpIndex = (bfd->nextOpIndex + 1) % nPrefStreams; + break; - memcpy((void *) bfd->ctrlBlks[bfd->currOpIndex].aio_buf, pMB, (size_t) amount); - - writePA(bfd, amount); - - Free(messageBuffer); - } - break; - - case IO_Send_buffer: - - if (!(bfd = listSetGet(bibBFiledataPA, fileIDTest, (void *) (intptr_t) rtag.id))) - xabort("fileID=%d is not in set", rtag.id); - - xdebug("command: %s, id=%d, name=%s", cdiPioCmdStrTab[rtag.command], rtag.id, bfd->name); - - bfd->currOpIndex = bfd->nextOpIndex; - bfd->nextOpIndex = (bfd->nextOpIndex + 1) % nPrefStreams; - - xmpi(MPI_Recv((void *) bfd->ctrlBlks[bfd->currOpIndex].aio_buf, messagesize, MPI_UNSIGNED_CHAR, source, tag, commPio, - &status)); - writePA(bfd, (size_t) messagesize); - break; - - case IO_Close_file: - - if (!(bfd = listSetGet(bibBFiledataPA, fileIDTest, (void *) (intptr_t) rtag.id))) - xabort("fileID=%d is not in set", rtag.id); - - xdebug(" command %s, id=%d, name=%s", cdiPioCmdStrTab[rtag.command], rtag.id, bfd->name); - - bfd->currOpIndex = bfd->nextOpIndex; - - bfd->nextOpIndex = (bfd->nextOpIndex + 1) % nPrefStreams; - - xmpi(MPI_Recv((void *) bfd->ctrlBlks[bfd->currOpIndex].aio_buf, messagesize, MPI_UNSIGNED_CHAR, source, tag, commPio, - &status)); - - writePA(bfd, (size_t) messagesize); + case IO_Send_buffer: + { + int fileID = rcvIdx / nProcsColl - numMetaOp; + assert(fileID >= 0 && (size_t) fileID < openFileFunnelsSize && openFileFunnels[fileID].name); + struct fileFunnelAIO *bfd = openFileFunnels + fileID; + + xdebug("command: %s, fileID=%d, name=%s", cdiPioCmdStrTab[command], fileID, bfd->name); + + int messagesize; + xmpi(MPI_Get_count(statui + cmpltIdx, MPI_UNSIGNED_CHAR, &messagesize)); + size_t amount = (size_t) messagesize; + + writePA(bfd, source, (size_t) nProcsColl, amount, conf); + if (!bfd->outstandingSync && bfd->syncOffset == bfd->offset) + sendCollSync(bfd, fileID, commPio, nProcsColl, req, &numOpenSends, wstats); + off_t *restrict perCollAmounts = bfd->perCollAmounts; + /* end of collector stream not yet reached? */ + if (perCollAmounts[source] != perCollAmounts[nProcsColl + source]) + reinstallListenReq(bfd, fileID, source, (size_t) nProcsColl, bufSize, aioQueueDepth, req, commPio, conf); + /* end of collector stream reached */ + else if (!--bfd->activeCollectors) + funnelFileCleanup(openFileFunnels, fileID, &openFileFunnelsFill, &maxOpenFileIDp1, &numOpenRequests, commPio, + nProcsColl); + } + break; - if (!--(bfd->activeCollectors)) - { - xdebug("all are finished with file %d, delete entry", rtag.id); - listSetRemove(bibBFiledataPA, fileIDTest, (void *) (intptr_t) rtag.id); - } - break; - case IO_Finalize: - { - int buffer, collID; + case IO_Sync_file: + { + int fileID = syncMsgs[source].fileID; + assert(fileID >= 0 && (size_t) fileID < openFileFunnelsSize && openFileFunnels[fileID].name); + struct fileFunnelAIO *bfd = openFileFunnels + fileID; + xdebug("COMMAND %s, FILE%d, SOURCE%d", cdiPioCmdStrTab[command], fileID, source); + bfd->syncOffset += syncMsgs[source].amount; + if (!--bfd->outstandingSync && bfd->syncOffset == bfd->offset) + sendCollSync(bfd, fileID, commPio, nProcsColl, req, &numOpenSends, wstats); + xmpi(MPI_Irecv(syncMsgs + source, 1, cdiPioSyncMsgDt, source, IO_Sync_file, commPio, req[MOSyncRx] + source)); + } + break; - xmpi(MPI_Recv(&buffer, 1, MPI_INT, source, tag, commPio, &status)); - sentFinalize[source] = true; - bool doFinalize = true; - for (collID = 0; collID < nProcsColl; collID++) doFinalize &= sentFinalize[collID]; - if (doFinalize) + case IO_Close_file: { - if (!listSetIsEmpty(bibBFiledataPA)) - xabort("Set bibBfiledataP is not empty."); - else + int fileID = syncMsgs[source].fileID; + assert(fileID >= 0 && (size_t) fileID < openFileFunnelsSize && openFileFunnels[fileID].name); + struct fileFunnelAIO *bfd = openFileFunnels + fileID; + xdebug("COMMAND %s, FILE%d, SOURCE%d", cdiPioCmdStrTab[command], fileID, source); + bfd->syncOffset += syncMsgs[source].amount; + off_t *restrict perCollAmounts = bfd->perCollAmounts; + perCollAmounts[nProcsColl + source] = syncMsgs[source].amount; + /* did this source collector already send enough data? */ + if (perCollAmounts[source] == perCollAmounts[nProcsColl + source]) { - xdebug("%s", "all files are finished, destroy set," - " return"); - listSetDelete(bibBFiledataPA); + size_t fileReqIdx = numMetaOp + (size_t) fileID; + assert(req[fileReqIdx][source] != MPI_REQUEST_NULL); + xmpi(MPI_Cancel(req[fileReqIdx] + source)); + xmpi(MPI_Request_free(req[fileReqIdx] + source)); + if (!--bfd->activeCollectors) + funnelFileCleanup(openFileFunnels, fileID, &openFileFunnelsFill, &maxOpenFileIDp1, &numOpenRequests, commPio, + nProcsColl); } - Free(sentFinalize); - return; + xmpi(MPI_Irecv(syncMsgs + source, 1, cdiPioSyncMsgDt, source, IO_Sync_file, commPio, req[MOSyncRx] + source)); } - } - - break; - default: xabort("COMMAND NOT IMPLEMENTED"); + break; + + case IO_Finalize: + if (req[MOSyncTx][source] != MPI_REQUEST_NULL) + { + xmpiStat(MPI_Wait(req[MOSyncTx] + source, wstats), wstats); + --numOpenSends; + } + if (req[MOOpenRx][source] != MPI_REQUEST_NULL) + { + xmpi(MPI_Cancel(req[MOOpenRx] + source)); + xmpi(MPI_Request_free(req[MOOpenRx] + source)); + } + if (!--outstandingFinalizations) + { + if (openFileFunnelsFill) + xabort("some files still not closed."); + else + { + xdebug("%s", "all files are finished, destroy file set," + " return"); + } + Free(completed); + Free(wstats); + Free(statui); + Free(req); + Free(syncMsgs); + Free(openReqBuffer); + Free(openFileFunnels); + return; + } + break; + default: xabort("COMMAND NOT IMPLEMENTED"); + } } } } diff --git a/src/pio_posixfpguardsendrecv.c b/src/pio_posixfpguardsendrecv.c index 838d9852dfeac12bd6d98380a89ab419d3eb88a2..d91a395d4add2a06684dc561398c7e2c516ecbea 100644 --- a/src/pio_posixfpguardsendrecv.c +++ b/src/pio_posixfpguardsendrecv.c @@ -8,10 +8,17 @@ #include "config.h" #endif +#define _XOPEN_SOURCE 500 + +#include <assert.h> +#include <errno.h> +#include <fcntl.h> #include <inttypes.h> #include <stdio.h> #include <stdbool.h> #include <string.h> +#include <sys/stat.h> +#include <sys/types.h> #include <mpi.h> @@ -20,312 +27,119 @@ #include "namespace.h" #include "pio.h" #include "pio_comm.h" +#include "pio_conf.h" +#include "pio_dbuffer.h" #include "pio_impl.h" #include "pio_util.h" -typedef struct -{ - struct dBuffer *db1; - struct dBuffer *db2; - struct dBuffer *db; - FILE *fp; - enum IO_Server_command command; - int tsID, fileID; - char name[]; -} aFiledataPF; - -static int -fileIDTestA(void *a, void *fileID) -{ - return ((aFiledataPF *) a)->fileID == (int) (intptr_t) fileID; -} - -typedef struct -{ - long offset; - bool finished; - int fileID; - bool nfinished[]; -} bFiledataPF; - -static int -fileIDTestB(void *a, void *fileID) +enum { - return ((bFiledataPF *) a)->fileID == (int) (intptr_t) fileID; -} + collGuardTag = 777, +}; -static bool -fileIDCmpB(void *a, void *b) +/* + * Represents file opened by multiple writers and the corresponding + * buffer(s) for accumulation of timestep data. + */ +struct mwFileBuf { - return ((bFiledataPF *) a)->fileID == ((bFiledataPF *) b)->fileID; -} + char *name; + struct dBuffer db; + int fd, tsID; + enum IO_Server_command command; +}; -static listSet *bibAFiledataPF; +static struct mwFileBuf *openFiles; +static unsigned openFilesSize, openFilesFill; /***************************************************************/ -static aFiledataPF * -initAFiledataPF(const char *key, size_t bs) +static void +newMultiwriterFileBuf(struct mwFileBuf *afd, const char *filename, size_t bs) { - aFiledataPF *afd; - size_t len; - int iret; - - len = strlen(key); - afd = Calloc(1, sizeof(*afd) + len + 1); - strcpy(afd->name, key); + { + size_t nameSize = strlen(filename) + 1; + char *name = afd->name = Malloc(nameSize); + memcpy(name, filename, nameSize); + } afd->tsID = 0; /* init output buffer */ xdebug(" name=%s, init output buffer", afd->name); - iret = dbuffer_init(&(afd->db1), bs); - iret += dbuffer_init(&(afd->db2), bs); - - if (iret > 0) xabort("dbuffer_init did not succeed"); - - afd->db = afd->db1; + cdiPioDbufferInit(&afd->db, bs); /* open file */ xdebug("name=%s, open file", afd->name); - if ((afd->fp = fopen(afd->name, "w")) == NULL) xabort("Failed to open %s", afd->name); + if ((afd->fd = open(afd->name, O_CREAT | O_WRONLY, 0666)) == -1) xabort("Failed to open %s", afd->name); afd->command = IO_Open_file; - return afd; } -/***************************************************************/ -static bFiledataPF * -initBFiledataPF(int fileID, int nc) -{ - bFiledataPF *bfd; - size_t bfdSize = sizeof(bFiledataPF) + (size_t) nc * sizeof(bool); - bfd = Calloc(1, bfdSize); - bfd->offset = 0; - bfd->finished = false; - bfd->fileID = fileID; - - return bfd; -} - -/***************************************************************/ - static int -destroyAFiledataPF(void *v) +deleteMultiwriterFileBuf(struct mwFileBuf *afd) { - int iret = 0; - aFiledataPF *afd = (aFiledataPF *) v; + int iret; /* close file */ xdebug("name=%s, close file", afd->name); - if ((iret = fclose(afd->fp)) == EOF) xabort("Failed to close %s", afd->name); + if ((iret = close(afd->fd)) == -1) xabort("Failed to close %s", afd->name); /* file closed, cleanup */ xdebug("name=%s, file closed, cleanup ...", afd->name); - dbuffer_cleanup(&(afd->db1)); - dbuffer_cleanup(&(afd->db2)); - - Free(afd); + cdiPioDbufferDestroy(&afd->db); + Free(afd->name); + afd->name = NULL; return iret; } -/***************************************************************/ - -static int -destroyBFiledataPF(void *v) -{ - int iret = 0; - bFiledataPF *bfd = (bFiledataPF *) v; - - Free(bfd); - - return iret; -} - -/***************************************************************/ - -static bool -compareNamesAPF(void *v1, void *v2) +//******************************************************* +#ifndef HAVE_PWRITE +static ssize_t +pwrite(int fd, const void *buf, size_t count, off_t offset) { - aFiledataPF *afd1 = v1, *afd2 = v2; - - return !strcmp(afd1->name, afd2->name); + off_t pos; + ssize_t written; + if ((pos = lseek(fd, offset, SEEK_SET)) == (off_t) -1) xabort("did not succeed seeking file: %s", strerror(errno)); + if ((written = write(fd, buf, count)) != amount) + xabort("fileId=%d, expect to write %zu byte, written %zd byte", id, count, written); + return written; } - -/***************************************************************/ - -static void -fpgPOSIXFPGUARDSENDRECV(void) -{ - int i, source, iret; - struct fileOpTag rtag; - MPI_Status status; - bFiledataPF *bfd; - listSet *bibBFiledataPF; - long amount; - MPI_Comm commPio = commInqCommPio(); - int nProcsColl = commInqSizeColl(); - bool *sentFinalize, doFinalize = false; - - xdebug("ncollectors=%d", nProcsColl); - - bibBFiledataPF = listSetNew(destroyBFiledataPF, fileIDCmpB); - sentFinalize = Calloc((size_t) nProcsColl, sizeof(sentFinalize[0])); - - for (;;) - { - xmpi(MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, commPio, &status)); - source = status.MPI_SOURCE; - rtag = decodeFileOpTag(status.MPI_TAG); - - xdebug("receive message from source=%d, id=%d, command=%d ( %s )", source, rtag.id, rtag.command, - cdiPioCmdStrTab[rtag.command]); - - switch (rtag.command) - { - case IO_Open_file: - - if (!(bfd = listSetGet(bibBFiledataPF, fileIDTestB, (void *) (intptr_t) rtag.id))) - { - bfd = initBFiledataPF(rtag.id, nProcsColl); - - if ((iret = listSetAdd(bibBFiledataPF, bfd)) < 0) xabort("fileID=%d not unique", rtag.id); - bfd->fileID = iret; - } - - xdebug("id=%d, command=%d ( %s ), send offset=%ld", rtag.id, rtag.command, cdiPioCmdStrTab[rtag.command], bfd->offset); - - xmpi(MPI_Sendrecv(&(bfd->offset), 1, MPI_LONG, source, status.MPI_TAG, &amount, 1, MPI_LONG, source, status.MPI_TAG, - commPio, &status)); - - bfd->offset += amount; - - xdebug("id=%d, command=%d ( %s ), recv amount=%ld, set offset=%ld", rtag.id, rtag.command, cdiPioCmdStrTab[rtag.command], - amount, bfd->offset); - - break; - - case IO_Set_fp: - - if (!(bfd = listSetGet(bibBFiledataPF, fileIDTestB, (void *) (intptr_t) rtag.id))) - xabort("fileId=%d not in set", rtag.id); - - xdebug("id=%d, command=%d ( %s ), send offset=%ld", rtag.id, rtag.command, cdiPioCmdStrTab[rtag.command], bfd->offset); - - xmpi(MPI_Sendrecv(&(bfd->offset), 1, MPI_LONG, source, status.MPI_TAG, &amount, 1, MPI_LONG, source, status.MPI_TAG, - commPio, &status)); - - bfd->offset += amount; - - xdebug("id=%d, command=%d ( %s ), recv amount=%ld, set offset=%ld", rtag.id, rtag.command, cdiPioCmdStrTab[rtag.command], - amount, bfd->offset); - - break; - - case IO_Close_file: - - if (!(bfd = listSetGet(bibBFiledataPF, fileIDTestB, (void *) (intptr_t) rtag.id))) - xabort("fileId=%d not in set", rtag.id); - - xdebug("id=%d, command=%d ( %s )), send offset=%ld", rtag.id, rtag.command, cdiPioCmdStrTab[rtag.command], bfd->offset); - - xmpi(MPI_Sendrecv(&(bfd->offset), 1, MPI_LONG, source, status.MPI_TAG, &amount, 1, MPI_LONG, source, status.MPI_TAG, - commPio, &status)); - - bfd->offset += amount; - - xdebug("id=%d, command=%d ( %s ), recv amount=%ld, set offset=%ld", rtag.id, rtag.command, cdiPioCmdStrTab[rtag.command], - amount, bfd->offset); - - bfd->nfinished[source] = true; - bfd->finished = true; - - for (i = 0; i < nProcsColl; i++) - if (!(bfd->nfinished[i])) - { - bfd->finished = false; - break; - } - - if (bfd->finished) listSetRemove(bibBFiledataPF, fileIDTestB, (void *) (intptr_t) rtag.id); - break; - case IO_Finalize: - { - int buffer = CDI_UNDEFID, collID; - - xmpi(MPI_Recv(&buffer, 1, MPI_INT, source, status.MPI_TAG, commPio, &status)); - sentFinalize[source] = true; - doFinalize = true; - for (collID = 0; collID < nProcsColl; collID++) doFinalize &= sentFinalize[collID]; - if (doFinalize) - { - if (!listSetIsEmpty(bibBFiledataPF)) - xabort("set bibBFiledataM not empty"); - else - { - xdebug("%s", "destroy set"); - listSetDelete(bibBFiledataPF); - } - Free(sentFinalize); - return; - } - } - break; - default: xabort("COMMAND NOT IMPLEMENTED"); - } - } -} - -//******************************************************* +#endif static void -writePF(aFiledataPF *afd) +writePF(struct mwFileBuf *afd) { - size_t amount, written; - long offset; - long amountL; - int error, tag; + ssize_t written; MPI_Status status; /* FIXME: pretend there's only one special rank for now */ + int fileID = (int) (afd - openFiles); int specialRank = commInqSizePio() - 1; MPI_Comm commPio = commInqCommPio(); /* send buffersize, recv offset */ - - amount = dbuffer_data_size(afd->db); - amountL = (long) amount; - int id = afd->fileID; - tag = encodeFileOpTag(id, afd->command); - - xmpi(MPI_Sendrecv(&amountL, 1, MPI_LONG, specialRank, tag, &offset, 1, MPI_LONG, specialRank, tag, commPio, &status)); - xdebug("id=%d, command=%d, amount=%zu, send amountL=%ld, recv offset=%ld", id, afd->command, amount, amountL, offset); - + size_t amount = cdiPioDbufferGetPos(&afd->db); + + struct syncMsg query = { .amount = (off_t) amount, .fileID = fileID, .command = afd->command }; + off_t offset; + xmpiStat(MPI_Sendrecv(&query, 1, cdiPioSyncMsgDt, specialRank, collGuardTag, &offset, 1, cdiPioOffsetDt, specialRank, + collGuardTag, commPio, &status), + &status); + xdebug("id=%d, command=%d, amount=%zu, sent amount=%lld, recv offset=%ld", fileID, afd->command, amount, + (long long) (off_t) amount, offset); + + bool doTruncate = offset < 0; + if (offset < 0) offset = -offset - 1; /* write buffer */ - - if ((error = fseek(afd->fp, offset, SEEK_SET)) != 0) xabort("did not succeed seeking fp"); - - if ((written = fwrite(afd->db->buffer, sizeof(char), amount, afd->fp)) != amount) - xabort("fileId=%d, expect to write %zu byte, written %zu byte", id, amount, written); - - xdebug("written %zu bytes in file %d with offset %ld", written, id, offset); - + if ((written = pwrite(afd->fd, afd->db.buffer, amount, offset)) != (ssize_t) amount) + xabort("fileId=%d, expect to write %zu byte, written %zu byte", fileID, amount, written); + xdebug("written %zu bytes in file %d with offset %ld", written, fileID, offset); + if (doTruncate) ftruncate(afd->fd, offset + (off_t) amount); /* change outputBuffer */ - - dbuffer_reset(afd->db); - - if (afd->db == afd->db1) - { - xdebug("id=%d, change to buffer 2 ...", id); - afd->db = afd->db2; - } - else - { - xdebug("id=%d, change to buffer 1 ...", id); - afd->db = afd->db1; - } + cdiPioDbufferReset(&afd->db); afd->command = IO_Set_fp; } @@ -333,16 +147,16 @@ writePF(aFiledataPF *afd) /***************************************************************/ static void -defTimestepPF(aFiledataPF *afd, int tsID) +defTimestepPF(struct mwFileBuf *afd, int tsID) { - if (afd == NULL || tsID < 0 || tsID != afd->tsID + 1) xabort(" defTimestepPF() didn't succeed."); + assert(afd != NULL && tsID >= 0 && tsID == afd->tsID + 1); afd->tsID = tsID; } /***************************************************************/ static void -flushOp(aFiledataPF *a, int tsID) +flushOp(struct mwFileBuf *a, int tsID) { writePF(a); defTimestepPF(a, tsID); @@ -351,9 +165,8 @@ flushOp(aFiledataPF *a, int tsID) static size_t fwPOSIXFPGUARDSENDRECV(int fileID, const void *buffer, size_t len, int tsID) { - int error = 0; - int filled = 0; - aFiledataPF *afd = listSetGet(bibAFiledataPF, fileIDTestA, (void *) (intptr_t) fileID); + assert(fileID >= 0 && (size_t) fileID < openFilesSize && openFiles[fileID].name); + struct mwFileBuf *afd = openFiles + fileID; bool flush = tsID != afd->tsID; @@ -364,10 +177,11 @@ fwPOSIXFPGUARDSENDRECV(int fileID, const void *buffer, size_t len, int tsID) xmpi(MPI_Barrier(commInqCommColl())); } - filled = dbuffer_push(afd->db, (unsigned char *) buffer, len); + int filled = cdiPioDbufferAppend(&afd->db, buffer, len); xdebug("fileID = %d, tsID = %d, pushed data on buffer, filled = %d", fileID, tsID, filled); + int error = 0; if (filled == 1) { if (flush) @@ -376,7 +190,7 @@ fwPOSIXFPGUARDSENDRECV(int fileID, const void *buffer, size_t len, int tsID) { writePF(afd); - error = dbuffer_push(afd->db, (unsigned char *) buffer, len); + error = cdiPioDbufferAppend(&afd->db, buffer, len); } } @@ -388,74 +202,77 @@ fwPOSIXFPGUARDSENDRECV(int fileID, const void *buffer, size_t len, int tsID) /***************************************************************/ static int -fcPOSIXFPGUARDSENDRECV(int id) +fcPOSIXFPGUARDSENDRECV(int fileID) { - aFiledataPF *afd; - int iret; + assert(fileID >= 0 && (size_t) fileID < openFilesSize && openFiles[fileID].name); + struct mwFileBuf *afd = openFiles + fileID; - xdebug("write buffer, close file %d and cleanup", id); - - afd = listSetGet(bibAFiledataPF, fileIDTestA, (void *) (intptr_t) id); + xdebug("write buffer, close file %d and cleanup", fileID); afd->command = IO_Close_file; writePF(afd); /* remove file element */ - iret = listSetRemove(bibAFiledataPF, fileIDTestA, (void *) (intptr_t) id); + int iret = deleteMultiwriterFileBuf(afd); /* make sure the file is closed on all collectors before proceeding */ xmpi(MPI_Barrier(commInqCommColl())); return iret; } /***************************************************************/ -static void -elemCheck(void *q, void *nm) -{ - aFiledataPF *afd = q; - const char *name = nm; - - if (!strcmp(name, afd->name)) xabort("Filename %s has already been added to set\n", name); -} static int fowPOSIXFPGUARDSENDRECV(const char *filename, const char *mode) { - int id; - enum - { - bcastRoot = 0 - }; - if ((mode[0] != 'w' && mode[0] != 'W') || mode[0] == 0 || mode[1] != 0) - xabort("Unsupported mode \"%s\" in parallel file open.", mode); - aFiledataPF *afd; - static unsigned long buffersize = 0; - - /* broadcast buffersize to collectors */ - if (!buffersize) + if ((mode[0] != 'w' && mode[0] != 'W') || mode[1] != 0) xabort("Unsupported mode \"%s\" in parallel file open.", mode); + + struct cdiPioConf *conf = cdiPioGetConf(); + + for (size_t i = 0; i < openFilesSize; ++i) + if (openFiles[i].name && !strcmp(openFiles[i].name, filename)) + { + Warning("filename %s is already open!" + " CDI-PIO does not support concurrent access" + " through different filehandles.", + filename); + return CDI_EINVAL; + } + + size_t fileID = SIZE_MAX; + if (openFilesSize == openFilesFill) { - if (commInqRankColl() == bcastRoot) buffersize = findWriteAccumBufsize(); - xmpi(MPI_Bcast(&buffersize, 1, MPI_UNSIGNED_LONG, bcastRoot, commInqCommColl())); + fileID = openFilesSize; + if (openFilesSize == (size_t) INT_MAX + 1) return CDI_ELIMIT; + openFilesSize = openFilesSize ? openFilesSize * 2 : 4; + if (openFilesSize > (size_t) INT_MAX + 1) openFilesSize = (size_t) INT_MAX + 1; + openFiles = Realloc(openFiles, sizeof(*openFiles) * openFilesSize); + for (size_t i = fileID; i < openFilesSize; ++i) openFiles[i].name = NULL; } + else + { + for (size_t i = 0; i < openFilesSize; ++i) + if (openFiles[i].name == NULL) + { + fileID = i; + break; + } + } + struct mwFileBuf *afd = openFiles + fileID; - /* init and add file element */ - listSetForeach(bibAFiledataPF, elemCheck, (void *) filename); - - afd = initAFiledataPF(filename, (size_t) buffersize); + newMultiwriterFileBuf(afd, filename, conf->writeAggBufLim); - if ((id = listSetAdd(bibAFiledataPF, afd)) < 0) xabort("filename %s not unique", afd->name); - afd->fileID = id; - xdebug("name=%s, init and add aFiledataPF, return id = %d", filename, id); - { - long offset, amount = 0L; - int tag = encodeFileOpTag(afd->fileID, afd->command); - int specialRank = commInqSpecialRank(); - MPI_Status status; - MPI_Comm commPio = commInqCommPio(); - xmpi(MPI_Sendrecv(&amount, 1, MPI_LONG, specialRank, tag, &offset, 1, MPI_LONG, specialRank, tag, commPio, &status)); - } + xdebug("name=%s, init and add struct mwFileBuf, return id = %zu", filename, fileID); + off_t offset; + int specialRank = commInqSpecialRank(); + MPI_Status status; + MPI_Comm commPio = commInqCommPio(); + struct syncMsg query = { .amount = 0, .fileID = (int) fileID, .command = afd->command }; + xmpiStat(MPI_Sendrecv(&query, 1, cdiPioSyncMsgDt, specialRank, collGuardTag, &offset, 1, cdiPioOffsetDt, specialRank, + collGuardTag, commPio, &status), + &status); afd->command = IO_Set_fp; - return id; + return (int) fileID; } /***************************************************************/ @@ -463,27 +280,26 @@ fowPOSIXFPGUARDSENDRECV(const char *filename, const char *mode) static void finalizePOSIXFPGUARDSENDRECV(void) { - int buffer = 0, tag = encodeFileOpTag(0, IO_Finalize); - - xmpi(MPI_Send(&buffer, 1, MPI_INT, commInqSpecialRank(), tag, commInqCommPio())); + static const struct syncMsg query = { .amount = 0, .fileID = 0, .command = IO_Finalize }; + xmpi(MPI_Send((void *) &query, 1, cdiPioSyncMsgDt, commInqSpecialRank(), collGuardTag, commInqCommPio())); - if (!listSetIsEmpty(bibAFiledataPF)) - xabort("set bibAFiledataM not empty"); - else - { - xdebug("%s", "destroy set"); - listSetDelete(bibAFiledataPF); - } + if (openFilesFill) xabort("files still open at CDI-PIO finalization"); + Free(openFiles); + cdiPioDestroySyncMsgDt(); } /***************************************************************/ +static void fpgPOSIXFPGUARDSENDRECV(void); + void initPOSIXFPGUARDSENDRECV(void) { int numIOServers = commInqSizePio(); if (numIOServers < 2) xabort("error: # of I/O processes must be >= 2 for mode, but is %d", numIOServers); + cdiPioLookupOffsetDt(); + cdiPioCreateSyncMsgDt(); int isCollector = commInqRankColl() != -1; if (!isCollector) fpgPOSIXFPGUARDSENDRECV(); @@ -492,8 +308,130 @@ initPOSIXFPGUARDSENDRECV(void) namespaceSwitchSet(NSSWITCH_FILE_OPEN, NSSW_FUNC(fowPOSIXFPGUARDSENDRECV)); namespaceSwitchSet(NSSWITCH_FILE_CLOSE, NSSW_FUNC(fcPOSIXFPGUARDSENDRECV)); namespaceSwitchSet(NSSWITCH_FILE_WRITE, NSSW_FUNC(fwPOSIXFPGUARDSENDRECV)); - cdiPioFileWritingFinalize = finalizePOSIXFPGUARDSENDRECV; - bibAFiledataPF = listSetNew(destroyAFiledataPF, compareNamesAPF); + namespaceSwitchSet(cdiPioExtraNSKeys[cdiPioEKFileWritingFinalize], NSSW_FUNC(finalizePOSIXFPGUARDSENDRECV)); + } +} + +/***************************************************************/ +/* the rank running the message loop below responds to queries of the form + * struct syncMsg { off_t amount, int fileID, int operation code } + * where the answer depends on the operation code: + * IO_Open_file, IO_Set_fp or IO_Close_file: + * off_t answer = offset to write to + * IO_Finalize: no answer + * + * In essence this is an implementation of a shared file pointer. + */ + +struct sharedFP +{ + off_t offset; + int unfinished; +}; + +static inline void +initSharedFP(struct sharedFP *bfd, int nProcsColl) +{ + bfd->offset = 0; + bfd->unfinished = nProcsColl; +} + +/* MPICH 3.3 has a problem in its implementation of MPI_Testany and + * MPI_Waitany, see commit 0f7be7196cc05bf0c908761e148628e88d635190 + * at https://github.com/pmodels/mpich + * effectively, the work-around prepends MPI_REQUEST_NULL to the + * request array */ +#ifdef MPICH_CALC_VERSION +#if MPICH_NUMVERSION >= MPICH_CALC_VERSION(3, 3, 0, 0, 0) && MPI_NUMVERSION < MPICH_CALC_VERSION(3, 3, 1, 0, 0) +#define CDIPIO_MPICH33_WORKAROUND(code) code +#else +#define CDIPIO_MPICH33_WORKAROUND(code) +#endif +#else +#define CDIPIO_MPICH33_WORKAROUND(code) +#endif + +static void +fpgPOSIXFPGUARDSENDRECV(void) +{ + int source; + MPI_Status status; + struct sharedFP *restrict sharedFPs = NULL; + size_t sharedFPsSize = 0, sharedFPsFill = 0; + MPI_Comm commPio = commInqCommPio(); + size_t nProcsColl = (size_t) (commInqSizeColl()), sentFinalize = nProcsColl; + struct syncMsg *msgWords = Malloc(sizeof(*msgWords) * nProcsColl); + size_t numReq = nProcsColl; + CDIPIO_MPICH33_WORKAROUND(++numReq); + MPI_Request *msgReq = Malloc(sizeof(*msgReq) * numReq); + + xdebug("ncollectors=%zu", nProcsColl); + + CDIPIO_MPICH33_WORKAROUND(msgReq[0] = MPI_REQUEST_NULL; ++msgReq); + for (size_t i = 0; i < nProcsColl; ++i) + xmpi(MPI_Irecv(msgWords + i, 1, cdiPioSyncMsgDt, (int) i, collGuardTag, commPio, msgReq + i)); + for (;;) + { + CDIPIO_MPICH33_WORKAROUND(--msgReq; ++nProcsColl); + xmpiStat(MPI_Waitany((int) nProcsColl, msgReq, &source, &status), &status); + CDIPIO_MPICH33_WORKAROUND(++msgReq; --nProcsColl; --source); + int fileID = msgWords[source].fileID; + assert(fileID >= 0); + int opcode = msgWords[source].command; + off_t amount = msgWords[source].amount; + /* re-instate listening */ + if (opcode != IO_Finalize) + xmpi(MPI_Irecv(msgWords + source, 1, cdiPioSyncMsgDt, source, collGuardTag, commPio, msgReq + source)); + + xdebug("receive message from source=%d, id=%d, command=%d (%s)", source, fileID, opcode, cdiPioCmdStrTab[opcode]); + + if (opcode >= IO_Open_file && opcode < IO_Send_buffer) + { + if (opcode == IO_Open_file) + { + if (sharedFPsSize <= (size_t) fileID) + { + size_t oldSize = sharedFPsSize; + sharedFPsSize = sharedFPsSize ? sharedFPsSize * 2 : 2; + sharedFPs = Realloc(sharedFPs, sharedFPsSize * sizeof(*sharedFPs)); + for (size_t i = oldSize; i < sharedFPsSize; ++i) sharedFPs[i].offset = -1; + } + if (sharedFPs[fileID].offset < 0) + { + initSharedFP(sharedFPs + fileID, (int) nProcsColl); + ++sharedFPsFill; + } + } + xdebug("id=%d, command=%d (%s), send offset=%lld", fileID, opcode, cdiPioCmdStrTab[opcode], + (long long) sharedFPs[fileID].offset); + + int unfinished = sharedFPs[fileID].unfinished; + if (opcode == IO_Close_file && unfinished == 1) sharedFPs[fileID].offset = -sharedFPs[fileID].offset - 1; + xmpi(MPI_Send(&sharedFPs[fileID].offset, 1, cdiPioOffsetDt, source, collGuardTag, commPio)); + + xdebug("id=%d, command=%d (%s), recv amount=%lld, set offset=%ld", fileID, opcode, cdiPioCmdStrTab[opcode], + (long long) amount, sharedFPs[fileID].offset); + + if (opcode == IO_Close_file && !(sharedFPs[fileID].unfinished = --unfinished)) + --sharedFPsFill; + else + sharedFPs[fileID].offset += amount; + } + else if (opcode == IO_Finalize) + { + if (!--sentFinalize) + { + if (sharedFPsFill) xabort("still files open"); + Free(sharedFPs); + CDIPIO_MPICH33_WORKAROUND(--msgReq); + Free(msgReq); + Free(msgWords); + cdiPioDestroySyncMsgDt(); + return; + } + } + else + xabort("COMMAND NOT IMPLEMENTED: %d", opcode); } } diff --git a/src/pio_posixnonb.c b/src/pio_posixnonb.c index 274f73a5be541bb9ad7f066b5754c97609cb7962..e5e7c87ceaab2f96e91067726b296b395ce51740 100644 --- a/src/pio_posixnonb.c +++ b/src/pio_posixnonb.c @@ -2,6 +2,8 @@ #include "config.h" #endif +#include <assert.h> +#include <errno.h> #include <stdbool.h> #include <stdio.h> #include <string.h> @@ -13,68 +15,76 @@ #include "pio.h" #include "pio_comm.h" +#include "pio_conf.h" +#include "pio_dbuffer.h" #include "pio_impl.h" #include "pio_util.h" -typedef struct +struct fileFunnelStdio { - struct dBuffer *fb; + char *name; + struct dBuffer *db; FILE *fp; - int fileID; - int activeCollectors; - char name[]; -} bFiledataP; - -static int -fileIDTest(void *a, void *fileID) -{ - return ((bFiledataP *) a)->fileID == (int) (intptr_t) fileID; -} + off_t *perCollAmounts, offset, syncOffset; + int activeCollectors, outstandingSync; +}; /***************************************************************/ -static bFiledataP * -initBFiledataP(char *filename, size_t bs, int nc, int fileID) +static void +initBFiledataP(struct fileFunnelStdio *bfp, const char *filename, size_t bs, size_t nc) { - bFiledataP *bfp; - - xdebug("filename=%s, buffersize=%lu, ncollectors=%d", filename, bs, nc); - - bfp = Malloc(sizeof(*bfp) + strlen(filename) + 1); - strcpy(bfp->name, filename); - - if ((bfp->fp = fopen(filename, "w")) == NULL) xabort("Failed to open %s", bfp->name); - int fd = fileno(bfp->fp); - ftruncate(fd, (off_t) 0); - dbuffer_init(&bfp->fb, bs); - - bfp->activeCollectors = nc; - - bfp->fileID = fileID; + xdebug("filename=%s, buffersize=%lu, ncollectors=%zu", filename, bs, nc); + + { + size_t nameSize = strlen(filename) + 1; + off_t *restrict perCollAmounts = bfp->perCollAmounts = Malloc(nc * sizeof(*perCollAmounts) * 2 + nameSize); + char *name = bfp->name = (char *) (bfp->perCollAmounts + nc * 2); + memcpy(name, filename, nameSize); + for (size_t i = 0; i < nc; ++i) + { + perCollAmounts[i] = 0; + perCollAmounts[nc + i] = -1; + } + } + + if ((bfp->fp = fopen(filename, "w")) == NULL) + { + int fopen_errno = errno; + xabort("Failed to open %s\nerrno=%d: %s", bfp->name, fopen_errno, strerror(fopen_errno)); + } + struct dBuffer *db = bfp->db = Malloc(sizeof(*db) * nc); + for (size_t i = 0; i < nc; ++i) cdiPioDbufferInit(db + i, bs); + bfp->offset = 0; + bfp->syncOffset = 0; + bfp->activeCollectors = (int) nc; + bfp->outstandingSync = (int) nc; xdebug("filename=%s, opened file, return", bfp->name); - - return bfp; } /***************************************************************/ static int -destroyBFiledataP(void *v) +destroyBFiledataP(struct fileFunnelStdio *bfp) { - int iret = 0; - bFiledataP *bfp = (bFiledataP *) v; xdebug("filename=%s, cleanup, in", bfp->name); /* close file */ - if ((iret = fclose(bfp->fp)) == EOF) xabort("Failed to close %s", bfp->name); - + int iret; + if ((iret = fclose(bfp->fp)) == EOF) + { + iret = errno; + Warning("Failed to close %s", bfp->name); + } /* file closed, cleanup */ - - dbuffer_cleanup(&(bfp->fb)); - - Free(bfp); + size_t numColl = (size_t) (commInqSizeColl()); + struct dBuffer *db = bfp->db; + for (size_t i = 0; i < numColl; ++i) cdiPioDbufferDestroy(db + i); + Free(db); + Free(bfp->perCollAmounts); + bfp->name = NULL; xdebug("%s", "cleaned up, return"); @@ -83,174 +93,275 @@ destroyBFiledataP(void *v) /***************************************************************/ -static bool -compareNamesBP(void *v1, void *v2) -{ - bFiledataP *bfd1 = v1, *bfd2 = v2; - - return !strcmp(bfd1->name, bfd2->name); -} - -/***************************************************************/ - static void -writeP(bFiledataP *bfd, size_t amount) +writeP(struct fileFunnelStdio *bfd, int source, size_t amount) { size_t written; - xdebug("filename=%s, amount=%ld, in", bfd->name, amount); - if ((written = fwrite(bfd->fb->buffer, 1, amount, bfd->fp)) != amount) xabort("did not succeed writing buffer in %s", bfd->name); + bfd->perCollAmounts[source] += (off_t) amount; + bfd->offset += (off_t) amount; + if ((written = fwrite(bfd->db[source].buffer, 1, amount, bfd->fp)) != amount) + xabort("did not succeed writing buffer to %s", bfd->name); xdebug("filename=%s, written=%ld, amount=%ld, return", bfd->name, written, amount); } -/***************************************************************/ +enum +{ + /* meta operation indices */ + MOOpenRx, + MOSyncRx, + MOSyncTx, + numMetaOp = 3 +}; + static void -elemCheck(void *q, void *nm) +sendCollSync(struct fileFunnelStdio *bfd, int fileID, MPI_Comm commPio, int nProcsColl, MPI_Request (*req)[nProcsColl], + size_t *numOpenSends, MPI_Status *statui) { - bFiledataP *bfd = q; - const char *name = nm; + if (*numOpenSends) /* make sure previous sync sends completed */ + xmpiStats(MPI_Waitall(nProcsColl, req[MOSyncTx], statui), nProcsColl, statui); + int sync2CollTag = encodeFileOpTag(fileID, IO_Sync_file); + for (size_t i = 0; i < (size_t) nProcsColl; ++i) + xmpi(MPI_Isend(NULL, 0, MPI_INT, (int) i, sync2CollTag, commPio, req[MOSyncTx] + i)); + *numOpenSends = (size_t) (bfd->outstandingSync = nProcsColl); + bfd->syncOffset = 0; +} - if (!strcmp(name, bfd->name)) xabort("Filename %s has already been added to the set\n", name); +static void +funnelFileCleanup(struct fileFunnelStdio *openFileFunnels, int fileID, size_t *openFileFunnelsFill, size_t *maxOpenFileIDp1, + size_t *numOpenRequests, MPI_Comm commPio, int nProcsColl) +{ + xdebug("all are finished with file %d, delete file table entry", fileID); + struct fileFunnelStdio *bfd = openFileFunnels + fileID; + assert(bfd->syncOffset == bfd->offset); + int retval = destroyBFiledataP(bfd); + --(*openFileFunnelsFill); + if ((size_t) fileID + 1 == *maxOpenFileIDp1) + { + size_t j = (size_t) fileID + 1; + while (j > 0 && !openFileFunnels[j - 1].name) --j; + *maxOpenFileIDp1 = j; + *numOpenRequests = (size_t) nProcsColl * (numMetaOp + *maxOpenFileIDp1); + } + xmpi(MPI_Bcast(&retval, 1, MPI_INT, nProcsColl, commPio)); } void pioWriterStdIO(void) { - bFiledataP *bfd; - listSet *bibBFiledataP; - int messagesize, source, tag, id; - struct fileOpTag rtag; - MPI_Status status; + size_t openFileFunnelsSize = 1, openFileFunnelsFill = 0; + struct fileFunnelStdio *openFileFunnels = Malloc(sizeof(*openFileFunnels) * openFileFunnelsSize); + for (size_t i = 0; i < openFileFunnelsSize; ++i) openFileFunnels[i].name = NULL; MPI_Comm commPio = commInqCommPio(); int nProcsColl = commInqSizeColl(); - bool *sentFinalize, doFinalize; - xdebug("ncollectors=%d", nProcsColl); - - bibBFiledataP = listSetNew(destroyBFiledataP, compareNamesBP); - sentFinalize = Calloc((size_t) nProcsColl, sizeof(sentFinalize[0])); + int outstandingFinalizations = nProcsColl; + struct cdiPioConf *conf = cdiPioGetConf(); + + int intPackSize; + xmpi(MPI_Pack_size(2, MPI_INT, commPio, &intPackSize)); + size_t maxPathLen = (size_t) conf->maxPathLen, openMsgSize = (size_t) intPackSize + maxPathLen; + assert(openMsgSize <= INT_MAX); + unsigned char *restrict openReqBuffer = Malloc((size_t) nProcsColl * openMsgSize + maxPathLen + 1); + char *filename = (char *) (openReqBuffer + (size_t) nProcsColl * openMsgSize); + struct syncMsg *syncMsgs = Malloc((size_t) nProcsColl * sizeof(*syncMsgs)); + /* array of requests first one open request per collector, then one + * sync receive (close, finalize) request per collector and one for + * sending sync messages, i.e. 3 rows of fixed meaning followed by + * one request per file and collector, i.e. number of open files + * rows. This array essentially describes all the messages + * concurrently in flight: open/sync/close/shutdown requests and + * data record aggregates for each file */ + MPI_Request(*req)[nProcsColl] = Malloc(sizeof(*req) * (numMetaOp + openFileFunnelsSize)); + MPI_Status *statui = Malloc(sizeof(*statui) * (size_t) nProcsColl * (numMetaOp + openFileFunnelsSize)), + *wstats = Malloc(sizeof(*wstats) * (size_t) nProcsColl); + int numCompleted, *completed = Malloc(sizeof(*completed) * (size_t) nProcsColl * (numMetaOp + openFileFunnelsSize)); + size_t maxOpenFileIDp1 = 0, numOpenSends = 0, numOpenRequests = (size_t) nProcsColl * (numMetaOp + maxOpenFileIDp1); + for (size_t i = 0; i < (size_t) nProcsColl; ++i) + { + xmpi(MPI_Irecv(openReqBuffer + i * openMsgSize, (int) openMsgSize, MPI_PACKED, (int) i, IO_Open_file, commPio, + req[MOOpenRx] + i)); + xmpi(MPI_Irecv(syncMsgs + i, 1, cdiPioSyncMsgDt, (int) i, IO_Sync_file, commPio, req[MOSyncRx] + i)); + req[MOSyncTx][i] = MPI_REQUEST_NULL; + } + for (size_t j = 0; j < openFileFunnelsSize; ++j) + for (size_t i = 0; i < (size_t) nProcsColl; ++i) req[numMetaOp + j][i] = MPI_REQUEST_NULL; for (;;) { - - xmpiStat(MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, commPio, &status), &status); - - source = status.MPI_SOURCE; - tag = status.MPI_TAG; - - rtag = decodeFileOpTag(tag); - - xmpi(MPI_Get_count(&status, MPI_UNSIGNED_CHAR, &messagesize)); - - xdebug("RECEIVE MESSAGE FROM SOURCE=%d, ID=%d, COMMAND=%d ( %s )," - "MESSAGESIZE=%d", - source, rtag.id, rtag.command, cdiPioCmdStrTab[rtag.command], messagesize); - - switch (rtag.command) + assert(numOpenRequests <= INT_MAX); + xmpiStats(MPI_Waitsome((int) numOpenRequests, *req, &numCompleted, completed, statui), numCompleted, statui); + for (size_t cmpltIdx = 0; cmpltIdx < (size_t) numCompleted; ++cmpltIdx) { - case IO_Open_file: - { - char *messageBuffer = Malloc((size_t) messagesize * sizeof(messageBuffer[0])); - char *pMB = messageBuffer; - xmpi(MPI_Recv(messageBuffer, messagesize, MPI_UNSIGNED_CHAR, source, tag, commPio, &status)); - - xdebug("%s", "after recv, in loop"); - - char *filename = pMB; - pMB += (strlen(filename) + 1); - char *temp = pMB; - long buffersize = strtol(temp, NULL, 16); - pMB += (strlen(temp) + 1); - size_t amount = (size_t) (messageBuffer + messagesize - pMB); - - xdebug("command %s, filename=%s, buffersize=%ld, amount=%zu", cdiPioCmdStrTab[rtag.command], filename, buffersize, - amount); - - if (!(bfd = listSetGet(bibBFiledataP, fileIDTest, (void *) (intptr_t) rtag.id))) + int rcvIdx = completed[cmpltIdx]; + int source = rcvIdx % nProcsColl; + int command; + switch (rcvIdx / nProcsColl) + { + case MOOpenRx: command = IO_Open_file; break; + case MOSyncRx: command = syncMsgs[source].command; break; + case MOSyncTx: --numOpenSends; continue; + default: command = IO_Send_buffer; + } + + xdebug("receive message from source=%d, command=%d (%s)", source, command, cdiPioCmdStrTab[command]); + + switch (command) + { + case IO_Open_file: { - listSetForeach(bibBFiledataP, elemCheck, filename); - bfd = initBFiledataP(filename, (size_t) buffersize, nProcsColl, rtag.id); - if ((id = listSetAdd(bibBFiledataP, bfd)) < 0) xabort("fileID=%d not unique", rtag.id); - bfd->fileID = id; + int openMsgHdr[2]; + int position = 0; + unsigned char *reqBuffer = openReqBuffer + (size_t) source * openMsgSize; + xmpi(MPI_Unpack(reqBuffer, (int) openMsgSize, &position, openMsgHdr, 2, MPI_INT, commPio)); + size_t len = (size_t) openMsgHdr[1]; + assert(len <= maxPathLen); + xmpi(MPI_Unpack(reqBuffer, (int) openMsgSize, &position, filename, openMsgHdr[1], MPI_CHAR, commPio)); + filename[len] = '\0'; + size_t buffersize = conf->writeAggBufLim; + xdebug("command %s, filename=%s, buffersize=%zu", cdiPioCmdStrTab[command], filename, buffersize); + + int fileID = openMsgHdr[0]; + size_t prevOpenFileFunnelsSize = openFileFunnelsSize; + if (openFileFunnelsSize <= (unsigned) fileID) + { + while (openFileFunnelsSize <= (unsigned) fileID) openFileFunnelsSize *= 2; + if (openFileFunnelsSize > (unsigned) INT_MAX + 1) openFileFunnelsSize = (unsigned) INT_MAX + 1; + openFileFunnels = Realloc(openFileFunnels, sizeof(*openFileFunnels) * openFileFunnelsSize); + for (size_t i = prevOpenFileFunnelsSize; i < openFileFunnelsSize; ++i) openFileFunnels[i].name = NULL; + req = Realloc(req, sizeof(*req) * (openFileFunnelsSize + numMetaOp)); + statui = Realloc(statui, sizeof(*statui) * (size_t) nProcsColl * (openFileFunnelsSize + numMetaOp)); + completed = Realloc(completed, sizeof(*completed) * (size_t) nProcsColl * (openFileFunnelsSize + numMetaOp)); + for (size_t j = prevOpenFileFunnelsSize; j < openFileFunnelsSize; ++j) + for (size_t i = 0; i < (size_t) nProcsColl; ++i) req[numMetaOp + j][i] = MPI_REQUEST_NULL; + maxOpenFileIDp1 = (size_t) fileID + 1; + } + else if (maxOpenFileIDp1 < (size_t) fileID + 1) + maxOpenFileIDp1 = (size_t) fileID + 1; + struct fileFunnelStdio *bfd = openFileFunnels + fileID; + if (!bfd->name) + { + for (size_t i = 0; i < prevOpenFileFunnelsSize; ++i) + if (openFileFunnels[i].name && !strcmp(openFileFunnels[i].name, filename)) + xabort("filename %s is already open!" + " CDI-PIO does not support concurrent access" + " through different filehandles.", + filename); + initBFiledataP(bfd, filename, buffersize, (size_t) nProcsColl); + ++openFileFunnelsFill; + } + else if (strcmp(filename, bfd->name) != 0) + xabort("filename is not consistent, fileID=%d," + " \"%s\" vs. \"%s\"", + fileID, filename, bfd->name); + int tag = encodeFileOpTag(fileID, IO_Send_buffer); + xmpi(MPI_Irecv(bfd->db[source].buffer, (int) bfd->db[source].size, MPI_UNSIGNED_CHAR, source, tag, commPio, + req[numMetaOp + fileID] + source)); + xmpi(MPI_Irecv(reqBuffer, (int) openMsgSize, MPI_PACKED, source, IO_Open_file, commPio, req[0] + source)); + numOpenRequests = (size_t) nProcsColl * (numMetaOp + maxOpenFileIDp1); } - else if (strcmp(filename, bfd->name) != 0) - xabort("filename is not consistent, fileID=%d", rtag.id); - memcpy(bfd->fb->buffer, pMB, amount); - - writeP(bfd, amount); - - Free(messageBuffer); - } - break; - - case IO_Send_buffer: - { - if (!(bfd = listSetGet(bibBFiledataP, fileIDTest, (void *) (intptr_t) rtag.id))) - xabort("fileID=%d is not in set", rtag.id); - size_t amount = (size_t) messagesize; - - xdebug("COMMAND %s, ID=%d, NAME=%s", cdiPioCmdStrTab[rtag.command], rtag.id, bfd->name); - - xmpi(MPI_Recv(bfd->fb->buffer, messagesize, MPI_UNSIGNED_CHAR, source, tag, commPio, &status)); - - writeP(bfd, amount); - } - break; + break; - case IO_Close_file: - { - xdebug("COMMAND %s, FILE%d, SOURCE%d", cdiPioCmdStrTab[rtag.command], rtag.id, source); - - if (!(bfd = listSetGet(bibBFiledataP, fileIDTest, (void *) (intptr_t) rtag.id))) - xabort("fileID=%d is not in set", rtag.id); - size_t amount = (size_t) messagesize; - xdebug("COMMAND %s, ID=%d, NAME=%s, AMOUNT=%zu", cdiPioCmdStrTab[rtag.command], rtag.id, bfd->name, amount); - - xmpi(MPI_Recv(bfd->fb->buffer, messagesize, MPI_UNSIGNED_CHAR, source, tag, commPio, &status)); - - writeP(bfd, amount); - - if (!--(bfd->activeCollectors)) + case IO_Send_buffer: { - xdebug("all are finished with file %d, delete node", rtag.id); - listSetRemove(bibBFiledataP, fileIDTest, (void *) (intptr_t) rtag.id); + int fileID = rcvIdx / nProcsColl - numMetaOp; + assert(fileID >= 0 && (size_t) fileID < openFileFunnelsSize && openFileFunnels[fileID].name); + struct fileFunnelStdio *bfd = openFileFunnels + fileID; + + xdebug("command %s, fileID=%d, name=%s", cdiPioCmdStrTab[command], fileID, bfd->name); + + int messagesize; + xmpi(MPI_Get_count(statui + cmpltIdx, MPI_UNSIGNED_CHAR, &messagesize)); + size_t amount = (size_t) messagesize; + + writeP(bfd, source, amount); + if (!bfd->outstandingSync && bfd->syncOffset == bfd->offset) + sendCollSync(bfd, fileID, commPio, nProcsColl, req, &numOpenSends, wstats); + off_t *restrict perCollAmounts = bfd->perCollAmounts; + /* end of collector stream not yet reached? */ + if (perCollAmounts[source] != perCollAmounts[nProcsColl + source]) + { + int tag = encodeFileOpTag(fileID, IO_Send_buffer); + xmpi(MPI_Irecv(bfd->db[source].buffer, (int) bfd->db[source].size, MPI_UNSIGNED_CHAR, source, tag, commPio, + req[numMetaOp + fileID] + source)); + } + /* end of collector stream reached */ + else if (!--bfd->activeCollectors) + funnelFileCleanup(openFileFunnels, fileID, &openFileFunnelsFill, &maxOpenFileIDp1, &numOpenRequests, commPio, + nProcsColl); } - } - break; - case IO_Finalize: - { - int buffer = CDI_UNDEFID, collID; - - xmpi(MPI_Recv(&buffer, 1, MPI_INT, source, tag, commPio, &status)); + break; - sentFinalize[source] = true; - doFinalize = true; - - for (collID = 0; collID < nProcsColl; collID++) - if (!sentFinalize[collID]) - { - doFinalize = false; - break; - } + case IO_Sync_file: + { + int fileID = syncMsgs[source].fileID; + assert(fileID >= 0 && (size_t) fileID < openFileFunnelsSize && openFileFunnels[fileID].name); + struct fileFunnelStdio *bfd = openFileFunnels + fileID; + xdebug("COMMAND %s, FILE%d, SOURCE%d", cdiPioCmdStrTab[command], fileID, source); + bfd->syncOffset += syncMsgs[source].amount; + if (!--bfd->outstandingSync && bfd->syncOffset == bfd->offset) + sendCollSync(bfd, fileID, commPio, nProcsColl, req, &numOpenSends, wstats); + xmpi(MPI_Irecv(syncMsgs + source, 1, cdiPioSyncMsgDt, source, IO_Sync_file, commPio, req[MOSyncRx] + source)); + } + break; - if (doFinalize) + case IO_Close_file: { - if (!listSetIsEmpty(bibBFiledataP)) - xabort("set bibBfiledataP is not empty."); - else + int fileID = syncMsgs[source].fileID; + assert(fileID >= 0 && (size_t) fileID < openFileFunnelsSize && openFileFunnels[fileID].name); + struct fileFunnelStdio *bfd = openFileFunnels + fileID; + xdebug("COMMAND %s, FILE%d, SOURCE%d", cdiPioCmdStrTab[command], fileID, source); + bfd->syncOffset += syncMsgs[source].amount; + off_t *restrict perCollAmounts = bfd->perCollAmounts; + perCollAmounts[nProcsColl + source] = syncMsgs[source].amount; + /* did this source collector already send enough data? */ + if (perCollAmounts[source] == perCollAmounts[nProcsColl + source]) { - xdebug("%s", "all files are finished, destroy file set," - " return"); - listSetDelete(bibBFiledataP); + size_t fileReqIdx = numMetaOp + (size_t) fileID; + assert(req[fileReqIdx][source] != MPI_REQUEST_NULL); + xmpi(MPI_Cancel(req[fileReqIdx] + source)); + xmpi(MPI_Request_free(req[fileReqIdx] + source)); + if (!--bfd->activeCollectors) + funnelFileCleanup(openFileFunnels, fileID, &openFileFunnelsFill, &maxOpenFileIDp1, &numOpenRequests, commPio, + nProcsColl); } - Free(sentFinalize); - return; + xmpi(MPI_Irecv(syncMsgs + source, 1, cdiPioSyncMsgDt, source, IO_Sync_file, commPio, req[MOSyncRx] + source)); } - } - break; - default: xabort("COMMAND NOT IMPLEMENTED"); + break; + case IO_Finalize: + if (req[MOSyncTx][source] != MPI_REQUEST_NULL) + { + xmpiStat(MPI_Wait(req[MOSyncTx] + source, wstats), wstats); + --numOpenSends; + } + if (req[MOOpenRx][source] != MPI_REQUEST_NULL) + { + xmpi(MPI_Cancel(req[MOOpenRx] + source)); + xmpi(MPI_Request_free(req[MOOpenRx] + source)); + } + if (!--outstandingFinalizations) + { + if (openFileFunnelsFill) + xabort("some files still not closed."); + else + { + xdebug("%s", "all files are finished, destroy file set," + " return"); + } + Free(completed); + Free(wstats); + Free(statui); + Free(req); + Free(syncMsgs); + Free(openReqBuffer); + Free(openFileFunnels); + return; + } + break; + default: xabort("COMMAND NOT IMPLEMENTED"); + } } } } diff --git a/src/pio_record_send.c b/src/pio_record_send.c index dafb21b3cf6029d1753f8186ed06e036ef689723..a127a3de7eb70cd5fa97480ce2919a67fb859191 100644 --- a/src/pio_record_send.c +++ b/src/pio_record_send.c @@ -2,209 +2,193 @@ #include "config.h" #endif +#include <assert.h> #include <inttypes.h> #include <stdlib.h> +#include <unistd.h> #include "cdipio.h" #include "dmemory.h" #include "namespace.h" #include "pio.h" #include "pio_comm.h" +#include "pio_dbuffer.h" +#include "pio_id_set.h" #include "pio_impl.h" #include "pio_util.h" -typedef struct +enum { - size_t size; - struct dBuffer *db1; - struct dBuffer *db2; - struct dBuffer *db; - enum IO_Server_command command; - MPI_Request request; - int tsID, fileID; - char name[]; -} remoteFileBuf; - -static listSet *bibRemoteFileBuf; - -static int -fileIDTest(void *a, void *fileID) + numRecordSendBuf = 2, + numFlushOp = 2, +}; +struct remoteFileBuf { - return ((remoteFileBuf *) a)->fileID == (int) (intptr_t) fileID; -} + char *name; + struct dBuffer dbuf[numRecordSendBuf]; + /* extra request for sync signal to and go-on signal from writer */ + MPI_Request request[numRecordSendBuf + numFlushOp]; + struct syncMsg syncMsg; + off_t amount; + unsigned dbufIdx; + int tsID; +}; + +static struct remoteFileBuf *openRemoteFiles; +static unsigned openRemoteFilesSize, openRemoteFilesFill; -static remoteFileBuf * -initRemoteFileBuf(const char *filename, size_t bs) +static void +initRemoteFileBuf(struct remoteFileBuf *restrict rfile, const char *filename, size_t bs) { - remoteFileBuf *afp; - size_t len; - int iret; xdebug("filename=%s, buffersize=%zu, in", filename, bs); - len = strlen(filename); - afp = Malloc(sizeof(remoteFileBuf) + len + 1); - strcpy(afp->name, filename); - afp->size = bs; - afp->tsID = 0; - + size_t len = strlen(filename); + rfile->name = Malloc(len + 1); + memcpy(rfile->name, filename, len + 1); + rfile->tsID = 0; + rfile->amount = 0; /* init output buffer */ - xdebug("filename=%s, init output buffer", afp->name); - - iret = dbuffer_init(&(afp->db1), afp->size); - iret += dbuffer_init(&(afp->db2), afp->size); + xdebug("filename=%s, init output buffer", filename); - if (iret > 0) xabort("dbuffer_init did not succeed"); + for (size_t i = 0; i < numRecordSendBuf; ++i) cdiPioDbufferInit(rfile->dbuf + i, bs); + for (size_t i = 0; i < numRecordSendBuf + numFlushOp; ++i) rfile->request[i] = MPI_REQUEST_NULL; - afp->db = afp->db1; + rfile->dbufIdx = 0; - afp->command = IO_Open_file; - afp->request = MPI_REQUEST_NULL; - - xdebug("added name=%s, return", afp->name); - return afp; + xdebug("added name=%s, return", rfile->name); } static int -destroyRemoteFileBuf(void *v) +destroyRemoteFileBuf(struct remoteFileBuf *restrict rfile) { - remoteFileBuf *afp = (remoteFileBuf *) v; - MPI_Status status; + MPI_Status status[numRecordSendBuf + numFlushOp]; - xdebug("filename=%s, cleanup, in", afp->name); + xdebug("filename=%s, cleanup, in", rfile->name); - xmpiStat(MPI_Wait(&afp->request, &status), &status); - dbuffer_cleanup(&afp->db1); - dbuffer_cleanup(&afp->db2); + xmpiStats(MPI_Waitall(numRecordSendBuf + numFlushOp, rfile->request, status), numRecordSendBuf, status); - Free(afp); + for (size_t i = 0; i < numRecordSendBuf; ++i) cdiPioDbufferDestroy(rfile->dbuf + i); + Free(rfile->name); + rfile->name = NULL; xdebug("%s", "cleaned up, return"); return 0; } -static bool -compareNames(void *v1, void *v2) -{ - remoteFileBuf *afd1 = v1, *afd2 = v2; - - return !strcmp(afd1->name, afd2->name); -} - /***************************************************************/ /* send buffer to writer and swap buffer for filling */ static void -sendP(remoteFileBuf *afd, int id) +sendP(struct remoteFileBuf *rfile) { - int tag; - size_t amount; - MPI_Status status; - - amount = dbuffer_data_size(afd->db); - tag = encodeFileOpTag(id, afd->command); - - xdebug("send buffer for %s, size: %zu bytes, command=%s, in", afd->name, amount, cdiPioCmdStrTab[afd->command]); + MPI_Status statui[numFlushOp]; + if (rfile->request[numRecordSendBuf + 1] != MPI_REQUEST_NULL) + xmpiStats(MPI_Waitall(numFlushOp, rfile->request + numRecordSendBuf, statui), numFlushOp, statui); + size_t dbufIdx = rfile->dbufIdx; + struct dBuffer *restrict dbuf = rfile->dbuf; + size_t amount = cdiPioDbufferGetPos(dbuf + dbufIdx); + if (amount) + { + int fileID = (int) (rfile - openRemoteFiles); + int tag = encodeFileOpTag(fileID, IO_Send_buffer); - xmpiStat(MPI_Wait(&(afd->request), &status), &status); + xdebug("send buffer for %s, size: %zu bytes, command=%s, in", rfile->name, amount, cdiPioCmdStrTab[IO_Send_buffer]); - /* FIXME: amount > INT_MAX unhandled */ - xmpi(MPI_Issend(afd->db->buffer, (int) amount, MPI_UNSIGNED_CHAR, commInqSizePio() - 1, tag, commInqCommPio(), &afd->request)); + /* FIXME: amount > INT_MAX unhandled */ + xmpi(MPI_Isend(dbuf[dbufIdx].buffer, (int) amount, MPI_UNSIGNED_CHAR, commInqSizePio() - 1, tag, commInqCommPio(), + rfile->request + dbufIdx)); + rfile->amount += (off_t) amount; - /* change outputBuffer */ - dbuffer_reset(afd->db); - if (afd->db == afd->db1) - { - xdebug("%s", "Change to buffer 2 ..."); - afd->db = afd->db2; + /* change outputBuffer */ + dbufIdx ^= 1; + xmpiStat(MPI_Wait(rfile->request + dbufIdx, statui), statui); + cdiPioDbufferReset(dbuf + dbufIdx); + rfile->dbufIdx = (unsigned) dbufIdx; } - else - { - xdebug("%s", "Change to buffer 1 ..."); - afd->db = afd->db1; - } - afd->command = IO_Send_buffer; - - return; } static void -defTimestep(remoteFileBuf *afd, int tsID) +flushOp(struct remoteFileBuf *rfile, int tsID) { - if (afd == NULL || tsID != afd->tsID + 1) xabort(" defTimestepPA () didn't succeed."); - afd->tsID = tsID; -} - -static void -flushOp(remoteFileBuf *fb, int tsID) -{ - sendP(fb, fb->fileID); - defTimestep(fb, (int) (intptr_t) tsID); + assert(rfile != NULL && tsID == rfile->tsID + 1); + sendP(rfile); + rfile->tsID = tsID; + int fileID = (int) (rfile - openRemoteFiles), funnelRank = commInqSizePio() - 1; + MPI_Comm commPio = commInqCommPio(); + MPI_Request *req = rfile->request + numRecordSendBuf; + rfile->syncMsg = (struct syncMsg){ .amount = rfile->amount, .fileID = fileID, .command = IO_Sync_file }; + xmpi(MPI_Isend(&rfile->syncMsg, 1, cdiPioSyncMsgDt, funnelRank, IO_Sync_file, commPio, req)); + int syncFromFunnelTag = encodeFileOpTag(fileID, IO_Sync_file); + xmpi(MPI_Irecv(NULL, 0, MPI_INT, funnelRank, syncFromFunnelTag, commPio, req + 1)); + MPI_Status statui[numFlushOp]; + int numComplete, completeIdx[numFlushOp]; + xmpiStats(MPI_Testsome(numFlushOp, req, &numComplete, completeIdx, statui), numComplete, statui); } static size_t -pioSendWrite(int id, const void *buffer, size_t len, int tsID) +pioSendWrite(int fileID, const void *buffer, size_t len, int tsID) { - int error = 0; - int flush = 0; - int filled; - remoteFileBuf *afd; + assert(fileID >= 0 && (size_t) fileID < openRemoteFilesSize && openRemoteFiles[fileID].name); + struct remoteFileBuf *rfile = openRemoteFiles + fileID; - afd = listSetGet(bibRemoteFileBuf, fileIDTest, (void *) (intptr_t) id); + bool flush = tsID != rfile->tsID; - flush = tsID != afd->tsID; + size_t dbufIdx = rfile->dbufIdx; + struct dBuffer *restrict dbuf = rfile->dbuf; if (flush) { - xdebug("tsID = %d, flush buffer for fileID=%d", tsID, afd->fileID); - - flushOp(afd, tsID); - { - MPI_Status status; - xmpiStat(MPI_Wait(&(afd->request), &status), &status); - } - xmpi(MPI_Barrier(commInqCommColl())); + xdebug("tsID = %d, flush buffer for fileID=%d", tsID, fileID); + flushOp(rfile, tsID); + dbufIdx ^= 1; } - filled = dbuffer_push(afd->db, buffer, len); + int filled = cdiPioDbufferAppend(dbuf + dbufIdx, buffer, len); - xdebug("id = %d, tsID = %d, pushed %lu byte data on buffer, filled = %d", id, tsID, len, filled); + xdebug("id = %d, tsID = %d, pushed %lu byte data on buffer, filled = %d", fileID, tsID, len, filled); + int error = 0; if (filled == 1) { if (flush) error = filled; else { - sendP(afd, id); - error = dbuffer_push(afd->db, buffer, len); + sendP(rfile); + dbufIdx = rfile->dbufIdx; + error = cdiPioDbufferAppend(dbuf + dbufIdx, buffer, len); } } - if (error == 1) xabort("did not succeed filling output buffer, id=%d", id); + if (error == 1) xabort("did not succeed filling output buffer, id=%d", fileID); return len; } static int -pioSendClose(int id) +pioSendClose(int fileID) { - remoteFileBuf *afd; - xdebug("fileID %d: send buffer, close file and cleanup", id); + assert(fileID >= 0 && (size_t) fileID < openRemoteFilesSize && openRemoteFiles[fileID].name); - afd = listSetGet(bibRemoteFileBuf, fileIDTest, (void *) (intptr_t) id); + struct remoteFileBuf *rfile = openRemoteFiles + fileID; - afd->command = IO_Close_file; + xdebug("fileID %d: send buffer, close file and cleanup", fileID); - sendP(afd, id); + sendP(rfile); + MPI_Comm commPio = commInqCommPio(); + int funnelRank = commInqSizePio() - 1; + struct syncMsg query = { .amount = rfile->amount, .fileID = fileID, .command = IO_Close_file }; + xmpi(MPI_Send(&query, 1, cdiPioSyncMsgDt, funnelRank, IO_Sync_file, commPio)); + /* remove file element and wait for pending data sends to finish */ + destroyRemoteFileBuf(rfile); /* wait for other collectors to also close the file * this prevents one process from re-using the file ID before * another has sent the close */ - xmpi(MPI_Barrier(commInqCommColl())); + int iret; + xmpi(MPI_Bcast(&iret, 1, MPI_INT, funnelRank, commPio)); - /* remove file element */ - int iret = listSetRemove(bibRemoteFileBuf, fileIDTest, (void *) (intptr_t) id); return iret; } @@ -213,91 +197,111 @@ pioSendOpen(const char *filename, const char *mode) { if ((mode[0] != 'w' && mode[0] != 'W') || mode[0] == 0 || mode[1] != 0) xabort("Unsupported mode \"%s\" in parallel file open.", mode); - remoteFileBuf *afd; - static unsigned long buffersize = 0; - int id, iret; - enum - { - bcastRoot = 0, - messageLength = 32, - }; - char message[messageLength]; - MPI_Comm commCollectors = commInqCommColl(); - - /* broadcast buffersize to collectors */ - if (!buffersize) - { - if (commInqRankColl() == bcastRoot) buffersize = findWriteAccumBufsize(); - xmpi(MPI_Bcast(&buffersize, 1, MPI_UNSIGNED_LONG, bcastRoot, commCollectors)); - } - - /* init and add remoteFileBuf */ - afd = initRemoteFileBuf(filename, (size_t) buffersize); - if ((id = listSetAdd(bibRemoteFileBuf, afd)) < 0) xabort("filename %s is not unique", afd->name); - afd->fileID = id; - xdebug("filename=%s, init and added remoteFileBuf, return id = %d", filename, id); + struct cdiPioConf *conf = cdiPioGetConf(); - /* put filename, id and buffersize on buffer */ - iret = dbuffer_push(afd->db, filename, strlen(filename) + 1); - xassert(iret == 0); - sprintf(message, "%lX", buffersize); - iret = dbuffer_push(afd->db, message, strlen(message) + 1); - xassert(iret == 0); + /* init and add struct remoteFileBuf */ + for (size_t i = 0; i < openRemoteFilesSize; ++i) + if (openRemoteFiles[i].name && !strcmp(openRemoteFiles[i].name, filename)) + { + Warning("filename %s is already open!" + " CDI-PIO does not support concurrent access" + " through different filehandles.", + filename); + return CDI_EINVAL; + } - if (ddebug) + int fileID = CDI_ELIMIT; + if (openRemoteFilesSize == openRemoteFilesFill) + { + fileID = (int) openRemoteFilesSize; + if (openRemoteFilesSize == (size_t) INT_MAX + 1) return CDI_ELIMIT; + openRemoteFilesSize = openRemoteFilesSize ? openRemoteFilesSize * 2 : 4; + if (openRemoteFilesSize > (size_t) INT_MAX + 1) openRemoteFilesSize = (size_t) INT_MAX + 1; + openRemoteFiles = Realloc(openRemoteFiles, sizeof(*openRemoteFiles) * openRemoteFilesSize); + for (size_t i = (size_t) fileID; i < openRemoteFilesSize; ++i) openRemoteFiles[i].name = NULL; + } + else { - size_t l = strlen(filename) + strlen(message) + 2; - char *temp = Malloc(l + 1); - strncpy(temp, (char *) afd->db->buffer, l); - temp[l] = '\0'; - xdebug("filename=%s, put Open file message on buffer:\n%s,\t return", filename, temp); - Free(temp); + for (size_t i = 0; i < openRemoteFilesSize; ++i) + if (openRemoteFiles[i].name == NULL) + { + fileID = (int) i; + break; + } } - sendP(afd, afd->fileID); - xmpi(MPI_Barrier(commCollectors)); - return id; + struct remoteFileBuf *rfile = openRemoteFiles + fileID; + initRemoteFileBuf(rfile, filename, conf->writeAggBufLim); + + xdebug("filename=%s, init and added remoteFileBuf, return fileID = %d", filename, fileID); + + /* put filename, id and buffersize on buffer */ + size_t dbufIdx = rfile->dbufIdx; + MPI_Comm commPio = commInqCommPio(); + int intPackSize; + xmpi(MPI_Pack_size(2, MPI_INT, commPio, &intPackSize)); + size_t maxPathLen = (size_t) conf->maxPathLen, openMsgSize = (size_t) intPackSize + maxPathLen; + + unsigned char *buf = rfile->dbuf[dbufIdx].size >= openMsgSize ? rfile->dbuf[dbufIdx].buffer : Malloc(openMsgSize); + size_t bufSize = conf->writeAggBufLim; + size_t nameLen = strlen(filename); + assert(nameLen <= (size_t) conf->maxPathLen); + int position = 0; + int openMsgHdr[2] = { [0] = fileID, [1] = (int) nameLen }; + int funnelRank = commInqSizePio() - 1; + xmpi(MPI_Pack(openMsgHdr, 2, MPI_INT, buf, (int) bufSize, &position, commPio)); + xmpi(MPI_Pack((void *) filename, (int) nameLen, MPI_CHAR, buf, (int) bufSize, &position, commPio)); + xmpi(MPI_Send(buf, position, MPI_PACKED, funnelRank, IO_Open_file, commPio)); + if (buf != rfile->dbuf[dbufIdx].buffer) Free(buf); + return fileID; } static void pioSendFinalize(void) { - int buffer = 0, tag, specialRank = commInqSizePio() - 1; + int funnelRank = commInqSizePio() - 1; MPI_Comm commPio = commInqCommPio(); - tag = encodeFileOpTag(0, IO_Finalize); + static const struct syncMsg finQuery = { .amount = 0, .fileID = 0, .command = IO_Finalize }; + xmpi(MPI_Send((void *) &finQuery, 1, cdiPioSyncMsgDt, funnelRank, IO_Sync_file, commPio)); - xmpi(MPI_Send(&buffer, 1, MPI_INT, specialRank, tag, commPio)); xdebug("%s", "SENT MESSAGE WITH TAG \"IO_FINALIZE\" TO SPECIAL PROCESS"); - if (!listSetIsEmpty(bibRemoteFileBuf)) - xabort("set bibRemoteFileBuf not empty."); + if (openRemoteFilesFill) + xabort("files still open."); else { xdebug("%s", "destroy set"); - listSetDelete(bibRemoteFileBuf); + Free(openRemoteFiles); } + cdiPioDestroySyncMsgDt(); } void pioSendInitialize(void) { int numIOServers = commInqSizePio(); + cdiPioCreateSyncMsgDt(); if (numIOServers < 2) xabort("error: # of I/O processes must be >= 2 for mode, but is %d", numIOServers); int isCollector = commInqRankColl() != -1; - if (!isCollector) switch (commInqIOMode()) - { - case PIO_WRITER: pioWriterStdIO(); break; - case PIO_ASYNCH: pioWriterAIO(); break; - } + if (!isCollector) + { + switch (commInqIOMode()) + { + case PIO_WRITER: pioWriterStdIO(); break; +#ifdef _POSIX_ASYNCHRONOUS_IO + case PIO_ASYNCH: pioWriterAIO(); break; +#endif + } + cdiPioDestroySyncMsgDt(); + } else { namespaceSwitchSet(NSSWITCH_FILE_OPEN, NSSW_FUNC(pioSendOpen)); namespaceSwitchSet(NSSWITCH_FILE_CLOSE, NSSW_FUNC(pioSendClose)); namespaceSwitchSet(NSSWITCH_FILE_WRITE, NSSW_FUNC(pioSendWrite)); - cdiPioFileWritingFinalize = pioSendFinalize; - bibRemoteFileBuf = listSetNew(destroyRemoteFileBuf, compareNames); + namespaceSwitchSet(cdiPioExtraNSKeys[cdiPioEKFileWritingFinalize], NSSW_FUNC(pioSendFinalize)); } } diff --git a/src/pio_roles.c b/src/pio_roles.c index 41fce459bd7e813d37a8a416c0cc787789d82cc9..57879494b5d2150ec2c11d108afa63bf039305cf 100644 --- a/src/pio_roles.c +++ b/src/pio_roles.c @@ -95,7 +95,7 @@ cdiPioCSRBalanced(MPI_Comm commSuper, int IOMode, int nProcsIO) case PIO_ASYNCH: specialRole = PIO_ROLE_WRITER; collType = PIO_ROLE_COLLECTOR; - /* fallthrough intentional */ + /*-fallthrough*/ case PIO_FPGUARD: clientsPerCollectorMin = numClients / (nProcsIO - 1); rest = numClients % nProcsIO; diff --git a/src/pio_rpc.c b/src/pio_rpc.c index 4980daa89988fdf1fedf52300996cfb357974db8..33b26834c4b451d42651f03a404c75256fad7286 100644 --- a/src/pio_rpc.c +++ b/src/pio_rpc.c @@ -6,12 +6,31 @@ #include <stdbool.h> #include "cdi.h" +#include "dmemory.h" #include "resource_handle.h" /* FIXME: no longer needed when taxis updates are sent as separate data */ #include "taxis.h" #include "pio_interface.h" +#include "pio_comm.h" #include "pio_rpc.h" +#include "pio_util.h" + +/* replace once size_t-based version of vlistInqVarSize is merged */ +static size_t +cdiPioVlistInqVarSize(int vlistID, int varID) +{ + int zaxisID, gridID, tsteptype; + vlistInqVar(vlistID, varID, &gridID, &zaxisID, &tsteptype); + + int nlevs = zaxisInqSize(zaxisID); + + int gridsize = gridInqSize(gridID); + + size_t size = (size_t) gridsize * (size_t) nlevs; + + return size; +} struct clientBufSize computeClientStreamBufSize(int streamID, const struct collSpec *collector) @@ -20,23 +39,50 @@ computeClientStreamBufSize(int streamID, const struct collSpec *collector) struct clientBufSize rmaSizeSpec = { .bufSize = sizeof(struct winHeaderEntry), .numDataRecords = 1, .numRPCRecords = 0 }; int vlistID = streamInqVlist(streamID); size_t nvars = (size_t) vlistNvars(vlistID); - for (size_t varID = 0; varID < nvars; ++varID) + if (collector->partDesc) { - size_t chunkSize; - { - int varSize = vlistInqVarSize(vlistID, (int) varID); - chunkSize = (size_t) (ceilf(cdiPIOpartInflate_ * (float) varSize / (float) collector->numClients)); - } - rmaSizeSpec.numDataRecords += 2; - rmaSizeSpec.bufSize += chunkSize * sizeof(double) - /* re-align chunk to multiple of double size */ - + sizeof(double) - - 1 - /* one header for data record, one for corresponding part - * descriptor*/ - + 2 * sizeof(struct winHeaderEntry) - /* FIXME: heuristic for size of packed Xt_idxlist */ - + sizeof(Xt_int) * chunkSize * 3; + /* the distribution of data is fully prescribed in this case, + * i.e. memory needed can be computed exactly if the clients + * also specified the element type as float or double, otherwise + * plan for the double precision case */ + const Xt_idxlist *partDesc = collector->partDesc; + const int *conversion = collector->conversion; + for (size_t varID = 0; varID < nvars; ++varID) + { + size_t chunkSize = (size_t) (xt_idxlist_get_num_indices(partDesc[varID])); + rmaSizeSpec.numDataRecords += 2; + size_t elemSize = cdiPioElemSizeInference(varID, conversion); + size_t chunkBytes = chunkSize * elemSize + /* re-align chunk to multiple of double size */ + + elemSize + - 1 + /* one header for data record, one for corresponding part + * descriptor*/ + + 2 * sizeof(struct winHeaderEntry); + rmaSizeSpec.bufSize += chunkBytes; + } + } + else + { + /* the data distribution is unknown, use heuristic */ + for (size_t varID = 0; varID < nvars; ++varID) + { + size_t chunkSize; + { + size_t varSize = cdiPioVlistInqVarSize(vlistID, (int) varID); + chunkSize = (size_t) (ceilf(cdiPIOpartInflate_ * (float) varSize / (float) collector->numClients)); + } + rmaSizeSpec.numDataRecords += 2; + rmaSizeSpec.bufSize += chunkSize * sizeof(double) + /* re-align chunk to multiple of double size */ + + sizeof(double) + - 1 + /* one header for data record, one for corresponding part + * descriptor*/ + + 2 * sizeof(struct winHeaderEntry) + /* FIXME: heuristic for size of packed Xt_idxlist */ + + sizeof(Xt_int) * chunkSize * 3; + } } // memory required for the function calls encoded @@ -45,11 +91,48 @@ computeClientStreamBufSize(int streamID, const struct collSpec *collector) // from one model process if (collector->sendRPCData) { + int taxisID = vlistInqTaxis(vlistID); + MPI_Comm comm = cdiPioInqInterComm(); rmaSizeSpec.numRPCRecords = numRPCFuncs; rmaSizeSpec.bufSize += numRPCFuncs * sizeof(struct winHeaderEntry) /* data part of streamDefTimestep */ - + (2 * CDI_MAX_NAME + sizeof(taxis_t)); + + (size_t) (reshResourceGetPackSize(taxisID, &taxisOps, &comm)); } rmaSizeSpec.bufSize = roundUpToMultiple(rmaSizeSpec.bufSize, PIO_WIN_ALIGN); return rmaSizeSpec; } + +void +cdiPioDestroyPartDescPreset(size_t nRanks, size_t nVars, struct partDescPreset *deco) +{ + Xt_idxlist(*restrict partDesc)[nRanks] = (Xt_idxlist(*)[nRanks]) deco->lists; + Xt_uid(*restrict partDescUID)[nRanks] = (Xt_uid(*restrict)[nRanks]) deco->uids; + deco->lists = NULL; + deco->uids = NULL; + for (size_t k = 0; k < nRanks; ++k) + { + for (size_t i = 0; i < nVars; ++i) + { + Xt_uid uid = partDescUID[i][k]; + if (uid != 0) + { + xt_idxlist_delete(partDesc[i][k]); + for (size_t j = i + 1; j < nVars; ++j) + if (partDescUID[j][k] == uid) partDescUID[j][k] = 0; + } + } + } + Free(deco->conversion); + Free(partDesc); + Free(partDescUID); +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ diff --git a/src/pio_rpc.h b/src/pio_rpc.h index 15124c7436d08e827d404b03dd7c070bae66bd96..bb6da5e59c929b4d2d7f84d111307c617842cf59 100644 --- a/src/pio_rpc.h +++ b/src/pio_rpc.h @@ -16,16 +16,24 @@ enum collectorCommandTags FINALIZE, RESOURCES, STREAMOPEN, + STREAMFLUSHCLOSE, STREAMCLOSE, STREAMDEFVLIST, + STREAM_DEF_DECOMPOSED_VLIST, WRITETS, BLOCK_XFER, + DIST_DATA_AGG, + ASSERT_CONSISTENCY, + IDXLIST_PRESET, + IDXLIST_PRESET_SIZE, }; #define MAXWINBUFFERSIZE ((size_t) 2048 * 1024 * 1024) enum { + DATA_HEADER_FLOAT = 4, + DATA_HEADER_DOUBLE = 8, numRPCFuncs = 1, STREAMDEFTIMESTEP = -1, HEADERSIZEMARKER = -numRPCFuncs - 1, @@ -122,6 +130,8 @@ struct clientBufSize struct collSpec { + const Xt_idxlist *partDesc; + int *conversion; int numClients; int numServers; bool sendRPCData; @@ -129,6 +139,15 @@ struct collSpec struct clientBufSize computeClientStreamBufSize(int streamID, const struct collSpec *collector); +struct partDescPreset +{ + Xt_idxlist *lists; + Xt_uid *uids; + int *conversion; +}; + +void cdiPioDestroyPartDescPreset(size_t nRanks, size_t nVars, struct partDescPreset *deco); + #endif /* diff --git a/src/pio_serialize.c b/src/pio_serialize.c index e7913b0ce40201a4b05d7f395452fc5649126ebd..6ad58108a697bf5fd78fa7769822c68f9989c792 100644 --- a/src/pio_serialize.c +++ b/src/pio_serialize.c @@ -11,19 +11,29 @@ #include "pio_serialize.h" #include "pio_util.h" -static struct +#if MPI_VERSION == 1 || (MPI_VERSION == 2 && MPI_SUBVERSION < 2) +#define CDI_DT_MATCH_NEEDED 1 +#endif + +static +#ifndef CDI_DT_MATCH_NEEDED + const +#endif + struct { int cdidt; MPI_Datatype mpidt; } dtDict[] = { -#if MPI_VERSION == 1 || (MPI_VERSION == 2 && MPI_SUBVERSION < 2) -#define CDI_DT_MATCH_NEEDED 1 - { CDI_DATATYPE_INT8, MPI_SIGNED_CHAR }, { CDI_DATATYPE_INT16, MPI_SHORT }, { CDI_DATATYPE_UINT32, MPI_INT }, +#ifdef CDI_DT_MATCH_NEEDED + { CDI_DATATYPE_INT8, MPI_SIGNED_CHAR }, { CDI_DATATYPE_INT16, MPI_SHORT }, { CDI_DATATYPE_INT32, MPI_INT }, + { CDI_DATATYPE_UINT32, MPI_INT }, #else - { CDI_DATATYPE_INT8, MPI_INT8_T }, { CDI_DATATYPE_INT16, MPI_INT16_T }, { CDI_DATATYPE_UINT32, MPI_UINT32_T }, + { CDI_DATATYPE_INT8, MPI_INT8_T }, { CDI_DATATYPE_INT16, MPI_INT16_T }, { CDI_DATATYPE_INT32, MPI_INT32_T }, + { CDI_DATATYPE_UINT32, MPI_UINT32_T }, #endif - { CDI_DATATYPE_INT, MPI_INT }, { CDI_DATATYPE_UINT, MPI_UNSIGNED }, { CDI_DATATYPE_FLT64, MPI_DOUBLE }, - { CDI_DATATYPE_TXT, MPI_CHAR }, { CDI_DATATYPE_UCHAR, MPI_UNSIGNED_CHAR }, { CDI_DATATYPE_LONG, MPI_LONG }, + { CDI_DATATYPE_INT, MPI_INT }, { CDI_DATATYPE_UINT, MPI_UNSIGNED }, { CDI_DATATYPE_FLT64, MPI_DOUBLE }, + { CDI_DATATYPE_FLT, MPI_DOUBLE }, { CDI_DATATYPE_TXT, MPI_CHAR }, { CDI_DATATYPE_UCHAR, MPI_UNSIGNED_CHAR }, + { CDI_DATATYPE_LONG, MPI_LONG }, }; static inline size_t @@ -54,6 +64,7 @@ setupDtDict() { dtDictFixMPIType(lookupDt(CDI_DATATYPE_INT8), MPI_TYPECLASS_INTEGER, (int) sizeof(int8_t)); dtDictFixMPIType(lookupDt(CDI_DATATYPE_INT16), MPI_TYPECLASS_INTEGER, (int) sizeof(int16_t)); + dtDictFixMPIType(lookupDt(CDI_DATATYPE_INT32), MPI_TYPECLASS_INTEGER, (int) sizeof(int32_t)); dtDictFixMPIType(lookupDt(CDI_DATATYPE_UINT32), MPI_TYPECLASS_INTEGER, (int) sizeof(uint32_t)); dtDictMatchComplete = 1; } diff --git a/src/pio_server.c b/src/pio_server.c index e94fcfd06d255d0177450f2598bdb284f01bf6ef..208996fc6a7f8e0f89eee50a3dc63f586eb3e4d3 100644 --- a/src/pio_server.c +++ b/src/pio_server.c @@ -4,17 +4,20 @@ #include "config.h" #endif -#include "pio_server.h" - #include <limits.h> +#ifdef HAVE_PARALLEL_NC4 +#include <setjmp.h> +#endif #include <stdlib.h> #include <stdio.h> #ifdef HAVE_PARALLEL_NC4 +#include <core/ppm_extents.h> #include <core/ppm_combinatorics.h> #include <core/ppm_rectilinear.h> #include <ppm/ppm_uniform_partition.h> #endif +#include <mpi.h> #include <yaxt.h> #include "cdi.h" @@ -24,16 +27,27 @@ #include "namespace.h" #include "taxis.h" #include "pio.h" +#include "pio_cdf_int.h" #include "pio_comm.h" #include "pio_conf.h" +#include "pio_idxlist_cache.h" #include "pio_id_set.h" #include "pio_interface.h" #include "pio_rpc.h" +#include "pio_server.h" #include "pio_util.h" +#include "pio_xmap_cache.h" #ifndef HAVE_NETCDF_PAR_H +#ifdef __clang__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-macros" +#endif +/* the following causes netcdf.h to not try to redefine MPI_Comm etc. */ #define MPI_INCLUDED +#ifdef __clang__ +#pragma GCC diagnostic pop +#endif #endif -#include "pio_cdf_int.h" #include "resource_handle.h" #include "resource_unpack.h" #include "stream_cdf.h" @@ -49,31 +63,50 @@ struct clientBuf struct streamMemLayout { Xt_uid varPartIdxListUID; - size_t offset; + int offset, conversion; }; struct cacheRedist { Xt_redist redist; - int sliceSize; + size_t sliceSize; +#if defined HAVE_PARALLEL_NC4 + // additional member for parallel writing variant for NetCDF4 + struct PPM_extent sliceExtent[3]; +#endif }; +static void *sharedClientBuf = NULL; +static size_t sharedClientBufSize = 0; + static struct { MPI_Win getWin; struct clientBuf *clientBuf; -#if defined HAVE_LIBNETCDF && !defined HAVE_PARALLEL_NC4 +#ifdef HAVE_LIBNETCDF int ownerRank; #endif /* put data for description of last layout from RMA GET here */ struct streamMemLayout *prevLayout; size_t numRetained; struct cacheRedist *retained; - size_t aggBufSize, aggBufUsed; - void *aggBuf; + struct partDescPreset clientDeco; } * rxWin; -static struct idList openStreams, openFiles; +static struct +{ + size_t size, used; + void *mem; +} aggBuf; + +/* map streamID's to linear index into arrays */ +static struct idList openStreams; + +static struct cdiPioIdxlistCache *DstIdxlistCache; +static size_t neededDstIdxlistCacheSize; + +static struct xmapCache *XmapCache; +static size_t neededXmapCacheSize; struct recordWrite { @@ -106,11 +139,12 @@ static int numPioPrimes; /************************************************************************/ static void -cdiPioServerStreamWinDestroy(size_t streamIdx) +cdiPioServerStreamWinDestroy(size_t streamIdx, const struct cdiPioConf *conf) { if (rxWin[streamIdx].getWin != MPI_WIN_NULL) { - Free(rxWin[streamIdx].clientBuf[0].mem); + if (conf->batchedRMA) Free(rxWin[streamIdx].clientBuf[0].mem); + rxWin[streamIdx].clientBuf[0].mem = NULL; xmpi(MPI_Win_free(&rxWin[streamIdx].getWin)); } } @@ -134,18 +168,61 @@ setupClientRanks(void) } static void -cdiPioServerStreamWinCreate(size_t streamIdx, MPI_Info no_locks_info, MPI_Comm collClientIntraComm, struct clientBufSize *bufSizes) +createClientStreamBuf(size_t streamIdx, const struct clientBufSize *bufSizes, const struct cdiPioConf *conf) { - xmpi(MPI_Win_create(MPI_BOTTOM, 0, 1, no_locks_info, collClientIntraComm, &rxWin[streamIdx].getWin)); + /* find and tabulate aggregate size needed for all clients of collector */ size_t streamBufferSize = 0; for (size_t i = 0; i < (size_t) numClients_; ++i) { streamBufferSize += (rxWin[streamIdx].clientBuf[i].size = bufSizes[i].bufSize); rxWin[streamIdx].clientBuf[i].dictSize = bufSizes[i].numDataRecords + bufSizes[i].numRPCRecords; } - rxWin[streamIdx].clientBuf[0].mem = Malloc(streamBufferSize); - for (size_t i = 1; i < (size_t) numClients_; ++i) - rxWin[streamIdx].clientBuf[i].mem = rxWin[streamIdx].clientBuf[i - 1].mem + bufSizes[i - 1].bufSize; + /* set pointer to RMA buffer for client 0 of collector */ + if (conf->batchedRMA) + rxWin[streamIdx].clientBuf[0].mem = Malloc(streamBufferSize); + else + { + if (streamBufferSize > sharedClientBufSize) + { + intptr_t oldmem = (intptr_t) sharedClientBuf; + sharedClientBuf = Realloc(sharedClientBuf, streamBufferSize); + sharedClientBufSize = streamBufferSize; + if (oldmem != (intptr_t) sharedClientBuf) + { + size_t numStreams = openStreams.size; + for (size_t j = 0; j < numStreams; ++j) + if (rxWin[j].getWin != MPI_WIN_NULL) + { + unsigned char *newmem = sharedClientBuf; + for (size_t i = 0; i < (size_t) numClients_; ++i) + { + rxWin[j].clientBuf[i].mem = newmem; + newmem += rxWin[j].clientBuf[i].size; + } + } + } + } + rxWin[streamIdx].clientBuf[0].mem = sharedClientBuf; + } + /* set pointers for other clients */ + { + unsigned char *newmem = rxWin[streamIdx].clientBuf[0].mem; + for (size_t i = 1; i < (size_t) numClients_; ++i) + { + newmem += rxWin[streamIdx].clientBuf[i - 1].size; + rxWin[streamIdx].clientBuf[i].mem = newmem; + } + } +} + +static void +cdiPioServerStreamWinCreate(size_t streamIdx, MPI_Comm collClientIntraComm) +{ + MPI_Info no_locks_info; + xmpi(MPI_Info_create(&no_locks_info)); + xmpi(MPI_Info_set(no_locks_info, "no_locks", "true")); + xmpi(MPI_Win_create(MPI_BOTTOM, 0, 1, no_locks_info, collClientIntraComm, &rxWin[streamIdx].getWin)); + xmpi(MPI_Info_free(&no_locks_info)); } /************************************************************************/ @@ -183,50 +260,52 @@ readFuncCall(struct winHeaderEntry *header, size_t streamIdx) /************************************************************************/ static void -resizeVarGatherBuf(int size, double **buf, int *bufSize) +resizeVarGatherBuf(size_t size, void **buf, size_t *bufSize) { if (size <= *bufSize) ; else - *buf = Realloc(*buf, (size_t) (*bufSize = size) * sizeof(buf[0][0])); + *buf = Realloc(*buf, *bufSize = size); } -#define wHECast struct winHeaderEntry *)(void * +#define wHECast(buf) ((struct winHeaderEntry *) (void *) buf) -static Xt_redist -buildVarRedist(int headerIdx, size_t streamIdx, - /* index list representing the data elements gathered on - * this rank */ - Xt_idxlist dstList, const struct cdiPioConf *conf) +static Xt_xmap +buildVarXmap(struct Xt_offset_ext *restrict partExts, const struct clientBuf *restrict clientBuf, size_t headerIdx, + Xt_idxlist dstList, Xt_idxlist *partDescPreset, MPI_Comm pioInterComm, MPI_Comm collComm, int varID, + const struct cdiPioConf *conf) { - const struct clientBuf *restrict clientBuf = rxWin[streamIdx].clientBuf; - const struct winHeaderEntry *winDict = (wHECast) clientBuf[0].mem; - int streamID = openStreams.entries[streamIdx]; - int varID = winDict[headerIdx].specific.dataRecord.varID; - struct Xt_offset_ext *partExts = Malloc((size_t) numClients_ * sizeof(partExts[0])); - Xt_idxlist *part = Malloc((size_t) numClients_ * sizeof(part[0])); - MPI_Comm pioInterComm = cdiPioInqInterComm(), collComm = commInqCommColl(); - for (size_t clientIdx = 0; clientIdx < (size_t) numClients_; ++clientIdx) + size_t numClients = (size_t) numClients_; + Xt_idxlist *part = partDescPreset ? partDescPreset : Malloc(numClients * sizeof(part[0])); + int conversion = (wHECast(clientBuf[0].mem))[headerIdx].id; + size_t elemSize = conversion == DATA_HEADER_FLOAT ? sizeof(float) : sizeof(double); + for (size_t clientIdx = 0; clientIdx < numClients; ++clientIdx) { unsigned char *clientMem = clientBuf[clientIdx].mem; - struct dataRecord *dataHeader = &((wHECast) clientMem)[headerIdx].specific.dataRecord; - int position = ((wHECast) clientMem)[headerIdx + 1].offset; - xassert(namespaceAdaptKey2(((wHECast) clientMem)[headerIdx].id) == streamID && dataHeader->varID == varID - && (((wHECast) clientMem)[headerIdx + 1].id == PARTDESCMARKER) && position > 0 - && ((size_t) position >= sizeof(struct winHeaderEntry) * (size_t) clientBuf[clientIdx].dictSize) - && ((size_t) position < clientBuf[clientIdx].size)); - part[clientIdx] = xt_idxlist_unpack(clientMem, (int) clientBuf[clientIdx].size, &position, pioInterComm); + struct dataRecord *dataHeader = &(wHECast(clientMem))[headerIdx].specific.dataRecord; + xassert(dataHeader->varID == varID && (wHECast(clientMem))[headerIdx].id == conversion + && ((wHECast(clientMem))[headerIdx + 1].id == PARTDESCMARKER)); + if (!partDescPreset) + { + int position = (wHECast(clientMem))[headerIdx + 1].offset; + xassert(position > 0 && ((size_t) position >= sizeof(struct winHeaderEntry) * (size_t) clientBuf[clientIdx].dictSize) + && ((size_t) position < clientBuf[clientIdx].size)); + part[clientIdx] = xt_idxlist_unpack(clientMem, (int) clientBuf[clientIdx].size, &position, pioInterComm); + } unsigned partSize = (unsigned) xt_idxlist_get_num_indices(part[clientIdx]); - size_t charOfs = (size_t) ((clientMem + ((wHECast) clientMem)[headerIdx].offset) - clientBuf[0].mem); - xassert(charOfs % sizeof(double) == 0 && charOfs / sizeof(double) + partSize <= INT_MAX); - int elemOfs = (int) (charOfs / sizeof(double)); + size_t charOfs = (size_t) ((clientMem + (wHECast(clientMem))[headerIdx].offset) - clientBuf[0].mem); + xassert(charOfs % elemSize == 0 && charOfs / elemSize + partSize <= INT_MAX); + int elemOfs = (int) (charOfs / elemSize); partExts[clientIdx].start = elemOfs; partExts[clientIdx].size = (int) partSize; partExts[clientIdx].stride = 1; } - Xt_idxlist srcList = xt_idxlist_collection_new(part, numClients_); - for (size_t clientIdx = 0; clientIdx < (size_t) numClients_; ++clientIdx) xt_idxlist_delete(part[clientIdx]); - Free(part); + Xt_idxlist srcList = xt_idxlist_collection_new(part, (int) numClients); + if (!partDescPreset) + { + for (size_t clientIdx = 0; clientIdx < numClients; ++clientIdx) xt_idxlist_delete(part[clientIdx]); + Free(part); + } if (conf->stripify) { Xt_idxlist srcListStriped = xt_idxstripes_from_idxlist_new(srcList); @@ -235,68 +314,80 @@ buildVarRedist(int headerIdx, size_t streamIdx, } Xt_xmap gatherXmap = conf->xmap_new(srcList, dstList, collComm); xt_idxlist_delete(srcList); - struct Xt_offset_ext gatherExt = { .start = 0, .size = xt_idxlist_get_num_indices(dstList), .stride = 1 }; - Xt_redist varRedist = xt_redist_p2p_ext_new(gatherXmap, numClients_, partExts, 1, &gatherExt, MPI_DOUBLE); - xt_xmap_delete(gatherXmap); - Free(partExts); - return varRedist; -} - -struct xyzDims -{ - int sizes[3]; -}; - -static Xt_idxlist -buildVarSlicesIdxList(int vlistID, int varID, int startLvl, int numLvl) -{ - int varShape[3] = { 0, 0, 0 }; - cdiPioQueryVarDims(varShape, vlistID, varID); - /* int varSize = varShape[0] * varShape[1] * varShape[2]; */ - Xt_int varShapeXt[3], origin[3] = { startLvl >= 0 ? (Xt_int) startLvl : 0, 0, 0 }; - int sliceShape[3]; - for (unsigned i = 0; i < 3; ++i) varShapeXt[2 - i] = (Xt_int) varShape[i]; - sliceShape[0] = numLvl >= 0 ? numLvl : (int) varShape[2]; - sliceShape[1] = varShape[1]; - sliceShape[2] = varShape[0]; - return xt_idxsection_new(0, 3, varShapeXt, sliceShape, origin); + return gatherXmap; } -static int -countVarChunkMissingVals(int vlistID, int varID, struct streamMapping *mapping, int chunkLen, const double *restrict data) +#ifdef HAVE_PARALLEL_NC4 +/* + * Given a divisor @a composite_div, + * find subset $F$ of prime divisors of @a composite_div such that the + * product of $F$ is less than npartMax and maximal + */ +unsigned +findMaxDivision(unsigned npartMax, unsigned composite_div) { - size_t nmiss = 0; - if (mapping->hasMissing[varID]) + uint32_t factors[31], *factors_ = factors; + int numFactors = PPM_prime_factorization_32((uint32_t) composite_div, &factors_); + /* try to use prime factors */ + uint_fast32_t divAttempt, maxDiv = 1; + /* test all possible assignments of factors, starting with + * only one assigned (omitting no assigned case because that would + * never be better than start value of maxDiv */ + for (int numAssigned = 1; numAssigned <= numFactors; ++numAssigned) { - double missval = vlistInqVarMissval(vlistID, varID); - for (size_t i = 0; i < (size_t) chunkLen; ++i) nmiss += (data[i] == missval); + uint_fast32_t pattern = (UINT32_C(1) << numAssigned) - 1, lastPattern = pattern << (numFactors - numAssigned); + do + { + divAttempt = 1; + /* loop over all factors */ + for (uint_fast32_t i = 0; i < (uint_fast32_t) numFactors; ++i) + { + uint_fast32_t assigned = (pattern >> i) & 1; + if (assigned) divAttempt *= factors[i]; + } + if (divAttempt <= npartMax && divAttempt > maxDiv) maxDiv = divAttempt; + /* find next sequence of numAssigned set bits and numFactors + * - numFactors unset bits */ + { + uint_fast32_t t; +#if HAVE_DECL___BUILTIN_CTZ + t = pattern | (pattern - 1); + pattern = (t + 1) | (((~t & -~t) - 1) >> (__builtin_ctz((unsigned) pattern) + 1)); +#else + t = (pattern | (pattern - 1)) + 1; + pattern = t | ((((t & -t) / (pattern & -pattern)) >> 1) - 1); +#endif + } + } + while (pattern <= lastPattern); } - return nmiss; + return (unsigned) maxDiv; } -#ifdef HAVE_LIBNETCDF -static void -gatherArray(int headerIdx, size_t streamIdx, double *gatherBuf, - /* index list representing the data elements gathered on - * this rank */ - Xt_idxlist dstList, const struct cdiPioConf *conf) -{ - Xt_redist gatherRedist = buildVarRedist(headerIdx, streamIdx, dstList, conf); - xt_redist_s_exchange1(gatherRedist, rxWin[streamIdx].clientBuf[0].mem, gatherBuf); - xt_redist_delete(gatherRedist); -} -#endif - -#ifdef HAVE_PARALLEL_NC4 static void queryVarBounds(struct PPM_extent varShape[3], int vlistID, int varID) { - varShape[0].first = 0; - varShape[1].first = 0; - varShape[2].first = 0; int sizes[3]; cdiPioQueryVarDims(sizes, vlistID, varID); - for (unsigned i = 0; i < 3; ++i) varShape[i].size = sizes[i]; + for (unsigned i = 0; i < 3; ++i) varShape[i].first = 0, varShape[i].size = sizes[i]; +} + +struct xyzDims +{ + unsigned sizes[3]; +}; + +static struct xyzDims +varDimsCollGridMax(const struct PPM_extent varDims[3]) +{ + struct xyzDims collGrid = { { 1U, 1U, 1U } }; + unsigned collDiv = (unsigned) (commInqSizeColl()); + for (size_t i = 3; i > 0; --i) + { + unsigned usedDiv = collGrid.sizes[i - 1] = findMaxDivision((unsigned) varDims[i - 1].size, collDiv); + collDiv /= usedDiv; + } + return collGrid; } /* compute distribution of collectors such that number of collectors @@ -304,19 +395,19 @@ queryVarBounds(struct PPM_extent varShape[3], int vlistID, int varID) static struct xyzDims varDimsCollGridMatch(const struct PPM_extent varDims[3]) { - xassert(PPM_extents_size(3, varDims) >= commInqSizeColl()); struct xyzDims collGrid = { { 1, 1, 1 } }; /* because of storage order, dividing dimension 3 first is preferred */ for (int i = 0; i < numPioPrimes; ++i) { for (int dim = 2; dim >= 0; --dim) - if (collGrid.sizes[dim] * pioPrimes[i] <= varDims[dim].size) + if (collGrid.sizes[dim] * pioPrimes[i] <= (unsigned) varDims[dim].size) { collGrid.sizes[dim] *= pioPrimes[i]; goto nextPrime; } - /* no position found, retrack */ - xabort("Not yet implemented back-tracking needed."); + /* no easy I/O decomposition found, do exhaustive search for not + * necessarily perfect decomposition */ + return varDimsCollGridMax(varDims); nextPrime:; } return collGrid; @@ -326,95 +417,576 @@ static void myVarPart(struct PPM_extent varShape[3], struct xyzDims collGrid, struct PPM_extent myPart[3]) { int32_t myCollGridCoord[3]; + struct PPM_extent collGridShape[3]; + unsigned collGridSize = 1; + for (size_t i = 0; i < 3; ++i) + { + collGridShape[i].first = 0; + collGridShape[i].size = (int32_t) collGrid.sizes[i]; + collGridSize *= collGrid.sizes[i]; + } + int collRank = commInqRankColl(); + if ((unsigned) collRank < collGridSize) + { + PPM_lidx2rlcoord_e(3, collGridShape, collRank, myCollGridCoord); + xdebug("my coord: (%d, %d, %d)", myCollGridCoord[0], myCollGridCoord[1], myCollGridCoord[2]); + int32_t sizes[3]; + for (size_t i = 0; i < 3; ++i) sizes[i] = (int32_t) collGrid.sizes[i]; + PPM_uniform_partition_nd(3, varShape, sizes, myCollGridCoord, myPart); + } + else + for (size_t i = 0; i < 3; ++i) myPart[i].first = myPart[i].size = 0; +} + +static void +cdiPioNetCDFParChunk(int vlistID, int varID, Xt_idxlist *preWriteChunk, struct PPM_extent varChunk[3]) +{ + struct PPM_extent varShape[3]; + queryVarBounds(varShape, vlistID, varID); + const struct xyzDims collGrid = varDimsCollGridMatch(varShape); + xdebug("writing varID %d with dimensions: " + "x=%d, y=%d, z=%d,\n" + "found distribution with dimensions:" + " x=%d, y=%d, z=%d.", + varID, varShape[0].size, varShape[1].size, varShape[2].size, collGrid.sizes[0], collGrid.sizes[1], collGrid.sizes[2]); + myVarPart(varShape, collGrid, varChunk); { - struct PPM_extent collGridShape[3]; + Xt_int preWriteChunkStart[3]; + int preWriteChunkSize[3]; + Xt_int varDims[3]; for (int i = 0; i < 3; ++i) { - collGridShape[i].first = 0; - collGridShape[i].size = collGrid.sizes[i]; + varDims[2 - i] = varShape[i].size; + preWriteChunkStart[2 - i] = (Xt_int) varChunk[i].first; + preWriteChunkSize[2 - i] = (int) varChunk[i].size; + } + *preWriteChunk = cdiPioIdxlistCacheAddSection3D(DstIdxlistCache, varDims, preWriteChunkStart, preWriteChunkSize); + } +} +#endif + +static void +allocUIDLookup(size_t numClients, Xt_uid *restrict *uids, int *restrict *partSizes) +{ + size_t uidBytes = sizeof(**uids) * (numClients + 1), partSizesBytes = sizeof(**partSizes) * (numClients + 1), + partSizeAlign = sizeof(**partSizes), uidBytesRoundUp = ((uidBytes + partSizeAlign - 1) / partSizeAlign * partSizeAlign); + *uids = Malloc(uidBytes + uidBytesRoundUp + partSizesBytes); + *partSizes = (int *) (void *) ((unsigned char *) *uids + uidBytes + uidBytesRoundUp); +} + +static Xt_idxlist buildVarSlicesIdxList(int vlistID, int varID, int startLvl, int numLvl, const struct cdiPioConf *conf); + +static void +buildDecoPresetXmapsCommon(Xt_idxlist outPartList, size_t numClients, const Xt_uid *partDescUIDs, Xt_idxlist *partDesc, + int *restrict partSizes, Xt_uid *uids, MPI_Comm collComm, const struct cdiPioConf *conf) +{ + uids[0] = xt_idxlist_get_uid(outPartList); + for (size_t clientIdx = 0; clientIdx < numClients; ++clientIdx) uids[clientIdx + 1] = partDescUIDs[clientIdx]; + Xt_xmap varXmap; + if (!(varXmap = cdiPioXmapCacheLookup(XmapCache, uids, partSizes))) + { + Xt_idxlist srcList = xt_idxlist_collection_new(partDesc, (int) numClients); + if (conf->stripify) + { + Xt_idxlist srcListStriped = xt_idxstripes_from_idxlist_new(srcList); + xt_idxlist_delete(srcList); + srcList = srcListStriped; + } + varXmap = conf->xmap_new(srcList, outPartList, collComm); + xt_idxlist_delete(srcList); + partSizes[0] = xt_idxlist_get_num_indices(outPartList); + for (size_t clientIdx = 0; clientIdx < numClients; ++clientIdx) + partSizes[clientIdx + 1] = xt_idxlist_get_num_indices(partDesc[clientIdx]); + cdiPioXmapCacheAdd(XmapCache, uids, partSizes, varXmap); + } +} + +#ifdef HAVE_LIBNETCDF +typedef Xt_idxlist (*outDstListConstruct)(int vlistID, int varID, const struct cdiPioConf *conf); +#ifdef HAVE_PARALLEL_NC4 +Xt_idxlist +createOutDstListNetCDFPar(int vlistID, int varID, const struct cdiPioConf *conf) +{ + (void) conf; + struct PPM_extent varChunk[3]; + Xt_idxlist preWriteChunk; + cdiPioNetCDFParChunk(vlistID, varID, &preWriteChunk, varChunk); + return preWriteChunk; +} +#endif + +static Xt_idxlist +createOutDstListNetCDFSerialFunnel(int vlistID, int varID, const struct cdiPioConf *conf) +{ + Xt_idxlist preWriteChunk = buildVarSlicesIdxList(vlistID, varID, -1, -1, conf); + return preWriteChunk; +} + +static Xt_idxlist +createOutDstListNetCDFSerialAssist(int vlistID, int varID, const struct cdiPioConf *conf) +{ + (void) vlistID; + (void) varID; + (void) conf; + return xt_idxempty_new(); +} + +static void +buildDecoPresetXmapsNetCDF(int vlistID, struct partDescPreset clientDeco, MPI_Comm collComm, outDstListConstruct getOutDstList, + const struct cdiPioConf *conf) +{ + int nVars = vlistNvars(vlistID); + size_t numClients = (size_t) numClients_; + /* assume all variables are written in full */ + Xt_uid *restrict uids = NULL, (*partDescUIDs)[numClients] = (Xt_uid(*)[numClients]) clientDeco.uids; + Xt_idxlist(*partDesc)[numClients] = (Xt_idxlist(*)[numClients]) clientDeco.lists; + int *partSizes = NULL; + allocUIDLookup(numClients, &uids, &partSizes); + for (int varID = 0; varID < nVars; ++varID) + { + Xt_idxlist outPartList = getOutDstList(vlistID, varID, conf); + buildDecoPresetXmapsCommon(outPartList, numClients, partDescUIDs[varID], partDesc[varID], partSizes, uids, collComm, conf); + } + Free(uids); +} +#endif + +/* build inventory of written variables for hypothetical full-stream */ +static struct streamMapping * +streamMappingSpeculativeNew(int vlistID, struct partDescPreset clientDeco, const struct cdiPioConf *conf) +{ + (void) conf; + int nVars = vlistNvars(vlistID); + /* varMap[i] == index of header if variable i is written to, + * numLvlsW[i] == number of levels of variable i or 0 if not written + */ + size_t numWrittenRecords = 0; + int *restrict numLvlsW = Malloc((size_t) nVars * sizeof(numLvlsW[0])); + for (int varID = 0; varID < nVars; ++varID) + { + numWrittenRecords += (size_t) (numLvlsW[varID] = zaxisInqSize(vlistInqVarZaxis(vlistID, varID))); + } + /* set number of levels for each variable written to full */ + struct streamMapping *result = Malloc(sizeof(*result) + numWrittenRecords * sizeof(result->writtenRecords[0]) + + (size_t) nVars * 2 * sizeof(result->varMap[0])); + struct recordWrite *restrict writtenRecords = result->writtenRecords; + result->varMap = (void *) (writtenRecords + numWrittenRecords); + result->numLvlsW = result->varMap + nVars; + const int *conversion = clientDeco.conversion; + { + size_t j = (size_t) -1; + /* initialized to shut up gcc, loop logic ensures initialization + * to occur before first use */ + size_t recordNumElem = 0; + int lastVarID = -1; + for (int varID = 0; varID < nVars; ++varID) + { + size_t numLvl = (size_t) (result->numLvlsW[varID] = numLvlsW[varID]); + if (varID != lastVarID) + { + int varShape[3]; + cdiPioQueryVarDims(varShape, vlistID, varID); + recordNumElem = (size_t) varShape[0] * (size_t) varShape[1]; + lastVarID = varID; + } + result->varMap[varID] = 1; + size_t elemSize = cdiPioElemSizeInference((size_t) varID, conversion); + size_t recordDataSize = recordNumElem * elemSize; + for (size_t lvl = 0; lvl < numLvl; ++lvl) + writtenRecords[++j] = (struct recordWrite){ .varID = varID, .level = (int) lvl, .dataSize = recordDataSize }; + } + } + result->numVars = nVars; + result->numWrittenRecords = (int) numWrittenRecords; + Free(numLvlsW); + result->layout = NULL; + return result; +} + +/* denote what will be aggregated at a single process */ +struct passPlan +{ + unsigned recordAggStart, recordAggEnd; + int varStart, varEnd; +}; + +struct passDict +{ + int varID; + unsigned recordStart, recordEnd; +}; + +static size_t buildPassVarDict(size_t collSize, const struct passPlan *passes, const struct recordWrite *restrict writtenRecords, + size_t *dictSize, struct passDict **dict); + +static size_t planPasses(const struct streamMapping *mapping, const struct cdiPioConf *conf, size_t collSize, + struct passPlan (**passes_)[collSize]); + +struct idxlistAndSize +{ + Xt_idxlist list; + int listSize; +}; + +static struct idxlistAndSize dstListFromRecordRange(int vlistID, int varID, int myVarStart, int myVarEnd, size_t myRecordStart, + size_t myRecordEnd, const struct recordWrite *restrict writtenRecords, + size_t recordStart, size_t recordEnd, const struct cdiPioConf *conf); + +static void +buildDecoPresetXmapsGrib(int vlistID, struct partDescPreset clientDeco, MPI_Comm collComm, int collRank, + const struct cdiPioConf *conf) +{ + struct streamMapping *syntheticMapping = streamMappingSpeculativeNew(vlistID, clientDeco, conf); + size_t collSize = (size_t) commInqSizeColl(); + struct passPlan(*passes)[collSize] = NULL; + size_t numPasses = planPasses(syntheticMapping, conf, collSize, &passes); + struct passDict *varsInPass = NULL; + size_t varsInPassSize = 0; + size_t numClients = (size_t) numClients_; + /* assume all variables are written in full */ + Xt_uid *restrict uids = NULL, (*partDescUIDs)[numClients] = (Xt_uid(*)[numClients]) clientDeco.uids; + Xt_idxlist(*partDesc)[numClients] = (Xt_idxlist(*)[numClients]) clientDeco.lists; + int *restrict partSizes = NULL; + allocUIDLookup(numClients, &uids, &partSizes); + struct recordWrite *restrict writtenRecords = syntheticMapping->writtenRecords; + for (size_t pass = 0; pass < numPasses; ++pass) + { + size_t myRecordStart = passes[pass][collRank].recordAggStart, myRecordEnd = passes[pass][collRank].recordAggEnd; + size_t numVarsInPass = buildPassVarDict(collSize, passes[pass], writtenRecords, &varsInPassSize, &varsInPass); + int myVarStart = passes[pass][collRank].varStart, myVarEnd = passes[pass][collRank].varEnd; + for (size_t varIdx = 0; varIdx < numVarsInPass; ++varIdx) + { + int varID = varsInPass[varIdx].varID; + struct idxlistAndSize dst + = dstListFromRecordRange(vlistID, varID, myVarStart, myVarEnd, myRecordStart, myRecordEnd, writtenRecords, + varsInPass[varIdx].recordStart, varsInPass[varIdx].recordEnd, conf); + buildDecoPresetXmapsCommon(dst.list, numClients, partDescUIDs[varID], partDesc[varID], partSizes, uids, collComm, conf); + } + } + Free(varsInPass); + Free(uids); + Free(syntheticMapping); + Free(passes); +} + +static void +buildDecoPresetXmaps(int streamID, struct partDescPreset clientDeco, MPI_Comm collComm, const struct cdiPioConf *conf) +{ + int filetype = streamInqFiletype(streamID); + int vlistID = streamInqVlist(streamID); + switch (filetype) + { + case CDI_FILETYPE_GRB: + case CDI_FILETYPE_GRB2: + buildDecoPresetXmapsGrib(vlistID, clientDeco, collComm, commInqRankColl(), conf); + /* writeGribStream(streamIdx, map, &data, ¤tDataBufSize, conf); */ + break; +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NC: + case CDI_FILETYPE_NC2: + case CDI_FILETYPE_NC4: + case CDI_FILETYPE_NC4C: + { + int rankOpen = cdiPioStream2Owner(streamID); + outDstListConstruct createOutList; +#ifdef HAVE_PARALLEL_NC4 + if (rankOpen == CDI_PIO_COLLECTIVE_OPEN) + createOutList = createOutDstListNetCDFPar; + else +#endif + { + const int collRank = commInqRankColl(); + createOutList = rankOpen == collRank ? createOutDstListNetCDFSerialFunnel : createOutDstListNetCDFSerialAssist; + } + buildDecoPresetXmapsNetCDF(vlistID, clientDeco, collComm, createOutList, conf); + } +#endif + } +} + +static Xt_redist +buildVarRedist(int headerIdx, size_t streamIdx, + /* index list representing the data elements gathered on + * this rank */ + Xt_idxlist dstList, Xt_idxlist *partDescPreset, const struct cdiPioConf *conf) +{ + const struct clientBuf *restrict clientBuf = rxWin[streamIdx].clientBuf; + const struct winHeaderEntry *winDict = wHECast(clientBuf[0].mem); + int varID = winDict[headerIdx].specific.dataRecord.varID; + int conversion = winDict[headerIdx].id; + size_t elemSize = conversion == DATA_HEADER_FLOAT ? sizeof(float) : sizeof(double); + size_t numClients = (size_t) numClients_; + struct Xt_offset_ext *partExts = Malloc(numClients * sizeof(partExts[0])); + MPI_Comm pioInterComm = cdiPioInqInterComm(), collComm = commInqCommColl(); + Xt_xmap gatherXmap; + struct Xt_offset_ext gatherExt = { .start = 0, .size = xt_idxlist_get_num_indices(dstList), .stride = 1 }; + Xt_uid *restrict uids = NULL; + int *restrict partSizes = NULL; + bool cacheXmaps = conf->cacheXmaps; + if (cacheXmaps) + { + allocUIDLookup(numClients, &uids, &partSizes); + uids[0] = xt_idxlist_get_uid(dstList); + for (size_t clientIdx = 0; clientIdx < numClients; ++clientIdx) + { + unsigned char *clientMem = clientBuf[clientIdx].mem; + struct winHeaderEntry *partHeader = (wHECast(clientMem)) + headerIdx + 1; + xassert(partHeader->id == PARTDESCMARKER); + uids[clientIdx + 1] = unpackXTUID(partHeader->specific.partDesc.packedUID); + } + if ((gatherXmap = cdiPioXmapCacheLookup(XmapCache, uids, partSizes))) + { + for (size_t clientIdx = 0; clientIdx < numClients; ++clientIdx) + { + unsigned char *clientMem = clientBuf[clientIdx].mem; + struct dataRecord *dataHeader = &(wHECast(clientMem))[headerIdx].specific.dataRecord; + xassert(dataHeader->varID == varID && (wHECast(clientMem))[headerIdx].id == conversion); + size_t charOfs = (size_t) ((clientMem + (wHECast(clientMem))[headerIdx].offset) - clientBuf[0].mem); + int partSize = partSizes[clientIdx + 1]; + xassert(charOfs % elemSize == 0 && charOfs / elemSize + (size_t) partSize <= INT_MAX); + int elemOfs = (int) (charOfs / elemSize); + partExts[clientIdx].start = elemOfs; + partExts[clientIdx].size = partSize; + partExts[clientIdx].stride = 1; + } + goto finishXmapCaching; + } + } + gatherXmap = buildVarXmap(partExts, clientBuf, (size_t) headerIdx, dstList, partDescPreset, pioInterComm, collComm, varID, conf); + if (cacheXmaps) + { + partSizes[0] = gatherExt.size; + for (size_t i = 0; i < numClients; ++i) partSizes[i + 1] = partExts[i].size; + cdiPioXmapCacheAdd(XmapCache, uids, partSizes, gatherXmap); + finishXmapCaching: + Free(uids); + } + MPI_Datatype elemDt = conversion == DATA_HEADER_FLOAT ? MPI_FLOAT : MPI_DOUBLE; + Xt_redist varRedist = xt_redist_p2p_ext_new(gatherXmap, (int) numClients, partExts, 1, &gatherExt, elemDt); + if (!cacheXmaps) xt_xmap_delete(gatherXmap); + Free(partExts); + return varRedist; +} + +static Xt_idxlist +buildVarSlicesIdxList(int vlistID, int varID, int startLvl, int numLvl, const struct cdiPioConf *conf) +{ + int varShape[3] = { 0, 0, 0 }; + cdiPioQueryVarDims(varShape, vlistID, varID); + /* int varSize = varShape[0] * varShape[1] * varShape[2]; */ + Xt_int varShapeXt[3], origin[3] = { startLvl >= 0 ? (Xt_int) startLvl : 0, 0, 0 }; + int sliceShape[3]; + for (unsigned i = 0; i < 3; ++i) varShapeXt[2 - i] = (Xt_int) varShape[i]; + sliceShape[0] = numLvl >= 0 ? numLvl : (int) varShape[2]; + sliceShape[1] = varShape[1]; + sliceShape[2] = varShape[0]; + Xt_idxlist idxlist; + if (conf->stripify) + { + /* FIXME: does not support grids larger than INT_MAX cells */ + int sliceSize = varShape[0] * varShape[1]; + Xt_int start = sliceSize * origin[0]; + int nstrides = sliceSize * sliceShape[0]; + idxlist = cdiPioIdxlistCacheAddStripes1(DstIdxlistCache, start, nstrides); + } + else + idxlist = cdiPioIdxlistCacheAddSection3D(DstIdxlistCache, varShapeXt, origin, sliceShape); + return idxlist; +} + +static inline size_t +countMemMissingDouble(size_t n, const double *restrict data, double missVal) +{ + size_t nmiss = 0; + for (size_t i = 0; i < n; ++i) nmiss += (data[i] == missVal); + return nmiss; +} + +static inline size_t +countMemMissingFloat(size_t n, const float *restrict data, double missVal) +{ + size_t nmiss = 0; + float missValF = (float) missVal; + if (missValF == missVal) + for (size_t i = 0; i < n; ++i) nmiss += (data[i] == missValF); + return nmiss; +} + +static size_t +countVarChunkMissingVals(int vlistID, int varID, struct streamMapping *mapping, size_t chunkLen, int conversion, + const void *restrict data) +{ + size_t nmiss = 0; + if (mapping->hasMissing[varID]) + { + double missVal = vlistInqVarMissval(vlistID, varID); + if (conversion == DATA_HEADER_DOUBLE) + nmiss = countMemMissingDouble(chunkLen, data, missVal); + else + nmiss = countMemMissingFloat(chunkLen, data, missVal); + } + return nmiss; +} + +static inline void +destructRetained(struct cacheRedist *restrict retained, size_t numRetained) +{ + for (size_t i = 0; i < (size_t) numRetained; ++i) + if (retained[i].redist) xt_redist_delete(retained[i].redist); +} + +/* return true if the new mapping for stream streamIdx is unchanged + * with respect to the previous mapping such that a previously + * constructed set of redists can be re-used. + * + * vlistID is only passed to prevent repeated calls to + * streamInqVlist(streamID) + */ +static inline bool +handleRedistCache(size_t streamIdx, struct streamMapping *restrict mapping, size_t numPasses, int vlistID, MPI_Comm collComm) +{ + bool reuseRedists = false; + if (!rxWin[streamIdx].retained) + { + rxWin[streamIdx].retained = Calloc(numPasses, sizeof(*rxWin[streamIdx].retained)); + rxWin[streamIdx].numRetained = numPasses; + rxWin[streamIdx].prevLayout = mapping->layout; + mapping->layout = NULL; + } + else + { + size_t numClients = (size_t) numClients_, numVars = (size_t) vlistNvars(vlistID); + reuseRedists = !memcmp(mapping->layout, rxWin[streamIdx].prevLayout, numClients * numVars * sizeof(mapping->layout[0])); + if (!reuseRedists) + { + Free(rxWin[streamIdx].prevLayout); + rxWin[streamIdx].prevLayout = mapping->layout; + mapping->layout = NULL; + } + { + int temp = reuseRedists; + xmpi(MPI_Allreduce(MPI_IN_PLACE, &temp, 1, MPI_INT, MPI_LAND, collComm)); + reuseRedists = temp; } - PPM_lidx2rlcoord_e(3, collGridShape, commInqRankColl(), myCollGridCoord); - xdebug("my coord: (%d, %d, %d)", myCollGridCoord[0], myCollGridCoord[1], myCollGridCoord[2]); - } - PPM_uniform_partition_nd(3, varShape, collGrid.sizes, myCollGridCoord, myPart); + if (!reuseRedists) + { + destructRetained(rxWin[streamIdx].retained, rxWin[streamIdx].numRetained); + rxWin[streamIdx].retained = Realloc(rxWin[streamIdx].retained, numPasses * sizeof(*rxWin[streamIdx].retained)); + for (size_t i = 0; i < numPasses; ++i) rxWin[streamIdx].retained[i].redist = NULL; + rxWin[streamIdx].numRetained = numPasses; + } + } + return reuseRedists; } +#ifdef HAVE_PARALLEL_NC4 + +#include <core/ppm_combinatorics.h> + /* collective writing variant */ static void -writeNetCDFStream(size_t streamIdx, struct streamMapping *mapping, double **data_, int *currentDataBufSize, - const struct cdiPioConf *conf) +writeNetCDFStreamParallel(size_t streamIdx, struct streamMapping *mapping, void **data_, size_t *currentDataBufSize, + const struct cdiPioConf *conf) { - int nvars = mapping->numVars; - int *restrict varMap = mapping->varMap; - int streamID = openStreams.entries[streamIdx], vlistID = streamInqVlist(streamID); + const int nvars = mapping->numVars; + const int *restrict varMap = mapping->varMap; + const int streamID = openStreams.entries[streamIdx], vlistID = streamInqVlist(streamID); + const MPI_Comm collComm = commInqCommColl(); + // init redistCache if applicable + const bool reuseRedists = conf->cacheRedists ? handleRedistCache(streamIdx, mapping, (size_t) nvars, vlistID, collComm) : false; + struct cacheRedist *restrict retained = rxWin[streamIdx].retained; + const struct clientBuf *restrict clientBuf = rxWin[streamIdx].clientBuf; + const struct winHeaderEntry *winDict = wHECast(clientBuf[0].mem); + Xt_idxlist *partDescPreset = rxWin[streamIdx].clientDeco.lists; + for (int varID = 0; varID < nvars; ++varID) if (mapping->numLvlsW[varID]) { - struct PPM_extent varShape[3]; - queryVarBounds(varShape, vlistID, varID); - struct xyzDims collGrid = varDimsCollGridMatch(varShape); - xdebug("writing varID %d with dimensions: " - "x=%d, y=%d, z=%d,\n" - "found distribution with dimensions:" - " x=%d, y=%d, z=%d.", - varID, varShape[0].size, varShape[1].size, varShape[2].size, collGrid.sizes[0], collGrid.sizes[1], - collGrid.sizes[2]); + int headerIdx = varMap[varID]; + size_t varSize; + Xt_redist gatherRedist; struct PPM_extent varChunk[3]; - myVarPart(varShape, collGrid, varChunk); int myChunk[3][2]; - for (int i = 0; i < 3; ++i) + if (reuseRedists) { - myChunk[i][0] = PPM_extent_start(varChunk[i]); - myChunk[i][1] = PPM_extent_end(varChunk[i]); + gatherRedist = retained[varID].redist; + varSize = retained[varID].sliceSize; + for (size_t i = 0; i < 3; ++i) + { + varChunk[i] = retained[varID].sliceExtent[i]; + myChunk[i][0] = PPM_extent_start(varChunk[i]); + myChunk[i][1] = PPM_extent_end(varChunk[i]); + } } - xdebug("Writing chunk { { %d, %d }, { %d, %d }," - " { %d, %d } }", - myChunk[0][0], myChunk[0][1], myChunk[1][0], myChunk[1][1], myChunk[2][0], myChunk[2][1]); - Xt_int varSize[3]; - for (int i = 0; i < 3; ++i) varSize[2 - i] = varShape[i].size; - Xt_idxlist preWriteChunk; - /* prepare yaxt descriptor for write chunk */ - { - Xt_int preWriteChunkStart[3]; - int preWriteChunkSize[3]; - for (int i = 0; i < 3; ++i) + else + { + /* prepare yaxt descriptor for write chunk */ + Xt_idxlist preWriteChunk; + cdiPioNetCDFParChunk(vlistID, varID, &preWriteChunk, varChunk); + for (int i = 0; i < 3; ++i) + { + myChunk[i][0] = PPM_extent_start(varChunk[i]); + myChunk[i][1] = PPM_extent_end(varChunk[i]); + } + xdebug("Writing chunk { { %d, %d }, { %d, %d }," + " { %d, %d } }", + myChunk[0][0], myChunk[0][1], myChunk[1][0], myChunk[1][1], myChunk[2][0], myChunk[2][1]); + varSize = (size_t) xt_idxlist_get_num_indices(preWriteChunk); + /* transpose data into write deco */ { - preWriteChunkStart[2 - i] = (Xt_int) varChunk[i].first; - preWriteChunkSize[2 - i] = (int) varChunk[i].size; + Xt_idxlist *varPartDescPreset = partDescPreset ? partDescPreset + numClients_ * varID : NULL; + gatherRedist = buildVarRedist(headerIdx, streamIdx, preWriteChunk, varPartDescPreset, conf); + if (conf->cacheRedists) + { + retained[varID].redist = gatherRedist; + retained[varID].sliceSize = varSize; + retained[varID].sliceExtent[0] = varChunk[0]; + retained[varID].sliceExtent[1] = varChunk[1]; + retained[varID].sliceExtent[2] = varChunk[2]; + } } - preWriteChunk = xt_idxsection_new(0, 3, varSize, preWriteChunkSize, preWriteChunkStart); - } - resizeVarGatherBuf(xt_idxlist_get_num_indices(preWriteChunk), data_, currentDataBufSize); - double *restrict data = *data_; - /* transpose data into write deco */ + } + int conversion = winDict[headerIdx].id; + size_t elemSize = conversion == DATA_HEADER_FLOAT ? sizeof(float) : sizeof(double); + resizeVarGatherBuf(elemSize * varSize, data_, currentDataBufSize); + void *restrict data = *data_; + xt_redist_s_exchange1(gatherRedist, rxWin[streamIdx].clientBuf[0].mem, data); + + if (!conf->cacheRedists) xt_redist_delete(gatherRedist); + { - int headerIdx = varMap[varID]; - gatherArray(headerIdx, streamIdx, data, preWriteChunk, conf); - xt_idxlist_delete(preWriteChunk); + /* count missing values if appropriate */ + size_t nmiss + = countVarChunkMissingVals(vlistID, varID, mapping, (size_t) (PPM_extents_size(3, varChunk)), conversion, data); + /* write chunk */ + if (conversion == DATA_HEADER_DOUBLE) + streamWriteVarChunk(streamID, varID, (const int(*)[2]) myChunk, data, (int) nmiss); + else + streamWriteVarChunkF(streamID, varID, (const int(*)[2]) myChunk, data, (int) nmiss); } - /* count missing values if appropriate */ - size_t nmiss = countVarChunkMissingVals(vlistID, varID, mapping, PPM_extents_size(3, varChunk), data); - /* write chunk */ - streamWriteVarChunk(streamID, varID, (const int(*)[2]) myChunk, data, nmiss); } } -#elif defined(HAVE_LIBNETCDF) +#endif + +#if defined(HAVE_LIBNETCDF) /* needed for writing when some files are only written to by a single process */ -/* cdiOpenFileMap(fileID) gives the writer process */ -static int -cdiPioSerialOpenFileMap(int streamID) +/* cdiOpenStreamMap(streamID) returns the writer process rank, or + * CDI_PIO_COLLECTIVE if the file is written collectively */ +int +cdiPioStream2Owner(int streamID) { size_t streamIdx = indexOfID(&openStreams, streamID); xassert(streamIdx < SIZE_MAX); return rxWin[streamIdx].ownerRank; } + /* for load-balancing purposes, count number of files per process */ /* cdiOpenFileCounts[rank] gives number of open files rank has to himself */ static int *cdiSerialOpenFileCount; static int -cdiPioNextOpenRank() +cdiPioNextOpenRank(void) { xassert(cdiSerialOpenFileCount != NULL); int commCollSize = commInqSizeColl(); @@ -446,57 +1018,107 @@ cdiPioCloseFileOnRank(int rank) static void cdiPioServerCdfDefVars(stream_t *streamptr) { - int rank, rankOpen; - if (commInqIOMode() == PIO_NONE || ((rank = commInqRankColl()) == (rankOpen = cdiPioSerialOpenFileMap(streamptr->self)))) + int rankOpen = cdiPioStream2Owner(streamptr->self); + if (commInqIOMode() == PIO_NONE +#ifdef HAVE_PARALLEL_NC4 + || rankOpen == CDI_PIO_COLLECTIVE_OPEN +#endif + || commInqRankColl() == rankOpen) cdfDefCoordinateVars(streamptr); } static void -writeNetCDFStream(size_t streamIdx, struct streamMapping *mapping, double **data_, int *currentDataBufSize, - const struct cdiPioConf *conf) +writeNetCDFStreamSerial(size_t streamIdx, struct streamMapping *mapping, void **data_, size_t *currentDataBufSize, + const struct cdiPioConf *conf) { - int nvars = mapping->numVars; - int *restrict varMap = mapping->varMap, *restrict numLvlsW = mapping->numLvlsW; + const int nvars = mapping->numVars; + const int *restrict varMap = mapping->varMap, *restrict numLvlsW = mapping->numLvlsW; /* determine process which has stream open (writer) and * which has data for which variable (var owner) * three cases need to be distinguished */ - int streamID = openStreams.entries[streamIdx], vlistID = streamInqVlist(streamID); - int writerRank = cdiPioSerialOpenFileMap(streamID); - int collRank = commInqRankColl(); + const int streamID = openStreams.entries[streamIdx], vlistID = streamInqVlist(streamID); + const int writerRank = cdiPioStream2Owner(streamID); + const int collRank = commInqRankColl(); + const MPI_Comm collComm = commInqCommColl(); // HB: which communicator is to be supplied here? + const bool reuseRedists + = conf->cacheRedists != 0 ? handleRedistCache(streamIdx, mapping, (size_t) nvars, vlistID, collComm) : false; + struct cacheRedist *restrict retained = rxWin[streamIdx].retained; + + const struct clientBuf *restrict clientBuf = rxWin[streamIdx].clientBuf; + const struct winHeaderEntry *winDict = wHECast(clientBuf[0].mem); + Xt_idxlist *partDescPreset = rxWin[streamIdx].clientDeco.lists; + for (int varID = 0; varID < nvars; ++varID) if (numLvlsW[varID]) { - int varSize; - Xt_idxlist dstList; - if (writerRank == collRank) + size_t varSize; + Xt_redist gatherRedist; + int headerIdx = varMap[varID]; + int conversion = winDict[headerIdx].id; + size_t elemSize = conversion == DATA_HEADER_FLOAT ? sizeof(float) : sizeof(double); + + if (reuseRedists) { - dstList = buildVarSlicesIdxList(vlistID, varID, -1, -1); - varSize = xt_idxlist_get_num_indices(dstList); - resizeVarGatherBuf(varSize, data_, currentDataBufSize); + gatherRedist = retained[varID].redist; + varSize = retained[varID].sliceSize; + if (writerRank == collRank) resizeVarGatherBuf(varSize * elemSize, data_, currentDataBufSize); } else { - varSize = 0; - dstList = xt_idxempty_new(); + Xt_idxlist dstList; + if (writerRank == collRank) + { + dstList = buildVarSlicesIdxList(vlistID, varID, -1, -1, conf); + varSize = (size_t) xt_idxlist_get_num_indices(dstList); + resizeVarGatherBuf(varSize * elemSize, data_, currentDataBufSize); + } + else + { + varSize = 0; + dstList = xt_idxempty_new(); + } + Xt_idxlist *varPartDescPreset = partDescPreset ? partDescPreset + numClients_ * varID : NULL; + gatherRedist = buildVarRedist(headerIdx, streamIdx, dstList, varPartDescPreset, conf); + if (conf->cacheRedists) + { + retained[varID].redist = gatherRedist; + retained[varID].sliceSize = varSize; + } } - double *restrict data = *data_; - int headerIdx = varMap[varID]; - gatherArray(headerIdx, streamIdx, data, dstList, conf); + void *restrict data = *data_; + xt_redist_s_exchange1(gatherRedist, rxWin[streamIdx].clientBuf[0].mem, data); + if (!conf->cacheRedists) xt_redist_delete(gatherRedist); if (writerRank == collRank) { - size_t nmiss = countVarChunkMissingVals(vlistID, varID, mapping, varSize, data); - streamWriteVar(streamID, varID, data, nmiss); + size_t nmiss = countVarChunkMissingVals(vlistID, varID, mapping, varSize, conversion, data); + if (conversion == DATA_HEADER_DOUBLE) + streamWriteVar(streamID, varID, data, (int) nmiss); + else + streamWriteVarF(streamID, varID, data, (int) nmiss); } - xt_idxlist_delete(dstList); } } +static void +writeNetCDFStream(size_t streamIdx, struct streamMapping *mapping, void **data_, size_t *currentDataBufSize, + const struct cdiPioConf *conf) +{ + void (*writeNetCDFStream_)(size_t streamIdx, struct streamMapping * mapping, void **data_, size_t *currentDataBufSize, + const struct cdiPioConf *conf) + = writeNetCDFStreamSerial; +#ifdef HAVE_PARALLEL_NC4 + int streamID = openStreams.entries[streamIdx]; + int rankOpen = cdiPioStream2Owner(streamID); + if (rankOpen == CDI_PIO_COLLECTIVE_OPEN) writeNetCDFStream_ = writeNetCDFStreamParallel; +#endif + writeNetCDFStream_(streamIdx, mapping, data_, currentDataBufSize, conf); +} #endif static inline struct winHeaderEntry * winDictEntry(size_t streamIdx, size_t client, size_t entry) { - return ((wHECast) rxWin[streamIdx].clientBuf[client].mem) + entry; + return (wHECast(rxWin[streamIdx].clientBuf[client].mem)) + entry; } static struct streamMemLayout * @@ -511,19 +1133,20 @@ getLayout(size_t streamIdx) for (size_t client = 0; client < numClients; ++client) for (size_t headerIdx = 1; headerIdx < numDataEntries; headerIdx += 2) { - xassert(namespaceAdaptKey2(winDictEntry(streamIdx, client, headerIdx)->id) == streamID); struct winHeaderEntry *varHeader = winDictEntry(streamIdx, client, headerIdx); + xassert(varHeader->id == DATA_HEADER_DOUBLE || varHeader->id == DATA_HEADER_FLOAT); + int conversion = varHeader->id; size_t varID = (size_t) varHeader[0].specific.dataRecord.varID; - size_t offset = (size_t) varHeader[0].offset; + int offset = varHeader[0].offset; Xt_uid uid = unpackXTUID(varHeader[1].specific.partDesc.packedUID); - layout[client][varID] = (struct streamMemLayout){ .varPartIdxListUID = uid, .offset = offset }; + layout[client][varID] = (struct streamMemLayout){ .varPartIdxListUID = uid, .offset = offset, .conversion = conversion }; } return *layout; } /* build inventory of written variables for stream */ static struct streamMapping * -streamMappingNew(size_t streamIdx, struct winHeaderEntry *winDict, const struct cdiPioConf *conf) +streamMappingNew(size_t streamIdx, const struct winHeaderEntry *winDict, const struct cdiPioConf *conf) { int streamID = openStreams.entries[streamIdx]; int numDataEntries = winDict[0].specific.headerSize.numDataEntries; @@ -536,7 +1159,6 @@ streamMappingNew(size_t streamIdx, struct winHeaderEntry *winDict, const struct *restrict numLvlsW = varMap + 2 * numVars, *restrict hasMissing_ = varMap + 3 * numVars; for (int headerIdx = 1; headerIdx < numDataEntries; headerIdx += 2) { - xassert(namespaceAdaptKey2(winDict[headerIdx].id) == streamID); int varID = winDict[headerIdx].specific.dataRecord.varID; /* ensure a variable has not been enqueued twice */ /* FIXME: this could better be ensured on client */ @@ -559,8 +1181,8 @@ streamMappingNew(size_t streamIdx, struct winHeaderEntry *winDict, const struct { size_t j = (size_t) -1; /* initialized to shut up gcc, loop logic ensures initialization - * at least once */ - size_t recordDataSize = 0; + * to occur before first use */ + size_t recordNumElem = 0; int lastVarID = -1; for (int varID = 0; varID < numVars; ++varID) { @@ -569,9 +1191,13 @@ streamMappingNew(size_t streamIdx, struct winHeaderEntry *winDict, const struct { int varShape[3]; cdiPioQueryVarDims(varShape, vlistID, varID); - recordDataSize = (size_t) varShape[0] * (size_t) varShape[1] * sizeof(double); + recordNumElem = (size_t) varShape[0] * (size_t) varShape[1]; lastVarID = varID; } + size_t headerIdx = (size_t) varMap[varID]; + int conversion = winDict[headerIdx].id; + size_t elemSize = conversion == DATA_HEADER_FLOAT ? sizeof(float) : sizeof(double); + size_t recordDataSize = recordNumElem * elemSize; result->varMap[varID] = varMap[varID]; result->hasMissing[varID] = hasMissing_[varID]; for (size_t lvl = 0; lvl < numLvl; ++lvl) @@ -593,54 +1219,13 @@ streamMappingDelete(struct streamMapping **mapping) *mapping = NULL; } -static inline void -destructRetained(struct cacheRedist *restrict retained, size_t numRetained) -{ - for (size_t i = 0; i < (size_t) numRetained; ++i) xt_redist_delete(retained[i].redist); -} - -static inline bool -handleRedistCache(size_t streamIdx, struct streamMapping *restrict mapping, size_t numPasses, int vlistID, MPI_Comm collComm) -{ - bool reuseRedists = false; - if (!rxWin[streamIdx].retained) - { - rxWin[streamIdx].retained = Malloc(numPasses * sizeof(*rxWin[streamIdx].retained)); - rxWin[streamIdx].numRetained = numPasses; - rxWin[streamIdx].prevLayout = mapping->layout; - mapping->layout = NULL; - } - else - { - size_t numClients = (size_t) numClients_, numVars = (size_t) vlistNvars(vlistID); - reuseRedists = !memcmp(mapping->layout, rxWin[streamIdx].prevLayout, numClients * numVars * sizeof(mapping->layout[0])); - if (!reuseRedists) - { - Free(rxWin[streamIdx].prevLayout); - rxWin[streamIdx].prevLayout = mapping->layout; - mapping->layout = NULL; - } - { - int temp = reuseRedists; - xmpi(MPI_Allreduce(MPI_IN_PLACE, &temp, 1, MPI_INT, MPI_LAND, collComm)); - reuseRedists = temp; - } - if (!reuseRedists) - { - destructRetained(rxWin[streamIdx].retained, rxWin[streamIdx].numRetained); - rxWin[streamIdx].retained = Realloc(rxWin[streamIdx].retained, numPasses * sizeof(*rxWin[streamIdx].retained)); - rxWin[streamIdx].numRetained = numPasses; - } - } - return reuseRedists; -} - -/* denote what will be aggregated at a single process */ -struct passPlan -{ - unsigned recordAggStart, recordAggEnd; - int varStart, varEnd; -}; +#if __GNUC__ == 11 && __GNUC_MINOR__ <= 2 +/* gcc 11.1 has a bug in the -fsanitize=undefined functionality + * which creates a bogus warning without the below suppression, bug + * report at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101585 */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wvla-parameter" +#endif /** * @param[out] passes_ pointer to pointer to 2-dimensional array of @@ -650,10 +1235,9 @@ struct passPlan * @return number of passes */ static size_t -planPasses(size_t streamIdx, const struct streamMapping *mapping, const struct cdiPioConf *conf, size_t collSize, +planPasses(const struct streamMapping *mapping, const struct cdiPioConf *conf, size_t collSize, struct passPlan (**passes_)[collSize]) { - (void) streamIdx; size_t numPasses = 0; size_t recordAggBufLim = conf->recordAggBufLimMB * 1024 * 1024, totalAggBufSpace = recordAggBufLim * collSize, totalWritten = 0; /* find total size of data written for the stream and build prefix sums */ @@ -698,12 +1282,19 @@ planPasses(size_t streamIdx, const struct streamMapping *mapping, const struct c * recordAggLim data bytes, but use at least one, unless none * remain */ size_t firstRecordOfPass = 0, curRecord; +#if !defined __PGI || __PGIC__ != 20 struct passPlan(*passes)[collSize] = NULL; +#else + /* we need the following workaround because pggpp2 fails to produce + * LLVM IR assembly file with -O2 optimization level */ + struct passPlan *passes = NULL; +#endif + size_t sizeof_pass = collSize * sizeof(struct passPlan); do { size_t taskBegin = firstRecordOfPass; curRecord = firstRecordOfPass - 1; - passes = Realloc(passes, sizeof(*passes) * (numPasses + 1)); + passes = Realloc(passes, sizeof_pass * (numPasses + 1)); for (size_t rank = 0; rank < collSize; ++rank) { size_t recordAggBufSize = 0; @@ -711,23 +1302,36 @@ planPasses(size_t streamIdx, const struct streamMapping *mapping, const struct c && ((recordAggBufSize + writtenRecords[curRecord + 1].dataSize) < recordAggBufLim)) recordAggBufSize += writtenRecords[++curRecord].dataSize; if (curRecord == taskBegin - 1 && curRecord + 1 < numWrittenRecords) ++curRecord; - passes[numPasses][rank] = (struct passPlan){ - .recordAggStart = (unsigned) taskBegin, - .recordAggEnd = (unsigned) curRecord, - .varStart = writtenRecords[taskBegin].varID, - .varEnd = writtenRecords[curRecord].varID, - }; +#if !defined __PGI || __PGIC__ != 20 + passes[numPasses][rank] +#else + passes[numPasses * collSize + rank] +#endif + = (struct passPlan){ + .recordAggStart = (unsigned) taskBegin, + .recordAggEnd = (unsigned) curRecord, + .varStart = writtenRecords[taskBegin].varID, + .varEnd = writtenRecords[curRecord].varID, + }; taskBegin = curRecord + 1; } ++numPasses, firstRecordOfPass = curRecord + 1; } while (curRecord + 1 < numWrittenRecords); +#if !defined __PGI || __PGIC__ != 20 *passes_ = passes; +#else + *passes_ = (struct passPlan(*)[collSize]) passes; +#endif } Free(recordDataSizePfxSums); return numPasses; } +#if __GNUC__ == 11 && __GNUC_MINOR__ <= 2 +#pragma GCC diagnostic pop +#endif + static inline size_t szmin(size_t a, size_t b) { @@ -743,26 +1347,79 @@ szmax(size_t a, size_t b) static size_t aggBufAppend(int fileID, const void *restrict ptr, size_t size) { - size_t fileIdx = indexOfID(&openFiles, fileID), aggBufSize = rxWin[fileIdx].aggBufSize, aggBufUsed = rxWin[fileIdx].aggBufUsed; - void *restrict aggBuf = rxWin[fileIdx].aggBuf; - if (aggBufUsed + size > aggBufSize) - rxWin[fileIdx].aggBuf = aggBuf = Realloc(aggBuf, (rxWin[fileIdx].aggBufSize = aggBufUsed + size)); - memcpy((unsigned char *) aggBuf + aggBufUsed, ptr, size); - rxWin[fileIdx].aggBufUsed = aggBufUsed + size; + (void) fileID; + size_t aggBufSize = aggBuf.size, aggBufUsed = aggBuf.used; + void *restrict buf = aggBuf.mem; + if (aggBufUsed + size > aggBufSize) aggBuf.mem = buf = Realloc(buf, (aggBuf.size = aggBufUsed + size)); + memcpy((unsigned char *) buf + aggBufUsed, ptr, size); + aggBuf.used = aggBufUsed + size; return size; } static void -aggBufFlush(size_t streamIdx, size_t (*cdiPioFileWrite)(int, const void *restrict, size_t, int)) +aggBufFlush(int streamID, int fileID, size_t (*cdiPioFileWrite)(int, const void *restrict, size_t, int)) { - int fileID = openFiles.entries[streamIdx]; - int streamID = openStreams.entries[streamIdx]; - cdiPioFileWrite(fileID, rxWin[streamIdx].aggBuf, rxWin[streamIdx].aggBufUsed, streamInqCurTimestepID(streamID)); - rxWin[streamIdx].aggBufUsed = 0; + cdiPioFileWrite(fileID, aggBuf.mem, aggBuf.used, streamInqCurTimestepID(streamID)); + aggBuf.used = 0; +} + +static size_t +buildPassVarDict(size_t collSize, const struct passPlan *passes, const struct recordWrite *restrict writtenRecords, + size_t *dictSize, struct passDict **dict) +{ + unsigned base = passes[0].recordAggStart; + size_t numRecordsInPass = passes[collSize - 1].recordAggEnd - base + 1; + size_t maxVarsInPass = (size_t) (passes[collSize - 1].varEnd - passes[0].varStart + 1); + struct passDict *varsInPass = *dict; + size_t oldSize = *dictSize, newSize = szmin(numRecordsInPass, maxVarsInPass); + if (oldSize < newSize) + { + *dictSize = newSize; + varsInPass = *dict = Realloc(varsInPass, newSize * sizeof(*varsInPass)); + } + /* establish variables involved in this pass */ + size_t numVarsInPass = 1; + varsInPass[0].recordStart = base; + int lastSeenVarID = varsInPass[0].varID = writtenRecords[base].varID; + for (size_t i = 1; i < numRecordsInPass; ++i) + if (lastSeenVarID != writtenRecords[base + i].varID) + { + varsInPass[numVarsInPass - 1].recordEnd = (unsigned) (base + i - 1); + varsInPass[numVarsInPass].varID = lastSeenVarID = writtenRecords[base + i].varID; + varsInPass[numVarsInPass].recordStart = (unsigned) (base + i); + ++numVarsInPass; + } + varsInPass[numVarsInPass - 1].recordEnd = (unsigned) (base + numRecordsInPass - 1); + return numVarsInPass; +} + +static struct idxlistAndSize +dstListFromRecordRange(int vlistID, int varID, int myVarStart, int myVarEnd, size_t myRecordStart, size_t myRecordEnd, + const struct recordWrite *restrict writtenRecords, size_t recordStart, size_t recordEnd, + const struct cdiPioConf *conf) +{ + /* is this process writing part of this variable? */ + Xt_idxlist dstList; + int listSize; + if (myRecordStart <= myRecordEnd && myVarStart <= varID && myVarEnd >= varID) + { + size_t myVarRecordStart = writtenRecords[myRecordStart].varID == varID ? myRecordStart : recordStart; + size_t myLevelStart = (size_t) writtenRecords[myVarRecordStart].level; + size_t myVarRecordEnd = writtenRecords[myRecordEnd].varID == varID ? myRecordEnd : recordEnd; + size_t myNumLevels = (size_t) writtenRecords[myVarRecordEnd].level - myLevelStart + 1; + dstList = buildVarSlicesIdxList(vlistID, varID, (int) myLevelStart, (int) myNumLevels, conf); + listSize = xt_idxlist_get_num_indices(dstList); + } + else + { + dstList = xt_idxempty_new(); + listSize = 0; + } + return (struct idxlistAndSize){ .list = dstList, .listSize = listSize }; } static void -writeGribStream(size_t streamIdx, struct streamMapping *mapping, double **data_, int *currentDataBufSize, +writeGribStream(size_t streamIdx, struct streamMapping *mapping, void **data_, size_t *currentDataBufSize, const struct cdiPioConf *conf) { const struct clientBuf *restrict clientBuf = rxWin[streamIdx].clientBuf; @@ -773,40 +1430,22 @@ writeGribStream(size_t streamIdx, struct streamMapping *mapping, double **data_, size_t collSize = (size_t) commInqSizeColl(); size_t collRank = (size_t) commInqRankColl(); struct passPlan(*passes)[collSize] = NULL; - size_t numPasses = planPasses(streamIdx, mapping, conf, collSize, &passes); + size_t numPasses = planPasses(mapping, conf, collSize, &passes); Xt_redist *varRedists = NULL; + size_t numClients = (size_t) numClients_; + Xt_idxlist(*partDescPreset)[numClients] = (Xt_idxlist(*)[numClients]) rxWin[streamIdx].clientDeco.lists; struct recordWrite *restrict writtenRecords = mapping->writtenRecords; size_t (*cdiPioFileWrite)(int fileID, const void *restrict buffer, size_t len, int tsID) = (size_t(*)(int, const void *restrict, size_t, int)) namespaceSwitchGet(NSSWITCH_FILE_WRITE).func; bool reuseRedists = conf->cacheRedists != 0 ? handleRedistCache(streamIdx, mapping, (size_t) numPasses, vlistID, collComm) : false; struct cacheRedist *restrict retained = rxWin[streamIdx].retained; - struct - { - int varID; - unsigned recordStart, recordEnd; - } *varsInPass = NULL; + struct passDict *varsInPass = NULL; + size_t varsInPassSize = 0, maxNumVarsAlloc = 0; MPI_Aint *displ = NULL; + const struct winHeaderEntry *winDict = wHECast(clientBuf[0].mem); for (size_t pass = 0; pass < numPasses; ++pass) { - unsigned base = passes[pass][0].recordAggStart; - size_t numRecordsInPass = passes[pass][collSize - 1].recordAggEnd - base + 1; - size_t maxVarsInPass = (size_t) (passes[pass][collSize - 1].varEnd - passes[pass][0].varStart + 1); - varsInPass = Realloc(varsInPass, sizeof(*varsInPass) * szmin(numRecordsInPass, maxVarsInPass)); - /* establish variables involved in this pass */ - size_t numVarsInPass = 1; - varsInPass[0].recordStart = base; - int lastSeenVarID = varsInPass[0].varID = writtenRecords[base].varID; - for (size_t i = 1; i < numRecordsInPass; ++i) - if (lastSeenVarID != writtenRecords[base + i].varID) - { - varsInPass[numVarsInPass - 1].recordEnd = (unsigned) (base + i - 1); - varsInPass[numVarsInPass].varID = lastSeenVarID = writtenRecords[base + i].varID; - varsInPass[numVarsInPass].recordStart = (unsigned) (base + i); - ++numVarsInPass; - } - varsInPass[numVarsInPass - 1].recordEnd = (unsigned) (base + numRecordsInPass - 1); - varRedists = Realloc(varRedists, numVarsInPass * sizeof(*varRedists)); size_t myRecordStart = passes[pass][collRank].recordAggStart, myRecordEnd = passes[pass][collRank].recordAggEnd; size_t myAggSize = 0; /* build or fetch from cache redists for all variables involved in current write pass */ @@ -818,34 +1457,27 @@ writeGribStream(size_t streamIdx, struct streamMapping *mapping, double **data_, } else { + size_t numVarsInPass = buildPassVarDict(collSize, passes[pass], writtenRecords, &varsInPassSize, &varsInPass); int myVarStart = passes[pass][collRank].varStart, myVarEnd = passes[pass][collRank].varEnd; - displ = Realloc(displ, sizeof(*displ) * (numVarsInPass * 2 + 1)); + if (numVarsInPass > maxNumVarsAlloc) + { + maxNumVarsAlloc = numVarsInPass; + varRedists = Realloc(varRedists, numVarsInPass * sizeof(*varRedists)); + displ = Realloc(displ, (numVarsInPass * 2 + 1) * sizeof(*displ)); + } memset(displ, 0, sizeof(*displ) * (numVarsInPass + 1)); - for (unsigned varIdx = 0; varIdx < numVarsInPass; ++varIdx) + for (size_t varIdx = 0; varIdx < numVarsInPass; ++varIdx) { - int varID = varsInPass[varIdx].varID; - Xt_idxlist dstList; - /* is this process writing part of this variable? */ - if (myRecordStart <= myRecordEnd && myVarStart <= varID && myVarEnd >= varID) - { - size_t myVarRecordStart - = writtenRecords[myRecordStart].varID == varID ? myRecordStart : varsInPass[varIdx].recordStart; - size_t myLevelStart = (size_t) writtenRecords[myVarRecordStart].level; - size_t myVarRecordEnd - = writtenRecords[myRecordEnd].varID == varID ? myRecordEnd : (size_t) varsInPass[varIdx].recordEnd; - size_t myNumLevels = (size_t) writtenRecords[myVarRecordEnd].level - myLevelStart + 1; - dstList = buildVarSlicesIdxList(vlistID, varID, (int) myLevelStart, (int) myNumLevels); - size_t sliceSize = (size_t) xt_idxlist_get_num_indices(dstList); - assert(sliceSize * sizeof(double) == (writtenRecords[myVarRecordStart].dataSize * myNumLevels)); - myAggSize += sliceSize; - } - else - { - dstList = xt_idxempty_new(); - } - displ[numVarsInPass + varIdx + 1] = (MPI_Aint) (sizeof(double) * myAggSize); - varRedists[varIdx] = buildVarRedist(mapping->varMap[varID], streamIdx, dstList, conf); - xt_idxlist_delete(dstList); + int varID = varsInPass[varIdx].varID, headerIdx = mapping->varMap[varID]; + int conversion = winDict[headerIdx].id; + size_t elemSize = conversion == DATA_HEADER_FLOAT ? sizeof(float) : sizeof(double); + struct idxlistAndSize dst + = dstListFromRecordRange(vlistID, varID, myVarStart, myVarEnd, myRecordStart, myRecordEnd, writtenRecords, + varsInPass[varIdx].recordStart, varsInPass[varIdx].recordEnd, conf); + myAggSize += (size_t) dst.listSize * elemSize; + displ[numVarsInPass + varIdx + 1] = (MPI_Aint) myAggSize; + Xt_idxlist *varPartDescPreset = partDescPreset ? partDescPreset[varIdx] : NULL; + varRedists[varIdx] = buildVarRedist(headerIdx, streamIdx, dst.list, varPartDescPreset, conf); } /* merge all redists for current pass */ if (numVarsInPass > 1) @@ -860,11 +1492,11 @@ writeGribStream(size_t streamIdx, struct streamMapping *mapping, double **data_, if (conf->cacheRedists) { retained[pass].redist = compositePassRedist; - retained[pass].sliceSize = (int) myAggSize; + retained[pass].sliceSize = myAggSize; } } /* resize gather buffer if needed */ - resizeVarGatherBuf((int) myAggSize, data_, currentDataBufSize); + resizeVarGatherBuf(myAggSize, data_, currentDataBufSize); /* execute composite redist */ xt_redist_s_exchange1(compositePassRedist, clientBuf[0].mem, *data_); /* delete composite redist */ @@ -872,14 +1504,15 @@ writeGribStream(size_t streamIdx, struct streamMapping *mapping, double **data_, /* append encoded data records from this pass to buffer written later */ /* todo: develop better heuristic for buffer size */ - if (sizeof(double) * myAggSize > rxWin[streamIdx].aggBufSize) + if (myAggSize > aggBuf.size) { - Free(rxWin[streamIdx].aggBuf); - size_t aggBufSize = szmax((size_t) conf->recordAggBufLimMB * (size_t) 1024 * (size_t) 1024, sizeof(double) * myAggSize); - if (posix_memalign(&rxWin[streamIdx].aggBuf, cdiGetPageSize(conf->largePageAlign), aggBufSize) == 0) + Free(aggBuf.mem); + size_t aggBufSize = szmax((size_t) conf->recordAggBufLimMB * (size_t) 1024 * (size_t) 1024, myAggSize); + if (posix_memalign(&aggBuf.mem, cdiGetPageSize(conf->largePageAlign), aggBufSize) == 0) ; else - rxWin[streamIdx].aggBuf = Malloc(aggBufSize); + aggBuf.mem = Malloc(aggBufSize); + aggBuf.size = aggBufSize; } namespaceSwitchSet(NSSWITCH_FILE_WRITE, NSSW_FUNC(aggBufAppend)); /* write records to aggregation buffer */ @@ -888,7 +1521,7 @@ writeGribStream(size_t streamIdx, struct streamMapping *mapping, double **data_, size_t varIdx = (size_t) -1; int varID = -1; size_t recordDataOfs = 0; - const double *data = *data_; + const unsigned char *restrict data = *data_; for (size_t recordIdx = myRecordStart; recordIdx <= myRecordEnd; ++recordIdx) { int level = writtenRecords[recordIdx].level; @@ -896,12 +1529,18 @@ writeGribStream(size_t streamIdx, struct streamMapping *mapping, double **data_, varID = writtenRecords[recordIdx].varID; varIdx += varID != prevVarID; size_t recordSize = writtenRecords[recordIdx].dataSize; - size_t nvals = recordSize / sizeof(double); - size_t nmiss = countVarChunkMissingVals(vlistID, varID, mapping, (int) nvals, data + recordDataOfs); - streamWriteVarSlice(streamID, varID, level, data + recordDataOfs, nmiss); - recordDataOfs += nvals; + int headerIdx = mapping->varMap[varID]; + int conversion = winDict[headerIdx].id; + size_t elemSize = conversion == DATA_HEADER_FLOAT ? sizeof(float) : sizeof(double); + size_t nvals = recordSize / elemSize; + size_t nmiss = countVarChunkMissingVals(vlistID, varID, mapping, nvals, conversion, data + recordDataOfs); + if (conversion == DATA_HEADER_DOUBLE) + streamWriteVarSlice(streamID, varID, level, (const double *) (const void *) (data + recordDataOfs), (int) nmiss); + else + streamWriteVarSliceF(streamID, varID, level, (const float *) (const void *) (data + recordDataOfs), (int) nmiss); + recordDataOfs += recordSize; } - aggBufFlush(streamIdx, cdiPioFileWrite); + aggBufFlush(streamID, fileID, cdiPioFileWrite); } else /* write zero bytes to trigger synchronization code in fileWrite */ @@ -920,7 +1559,7 @@ readGetBuffers(size_t streamIdx, const struct cdiPioConf *conf) int streamID = openStreams.entries[streamIdx]; xdebug("%s", "START"); - struct winHeaderEntry *winDict = (wHECast) rxWin[streamIdx].clientBuf[0].mem; + struct winHeaderEntry *winDict = wHECast(rxWin[streamIdx].clientBuf[0].mem); xassert(winDict[0].id == HEADERSIZEMARKER); { int dictSize = rxWin[streamIdx].clientBuf[0].dictSize, @@ -937,15 +1576,15 @@ readGetBuffers(size_t streamIdx, const struct cdiPioConf *conf) { struct streamMapping *map = streamMappingNew(streamIdx, winDict, conf); /* TODO: build list of rma buffer layout here to check if caching can be done */ - double *data = NULL; - int currentDataBufSize = 0; + void *data = NULL; + size_t currentDataBufSize = 0; int filetype = streamInqFiletype(streamID); switch (cdiBaseFiletype(filetype)) { case CDI_FILETYPE_GRB: case CDI_FILETYPE_GRB2: writeGribStream(streamIdx, map, &data, ¤tDataBufSize, conf); break; -#ifdef HAVE_NETCDF4 +#ifdef HAVE_LIBNETCDF case CDI_FILETYPE_NETCDF: writeNetCDFStream(streamIdx, map, &data, ¤tDataBufSize, conf); break; #endif default: xabort("unhandled filetype in parallel I/O."); @@ -963,9 +1602,18 @@ static void clearModelWinBuffer(size_t streamIdx) { xassert(streamIdx < openStreams.size && rxWin != NULL && rxWin[streamIdx].clientBuf[0].mem != NULL); - size_t bufSizeTotal = (size_t) (rxWin[streamIdx].clientBuf[numClients_ - 1].mem - rxWin[streamIdx].clientBuf[0].mem) - + rxWin[streamIdx].clientBuf[numClients_ - 1].size; - memset(rxWin[streamIdx].clientBuf[0].mem, 0, bufSizeTotal); + size_t clearSize; +#if 0 + /* for debugging purposes it might be smart to set the whole buffer + * to 0 */ + clearSize = (size_t)(rxWin[streamIdx].clientBuf[numClients_ - 1].mem + - rxWin[streamIdx].clientBuf[0].mem) + + rxWin[streamIdx].clientBuf[numClients_ - 1].size; +#else + /* but normally, setting the first header record to zero will suffice */ + clearSize = sizeof(struct winHeaderEntry); +#endif + memset(rxWin[streamIdx].clientBuf[0].mem, 0, clearSize); } /************************************************************************/ @@ -981,17 +1629,17 @@ getTimeStepData(int *streamActivity, const struct cdiPioConf *conf) if (streamActivity[streamIdx]) { clearModelWinBuffer(streamIdx); - // todo put in correct lbs and ubs xmpi(MPI_Win_start(clientGroup, 0, rxWin[streamIdx].getWin)); /* FIXME: this needs to use MPI_PACKED for portability */ for (size_t i = 0; i < (size_t) numClients_; ++i) xmpi(MPI_Get(rxWin[streamIdx].clientBuf[i].mem, (int) rxWin[streamIdx].clientBuf[i].size, MPI_UNSIGNED_CHAR, clientRanks_[i], 0, (int) rxWin[streamIdx].clientBuf[i].size, MPI_UNSIGNED_CHAR, rxWin[streamIdx].getWin)); xmpi(MPI_Win_complete(rxWin[streamIdx].getWin)); + if (!conf->batchedRMA) readGetBuffers(streamIdx, conf); } - - for (size_t streamIdx = 0; streamIdx < openStreams.size; ++streamIdx) - if (streamActivity[streamIdx]) readGetBuffers(streamIdx, conf); + if (conf->batchedRMA) + for (size_t streamIdx = 0; streamIdx < openStreams.size; ++streamIdx) + if (streamActivity[streamIdx]) readGetBuffers(streamIdx, conf); xdebug("%s", "RETURN"); } @@ -1002,15 +1650,39 @@ static int cdiPioServerStreamOpen(const char *filename, char filemode, int filetype, stream_t *streamptr, int recordBufIsToBeCreated) { int fileID = -1; -#if defined HAVE_LIBNETCDF && !defined HAVE_PARALLEL_NC4 +#ifdef HAVE_LIBNETCDF /* Only needs initialization to shut up gcc */ int rank = -1; #endif switch (filetype) { -#if defined HAVE_LIBNETCDF && !defined HAVE_PARALLEL_NC4 +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NC: + case CDI_FILETYPE_NC2: case CDI_FILETYPE_NC4: case CDI_FILETYPE_NC4C: +#ifdef HAVE_PARALLEL_NC4 + { + struct cdiPioNcCreateLongJmpRetBuf retJmpBuf; + retJmpBuf.openRank = cdiPioNextOpenRank(); +#if !defined TLS && defined HAVE_PTHREAD + pthread_setspecific(cdiPioCdfJmpKey, &jmpBuf); +#else + cdiPioCdfJmpBuf = &retJmpBuf; +#endif + if (!setjmp(retJmpBuf.jmpBuf)) /* attempt parallel open first */ + /* in case it fails, ranks other than retJmpBuf.openRank + * will call longjmp and return 1 from the above setjmp */ + fileID = cdiStreamOpenDefaultDelegate(filename, filemode, filetype, streamptr, recordBufIsToBeCreated); + rank = retJmpBuf.openRank; + if (rank != CDI_PIO_COLLECTIVE_OPEN) + { + streamptr->filetype = filetype; + if (commInqIOMode() != PIO_NONE) xmpi(MPI_Bcast(&fileID, 1, MPI_INT, rank, commInqCommColl())); + cdiPioOpenFileOnRank(rank); + } + } +#else { int ioMode = commInqIOMode(); if (ioMode == PIO_NONE || commInqRankColl() == (rank = cdiPioNextOpenRank())) @@ -1020,6 +1692,7 @@ cdiPioServerStreamOpen(const char *filename, char filemode, int filetype, stream if (ioMode != PIO_NONE) xmpi(MPI_Bcast(&fileID, 1, MPI_INT, rank, commInqCommColl())); cdiPioOpenFileOnRank(rank); } +#endif break; #endif default: fileID = cdiStreamOpenDefaultDelegate(filename, filemode, filetype, streamptr, recordBufIsToBeCreated); @@ -1028,8 +1701,6 @@ cdiPioServerStreamOpen(const char *filename, char filemode, int filetype, stream { size_t oldNumStreams = openStreams.size; size_t streamIdx = insertID(&openStreams, streamptr->self); - size_t fileIdx = insertID(&openFiles, fileID); - xassert(fileIdx == streamIdx); size_t numStreams = openStreams.size; struct clientBuf *oldClientBufs = rxWin ? rxWin[0].clientBuf : NULL; rxWin = Realloc(rxWin, numStreams * sizeof(rxWin[0])); @@ -1040,37 +1711,87 @@ cdiPioServerStreamOpen(const char *filename, char filemode, int filetype, stream else if (oldNumStreams < numStreams) for (size_t i = oldNumStreams; i < numStreams; ++i) rxWin[i].clientBuf = newClientBufs + i * (size_t) numClients_; rxWin[streamIdx].getWin = MPI_WIN_NULL; + rxWin[streamIdx].clientBuf[0].mem = NULL; rxWin[streamIdx].prevLayout = NULL; rxWin[streamIdx].retained = NULL; rxWin[streamIdx].numRetained = 0; - rxWin[streamIdx].aggBufSize = 0; - rxWin[streamIdx].aggBufUsed = 0; - rxWin[streamIdx].aggBuf = NULL; -#if defined HAVE_LIBNETCDF && !defined HAVE_PARALLEL_NC4 + rxWin[streamIdx].clientDeco.lists = NULL; + rxWin[streamIdx].clientDeco.uids = NULL; + rxWin[streamIdx].clientDeco.conversion = NULL; +#ifdef HAVE_LIBNETCDF rxWin[streamIdx].ownerRank = rank; #endif } return fileID; } +static size_t +getMaxNumStreamWrites(stream_t *streamptr) +{ + int filetype = streamptr->filetype; + int vlistID = streamptr->vlistID; + size_t numVars = (size_t) vlistNvars(streamptr->vlistID), maxNumStreamWrites = 0, numColl = (size_t) commInqSizeColl(); + switch (filetype) + { +#ifdef HAVE_LIBNETCDF + case CDI_FILETYPE_NC: + case CDI_FILETYPE_NC2: + case CDI_FILETYPE_NC4: + case CDI_FILETYPE_NC4C: + { + int rankOpen = cdiPioStream2Owner(streamptr->self); + if (commInqIOMode() == PIO_NONE +#ifdef HAVE_PARALLEL_NC4 + || rankOpen == CDI_PIO_COLLECTIVE_OPEN +#endif + || (commInqRankColl() == rankOpen)) + maxNumStreamWrites = (numVars + numColl - 1) / numColl; + } + break; +#endif + default: + for (size_t varID = 0; varID < numVars; ++varID) + { + size_t numRec = (size_t) (zaxisInqSize(vlistInqVarZaxis(vlistID, (int) varID))); + maxNumStreamWrites += (numRec + numColl - 1) / numColl; + } + } + return maxNumStreamWrites; +} + static void cdiPioServerStreamClose(stream_t *streamptr, int recordBufIsToBeDeleted) { int fileID = streamptr->fileID; int filetype = streamptr->filetype; + int vlistID = streamptr->vlistID; + const struct cdiPioConf *conf = cdiPioGetConf(); + if (vlistID != CDI_UNDEFID) + { + size_t maxNumStreamWrites = getMaxNumStreamWrites(streamptr); + neededDstIdxlistCacheSize -= maxNumStreamWrites; + if (conf->cacheXmaps) neededXmapCacheSize -= maxNumStreamWrites; + } if (fileID == CDI_UNDEFID) Warning("File %s not open!", streamptr->filename); else { switch (cdiBaseFiletype(filetype)) { -#if defined(HAVE_LIBNETCDF) && !defined(HAVE_PARALLEL_NC4) +#ifdef HAVE_LIBNETCDF case CDI_FILETYPE_NETCDF: { - int rank, rankOpen = cdiPioSerialOpenFileMap(streamptr->self); - if (commInqIOMode() == PIO_NONE || ((rank = commInqRankColl()) == rankOpen)) + int rankOpen = cdiPioStream2Owner(streamptr->self); + if (commInqIOMode() == PIO_NONE +#ifdef HAVE_PARALLEL_NC4 + || rankOpen == CDI_PIO_COLLECTIVE_OPEN +#endif + || commInqRankColl() == rankOpen) cdiStreamCloseDefaultDelegate(streamptr, recordBufIsToBeDeleted); - cdiPioCloseFileOnRank(rankOpen); +#ifdef HAVE_PARALLEL_NC4 + if (rankOpen != CDI_PIO_COLLECTIVE_OPEN) +#endif + cdiPioCloseFileOnRank(rankOpen); } break; #endif @@ -1079,22 +1800,41 @@ cdiPioServerStreamClose(stream_t *streamptr, int recordBufIsToBeDeleted) int streamID = streamptr->self; size_t streamIdx = indexOfID(&openStreams, streamID); destructRetained(rxWin[streamIdx].retained, rxWin[streamIdx].numRetained); + if (rxWin[streamIdx].clientDeco.lists) + cdiPioDestroyPartDescPreset((size_t) numClients_, (size_t) (vlistNvars(vlistID)), &rxWin[streamIdx].clientDeco); Free(rxWin[streamIdx].retained); Free(rxWin[streamIdx].prevLayout); - Free(rxWin[streamIdx].aggBuf); - cdiPioServerStreamWinDestroy(streamIdx); + cdiPioServerStreamWinDestroy(streamIdx, conf); removeID(&openStreams, streamID); - removeID(&openFiles, fileID); } + void (*streamCloseCallBack)(int streamID) = (void (*)(int)) conf->callbacks[CDIPIO_CALLBACK_POSTSTREAMCLOSE]; + streamCloseCallBack(streamptr->self); } -#if defined(HAVE_LIBNETCDF) && !defined(HAVE_PARALLEL_NC4) +#if defined HAVE_H5GET_LIBVERSION && defined HAVE_PARALLEL_NC4 +static bool parH5ZeroCountProblem = false; +#endif + +#ifdef HAVE_LIBNETCDF static void -cdiPioCdfDefTimestep(stream_t *streamptr, int tsID) +cdiPioCdfDefTimestep(stream_t *streamptr, int tsID, size_t valCount) { - int rank, rankOpen, streamID = streamptr->self; - if (commInqIOMode() == PIO_NONE || ((rank = commInqRankColl()) == (rankOpen = cdiPioSerialOpenFileMap(streamID)))) - cdfDefTimestep(streamptr, tsID); + int streamID = streamptr->self, rankOpen = cdiPioStream2Owner(streamID); +#ifdef HAVE_PARALLEL_NC4 + valCount = rankOpen != CDI_PIO_COLLECTIVE_OPEN +#if defined HAVE_H5GET_LIBVERSION + || (parH5ZeroCountProblem && streamptr->filetype == CDI_FILETYPE_NC4) +#else + || streamptr->filetype == CDI_FILETYPE_NC4 +#endif + || commInqRankColl() == 0; +#endif + if (commInqIOMode() == PIO_NONE +#ifdef HAVE_PARALLEL_NC4 + || rankOpen == CDI_PIO_COLLECTIVE_OPEN +#endif + || commInqRankColl() == rankOpen) + cdfDefTimestep(streamptr, tsID, valCount); } #endif @@ -1128,16 +1868,53 @@ cdiPioRecvStreamOpen(void *buffer, int size, int *pos, MPI_Comm pioInterComm) } static void -cdiPioRecvStreamClose(void *buffer, int size, int *pos, MPI_Comm pioInterComm) +cdiPioRecvStreamClose(void *buffer, int size, int *pos, MPI_Comm pioInterComm, bool flushNeeded, const struct cdiPioConf *conf) { int clientStreamID; xmpi(MPI_Unpack(buffer, size, pos, &clientStreamID, 1, MPI_INT, pioInterComm)); int serverStreamID = namespaceAdaptKey2(clientStreamID); + if (flushNeeded) + { + int streamActivity[openStreams.size]; + size_t streamIdx = indexOfID(&openStreams, serverStreamID); + for (size_t i = 0; i < openStreams.size; ++i) streamActivity[i] = 0; + streamActivity[streamIdx] = 1; + getTimeStepData(streamActivity, conf); + conf->callbacks[CDIPIO_CALLBACK_POSTWRITEBATCH](); + } streamClose(serverStreamID); } +#ifdef HAVE_LIBNETCDF +static void +cdiPioCdfGridAccess(int streamID, int vlistID) +{ + int filetype = streamInqFiletype(streamID); + switch (filetype) + { + case CDI_FILETYPE_NC: + case CDI_FILETYPE_NC2: + case CDI_FILETYPE_NC4: + case CDI_FILETYPE_NC4C: +#ifdef HAVE_PARALLEL_NC4 + if (cdiPioStream2Owner(streamID) != CDI_PIO_COLLECTIVE_OPEN) +#endif + { + int nGrids = vlistNgrids(vlistID); + for (int gridIdx = 0; gridIdx < nGrids; ++gridIdx) + { + int gridID = vlistGrid(vlistID, gridIdx); + if (!cdiPioDistGridIndividualQueriesEnabled(gridID)) cdiPioDistGridEnableIndividualQueries(gridID); + } + } + } +} +#else +#define cdiPioCdfGridAccess(streamID, vlistID) +#endif + static void -cdiPioRecvStreamDefVlist(void *buffer, int size, int *pos, MPI_Comm pioInterComm) +cdiPioRecvStreamDefVlist(void *buffer, int size, int *pos, MPI_Comm pioInterComm, int tag, const struct cdiPioConf *conf) { int serverStreamID, serverVlistID; { @@ -1146,11 +1923,11 @@ cdiPioRecvStreamDefVlist(void *buffer, int size, int *pos, MPI_Comm pioInterComm serverStreamID = namespaceAdaptKey2(msgData[0]); serverVlistID = namespaceAdaptKey2(msgData[1]); } - cdiStreamSetupVlist(stream_to_pointer(serverStreamID), serverVlistID); - MPI_Info no_locks_info; - xmpi(MPI_Info_create(&no_locks_info)); - xmpi(MPI_Info_set(no_locks_info, "no_locks", "true")); + stream_t *streamptr = stream_to_pointer(serverStreamID); + cdiPioCdfGridAccess(serverStreamID, serverVlistID); + cdiStreamSetupVlist(streamptr, serverVlistID); size_t streamIdx = indexOfID(&openStreams, serverStreamID); + cdiPioServerStreamWinCreate(streamIdx, cdiPioInqCollClientIntraComm()); int numClients = cdiPioCommInqSizeClients(), numColl = commInqSizeColl(); struct collSpec collectorData = { .numClients = numClients, @@ -1158,11 +1935,69 @@ cdiPioRecvStreamDefVlist(void *buffer, int size, int *pos, MPI_Comm pioInterComm .sendRPCData = 1, }; struct clientBufSize bufSizes[numClients_]; - bufSizes[0] = computeClientStreamBufSize(serverStreamID, &collectorData); - collectorData.sendRPCData = 0; - for (size_t i = 1; i < (size_t) numClients_; ++i) bufSizes[i] = computeClientStreamBufSize(serverStreamID, &collectorData); - cdiPioServerStreamWinCreate(streamIdx, no_locks_info, cdiPioInqCollClientIntraComm(), bufSizes); - xmpi(MPI_Info_free(&no_locks_info)); + if (tag == STREAMDEFVLIST) + { + collectorData.partDesc = NULL; + collectorData.conversion = NULL; + bufSizes[0] = computeClientStreamBufSize(serverStreamID, &collectorData); + collectorData.sendRPCData = 0; + for (size_t clientIdx = 1; clientIdx < (size_t) numClients_; ++clientIdx) + bufSizes[clientIdx] = computeClientStreamBufSize(serverStreamID, &collectorData); + } + else /* tag == STREAM_DEF_DECOMPOSED_VLIST */ + { + size_t nVars = (size_t) (vlistNvars(serverVlistID)); + /* unpack client data representation */ + int *conversion = Malloc(nVars * sizeof(*conversion)); + xmpi(MPI_Unpack(buffer, size, pos, conversion, (int) nVars, MPI_INT, pioInterComm)); + collectorData.conversion = rxWin[streamIdx].clientDeco.conversion = conversion; + /* unpack per-client index lists */ + Xt_idxlist(*partDescPreset)[numClients_] = Malloc(nVars * sizeof(*partDescPreset)), + *clientPartDesc = Malloc(nVars * sizeof(*clientPartDesc)); + Xt_uid(*partDescUID)[numClients_] = Malloc(nVars * sizeof(*partDescUID)); + rxWin[streamIdx].clientDeco.lists = &partDescPreset[0][0]; + rxWin[streamIdx].clientDeco.uids = &partDescUID[0][0]; + int remainingSize = size - *pos; + for (int clientIdx = 0; clientIdx < numClients_; ++clientIdx) + { + unsigned char *clientBuf = (unsigned char *) buffer + *pos; + int clientPos = 0; + for (size_t varIdx = 0; varIdx < nVars; ++varIdx) + { + xmpi(MPI_Unpack(clientBuf, remainingSize, &clientPos, partDescUID[varIdx] + clientIdx, 1, YAXT_UID_DT, pioInterComm)); + Xt_uid uid = partDescUID[varIdx][clientIdx]; + for (size_t prevVarIdx = 0; prevVarIdx < varIdx; ++prevVarIdx) + if (partDescUID[prevVarIdx][clientIdx] == uid) + { + clientPartDesc[varIdx] = clientPartDesc[prevVarIdx]; + goto got_idxlist; + } + clientPartDesc[varIdx] = xt_idxlist_unpack(clientBuf, remainingSize, &clientPos, pioInterComm); + got_idxlist: + partDescPreset[varIdx][clientIdx] = clientPartDesc[varIdx]; + } + remainingSize -= clientPos; + *pos += clientPos; + collectorData.partDesc = clientPartDesc; + bufSizes[clientIdx] = computeClientStreamBufSize(serverStreamID, &collectorData); + collectorData.sendRPCData = 0; + } + Free(clientPartDesc); + } + createClientStreamBuf(streamIdx, bufSizes, conf); + + size_t maxNumStreamWrites = (size_t) getMaxNumStreamWrites(streamptr), + currentDstIdxlistCacheSize = cdiPioIdxlistCacheGetSize(DstIdxlistCache); + if ((neededDstIdxlistCacheSize += maxNumStreamWrites) > currentDstIdxlistCacheSize) + DstIdxlistCache = cdiPioIdxlistCacheResize(DstIdxlistCache, neededDstIdxlistCacheSize); + if (conf->cacheXmaps) + { + size_t currentXmapCacheSize = cdiPioXmapCacheGetSize(XmapCache); + if ((neededXmapCacheSize += maxNumStreamWrites) > currentXmapCacheSize) + XmapCache = cdiPioXmapCacheResize(XmapCache, neededXmapCacheSize); + if (tag == STREAM_DEF_DECOMPOSED_VLIST) + buildDecoPresetXmaps(serverStreamID, rxWin[streamIdx].clientDeco, commInqCommColl(), conf); + } } /** @@ -1170,7 +2005,7 @@ cdiPioRecvStreamDefVlist(void *buffer, int size, int *pos, MPI_Comm pioInterComm */ void -cdiPioCollectorMessageLoop(const struct cdiPioConf *conf) +cdiPioCollectorMessageLoop() { MPI_Status status; @@ -1179,10 +2014,20 @@ cdiPioCollectorMessageLoop(const struct cdiPioConf *conf) MPI_Comm pioInterComm = cdiPioInqInterComm(); namespaceSwitchSet(NSSWITCH_STREAM_OPEN_BACKEND, NSSW_FUNC(cdiPioServerStreamOpen)); namespaceSwitchSet(NSSWITCH_STREAM_CLOSE_BACKEND, NSSW_FUNC(cdiPioServerStreamClose)); + const struct cdiPioConf *conf = cdiPioGetConf(); #ifdef HAVE_PARALLEL_NC4 cdiPioEnableNetCDFParAccess(); numPioPrimes = PPM_prime_factorization_32((uint32_t) commInqSizeColl(), &pioPrimes); -#elif defined(HAVE_LIBNETCDF) +#ifdef HAVE_H5GET_LIBVERSION + { + unsigned majnum, minnum, relnum; + extern int H5get_libversion(unsigned *, unsigned *, unsigned *); + H5get_libversion(&majnum, &minnum, &relnum); + parH5ZeroCountProblem = (majnum == 1 && ((minnum == 8 && relnum <= 8) || (minnum < 8))); + } +#endif +#endif +#ifdef HAVE_LIBNETCDF cdiSerialOpenFileCount = Calloc(sizeof(cdiSerialOpenFileCount[0]), (size_t) commInqSizeColl()); namespaceSwitchSet(NSSWITCH_CDF_DEF_TIMESTEP, NSSW_FUNC(cdiPioCdfDefTimestep)); namespaceSwitchSet(NSSWITCH_CDF_STREAM_SETUP, NSSW_FUNC(cdiPioServerCdfDefVars)); @@ -1190,6 +2035,7 @@ cdiPioCollectorMessageLoop(const struct cdiPioConf *conf) int *streamActivity = NULL; setupClientRanks(); + if (conf->cacheXmaps) XmapCache = cdiPioXmapCacheNew(16, (size_t) numClients_ + 1); for (;;) { xmpi(MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, pioInterComm, &status)); @@ -1212,7 +2058,7 @@ cdiPioCollectorMessageLoop(const struct cdiPioConf *conf) Free(rxWin); } idSetDestroy(&openStreams); - idSetDestroy(&openFiles); + Free(aggBuf.mem); Free(streamActivity); Free(clientRanks_); #ifdef HAVE_PARALLEL_NC4 @@ -1220,23 +2066,29 @@ cdiPioCollectorMessageLoop(const struct cdiPioConf *conf) #elif defined(HAVE_LIBNETCDF) Free(cdiSerialOpenFileCount); #endif + if (conf->cacheXmaps) cdiPioXmapCacheDelete(XmapCache); + cdiPioIdxlistCacheDelete(DstIdxlistCache); xdebug("%s", "RETURN"); return; + case RESOURCES: case STREAMOPEN: + case STREAMFLUSHCLOSE: case STREAMCLOSE: case STREAMDEFVLIST: - case RESOURCES: + case STREAM_DEF_DECOMPOSED_VLIST: { int size; xmpi(MPI_Get_count(&status, MPI_PACKED, &size)); char *buffer = Malloc((size_t) size); xmpi(MPI_Recv(buffer, size, MPI_PACKED, source, tag, pioInterComm, &status)); - int pos = reshUnpackResources(buffer, size, &pioInterComm); + int pos = reshUnpackResources(buffer, size, &pioInterComm, (cdiPostResUpdateHook) 0); switch (tag) { case STREAMOPEN: cdiPioRecvStreamOpen(buffer, size, &pos, pioInterComm); break; - case STREAMCLOSE: cdiPioRecvStreamClose(buffer, size, &pos, pioInterComm); break; - case STREAMDEFVLIST: cdiPioRecvStreamDefVlist(buffer, size, &pos, pioInterComm); break; + case STREAMFLUSHCLOSE: + case STREAMCLOSE: cdiPioRecvStreamClose(buffer, size, &pos, pioInterComm, tag == STREAMFLUSHCLOSE, conf); break; + case STREAMDEFVLIST: + case STREAM_DEF_DECOMPOSED_VLIST: cdiPioRecvStreamDefVlist(buffer, size, &pos, pioInterComm, tag, conf); break; } Free(buffer); streamActivity = Realloc(streamActivity, openStreams.size * sizeof(streamActivity[0])); @@ -1247,6 +2099,7 @@ cdiPioCollectorMessageLoop(const struct cdiPioConf *conf) xmpi(MPI_Recv(streamActivity, (int) openStreams.size, MPI_INT, source, tag, pioInterComm, &status)); xdebug("RECEIVED MESSAGE WITH TAG \"WRITETS\": source=%d", source); getTimeStepData(streamActivity, conf); + conf->callbacks[CDIPIO_CALLBACK_POSTWRITEBATCH](); } break; diff --git a/src/pio_server.h b/src/pio_server.h index aeca9fbf02279ca9a54c1c0b094bd26a0fd75bc8..13a9bdff91ed6709812f19f0d19f012740bb2ed1 100644 --- a/src/pio_server.h +++ b/src/pio_server.h @@ -7,9 +7,9 @@ #include <mpi.h> -#include "pio_conf.h" +void cdiPioCollectorMessageLoop(void); -void cdiPioCollectorMessageLoop(const struct cdiPioConf *conf); +int cdiPioStream2Owner(int streamID); #endif /* diff --git a/src/pio_util.c b/src/pio_util.c index b55666f8f3bb68414ca8bc32f8ebd9adcd5554da..3c2a4b6920717f67135a20f03015b7e48682001e 100644 --- a/src/pio_util.c +++ b/src/pio_util.c @@ -2,7 +2,9 @@ #include "config.h" #endif +#include <assert.h> #include <errno.h> +#include <limits.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -10,12 +12,11 @@ #include <unistd.h> +#include "pio_rpc.h" #include "pio_util.h" #include "cdi.h" #include "dmemory.h" -static char commands[][13] = { "FINALIZE", "RESOURCES", "WRITETS" }; - /*****************************************************************************/ void cdiAbortC_MPI(const char *caller, const char *filename, const char *functionname, int line, const char *errorString, va_list ap) @@ -61,8 +62,8 @@ pcdiXMPI(int iret, const char *filename, int line) MPI_Error_string(iret, errorString[1], &len); errorString[1][len] = '\0'; fprintf(stderr, - "MPI ERROR, pe%d, %s, line %d," - "errorClass: \"%s\"" + "MPI ERROR, pe%d, %s, line %d, " + "errorClass: \"%s\", " "errorString: \"%s\"\n", rank, filename, line, errorString[0], errorString[1]); MPI_Abort(MPI_COMM_WORLD, 1); @@ -74,7 +75,6 @@ void pcdiXMPIStat(int iret, const char *filename, int line, MPI_Status *status) { char errorString[MPI_MAX_ERROR_STRING + 1]; - int len, rank = getMPICommWorldRank(); if (iret == MPI_ERR_IN_STATUS) { @@ -84,45 +84,57 @@ pcdiXMPIStat(int iret, const char *filename, int line, MPI_Status *status) case MPI_SUCCESS: fprintf(stderr, "-------- mpi_success -----------\n"); break; case MPI_ERR_PENDING: fprintf(stderr, "-------- mpi_err_pending ----------\n"); break; default: - MPI_Error_string(status->MPI_ERROR, errorString, &len); - errorString[len] = '\0'; - fprintf(stderr, - "MPI ERROR in request, pe%d, %s, line %d," - "return value: %d, error_string: %s\n", - rank, filename, line, iret, errorString); - MPI_Abort(MPI_COMM_WORLD, iret); + { + int len, rank = getMPICommWorldRank(); + MPI_Error_string(status->MPI_ERROR, errorString, &len); + errorString[len] = '\0'; + fprintf(stderr, + "MPI ERROR in request, pe%d, %s, line %d," + "return value: %d, error_string: %s\n", + rank, filename, line, iret, errorString); + MPI_Abort(MPI_COMM_WORLD, iret); + } } } - else - xmpi(iret); + else if (iret != MPI_SUCCESS) + pcdiXMPI(iret, filename, line); return; } -/****************************************************/ - void -pcdiDebugMsg(const char *cdiPioDebugString, const char *filename, const char *functionname, int line, int tag, int source, - int nfinished) +pcdiXMPIStats(int iret, const char *filename, int line, int n, MPI_Status *restrict statuses) { - int rank = getMPICommWorldRank(); - - fprintf(stdout, "%s pe%d in %s, %s, line %d: command %s, source %d, finalized=%d\n", cdiPioDebugString, rank, functionname, - filename, line, &commands[tag][0], source, nfinished); + if (iret == MPI_ERR_IN_STATUS) + { + for (size_t i = 0; i < (size_t) n; ++i) + if (statuses[i].MPI_ERROR != MPI_SUCCESS && statuses[i].MPI_ERROR != MPI_ERR_PENDING) + pcdiXMPIStat(iret, filename, line, statuses + i); + } + else if (iret != MPI_SUCCESS) + pcdiXMPI(iret, filename, line); } /****************************************************/ +#ifndef NDEBUG void -pcdiDebugMsg2(const char *filename, const char *functionname, int line, int tag, int source, char *text) +cdiPioAssertConsistentIntVec(size_t n, const int *restrict a, MPI_Comm comm, int commRank, int rankRangeStart, int rankRangeSize) { - int rank = getMPICommWorldRank(); - - fprintf(stdout, "pe%d in %s, %s, line %d: command %s, source %d, %s\n", rank, functionname, filename, line, &commands[tag][0], - source, text); + int *restrict b = Malloc(n * sizeof(*b)); + int rankDst = rankRangeStart + (commRank + 1 - rankRangeStart) % rankRangeSize, + rankSrc = rankRangeStart + (commRank + rankRangeSize - 1 - rankRangeStart) % rankRangeSize; + MPI_Request req[2]; + assert(n <= INT_MAX); + xmpi(MPI_Irecv(b, (int) n, MPI_INT, rankSrc, ASSERT_CONSISTENCY, comm, req + 0)); + xmpi(MPI_Isend((int *) a, (int) n, MPI_INT, rankDst, ASSERT_CONSISTENCY, comm, req + 1)); + xmpi(MPI_Waitall(2, req, MPI_STATUSES_IGNORE)); + bool allEqual = true; + for (size_t i = 0; i < n; ++i) allEqual &= (a[i] == b[i]); + assert(allEqual); + Free(b); } - -/****************************************************/ +#endif void printArray(const char *cdiPioDebugString, const char *ps, const void *array, int n, int datatype, const char *funname, @@ -165,6 +177,7 @@ cdiPioQueryVarDims(int varShape[3], int vlistID, int varID) { case GRID_LONLAT: case GRID_GAUSSIAN: + case GRID_CURVILINEAR: varShape[0] = gridInqXsize(gridID); varShape[1] = gridInqYsize(gridID); break; @@ -172,15 +185,17 @@ cdiPioQueryVarDims(int varShape[3], int vlistID, int varID) varShape[0] = 2; varShape[1] = gridInqSize(gridID) / 2; break; + case GRID_UNSTRUCTURED: + varShape[0] = gridInqSize(gridID); + varShape[1] = 1; + break; case GRID_GENERIC: case GRID_PROJECTION: - case GRID_GME: - case GRID_CURVILINEAR: - case GRID_UNSTRUCTURED: xabort("unimplemented grid type: %d", gridType); + case GRID_GME: xabort("unimplemented grid type: %d", gridType); } varShape[2] = zaxisInqSize(zaxisID); /* FIXME: other grids have different dimensionality */ - return (varShape[2] == 1) ? 2 : 3; + return (varShape[2] > 1) ? 2 : 3; } void diff --git a/src/pio_util.h b/src/pio_util.h index c3a34400e78d84e01167cea72783e547e453396b..5f4101328827b4aef898b61dc240645f57efaecb 100644 --- a/src/pio_util.h +++ b/src/pio_util.h @@ -12,6 +12,8 @@ #include "error.h" #endif +#include "cdi.h" + #define MAXDEBUG 3 #define ddebug 0 @@ -62,16 +64,22 @@ void pcdiXMPI(int iret, const char *, int); while (0) void pcdiXMPIStat(int, const char *, int, MPI_Status *); -#define xmpiStat(ret, stat) pcdiXMPIStat(ret, __FILE__, __LINE__, stat) - -void pcdiDebugMsg(const char *cdiDebugString, const char *filename, const char *functionname, int line, int tag, int source, - int nfinished); -#define xdebugMsg(tag, source, nfinished) \ - if (ddebug) pcdiDebugMsg(debugString, __FILE__, __func__, __LINE__, tag, source, nfinished) +#define xmpiStat(ret, stat) \ + do \ + { \ + int tmpIRet = (ret); \ + if (tmpIRet != MPI_SUCCESS) pcdiXMPIStat(ret, __FILE__, __LINE__, stat); \ + } \ + while (0) -void pcdiDebugMsg2(const char *filename, const char *functionname, int line, int tag, int source, char *text); -#define xdebugMsg2(tag, source, text) \ - if (ddebug) pcdiDebugMsg(__FILE__, __func__, __LINE__, tag, source, text) +void pcdiXMPIStats(int, const char *, int, int, MPI_Status *); +#define xmpiStats(ret, n, stats) \ + do \ + { \ + int tmpIRet = (ret); \ + if (tmpIRet != MPI_SUCCESS) pcdiXMPIStats(ret, __FILE__, __LINE__, n, stats); \ + } \ + while (0) static inline int sum_int(size_t n, int *a) @@ -81,6 +89,17 @@ sum_int(size_t n, int *a) return sum; } +#ifndef NDEBUG +void cdiPioAssertConsistentIntVec(size_t n, const int *restrict a, MPI_Comm comm, int commRank, int rankRangeStart, + int rankRangeEnd); +#else +#define cdiPioAssertConsistentIntVec(n, a, comm, r, rs, re) \ + do \ + { \ + } \ + while (0) +#endif + void printArray(const char *, const char *, const void *, int, int, const char *, const char *, int); #define xprintArray(ps, array, n, datatype) \ if (ddebug) printArray(debugString, ps, array, n, datatype, __func__, __FILE__, __LINE__) @@ -93,7 +112,35 @@ void printArray(const char *, const char *, const void *, int, int, const char * */ int cdiPioQueryVarDims(int varShape[3], int vlistID, int varID); -void cdiPioDeco1D_CCP(size_t n, const size_t weightPfxSums[n], size_t nparts, size_t separators[nparts + 1]); +/** + * Computes simple, balanced 1D decomposition of weighted elements e. + * + * @param n number of elements to balance + * @param[in] weightPfxSums points to array of the \a n+1 partial + * weight sums, where + * weightPfxSums[i]-weightPfxSums[i-1] = + * weight of \$e_{i-1}\$ + * @param nparts number of parts to generate for partition + * @param[out] separators pointer to array of size nparts+1, + * initialized by this function such that + * part i consists of elements indexed as + * separators[i] to separators[i+1]-1 + */ +void cdiPioDeco1D_CCP(size_t n, const size_t *restrict weightPfxSums, size_t nparts, size_t *restrict separators); + +static inline size_t +cdiPioElemSizeInference(size_t varID, const int *conversion) +{ + int conv = conversion ? conversion[varID] : CDI_DATATYPE_FLT64; + size_t elemSize; + switch (conv) + { + case CDI_DATATYPE_FLT32: elemSize = sizeof(float); break; + case CDI_DATATYPE_FLT64: elemSize = sizeof(double); break; + default: Error("Invalid conversion specification: %d\n", conv); elemSize = (size_t) -1; + } + return elemSize; +} #endif /* diff --git a/src/pio_xmap_cache.c b/src/pio_xmap_cache.c new file mode 100644 index 0000000000000000000000000000000000000000..002680378a72a673b73f49b1b88472c8745de306 --- /dev/null +++ b/src/pio_xmap_cache.c @@ -0,0 +1,152 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <assert.h> + +#include <mpi.h> +#include <yaxt.h> + +#include "dmemory.h" +#include "error.h" +#include "pio_comm.h" +#include "pio_util.h" +#include "pio_xmap_cache.h" + +enum +{ + LRAND48_BITS = 31, +}; +#define MAX_CACHE_SIZE ((((size_t) 1) << LRAND48_BITS) - 1) + +struct xmapCache +{ + size_t numUid, size, numEntries; + Xt_uid *keys; + int *numIndices; + Xt_xmap xmaps[]; +}; + +struct xmapCache * +cdiPioXmapCacheNew(size_t sizeEntries, size_t numUid) +{ + if (sizeEntries > MAX_CACHE_SIZE) xabort("cache cannot hold more than %zu entries", MAX_CACHE_SIZE); + struct xmapCache *cache = Malloc(sizeof(struct xmapCache) + sizeof(Xt_xmap) * sizeEntries + sizeEntries); + cache->numUid = numUid; + cache->size = sizeEntries; + cache->numEntries = 0; + cache->keys = Malloc(sizeof(*cache->keys) * numUid * sizeEntries); + cache->numIndices = Malloc(sizeof(*cache->numIndices) * numUid * sizeEntries); + return cache; +} + +size_t +cdiPioXmapCacheGetSize(struct xmapCache *cache) +{ + return cache ? cache->size : 0; +} + +struct xmapCache * +cdiPioXmapCacheResize(struct xmapCache *cache, size_t sizeEntries) +{ + assert(cache); + size_t cacheSize = cache->size; + if (sizeEntries > MAX_CACHE_SIZE) xabort("cache cannot hold more than %zu entries", MAX_CACHE_SIZE); + struct xmapCache *newCache; + if (sizeEntries != cacheSize) + { + size_t numUid = cache->numUid; + if (sizeEntries < cacheSize) + { + Xt_xmap *restrict xmaps = cache->xmaps; + size_t numEntries = cache->numEntries; + for (size_t i = sizeEntries; i < numEntries; ++i) xt_xmap_delete(xmaps[i]); + cache->numEntries = numEntries > sizeEntries ? sizeEntries : numEntries; + } + cache->size = sizeEntries; + newCache = Realloc(cache, sizeof(struct xmapCache) + sizeof(Xt_xmap) * sizeEntries + sizeEntries); + size_t numKeysPerXmap = numUid * sizeEntries; + newCache->keys = Realloc(newCache->keys, sizeof(*newCache->keys) * numKeysPerXmap); + newCache->numIndices = Realloc(newCache->numIndices, sizeof(*newCache->numIndices) * numKeysPerXmap); + } + else + newCache = cache; + return newCache; +} + +void +cdiPioXmapCacheDelete(struct xmapCache *cache) +{ + Xt_xmap *restrict xmaps = cache->xmaps; + size_t numEntries = cache->numEntries; + for (size_t i = 0; i < numEntries; ++i) xt_xmap_delete(xmaps[i]); + Free(cache->numIndices); + Free(cache->keys); + Free(cache); +} + +void +cdiPioXmapCacheAdd(struct xmapCache *cache, const Xt_uid *restrict keys, const int *restrict numIndices, Xt_xmap xmap) +{ + size_t cacheSize = cache->size, cacheFill = cache->numEntries, numUid = cache->numUid, cacheInsertPos; + Xt_xmap *restrict xmaps = cache->xmaps; + if (cacheFill < cacheSize) + { + cacheInsertPos = cacheFill; + cache->numEntries = ++cacheFill; + } + else + { + /* we use lrand48 because it's guaranteed to generate 31 bits + * per call */ + MPI_Comm collComm = commInqCommColl(); + long randVal = lrand48(); + xmpi(MPI_Bcast(&randVal, 1, MPI_LONG, 0, collComm)); + cacheInsertPos = (size_t) randVal % cacheSize; + xt_xmap_delete(xmaps[cacheInsertPos]); + } + Xt_uid *restrict keys_ = cache->keys + numUid * cacheInsertPos; + int *restrict numIndices_ = cache->numIndices + numUid * cacheInsertPos; + for (size_t i = 0; i < numUid; ++i) + { + numIndices_[i] = numIndices[i]; + keys_[i] = keys[i]; + } + xmaps[cacheInsertPos] = xmap; +} + +Xt_xmap +cdiPioXmapCacheLookup(struct xmapCache *cache, const Xt_uid *restrict keys, int *restrict numIndices) +{ + size_t cacheSize = cache->size, cacheFill = cache->numEntries, numUid = cache->numUid; + unsigned char *restrict matches = (unsigned char *) (cache->xmaps + cacheSize); + for (size_t j = 0; j < cacheFill; ++j) + { + Xt_uid *restrict keys_ = cache->keys + j * numUid; + Xt_uid match = 1; + for (size_t i = 0; i < numUid; ++i) match &= (keys_[i] == keys[i]); + matches[j] = (unsigned char) match; + keys_ += numUid; + } + MPI_Comm collComm = commInqCommColl(); + xmpi(MPI_Allreduce(MPI_IN_PLACE, matches, (int) cacheFill, MPI_UNSIGNED_CHAR, MPI_LAND, collComm)); + for (size_t j = 0; j < cacheFill; ++j) + if (matches[j]) + { + Xt_xmap *restrict xmaps = cache->xmaps; + int *restrict numIndices_ = cache->numIndices + j * numUid; + for (size_t i = 0; i < numUid; ++i) numIndices[i] = numIndices_[i]; + return xmaps[j]; + } + return NULL; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ diff --git a/src/pio_xmap_cache.h b/src/pio_xmap_cache.h new file mode 100644 index 0000000000000000000000000000000000000000..f9f24c41877911da8b21554fefed403afb19ec33 --- /dev/null +++ b/src/pio_xmap_cache.h @@ -0,0 +1,34 @@ +#ifndef CDI_PIO_XMAP_CACHE_H +#define CDI_PIO_XMAP_CACHE_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdlib.h> + +#include <yaxt.h> + +struct xmapCache *cdiPioXmapCacheNew(size_t sizeEntries, size_t numUid); + +size_t cdiPioXmapCacheGetSize(struct xmapCache *cache); + +struct xmapCache *cdiPioXmapCacheResize(struct xmapCache *cache, size_t sizeEntries); + +void cdiPioXmapCacheDelete(struct xmapCache *cache); + +void cdiPioXmapCacheAdd(struct xmapCache *cache, const Xt_uid *restrict keys, const int *restrict numIndices, Xt_xmap xmap); + +Xt_xmap cdiPioXmapCacheLookup(struct xmapCache *cache, const Xt_uid *restrict keys, int *restrict numIndices); + +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ diff --git a/src/pkgconfig/cdi.pc.in b/src/pkgconfig/cdi.pc.in index 5d76a923b8ebd5a4ecec420648f139adabb9773b..28bdc5fc738de0f74f00fe219ccba1a5dc5e4104 100644 --- a/src/pkgconfig/cdi.pc.in +++ b/src/pkgconfig/cdi.pc.in @@ -3,8 +3,8 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ cflags=-I@includedir@ -fcflags=@FPP_INCOPT@@includedir@ @CDI_F90_INTERFACE_FCFLAGS@ -libs=-L@libdir@ -lcdi @GRIB_API_LIBS@ @NETCDF_LIBS@ @SZLIB_LIBS@ @THREADS_LIBS@ @LIBS@ +@ENABLE_CF_INTERFACE_TRUE@fcflags=@FC_OPTINC@@includedir@ +libs=-L@libdir@ -lcdi @GRIB_API_LIBS@ @ECCODES_LIBS@ @NETCDF_LIBS@ @SZLIB_LIBS@ @THREADS_LIBS@ @LIBS@ threads_libs=@THREADS_LIBS@ threads_cflags=@THREADS_INCLUDE@ szlib_cflags=@SZLIB_INCLUDE@ @@ -15,6 +15,8 @@ netcdf_libs=@NETCDF_LIBS@ aux_libs=@LIBS@ grib_api_cflags=@GRIB_API_INCLUDE@ grib_api_libs=@GRIB_API_LIBS@ +eccodes_cflags=@ECCODES_INCLUDE@ +eccodes_libs=@ECCODES_LIBS@ cdi_build_cc=@CC@ cdi_build_cflags=@CFLAGS@ cdi_build_cppflags=@CPPFLAGS@ @@ -39,5 +41,5 @@ Version: @VERSION@ Requires: Libs: ${libs} Cflags: ${cflags} -FCflags: ${fcflags} +@ENABLE_CF_INTERFACE@FCflags: ${fcflags} diff --git a/src/pkgconfig/cdi_f2003.pc.in b/src/pkgconfig/cdi_f2003.pc.in index 7087343906a274eaa27fa1526961665ce5d0286b..4d25db38048a2312c5f8d98b5f9a578a7a10fffc 100644 --- a/src/pkgconfig/cdi_f2003.pc.in +++ b/src/pkgconfig/cdi_f2003.pc.in @@ -3,7 +3,7 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ cflags=-I@includedir@ -fcflags=@FPP_INCOPT@@includedir@ @CDI_F90_INTERFACE_FCFLAGS@ +fcflags=@FC_MOD_FLAG@@includedir@ libs=-L@libdir@ -lcdi_f2003 -lcdi @GRIB_API_LIBS@ @ECCODES_LIBS@ @NETCDF_LIBS@ @SZLIB_LIBS@ @THREADS_LIBS@ @LIBS@ threads_libs=@THREADS_LIBS@ threads_cflags=@THREADS_INCLUDE@ diff --git a/src/pkgconfig/cdipio.pc.in b/src/pkgconfig/cdipio.pc.in index dd6adc42aead316479369ec67b1349c249f698bc..c99faeb2dd8454c57d0e7bf40a0cf7a041523aff 100644 --- a/src/pkgconfig/cdipio.pc.in +++ b/src/pkgconfig/cdipio.pc.in @@ -4,7 +4,7 @@ libdir=@libdir@ includedir=@includedir@ cflags=-I@includedir@ fcflags=@FPP_INCOPT@@includedir@ @CDI_F90_INTERFACE_FCFLAGS@ -libs=-L@libdir@ -lcdipio @LIBRT@ @PPM_CORE_LIBS@ @YAXT_LIBS@ -lcdi @GRIB_API_LIBS@ @NETCDF_LIBS@ @SZLIB_LIBS@ @THREADS_LIBS@ @LIBS@ +libs=-L@libdir@ -lcdipio @LIBRT@ @PPM_CORE_C_LIB@ @YAXT_C_LIB@ @MPI_C_LIB@ -lcdi @GRIB_API_LIBS@ @ECCODES_LIBS@ @NETCDF_LIBS@ @SZLIB_LIBS@ @THREADS_LIBS@ @LIBS@ threads_libs=@THREADS_LIBS@ threads_cflags=@THREADS_INCLUDE@ szlib_cflags=@SZLIB_INCLUDE@ @@ -14,6 +14,14 @@ netcdf_cflags=@NETCDF_INCLUDE@ netcdf_libs=@NETCDF_LIBS@ grib_api_cflags=@GRIB_API_INCLUDE@ grib_api_libs=@GRIB_API_LIBS@ +eccodes_cflags=@ECCODES_INCLUDE@ +eccodes_libs=@ECCODES_LIBS@ +yaxt_fc_include=@YAXT_FC_MOD@ +yaxt_fc_lib=@YAXT_FC_LIB@ +yaxt_c_cflags=@YAXT_C_INCLUDE@ +yaxt_c_libs=@YAXT_C_LIB@ +ppm_core_cflags=@PPM_CORE_C_INCLUDE@ +ppm_core_libs=@PPM_CORE_C_LIB@ aux_libs=@LIBRT@ @LIBS@ cdipio_build_cc=@CC@ cdipio_build_cflags=@CFLAGS@ diff --git a/src/resource_handle.c b/src/resource_handle.c index 5e14e314e7f3650bba039241647b1c17c894118b..92f5024113ee701a2c2a3be4a558cf1b5fe7fba6 100644 --- a/src/resource_handle.c +++ b/src/resource_handle.c @@ -116,6 +116,78 @@ static int listInit = 0; #endif +#ifdef CDI_CHECK_RESOURCE_LISTS +static void +checkListLinear(const char *caller, int nsp) +{ + const listElem_t *restrict r = resHList[nsp].resources; + for (int i = 0; i < resHList[nsp].size; i++) + { + if (r[i].status != RESH_UNUSED) continue; + + int prev = r[i].res.free.prev; + int next = r[i].res.free.next; + + if (prev < -1 || prev >= resHList[nsp].size) xabortC(caller, "error: found invalid back-link in free-list!"); + if (prev != -1) + { + if (r[prev].res.free.next != i) xabortC(caller, "error: found incomplete back link in free-list!"); + if (r[prev].status & RESH_IN_USE_BIT) xabortC(caller, "error: found in-use back link element in free-list!"); + } + + if (next < -1 || next >= resHList[nsp].size) xabortC(caller, "error: found invalid forward-link in free-list!"); + if (next != -1) + { + if (r[next].res.free.prev != i) xabortC(caller, "error: found incomplete forward link in free-list!"); + if (r[next].status & RESH_IN_USE_BIT) xabortC(caller, "error: found in-use next element in free-list!"); + } + } +} + +static void +checkListFwdBwd(const char *caller, int nsp) +{ + const listElem_t *restrict r = resHList[nsp].resources; + + int next = resHList[nsp].freeHead, loopLimit = resHList[nsp].size + 1; + int i = 0, cur = -1; + while (next != -1) + { + if (next < 0 || next >= resHList[nsp].size) xabortC(caller, "error: found invalid index in free-list!"); + if (r[next].status & RESH_IN_USE_BIT) xabortC(caller, "error: found in-use next element in free-list!"); + + cur = next; + next = r[next].res.free.next; + + if (++i > loopLimit) xabortC(caller, "error: found loop in free-list!"); + } + + i = 0; + int prev = cur; + while (prev != -1) + { + if (prev < 0 || prev >= resHList[nsp].size) xabortC(caller, "error: found invalid index in free-list!"); + if (r[prev].status & RESH_IN_USE_BIT) xabortC(caller, "error: found in-use prev element in free-list!"); + + cur = prev; + prev = r[prev].res.free.prev; + + if (prev == -1) break; + + if (++i > loopLimit) xabortC(caller, "error: found loop in free-list!"); + } +} + +static void +checkList(const char *caller, int nsp) +{ + checkListLinear(caller, nsp); + checkListFwdBwd(caller, nsp); +} +#else +#define checkList(caller, nsp) +#endif + /**************************************************************/ static void @@ -133,9 +205,11 @@ listInitResources(int nsp) p[i].res.free.prev = i - 1; p[i].status = RESH_UNUSED; } - p[size - 1].res.free.next = -1; resHList[nsp].freeHead = 0; + + checkList(__func__, nsp); + int oldNsp = namespaceGetActive(); namespaceSetActive(nsp); instituteDefaultEntries(); @@ -167,6 +241,7 @@ reshListCreate(int namespaceID) } /**************************************************************/ +static void reshRemove_(int nsp, int idx, const char *caller); void reshListDestruct(int namespaceID) @@ -180,7 +255,11 @@ reshListDestruct(int namespaceID) for (int j = 0; j < resHList[namespaceID].size; j++) { listElem_t *listElem = resHList[namespaceID].resources + j; - if (listElem->status & RESH_IN_USE_BIT) listElem->res.v.ops->valDestroy(listElem->res.v.val); + if (listElem->status & RESH_IN_USE_BIT) + { + listElem->res.v.ops->valDestroy(listElem->res.v.val); + reshRemove_(namespaceID, j, __func__); + } } Free(resHList[namespaceID].resources); resHList[namespaceID].resources = NULL; @@ -229,9 +308,10 @@ listInitialize(void) /**************************************************************/ static void -listSizeExtend() +listSizeExtend(void) { int nsp = namespaceGetActive(); + checkList(__func__, nsp); int oldSize = resHList[nsp].size; size_t newListSize = (size_t) oldSize + MIN_LIST_SIZE; @@ -250,6 +330,8 @@ listSizeExtend() r[oldSize].res.free.prev = -1; resHList[nsp].freeHead = oldSize; resHList[nsp].size = (int) newListSize; + + checkList(__func__, nsp); } /**************************************************************/ @@ -257,6 +339,8 @@ listSizeExtend() static void reshPut_(int nsp, int entry, void *p, const resOps *ops) { + checkList(__func__, nsp); + listElem_t *newListElem = resHList[nsp].resources + entry; int next = newListElem->res.free.next, prev = newListElem->res.free.prev; if (next != -1) resHList[nsp].resources[next].res.free.prev = prev; @@ -267,6 +351,8 @@ reshPut_(int nsp, int entry, void *p, const resOps *ops) newListElem->res.v.val = p; newListElem->res.v.ops = ops; newListElem->status = RESH_DESYNC_IN_USE; + + checkList(__func__, nsp); } int @@ -293,15 +379,20 @@ reshPut(void *p, const resOps *ops) /**************************************************************/ static void -reshRemove_(int nsp, int idx) +reshRemove_(int nsp, int idx, const char *caller) { + checkList(__func__, nsp); + int curFree = resHList[nsp].freeHead; listElem_t *r = resHList[nsp].resources; + if (!(r[idx].status & RESH_IN_USE_BIT)) xabortC(caller, "Attempting to remove an item that is already removed."); r[idx].res.free.next = curFree; r[idx].res.free.prev = -1; if (curFree != -1) r[curFree].res.free.prev = idx; r[idx].status = RESH_DESYNC_DELETED; resHList[nsp].freeHead = idx; + + checkList(__func__, nsp); } void @@ -316,9 +407,15 @@ reshDestroy(cdiResH resH) nspT = namespaceResHDecode(resH); - xassert(nspT.nsp == nsp && nspT.idx >= 0 && nspT.idx < resHList[nsp].size && resHList[nsp].resources[nspT.idx].res.v.ops); + listElem_t *r = resHList[nsp].resources + nspT.idx; - if (resHList[nsp].resources[nspT.idx].status & RESH_IN_USE_BIT) reshRemove_(nsp, nspT.idx); + xassert(nspT.nsp == nsp && nspT.idx >= 0 && nspT.idx < resHList[nsp].size && r->res.v.ops); + + if (r->status & RESH_IN_USE_BIT) + { + r->res.v.ops->valDestroy(r->res.v.val); + reshRemove_(nsp, nspT.idx, __func__); + } LIST_UNLOCK(); } @@ -339,7 +436,7 @@ reshRemove(cdiResH resH, const resOps *ops) && (resHList[nsp].resources[nspT.idx].status & RESH_IN_USE_BIT) && resHList[nsp].resources[nspT.idx].res.v.ops && resHList[nsp].resources[nspT.idx].res.v.ops == ops); - reshRemove_(nsp, nspT.idx); + reshRemove_(nsp, nspT.idx, __func__); LIST_UNLOCK(); } @@ -353,16 +450,21 @@ reshReplace(cdiResH resH, void *p, const resOps *ops) LIST_INIT(1); LIST_LOCK(); int nsp = namespaceGetActive(); + + checkList(__func__, nsp); + namespaceTuple_t nspT = namespaceResHDecode(resH); while (resHList[nsp].size <= nspT.idx) listSizeExtend(); listElem_t *q = resHList[nsp].resources + nspT.idx; if (q->status & RESH_IN_USE_BIT) { q->res.v.ops->valDestroy(q->res.v.val); - reshRemove_(nsp, nspT.idx); + reshRemove_(nsp, nspT.idx, __func__); } reshPut_(nsp, nspT.idx, p, ops); LIST_UNLOCK(); + + checkList(__func__, nsp); } static listElem_t * @@ -585,7 +687,7 @@ reshGetTxCode(cdiResH resH) { listElem_t *listElem = resHList[nsp].resources + nspT.idx; xassert(listElem->res.v.ops); - type = listElem->res.v.ops->valTxCode(); + type = listElem->res.v.ops->valTxCode(listElem->res.v.val); } LIST_UNLOCK(); @@ -628,7 +730,7 @@ reshPackBufferCreate(char **packBuffer, int *packBufferSize, void *context) { listElem_t *curr = r + i; xassert(curr->res.v.ops); - int type = curr->res.v.ops->valTxCode(); + int type = curr->res.v.ops->valTxCode(curr->res.v.val); if (!type) continue; serializePack(&type, 1, CDI_DATATYPE_INT, pB, pBSize, &packBufferPos, context); curr->res.v.ops->valPack(curr->res.v.val, pB, pBSize, &packBufferPos, context); @@ -654,8 +756,6 @@ reshSetStatus(cdiResH resH, const resOps *ops, int status) namespaceTuple_t nspT; listElem_t *listElem; - xassert((ops != NULL) ^ !(status & RESH_IN_USE_BIT)); - LIST_INIT(1); LIST_LOCK(); @@ -696,7 +796,7 @@ reshGetStatus(cdiResH resH, const resOps *ops) { listElem_t *listElem = resHList[nsp].resources + nspT.idx; const resOps *elemOps = listElem->res.v.ops; - xassert(listElem && (!(listElem->status & RESH_IN_USE_BIT) || elemOps == ops)); + xassert(listElem && (!(listElem->status & RESH_IN_USE_BIT) || elemOps == ops || !ops)); status = listElem->status; } diff --git a/src/resource_handle.h b/src/resource_handle.h index d02fb1982759d39ed17495a94c227c9c59175d26..b3f62cd2a0860422c5a21160a49ba1baae4fd23b 100644 --- a/src/resource_handle.h +++ b/src/resource_handle.h @@ -22,7 +22,7 @@ typedef void (*valDestroyFunc)(void *); typedef void (*valPrintFunc)(void *, FILE *); typedef int (*valGetPackSizeFunc)(void *, void *context); typedef void (*valPackFunc)(void *, void *buf, int size, int *pos, void *context); -typedef int (*valTxCodeFunc)(void); +typedef int (*valTxCodeFunc)(void *); typedef struct { diff --git a/src/resource_unpack.c b/src/resource_unpack.c index b14466149c6b05d96b4cbc259076a3e7012a68f0..e1b3fe08421dc7446bf36b1fb9c4c4ced591031b 100644 --- a/src/resource_unpack.c +++ b/src/resource_unpack.c @@ -12,10 +12,13 @@ #include "taxis.h" #include "zaxis.h" +int (*reshDistGridUnpack)(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, + int force_id); + /*****************************************************************************/ int -reshUnpackResources(char *unpackBuffer, int unpackBufferSize, void *context) +reshUnpackResources(char *unpackBuffer, int unpackBufferSize, void *context, cdiPostResUpdateHook postHook) { int updateType, resH, originNamespace; int unpackBufferPos = 0; @@ -32,28 +35,41 @@ reshUnpackResources(char *unpackBuffer, int unpackBufferSize, void *context) { serializeUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, &updateType, 1, CDI_DATATYPE_INT, context); if (updateType == END) break; + int updatedResH; switch (updateType) { - case GRID: gridUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, originNamespace, context, 1); break; - case ZAXIS: zaxisUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, originNamespace, context, 1); break; - case TAXIS: taxisUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, originNamespace, context, 1); break; - case INSTITUTE: instituteUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, originNamespace, context, 1); break; - case MODEL: modelUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, originNamespace, context, 1); break; + case GRID: updatedResH = gridUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, originNamespace, context, 1); break; + case ZAXIS: updatedResH = zaxisUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, originNamespace, context, 1); break; + case TAXIS: updatedResH = taxisUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, originNamespace, context, 1); break; + case INSTITUTE: + updatedResH = instituteUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, originNamespace, context, 1); + break; + case MODEL: updatedResH = modelUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, originNamespace, context, 1); break; case STREAM: if (sizeAssociations == numAssociations) associations = (struct streamAssoc *) Realloc(associations, sizeof(associations[0]) * (size_t) (sizeAssociations *= 2)); - associations[numAssociations] = streamUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, originNamespace, context); + { + struct streamAssoc newAssoc; + associations[numAssociations] = newAssoc + = streamUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, originNamespace, context); + updatedResH = newAssoc.streamID; + } ++numAssociations; break; - case VLIST: vlistUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, originNamespace, context, 1); break; + case VLIST: updatedResH = vlistUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, originNamespace, context, 1); break; + case DIST_GRID: + updatedResH = reshDistGridUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, originNamespace, context, 1); + break; case RESH_DELETE: serializeUnpack(unpackBuffer, unpackBufferSize, &unpackBufferPos, &resH, 1, CDI_DATATYPE_INT, context); resH = namespaceAdaptKey(resH, originNamespace); reshDestroy(resH); + updatedResH = resH; reshSetStatus(resH, NULL, RESH_UNUSED); break; default: xabort("Invalid/unexpected serialization type %d or transfer error!", updateType); } + if (postHook != (cdiPostResUpdateHook) 0) postHook(updatedResH, updateType); } for (int i = 0; i < numAssociations; ++i) { diff --git a/src/resource_unpack.h b/src/resource_unpack.h index b5983521df22588d74f4ef2db5bf4c34691b84ac..e5187cc594d6e1cac61ee78fb695f09635cf0594 100644 --- a/src/resource_unpack.h +++ b/src/resource_unpack.h @@ -14,13 +14,18 @@ enum MODEL = 5, STREAM = 6, VLIST = 7, + DIST_GRID = 8, RESH_DELETE, START = 55555555, END = 99999999 }; -int reshUnpackResources(char *unpackBuffer, int unpackBufferSize, void *context); +typedef void (*cdiPostResUpdateHook)(int resH, int resType); +int reshUnpackResources(char *unpackBuffer, int unpackBufferSize, void *context, cdiPostResUpdateHook postHook); + +extern int (*reshDistGridUnpack)(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, + int force_id); #endif /* diff --git a/src/serialize.h b/src/serialize.h index b3b99691494bcfe05f2715738df444c846fd8296..fe80b20f1aae6a7e733654d7a88a455cd9fc6b40 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -46,10 +46,14 @@ serializeKeysGetPackSize(const cdi_keys_t *keysp, void *context) int length = keyp->length; packBuffSize += serializeGetSize(1, CDI_DATATYPE_INT, context) + serializeGetSize(length, CDI_DATATYPE_TXT, context); } - else + else if (type == KEY_INT) { packBuffSize += serializeGetSize(1, CDI_DATATYPE_INT, context); } + else if (type == KEY_FLOAT) + { + packBuffSize += serializeGetSize(1, CDI_DATATYPE_FLT64, context); + } } packBuffSize += serializeGetSize(1, CDI_DATATYPE_UINT32, context); return packBuffSize; @@ -122,6 +126,12 @@ serializeKeysUnpack(const void *buf, int buf_size, int *position, cdi_keys_t *ke serializeUnpack(buf, buf_size, position, &ival, 1, CDI_DATATYPE_INT, context); cdiDefVarKeyInt(keysp, key, ival); } + else if (type == KEY_FLOAT) + { + double dval; + serializeUnpack(buf, buf_size, position, &dval, 1, CDI_DATATYPE_FLT64, context); + cdiDefVarKeyFloat(keysp, key, dval); + } } serializeUnpack(buf, buf_size, position, &d, 1, CDI_DATATYPE_UINT32, context); xassert(d == d2); diff --git a/src/servicelib.c b/src/servicelib.c index ad1e8c960ff13545de0ee120112765db737fba25..368d72cddb8e85b45eaf6eaf97d3ecbddd4f11f1 100644 --- a/src/servicelib.c +++ b/src/servicelib.c @@ -29,7 +29,7 @@ static int srvDefaultDprec = 0; // A version string. #undef LIBVERSION -#define LIBVERSION 1.4.2 +#define LIBVERSION 1.5.0 #define XSTRING(x) #x #define STRING(x) XSTRING(x) static const char srv_libvers[] = STRING(LIBVERSION); @@ -69,7 +69,7 @@ srvLibInit() { case '4': srvDefaultHprec = EXSE_SINGLE_PRECISION; break; case '8': srvDefaultHprec = EXSE_DOUBLE_PRECISION; break; - default: Message("Invalid digit in %s: %s", envName, envString); + default: Warning("Invalid digit in %s: %s", envName, envString); } break; } @@ -79,13 +79,13 @@ srvLibInit() { case '4': srvDefaultDprec = EXSE_SINGLE_PRECISION; break; case '8': srvDefaultDprec = EXSE_DOUBLE_PRECISION; break; - default: Message("Invalid digit in %s: %s", envName, envString); + default: Warning("Invalid digit in %s: %s", envName, envString); } break; } default: { - Message("Invalid character in %s: %s", envName, envString); + Warning("Invalid character in %s: %s", envName, envString); break; } } @@ -141,44 +141,44 @@ srvCheckFiletype(int fileID, int *swap) if (fileRead(fileID, buffer, 4) != 4) return 0; - const size_t blocklen = (size_t) get_UINT32(buffer); - const size_t sblocklen = (size_t) get_SUINT32(buffer); + size_t blocklen = (size_t) get_UINT32(buffer); + size_t sblocklen = (size_t) get_SUINT32(buffer); if (SRV_Debug) Message("blocklen = %d sblocklen = %d", blocklen, sblocklen); // clang-format off - if ( blocklen == 32 ) + if (blocklen == 32) { *swap = 0; fact = blocklen>>3; - if ( fileRead(fileID, buffer, blocklen+8) != blocklen+8 ) return 0; + if (fileRead(fileID, buffer, blocklen+8) != blocklen+8) return 0; pbuf = buffer+4*fact; dimx = (size_t) get_UINT32(pbuf); pbuf = buffer+5*fact; dimy = (size_t) get_UINT32(pbuf); pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf); } - else if ( blocklen == 64 ) + else if (blocklen == 64) { *swap = 0; fact = blocklen>>3; - if ( fileRead(fileID, buffer, blocklen+8) != blocklen+8 ) return 0; + if (fileRead(fileID, buffer, blocklen+8) != blocklen+8) return 0; pbuf = buffer+4*fact; dimx = (size_t) get_UINT64(pbuf); pbuf = buffer+5*fact; dimy = (size_t) get_UINT64(pbuf); pbuf = buffer+blocklen+4; data = (size_t) get_UINT32(pbuf); } - else if ( sblocklen == 32 ) + else if (sblocklen == 32) { *swap = 1; fact = sblocklen>>3; - if ( fileRead(fileID, buffer, sblocklen+8) != sblocklen+8 ) return 0; + if (fileRead(fileID, buffer, sblocklen+8) != sblocklen+8) return 0; pbuf = buffer+4*fact; dimx = (size_t) get_SUINT32(pbuf); pbuf = buffer+5*fact; dimy = (size_t) get_SUINT32(pbuf); pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf); } - else if ( sblocklen == 64 ) + else if (sblocklen == 64) { *swap = 1; fact = sblocklen>>3; - if ( fileRead(fileID, buffer, sblocklen+8) != sblocklen+8 ) return 0; + if (fileRead(fileID, buffer, sblocklen+8) != sblocklen+8) return 0; pbuf = buffer+4*fact; dimx = (size_t) get_SUINT64(pbuf); pbuf = buffer+5*fact; dimy = (size_t) get_SUINT64(pbuf); pbuf = buffer+sblocklen+4; data = (size_t) get_SUINT32(pbuf); @@ -187,13 +187,10 @@ srvCheckFiletype(int fileID, int *swap) fileRewind(fileID); - if (SRV_Debug) - { - Message("swap = %d fact = %d", *swap, fact); - Message("dimx = %lu dimy = %lu data = %lu", dimx, dimy, data); - } + if (SRV_Debug) Message("swap = %d fact = %d", *swap, fact); + if (SRV_Debug) Message("dimx = %lu dimy = %lu data = %lu", dimx, dimy, data); - const int found = data && (dimx * dimy * fact == data || dimx * dimy * 8 == data); + int found = data && (dimx * dimy * fact == data || dimx * dimy * 8 == data); return found; } @@ -227,10 +224,10 @@ static int srvInqData(srvrec_t *srvp, int prec, void *data) { int ierr = 0; - const int byteswap = srvp->byteswap; - const size_t datasize = srvp->datasize; + int byteswap = srvp->byteswap; + size_t datasize = srvp->datasize; void *buffer = srvp->buffer; - const int dprec = srvp->dprec; + int dprec = srvp->dprec; switch (dprec) { @@ -293,16 +290,16 @@ srvDefData(void *srv, int prec, const void *data) { srvrec_t *srvp = (srvrec_t *) srv; - const int dprec = srvDefaultDprec ? srvDefaultDprec : srvp->dprec; + int dprec = srvDefaultDprec ? srvDefaultDprec : srvp->dprec; srvp->dprec = dprec ? dprec : prec; - const int hprec = srvDefaultHprec ? srvDefaultHprec : srvp->hprec; + int hprec = srvDefaultHprec ? srvDefaultHprec : srvp->hprec; srvp->hprec = hprec ? hprec : dprec; int *header = srvp->header; - const size_t datasize = (size_t) header[4] * (size_t) header[5]; - const size_t blocklen = datasize * (size_t) dprec; + size_t datasize = (size_t) header[4] * (size_t) header[5]; + size_t blocklen = datasize * (size_t) dprec; srvp->datasize = datasize; @@ -362,12 +359,12 @@ srvRead(int fileID, void *srv) if (!srvp->checked) { - const int status = srvCheckFiletype(fileID, &srvp->byteswap); + int status = srvCheckFiletype(fileID, &srvp->byteswap); if (status == 0) Error("Not a SERVICE file!"); srvp->checked = 1; } - const int byteswap = srvp->byteswap; + int byteswap = srvp->byteswap; // read header record size_t blocklen = binReadF77Block(fileID, byteswap); @@ -376,7 +373,7 @@ srvRead(int fileID, void *srv) if (SRV_Debug) Message("blocklen = %lu", blocklen); - const size_t hprec = blocklen / SRV_HEADER_LEN; + size_t hprec = blocklen / SRV_HEADER_LEN; srvp->hprec = (int) hprec; @@ -421,7 +418,7 @@ srvRead(int fileID, void *srv) srvp->buffer = Realloc(srvp->buffer, srvp->buffersize); } - const size_t dprec = blocklen / srvp->datasize; + size_t dprec = blocklen / srvp->datasize; srvp->dprec = (int) dprec; @@ -449,9 +446,9 @@ srvWrite(int fileID, void *srv) { srvrec_t *srvp = (srvrec_t *) srv; union SRV_HEADER tempheader; - const int byteswap = srvp->byteswap; - const int dprec = srvp->dprec; - const int hprec = srvp->hprec; + int byteswap = srvp->byteswap; + int dprec = srvp->dprec; + int hprec = srvp->hprec; int *restrict header = srvp->header; // write header record diff --git a/src/stream.c b/src/stream.c index a6df254a15dcc16edf5b22c64653c700a34bd72f..f182e2aa9378f1316c738805a9f71e155b1e6877 100644 --- a/src/stream.c +++ b/src/stream.c @@ -39,13 +39,12 @@ #include "async_worker.h" static stream_t *stream_new_entry(int resH); -static void stream_delete_entry(stream_t *streamptr); static int streamCompareP(void *streamptr1, void *streamptr2); static void streamDestroyP(void *streamptr); static void streamPrintP(void *streamptr, FILE *fp); static int streamGetPackSize(void *streamptr, void *context); static void streamPack(void *streamptr, void *buff, int size, int *position, void *context); -static int streamTxCode(void); +static int streamTxCode(void *streamptr); const resOps streamOps = { streamCompareP, streamDestroyP, streamPrintP, streamGetPackSize, streamPack, streamTxCode }; @@ -77,7 +76,7 @@ cdiGetFiletype(const char *uri, int *byteorder) long recpos; const char *filename; - const int protocol = cdiGetProtocol(uri, &filename); + int protocol = cdiGetProtocol(uri, &filename); switch (protocol) { @@ -89,7 +88,7 @@ cdiGetFiletype(const char *uri, int *byteorder) break; } - const int fileID = fileOpen(filename, "r"); + int fileID = fileOpen(filename, "r"); if (fileID == CDI_UNDEFID) return CDI_ESYSTEM; else if (fileID == -2) return CDI_ETMOF; @@ -199,6 +198,21 @@ streamDefMaxSteps(int streamID, int maxSteps) } } +static long +cdiInqTimeSize(int streamID) +{ + stream_t *streamptr = stream_to_pointer(streamID); + + long ntsteps = streamptr->ntsteps; + if (ntsteps == (long) CDI_UNDEFID) + { + int tsID = 0; + while (streamInqTimestep(streamID, tsID++)) ntsteps = streamptr->ntsteps; + } + + return ntsteps; +} + void streamDefNumWorker(int streamID, int numWorker) { @@ -206,6 +220,10 @@ streamDefNumWorker(int streamID, int numWorker) { stream_t *streamptr = stream_to_pointer(streamID); streamptr->numWorker = numWorker; + + int filetype = streamptr->filetype; + bool filetypeIsGrib = (filetype == CDI_FILETYPE_GRB || filetype == CDI_FILETYPE_GRB2); + if (streamptr->filemode == 'r' && filetypeIsGrib) (void) cdiInqTimeSize(streamID); } } @@ -320,26 +338,11 @@ streamFilename(int streamID) return streamptr->filename; } -static long -cdiInqTimeSize(int streamID) -{ - stream_t *streamptr = stream_to_pointer(streamID); - - long ntsteps = streamptr->ntsteps; - if (ntsteps == (long) CDI_UNDEFID) - { - int tsID = 0; - while (streamInqTimestep(streamID, tsID++)) ntsteps = streamptr->ntsteps; - } - - return ntsteps; -} - static int cdiInqContents(stream_t *streamptr) { int status = 0; - const int filetype = streamptr->filetype; + int filetype = streamptr->filetype; switch (cdiBaseFiletype(filetype)) { @@ -379,7 +382,7 @@ cdiInqContents(stream_t *streamptr) if (status == 0) { - const int taxisID = vlistInqTaxis(streamptr->vlistID); + int taxisID = vlistInqTaxis(streamptr->vlistID); if (taxisID != CDI_UNDEFID) { taxis_t *taxisptr1 = &streamptr->tsteps[0].taxis; @@ -394,14 +397,14 @@ cdiInqContents(stream_t *streamptr) int cdiGetProtocol(const char *uri, const char **filename) { - char *pos = strstr(uri, "://"); + const char *pos = strstr(uri, "://"); if (pos == NULL) { *filename = uri; return CDI_PROTOCOL_FILE; } - const int protocollen = pos - uri; + int protocollen = pos - uri; *filename = pos + 3; // if (strncmp(uri, "file", protocollen) == 0) return CDI_PROTOCOL_FILE; // file is already used in NetCDF @@ -590,6 +593,28 @@ cdiStreamOpenDefaultDelegate(const char *uri, char filemode, int filetype, strea return fileID; } +static int +stream_create_vlist(stream_t *streamptr, CdiQuery *query) +{ + int vlistID = vlistCreate(); + if (vlistID < 0) return CDI_ELIMIT; + + cdiVlistMakeInternal(vlistID); + streamptr->vlistID = vlistID; + + if (query) streamptr->query = query; + + int status = cdiInqContents(streamptr); + if (status >= 0) + { + vlist_t *vlistptr = vlist_to_pointer(streamptr->vlistID); + vlistptr->ntsteps = streamptr->ntsteps; + cdiVlistMakeImmutable(vlistID); + } + + return status; +} + int streamOpenID(const char *filename, char filemode, int filetype, int resH) { @@ -603,10 +628,13 @@ streamOpenID(const char *filename, char filemode, int filetype, int resH) int (*streamOpenDelegate)(const char *filename, char filemode, int filetype, stream_t *streamptr, int recordBufIsToBeCreated) = (int (*)(const char *, char, int, stream_t *, int)) namespaceSwitchGet(NSSWITCH_STREAM_OPEN_BACKEND).func; - const int fileID = streamOpenDelegate(filename, filemode, filetype, streamptr, 1); + int fileID = streamOpenDelegate(filename, filemode, filetype, streamptr, 1); if (fileID < 0) { streamID = fileID; + if (streamptr->record) Free(streamptr->record); + reshRemove(streamptr->self, &streamOps); + Free(streamptr); } else { @@ -616,33 +644,6 @@ streamOpenID(const char *filename, char filemode, int filetype, int resH) streamptr->filemode = filemode; streamptr->filename = strdupx(filename); streamptr->fileID = fileID; - - if (filemode == 'r') - { - const int vlistID = vlistCreate(); - if (vlistID < 0) return CDI_ELIMIT; - - cdiVlistMakeInternal(vlistID); - streamptr->vlistID = vlistID; - // cdiReadByteorder(streamID); - const int status = cdiInqContents(streamptr); - if (status < 0) - { - streamID = status; - } - else - { - vlist_t *vlistptr = vlist_to_pointer(streamptr->vlistID); - vlistptr->ntsteps = streamptr->ntsteps; - cdiVlistMakeImmutable(vlistID); - } - } - } - - if (streamID < 0) - { - Free(streamptr->record); - stream_delete_entry(streamptr); } return streamID; @@ -692,7 +693,7 @@ streamOpenA(const char *filename, const char *filemode, int filetype) // Needed for NetCDF4 for (int varID = 0; varID < vlistptr->nvars; ++varID) streamptr->vars[varID].defmiss = true; - if (!strcmp(filemode, "r")) cdiVlistMakeImmutable(streamptr->vlistID); + if (str_is_equal(filemode, "r")) cdiVlistMakeImmutable(streamptr->vlistID); { void (*streamCloseDelegate)(stream_t * streamptr, int recordBufIsToBeDeleted) @@ -753,7 +754,7 @@ streamOpenA(const char *filename, const char *filemode, int filetype) } case CDI_FILETYPE_NCZARR: { - Message("%s not available in append mode!", strfiletype(filetype)); + Warning("%s not available in append mode!", strfiletype(filetype)); return CDI_ELIBNAVAIL; } #endif @@ -816,14 +817,51 @@ streamOpenRead(const char *filename) cdiInitialize(); int byteorder = 0; - const int filetype = cdiGetFiletype(filename, &byteorder); + int filetype = cdiGetFiletype(filename, &byteorder); if (filetype < 0) return filetype; - const int streamID = streamOpen(filename, "r", filetype); + int streamID = streamOpen(filename, "r", filetype); if (streamID >= 0) { stream_t *streamptr = stream_to_pointer(streamID); streamptr->byteorder = byteorder; + + int status = stream_create_vlist(streamptr, NULL); + if (status < 0) + { + streamID = status; + if (streamptr->record) Free(streamptr->record); + reshRemove(streamptr->self, &streamOps); + } + } + + return streamID; +} + +int +streamOpenReadQuery(const char *filename, CdiQuery *query) +{ + cdiInitialize(); + + int byteorder = 0; + int filetype = cdiGetFiletype(filename, &byteorder); + if (filetype < 0) return filetype; + + if (cdiBaseFiletype(filetype) != CDI_FILETYPE_NETCDF && filetype != CDI_FILETYPE_GRB2) return CDI_EQNAVAIL; + + int streamID = streamOpen(filename, "r", filetype); + if (streamID >= 0) + { + stream_t *streamptr = stream_to_pointer(streamID); + streamptr->byteorder = byteorder; + + int status = stream_create_vlist(streamptr, query); + if (status < 0) + { + streamID = status; + if (streamptr->record) Free(streamptr->record); + reshRemove(streamptr->self, &streamOps); + } } return streamID; @@ -835,10 +873,10 @@ streamOpenAppend(const char *filename) cdiInitialize(); int byteorder = 0; - const int filetype = cdiGetFiletype(filename, &byteorder); + int filetype = cdiGetFiletype(filename, &byteorder); if (filetype < 0) return filetype; - const int streamID = streamOpenA(filename, "a", filetype); + int streamID = streamOpenA(filename, "a", filetype); if (streamID >= 0) { stream_t *streamptr = stream_to_pointer(streamID); @@ -909,6 +947,7 @@ streamDefaultValue(stream_t *streamptr) streamptr->numvals = 0; streamptr->filename = NULL; streamptr->record = NULL; + streamptr->query = NULL; streamptr->varsAllocated = 0; streamptr->nrecs = 0; streamptr->nvars = 0; @@ -930,6 +969,10 @@ streamDefaultValue(stream_t *streamptr) streamptr->have_missval = cdiHaveMissval; streamptr->comptype = CDI_COMPRESS_NONE; streamptr->complevel = 0; + // netcdf4/HDF5 filter + streamptr->filterId = 0; + streamptr->numParams = 0; + streamptr->maxParams = sizeof(streamptr->params) / sizeof(streamptr->params[0]); basetimeInit(&streamptr->basetime); @@ -942,10 +985,16 @@ streamDefaultValue(stream_t *streamptr) for (int i = 0; i < MAX_GRIDS_PS; i++) { + streamptr->ncgrid[i].start = CDI_UNDEFID; + streamptr->ncgrid[i].count = CDI_UNDEFID; streamptr->ncgrid[i].gridID = CDI_UNDEFID; for (size_t j = 0; j < CDF_SIZE_ncIDs; ++j) streamptr->ncgrid[i].ncIDs[j] = CDI_UNDEFID; } + streamptr->ncNumDims = 0; + for (int i = 0; i < MAX_DIMS_PS; i++) streamptr->ncDimID[i] = CDI_UNDEFID; + for (int i = 0; i < MAX_DIMS_PS; i++) streamptr->ncDimLen[i] = 0; + streamptr->vct.ilev = 0; streamptr->vct.mlev = 0; streamptr->vct.ilevID = CDI_UNDEFID; @@ -955,7 +1004,7 @@ streamDefaultValue(stream_t *streamptr) streamptr->gribContainers = NULL; streamptr->numWorker = 0; - streamptr->nextRecID = 0; + streamptr->nextGlobalRecId = 0; streamptr->cachedTsID = -1; streamptr->jobs = NULL; streamptr->jobManager = NULL; @@ -985,8 +1034,8 @@ stream_new_entry(int resH) void cdiStreamCloseDefaultDelegate(stream_t *streamptr, int recordBufIsToBeDeleted) { - const int fileID = streamptr->fileID; - const int filetype = streamptr->filetype; + int fileID = streamptr->fileID; + int filetype = streamptr->filetype; switch (streamptr->protocol) { @@ -1016,77 +1065,80 @@ cdiStreamCloseDefaultDelegate(stream_t *streamptr, int recordBufIsToBeDeleted) } if (fileID == CDI_UNDEFID) - Warning("File %s not open!", streamptr->filename); - else - switch (cdiBaseFiletype(filetype)) - { + { + Warning("File %s not open!", streamptr->filename); + return; + } + + switch (cdiBaseFiletype(filetype)) + { #if defined(HAVE_LIBGRIB) && (defined(HAVE_LIBCGRIBEX) || defined(HAVE_LIBGRIB_API)) - case CDI_FILETYPE_GRB: - { - gribClose(fileID); - if (recordBufIsToBeDeleted) gribContainersDelete(streamptr); + case CDI_FILETYPE_GRB: + { + gribClose(fileID); + if (recordBufIsToBeDeleted) gribContainersDelete(streamptr); #ifdef HAVE_LIBCGRIBEX - if (recordBufIsToBeDeleted) cgribexDelete(streamptr->record->objectp); + if (recordBufIsToBeDeleted) cgribexDelete(streamptr->record->objectp); #endif - break; - } - case CDI_FILETYPE_GRB2: - { - gribClose(fileID); - if (recordBufIsToBeDeleted) gribContainersDelete(streamptr); - break; - } + break; + } + case CDI_FILETYPE_GRB2: + { + gribClose(fileID); + if (recordBufIsToBeDeleted) gribContainersDelete(streamptr); + break; + } #endif #ifdef HAVE_LIBSERVICE - case CDI_FILETYPE_SRV: - { - fileClose(fileID); - if (recordBufIsToBeDeleted) srvDelete(streamptr->record->objectp); - break; - } + case CDI_FILETYPE_SRV: + { + fileClose(fileID); + if (recordBufIsToBeDeleted) srvDelete(streamptr->record->objectp); + break; + } #endif #ifdef HAVE_LIBEXTRA - case CDI_FILETYPE_EXT: - { - fileClose(fileID); - if (recordBufIsToBeDeleted) extDelete(streamptr->record->objectp); - break; - } + case CDI_FILETYPE_EXT: + { + fileClose(fileID); + if (recordBufIsToBeDeleted) extDelete(streamptr->record->objectp); + break; + } #endif #ifdef HAVE_LIBIEG - case CDI_FILETYPE_IEG: - { - fileClose(fileID); - if (recordBufIsToBeDeleted) iegDelete(streamptr->record->objectp); - break; - } + case CDI_FILETYPE_IEG: + { + fileClose(fileID); + if (recordBufIsToBeDeleted) iegDelete(streamptr->record->objectp); + break; + } #endif #ifdef HAVE_LIBNETCDF - case CDI_FILETYPE_NETCDF: - { - cdfClose(fileID); - if (streamptr->ntsteps == 0 && streamptr->tsteps != NULL) - { - if (streamptr->tsteps[0].records) - { - Free(streamptr->tsteps[0].records); - streamptr->tsteps[0].records = NULL; - } - if (streamptr->tsteps[0].recIDs) - { - Free(streamptr->tsteps[0].recIDs); - streamptr->tsteps[0].recIDs = NULL; - } - } - break; - } + case CDI_FILETYPE_NETCDF: + { + cdfClose(fileID); + if (streamptr->ntsteps == 0 && streamptr->tsteps != NULL) + { + if (streamptr->tsteps[0].records) + { + Free(streamptr->tsteps[0].records); + streamptr->tsteps[0].records = NULL; + } + if (streamptr->tsteps[0].recIDs) + { + Free(streamptr->tsteps[0].recIDs); + streamptr->tsteps[0].recIDs = NULL; + } + } + break; + } #endif - default: - { - Error("%s support not compiled in (fileID = %d)!", strfiletype(filetype), fileID); - break; - } + default: + { + Error("%s support not compiled in (fileID = %d)!", strfiletype(filetype), fileID); + break; } + } } static void @@ -1098,27 +1150,11 @@ deallocate_sleveltable_t(sleveltable_t *entry) entry->lindex = NULL; } -/* -@Function streamClose -@Title Close an open dataset - -@Prototype void streamClose(int streamID) -@Parameter - @Item streamID Stream ID, from a previous call to @fref{streamOpenRead} or @fref{streamOpenWrite}. - -@Description -The function @func{streamClose} closes an open dataset. - -@EndFunction -*/ -void -streamClose(int streamID) +static void +streamDestroy(stream_t *streamptr) { - stream_t *streamptr = stream_to_pointer(streamID); - - if (CDI_Debug) Message("streamID = %d filename = %s", streamID, streamptr->filename); - - const int vlistID = streamptr->vlistID; + xassert(streamptr); + int vlistID = streamptr->vlistID; void (*streamCloseDelegate)(stream_t * streamptr, int recordBufIsToBeDeleted) = (void (*)(stream_t *, int)) namespaceSwitchGet(NSSWITCH_STREAM_CLOSE_BACKEND).func; @@ -1128,7 +1164,6 @@ streamClose(int streamID) if (streamptr->record) { if (streamptr->record->buffer) Free(streamptr->record->buffer); - Free(streamptr->record); } @@ -1142,59 +1177,80 @@ streamClose(int streamID) for (int index = 0; index < streamptr->nvars; index++) { sleveltable_t *pslev = streamptr->vars[index].recordTable; - const unsigned nsub = streamptr->vars[index].subtypeSize >= 0 ? (unsigned) streamptr->vars[index].subtypeSize : 0U; + unsigned nsub = streamptr->vars[index].subtypeSize >= 0 ? (unsigned) streamptr->vars[index].subtypeSize : 0U; for (size_t isub = 0; isub < nsub; isub++) deallocate_sleveltable_t(pslev + isub); if (pslev) Free(pslev); } Free(streamptr->vars); streamptr->vars = NULL; - for (int index = 0; index < streamptr->ntsteps; ++index) + if (streamptr->tsteps) { - tsteps_t *tstep = &(streamptr->tsteps[index]); + int maxSteps = streamptr->tstepsNextID; + for (int index = 0; index < maxSteps; ++index) + { + tsteps_t *tstep = &(streamptr->tsteps[index]); #ifdef HAVE_LIBFDB5 - if (tstep->records && tstep->records->fdbItem) free(tstep->records->fdbItem); + if (tstep->records && tstep->records->fdbItem) free(tstep->records->fdbItem); #endif - if (tstep->records) Free(tstep->records); - if (tstep->recIDs) Free(tstep->recIDs); - taxisDestroyKernel(&(tstep->taxis)); - } - - if (streamptr->tsteps) Free(streamptr->tsteps); + if (tstep->records) Free(tstep->records); + if (tstep->recIDs) Free(tstep->recIDs); + taxisDestroyKernel(&(tstep->taxis)); + } - if (streamptr->basetime.timevar_cache) Free(streamptr->basetime.timevar_cache); + Free(streamptr->tsteps); + } if (vlistID != -1) { if (streamptr->filemode != 'w' && vlistInqTaxis(vlistID) != -1) taxisDestroy(vlistInqTaxis(vlistID)); - cdiVlistDestroy_(vlistID); + void (*mycdiVlistDestroy_)(int, bool) = (void (*)(int, bool)) namespaceSwitchGet(NSSWITCH_VLIST_DESTROY_).func; + mycdiVlistDestroy_(vlistID, true); } if (streamptr->jobs) free(streamptr->jobs); if (streamptr->jobManager) AsyncWorker_finalize((AsyncManager *) streamptr->jobManager); - stream_delete_entry(streamptr); + Free(streamptr); } static void -stream_delete_entry(stream_t *streamptr) +streamDestroyP(void *streamptr) { - xassert(streamptr); + streamDestroy((stream_t *) streamptr); +} - const int idx = streamptr->self; - Free(streamptr); - reshRemove(idx, &streamOps); +/* +@Function streamClose +@Title Close an open dataset + +@Prototype void streamClose(int streamID) +@Parameter + @Item streamID Stream ID, from a previous call to @fref{streamOpenRead} or @fref{streamOpenWrite}. + +@Description +The function @func{streamClose} closes an open dataset. - if (CDI_Debug) Message("Removed idx %d from stream list", idx); +@EndFunction +*/ +void +streamClose(int streamID) +{ + stream_t *streamptr = stream_to_pointer(streamID); + + if (CDI_Debug) Message("streamID = %d filename = %s", streamID, streamptr->filename); + streamDestroy(streamptr); + reshRemove(streamID, &streamOps); + if (CDI_Debug) Message("Removed stream %d from stream list", streamID); } void cdiStreamSync_(stream_t *streamptr) { - const int fileID = streamptr->fileID; - const int filetype = streamptr->filetype; - const int vlistID = streamptr->vlistID; - const int nvars = vlistNvars(vlistID); + int fileID = streamptr->fileID; + int filetype = streamptr->filetype; + int vlistID = streamptr->vlistID; + int nvars = vlistNvars(vlistID); if (fileID == CDI_UNDEFID) Warning("File %s not open!", streamptr->filename); @@ -1255,9 +1311,14 @@ cdiStreamDefTimestep_(stream_t *streamptr, int tsID) if (CDI_Debug) Message("streamID = %d tsID = %d", streamptr->self, tsID); - const int vlistID = streamptr->vlistID; - const int timeIsVarying = vlistHasTime(vlistID); - const int taxisID = vlistInqTaxis(vlistID); + int vlistID = streamptr->vlistID; + if (vlistID == CDI_UNDEFID) + Error("Must not call streamDefTimestep for stream (ID=%d)" + " with (not yet) defined vlist", + streamptr->self); + + int timeIsVarying = vlistHasTime(vlistID); + int taxisID = vlistInqTaxis(vlistID); /* moved to cdiStreamSetupVlist int taxisID = timeIsVarying ? vlistInqTaxis(vlistID) : CDI_UNDEFID; @@ -1273,7 +1334,7 @@ cdiStreamDefTimestep_(stream_t *streamptr, int tsID) */ if (tsID > 0) { - const int newtsID = tstepsNewEntry(streamptr); + int newtsID = tstepsNewEntry(streamptr); if (tsID != newtsID) Error("Internal problem: tsID = %d newtsID = %d", tsID, newtsID); } @@ -1285,9 +1346,12 @@ cdiStreamDefTimestep_(stream_t *streamptr, int tsID) #ifdef HAVE_LIBNETCDF if (cdiBaseFiletype(streamptr->filetype) == CDI_FILETYPE_NETCDF && timeIsVarying) { - void (*myCdfDefTimestep)(stream_t * streamptr, int tsID) - = (void (*)(stream_t *, int)) namespaceSwitchGet(NSSWITCH_CDF_DEF_TIMESTEP).func; - myCdfDefTimestep(streamptr, tsID); + /* usually points to cdfDefTimestep in serial mode but + * to cdiPioCdfDefTimestep on servers and to a null-op on + * clients in client/server mode */ + void (*myCdfDefTimestep)(stream_t * streamptr, int tsID, size_t) + = (void (*)(stream_t *, int, size_t)) namespaceSwitchGet(NSSWITCH_CDF_DEF_TIMESTEP).func; + myCdfDefTimestep(streamptr, tsID, 1); } #endif @@ -1357,7 +1421,7 @@ streamInqTimestep(int streamID, int tsID) { int nrecs = 0; stream_t *streamptr = stream_to_pointer(streamID); - const int vlistID = streamptr->vlistID; + int vlistID = streamptr->vlistID; if (tsID < streamptr->ntsteps) streamptr->tsteps[tsID].curRecID = CDI_UNDEFID; // fix for netCDF if (tsID < streamptr->rtsteps) @@ -1365,7 +1429,7 @@ streamInqTimestep(int streamID, int tsID) streamptr->curTsID = tsID; nrecs = streamptr->tsteps[tsID].nrecs; streamptr->tsteps[tsID].curRecID = CDI_UNDEFID; - const int taxisID = vlistInqTaxis(vlistID); + int taxisID = vlistInqTaxis(vlistID); if (taxisID == -1) Error("Timestep undefined for fileID = %d", streamID); ptaxisCopy(taxisPtr(taxisID), &streamptr->tsteps[tsID].taxis); @@ -1374,7 +1438,7 @@ streamInqTimestep(int streamID, int tsID) if (tsID >= streamptr->ntsteps && streamptr->ntsteps != CDI_UNDEFID) return 0; - const int filetype = streamptr->filetype; + int filetype = streamptr->filetype; if (CDI_Debug) Message("streamID = %d tsID = %d filetype = %d", streamID, tsID, filetype); @@ -1430,7 +1494,7 @@ streamInqTimestep(int streamID, int tsID) } } - const int taxisID = vlistInqTaxis(vlistID); + int taxisID = vlistInqTaxis(vlistID); if (taxisID == -1) Error("Timestep undefined for fileID = %d", streamID); ptaxisCopy(taxisPtr(taxisID), &streamptr->tsteps[tsID].taxis); @@ -1438,95 +1502,6 @@ streamInqTimestep(int streamID, int tsID) return nrecs; } -#if 0 -void streamWriteContents(int streamID, char *cname) -{ - stream_t *streamptr = stream_to_pointer(streamID); - - int vlistID = streamptr->vlistID; - - FILE *cnp = fopen(cname, "w"); - - if ( cnp == NULL ) SysError(cname); - - fprintf(cnp, "#CDI library version %s\n" - "#\n", cdiLibraryVersion()); - - int filetype = streamptr->filetype; - fprintf(cnp, "filename: %s\n" - "filetype: %s\n", streamptr->filename, strfiletype(filetype)); - - fputs("#\n#grids:\n", cnp); - - int ngrids = vlistNgrids(vlistID); - for (int i = 0; i < ngrids; ++i) - { - int gridID = vlistGrid(vlistID, i); - int gridtype = gridInqType(gridID); - size_t xsize = gridInqXsize(gridID); - size_t ysize = gridInqYsize(gridID); - fprintf(cnp, "%4d:%4d:%4zu:%4zu\n", i+1, gridtype, xsize, ysize); - } - - fputs("#\nvarID:code:gridID:zaxisID:tsteptype:datatype\n", cnp); - - int nvars = vlistNvars(vlistID); - for (int varID = 0; varID < nvars; ++varID) - { - int code = vlistInqVarCode(vlistID, varID); - int gridID = vlistInqVarGrid(vlistID, varID); - int zaxisID = vlistInqVarZaxis(vlistID, varID); - int tsteptype = vlistInqVarTsteptype(vlistID, varID); - int datatype = vlistInqVarDatatype(vlistID, varID); - fprintf(cnp, "%4d:%4d:%4d:%4d:%4d:%4d:\n", - varID+1, code, gridID, zaxisID, tsteptype, datatype); - } - - fputs("#\ntsID:nrecs:date:time\n", cnp); - - int tsID = 0; - while (1) - { - int nrecs = streamptr->tsteps[tsID].nallrecs; - int date = streamptr->tsteps[tsID].taxis.vdate; - int time = streamptr->tsteps[tsID].taxis.vtime; - off_t position = streamptr->tsteps[tsID].position; - - fprintf(cnp, "%4d:%4d:%4d:%4d:%ld\n", - tsID, nrecs, date, time, (long) position); - - if ( streamptr->tsteps[tsID].next ) - tsID++; - else - break; - } - - fputs("#\ntsID:recID:varID:levID:size:pos\n", cnp); - - tsID = 0; - while (1) - { - int nrecs = streamptr->tsteps[tsID].nallrecs; - for (int recID = 0; recID < nrecs; ++recID) - { - int varID = streamptr->tsteps[tsID].records[recID].varID; - int levelID = streamptr->tsteps[tsID].records[recID].levelID; - off_t recpos = streamptr->tsteps[tsID].records[recID].position; - long recsize = (long)streamptr->tsteps[tsID].records[recID].size; - fprintf(cnp, "%4d:%4d:%4d:%4d:%4ld:%ld\n", - tsID, recID, varID, levelID, recsize, (long) recpos); - } - - if ( streamptr->tsteps[tsID].next ) - tsID++; - else - break; - } - - fclose(cnp); -} -#endif - // This function is used in CDO! SizeType streamNvals(int streamID) @@ -1568,7 +1543,7 @@ cdiStreamDefVlist_(int streamID, int vlistID) if (streamptr->vlistID == CDI_UNDEFID) { - const int vlistCopy = vlistDuplicate(vlistID); + int vlistCopy = vlistDuplicate(vlistID); cdiVlistMakeInternal(vlistCopy); cdiVlistMakeImmutable(vlistID); cdiStreamSetupVlist(streamptr, vlistCopy); @@ -1596,17 +1571,31 @@ The function @func{streamInqVlist} returns the variable list of a stream. int streamInqVlist(int streamID) { - stream_t *streamptr = stream_to_pointer(streamID); - return streamptr->vlistID; + stream_t *s = stream_to_pointer(streamID); + return s->vlistID; +} + +void +streamDefFilter(int streamID, int filterId, int numParams, const int *params) +{ + stream_t *s = stream_to_pointer(streamID); + if ((int) s->filterId != filterId) + { + if (numParams > (int) s->maxParams) Error("Too many filter parameter %d (max=%zu)!", numParams, s->maxParams); + s->filterId = filterId; + s->numParams = numParams; + for (int i = 0; i < numParams; ++i) s->params[i] = params[i]; + reshSetStatus(streamID, &streamOps, RESH_DESYNC_IN_USE); + } } void streamDefCompType(int streamID, int comptype) { - stream_t *streamptr = stream_to_pointer(streamID); - if (streamptr->comptype != comptype) + stream_t *s = stream_to_pointer(streamID); + if (s->comptype != comptype) { - streamptr->comptype = comptype; + s->comptype = comptype; reshSetStatus(streamID, &streamOps, RESH_DESYNC_IN_USE); } } @@ -1614,10 +1603,10 @@ streamDefCompType(int streamID, int comptype) void streamDefCompLevel(int streamID, int complevel) { - stream_t *streamptr = stream_to_pointer(streamID); - if (streamptr->complevel != complevel) + stream_t *s = stream_to_pointer(streamID); + if (s->complevel != complevel) { - streamptr->complevel = complevel; + s->complevel = complevel; reshSetStatus(streamID, &streamOps, RESH_DESYNC_IN_USE); } } @@ -1625,68 +1614,69 @@ streamDefCompLevel(int streamID, int complevel) int streamInqCompType(int streamID) { - stream_t *streamptr = stream_to_pointer(streamID); - return streamptr->comptype; + stream_t *s = stream_to_pointer(streamID); + return s->comptype; } int streamInqCompLevel(int streamID) { - stream_t *streamptr = stream_to_pointer(streamID); - return streamptr->complevel; + stream_t *s = stream_to_pointer(streamID); + return s->complevel; } int streamInqFileID(int streamID) { - stream_t *streamptr = (stream_t *) reshGetVal(streamID, &streamOps); - return streamptr->fileID; + stream_t *s = (stream_t *) reshGetVal(streamID, &streamOps); + return s->fileID; } void cdiDefAccesstype(int streamID, int type) { - stream_t *streamptr = (stream_t *) reshGetVal(streamID, &streamOps); + stream_t *s = (stream_t *) reshGetVal(streamID, &streamOps); - if (streamptr->accesstype == CDI_UNDEFID) + if (s->accesstype == CDI_UNDEFID) { - streamptr->accesstype = type; + s->accesstype = type; } - else if (streamptr->accesstype != type) - Error("Changing access type from %s not allowed!", streamptr->accesstype == TYPE_REC ? "REC to VAR" : "VAR to REC"); + else if (s->accesstype != type) + Error("Changing access type from %s not allowed!", s->accesstype == TYPE_REC ? "REC to VAR" : "VAR to REC"); } int cdiInqAccesstype(int streamID) { - stream_t *streamptr = (stream_t *) reshGetVal(streamID, &streamOps); - return streamptr->accesstype; + stream_t *s = (stream_t *) reshGetVal(streamID, &streamOps); + return s->accesstype; } static int -streamTxCode(void) +streamTxCode(void *s) { + (void) s; return STREAM; } void -cdiStreamSetupVlist(stream_t *streamptr, int vlistID) +cdiStreamSetupVlist(stream_t *s, int vlistID) { - void (*myStreamSetupVlist)(stream_t * streamptr, int vlistID) + void (*myStreamSetupVlist)(stream_t * s, int vlistID) = (void (*)(stream_t *, int)) namespaceSwitchGet(NSSWITCH_STREAM_SETUP_VLIST).func; - myStreamSetupVlist(streamptr, vlistID); + myStreamSetupVlist(s, vlistID); } void cdiStreamSetupVlist_(stream_t *streamptr, int vlistID) { streamptr->vlistID = vlistID; - const int nvars = vlistNvars(vlistID); + int nvars = vlistNvars(vlistID); for (int varID = 0; varID < nvars; ++varID) { - const int gridID = vlistInqVarGrid(vlistID, varID); - const int zaxisID = vlistInqVarZaxis(vlistID, varID); - const int tilesetID = vlistInqVarSubtype(vlistID, varID); + int gridID = vlistInqVarGrid(vlistID, varID); + int zaxisID = vlistInqVarZaxis(vlistID, varID); + int tilesetID = vlistInqVarSubtype(vlistID, varID); stream_new_var(streamptr, gridID, zaxisID, tilesetID); if (streamptr->have_missval) vlistDefVarMissval(vlistID, varID, vlistInqVarMissval(vlistID, varID)); } @@ -1694,8 +1684,8 @@ cdiStreamSetupVlist_(stream_t *streamptr, int vlistID) if (streamptr->filemode == 'w') { tstepsNewEntry(streamptr); // timestep 0 - const int vlistIDw = streamptr->vlistID; - const int timeIsVarying = vlistHasTime(vlistIDw); + int vlistIDw = streamptr->vlistID; + int timeIsVarying = vlistHasTime(vlistIDw); if (timeIsVarying) { int taxisID = vlistInqTaxis(vlistIDw); @@ -1711,7 +1701,7 @@ cdiStreamSetupVlist_(stream_t *streamptr, int vlistID) if (cdiBaseFiletype(streamptr->filetype) == CDI_FILETYPE_NETCDF) { const taxis_t *taxisptr = taxisPtr(taxisID); - if (cdiDateTime_isNull(taxisptr->rdatetime)) + if (cdiDateTime_isNull(taxisptr->rDateTime)) { int vdate = taxisInqVdate(taxisID); if (vdate == 0) vdate = 10101; @@ -1753,8 +1743,8 @@ cdiStreamGetIndexList(unsigned numIDs, int *IDs) int streamInqNvars(int streamID) { - stream_t *streamptr = (stream_t *) reshGetVal(streamID, &streamOps); - return streamptr->nvars; + stream_t *s = (stream_t *) reshGetVal(streamID, &streamOps); + return s->nvars; } static int @@ -1778,7 +1768,7 @@ streamCompareP(void *streamptr1, void *streamptr2) if (s1->filename) { - if (strcmp(s1->filename, s2->filename)) return differ; + if (!str_is_equal(s1->filename, s2->filename)) return differ; } else if (s2->filename) return differ; @@ -1786,17 +1776,6 @@ streamCompareP(void *streamptr1, void *streamptr2) return equal; } -void -streamDestroyP(void *streamptr) -{ - stream_t *sp = (stream_t *) streamptr; - - xassert(sp); - - int id = sp->self; - streamClose(id); -} - void streamPrintP(void *streamptr, FILE *fp) { diff --git a/src/stream_cdf.h b/src/stream_cdf.h index c41d5a12c2cafc382301e15aa29f64d0cb53cc5c..bff944cee202a7a6f577ba50e33077a1b43a4155 100644 --- a/src/stream_cdf.h +++ b/src/stream_cdf.h @@ -2,6 +2,8 @@ #define _STREAM_CDF_H #include "cdi_int.h" +#include "taxis.h" +#include "grid.h" enum { @@ -9,8 +11,21 @@ enum POSITIVE_DOWN = 2, }; +enum +{ + CDF_MAX_TIME_UNIT_STR /* maximum length of time unit string */ + = TAXIS_MAX_UNIT_STR_LEN /* longest result from tunitNamePtr */ + + 7 /* room for " since " */ + + 7 + 1 + 2 + 1 + 2 /* room for year with 7 digits, + * dashes and 2 digits for month and day */ + + 1 + 2 + 1 + 2 + 1 + 2 /* room for " " and 2 digit hour, minute, + * second */ + + 1 /* and terminating '\0' */ +}; + +int cdfDefVar(stream_t *streamptr, int varID); void cdfDefCoordinateVars(stream_t *streamptr); -void cdfDefTimestep(stream_t *streamptr, int tsID); +void cdfDefTimestep(stream_t *streamptr, int tsID, size_t valCount); int cdfInqTimestep(stream_t *streamptr, int tsID); int cdfInqContents(stream_t *streamptr); @@ -32,13 +47,15 @@ void cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtyp void cdf_write_var_chunk(stream_t *streamptr, int varID, int memtype, const int rect[][2], const void *data, size_t nmiss); -void cdfDefVarDeflate(int ncid, int ncvarid, int deflate_level); +void cdfDefVarDeflate(int ncid, int ncvarid, int deflateLevel); void cdfDefTime(stream_t *streamptr); void cdf_scale_add(size_t size, double *data, double addoffset, double scalefactor); int cdfDefDatatype(int datatype, stream_t *streamptr); +void cdf_create_records(stream_t *streamptr, int tsID); + #define ChunkSizeMax 65536 #define ChunkSizeLim 16777216 size_t calc_chunksize_x(int chunkType, int chunkSize, size_t xsize, bool yIsUndefined); diff --git a/src/stream_cdf_i.c b/src/stream_cdf_i.c index b002e60e4cb413023986cea2f6e8f618789ec320..46f85998a468380ca9c9da6741335fc448f26bce 100644 --- a/src/stream_cdf_i.c +++ b/src/stream_cdf_i.c @@ -92,8 +92,8 @@ typedef struct int truncation; int position; int numLPE; - bool defmissval; - bool deffillval; + bool missvalDefined; + bool fillvalDefined; int xtype; int gmapid; int positive; @@ -101,9 +101,14 @@ typedef struct int dimids[MAX_DIMS_CDF]; int dimtype[MAX_DIMS_CDF]; size_t chunks[MAX_DIMS_CDF]; - bool chunked; + bool isChunked; int chunkType; int chunkSize; + size_t chunkCacheSize; + size_t chunkCacheNelems; + float chunkCachePreemption; + size_t gridSize; + size_t numLevels; int natts; int *atts; size_t vctsize; @@ -112,14 +117,16 @@ typedef struct double fillval; double addoffset; double scalefactor; - bool ldeflate; - bool lszip; - bool lunsigned; - bool lvalidrange; + bool hasFilter; + bool hasDeflate; + bool hasSzip; + bool isUnsigned; + bool validrangeDefined; double validrange[2]; int typeOfEnsembleForecast; int numberOfForecastsInEnsemble; int perturbationNumber; + int unitsLen; char name[CDI_MAX_NAME]; char longname[CDI_MAX_NAME]; char stdname[CDI_MAX_NAME]; @@ -152,8 +159,8 @@ scan_time_string(const char *ptu) day = tmp; } - const int second = (int) fseconds; - const int ms = (fseconds - second) * 1000; + int second = (int) fseconds; + int ms = (fseconds - second) * 1000; CdiDateTime datetime; datetime.date.year = year; @@ -170,24 +177,18 @@ scan_time_string(const char *ptu) static int scan_time_units(const char *unitstr) { - const size_t len = strlen(unitstr); - const int timeunit = get_time_units(len, unitstr); - if (timeunit == -1) Message("Unsupported TIMEUNIT: %s!", unitstr); + int timeunit = get_time_units(strlen(unitstr), unitstr); + if (timeunit == -1) Warning("Unsupported TIMEUNIT: %s!", unitstr); return timeunit; } static void set_forecast_time(const char *timestr, taxis_t *taxis) { - const size_t len = strlen(timestr); - if (len != 0) - { - const CdiDateTime datetime = scan_time_string(timestr); - taxis->fdate = (int) cdiDate_get(datetime.date); - taxis->ftime = cdiTime_get(datetime.time); - } + if (strlen(timestr) != 0) + taxis->fDateTime = scan_time_string(timestr); else - taxis->fdate = taxis->ftime = 0; + cdiDateTime_init(&(taxis->fDateTime)); } static int @@ -202,7 +203,7 @@ set_base_time(const char *timeUnitsStr, taxis_t *taxis) len--; } - char *tu = (char *) Malloc((len + 1) * sizeof(char)); + char *tu = (char *) malloc((len + 1) * sizeof(char)); for (size_t i = 0; i < len; i++) tu[i] = (char) tolower((int) timeUnitsStr[i]); tu[len] = 0; @@ -210,7 +211,7 @@ set_base_time(const char *timeUnitsStr, taxis_t *taxis) int timeUnits = get_time_units(len, tu); if (timeUnits == -1) { - Message("Unsupported TIMEUNIT: %s!", timeUnitsStr); + Warning("Unsupported TIMEUNIT: %s!", timeUnitsStr); return 1; } @@ -260,9 +261,9 @@ set_base_time(const char *timeUnitsStr, taxis_t *taxis) } else if (taxisType == TAXIS_RELATIVE) { - taxis->rdatetime = scan_time_string(tu + pos); + taxis->rDateTime = scan_time_string(tu + pos); if (CDI_Debug) - Message("rdate = %d rtime = %d", (int) cdiDate_get(taxis->rdatetime.date), cdiTime_get(taxis->rdatetime.time)); + Message("rdate = %d rtime = %d", (int) cdiDate_get(taxis->rDateTime.date), cdiTime_get(taxis->rDateTime.time)); } } } @@ -270,19 +271,19 @@ set_base_time(const char *timeUnitsStr, taxis_t *taxis) taxis->type = taxisType; taxis->unit = timeUnits; - Free(tu); + free(tu); if (CDI_Debug) Message("taxisType = %d timeUnits = %d", taxisType, timeUnits); return 0; } -static bool +bool xtypeIsText(int xtype) { - const bool isText = (xtype == NC_CHAR) + bool isText = (xtype == NC_CHAR) #ifdef HAVE_NETCDF4 - || (xtype == NC_STRING) + || (xtype == NC_STRING) #endif ; return isText; @@ -297,9 +298,9 @@ xtypeIsFloat(nc_type xtype) static bool xtypeIsInt(nc_type xtype) { - const bool isInt = xtype == NC_SHORT || xtype == NC_INT || xtype == NC_BYTE + bool isInt = xtype == NC_SHORT || xtype == NC_INT || xtype == NC_BYTE #ifdef HAVE_NETCDF4 - || xtype == NC_USHORT || xtype == NC_UINT || xtype == NC_UBYTE + || xtype == NC_USHORT || xtype == NC_UINT || xtype == NC_UBYTE #endif ; @@ -307,28 +308,28 @@ xtypeIsInt(nc_type xtype) } static int -cdfInqDatatype(stream_t *streamptr, int xtype, bool lunsigned) +cdfInqDatatype(stream_t *streamptr, int xtype, bool isUnsigned) { int datatype = -1; #ifdef HAVE_NETCDF4 - if (xtype == NC_BYTE && lunsigned) xtype = NC_UBYTE; + if (xtype == NC_BYTE && isUnsigned) xtype = NC_UBYTE; #endif // clang-format off - if ( xtype == NC_BYTE ) datatype = CDI_DATATYPE_INT8; - else if ( xtype == NC_CHAR ) datatype = CDI_DATATYPE_UINT8; - else if ( xtype == NC_SHORT ) datatype = CDI_DATATYPE_INT16; - else if ( xtype == NC_INT ) datatype = CDI_DATATYPE_INT32; - else if ( xtype == NC_FLOAT ) datatype = CDI_DATATYPE_FLT32; - else if ( xtype == NC_DOUBLE ) datatype = CDI_DATATYPE_FLT64; + if (xtype == NC_BYTE ) datatype = CDI_DATATYPE_INT8; + else if (xtype == NC_CHAR ) datatype = CDI_DATATYPE_UINT8; + else if (xtype == NC_SHORT ) datatype = CDI_DATATYPE_INT16; + else if (xtype == NC_INT ) datatype = CDI_DATATYPE_INT32; + else if (xtype == NC_FLOAT ) datatype = CDI_DATATYPE_FLT32; + else if (xtype == NC_DOUBLE) datatype = CDI_DATATYPE_FLT64; #ifdef HAVE_NETCDF4 - else if ( xtype == NC_UBYTE ) datatype = CDI_DATATYPE_UINT8; - else if ( xtype == NC_LONG ) datatype = CDI_DATATYPE_INT32; - else if ( xtype == NC_USHORT ) datatype = CDI_DATATYPE_UINT16; - else if ( xtype == NC_UINT ) datatype = CDI_DATATYPE_UINT32; - else if ( xtype == NC_INT64 ) datatype = CDI_DATATYPE_FLT64; - else if ( xtype == NC_UINT64 ) datatype = CDI_DATATYPE_FLT64; + else if (xtype == NC_UBYTE ) datatype = CDI_DATATYPE_UINT8; + else if (xtype == NC_LONG ) datatype = CDI_DATATYPE_INT32; + else if (xtype == NC_USHORT) datatype = CDI_DATATYPE_UINT16; + else if (xtype == NC_UINT ) datatype = CDI_DATATYPE_UINT32; + else if (xtype == NC_INT64 ) datatype = CDI_DATATYPE_FLT64; + else if (xtype == NC_UINT64) datatype = CDI_DATATYPE_FLT64; else { if (xtype != streamptr->nc_complex_float_id && xtype != streamptr->nc_complex_double_id) @@ -356,8 +357,8 @@ cdfInqDatatype(stream_t *streamptr, int xtype, bool lunsigned) } } } - if ( xtype == streamptr->nc_complex_float_id ) datatype = CDI_DATATYPE_CPX32; - else if ( xtype == streamptr->nc_complex_double_id ) datatype = CDI_DATATYPE_CPX64; + if (xtype == streamptr->nc_complex_float_id ) datatype = CDI_DATATYPE_CPX32; + else if (xtype == streamptr->nc_complex_double_id) datatype = CDI_DATATYPE_CPX64; } #endif // clang-format on @@ -377,10 +378,10 @@ cdfGetAttInt(int fileID, int ncvarid, const char *attname, size_t attlen, int *a if (xtypeIsFloat(atttype) || xtypeIsInt(atttype)) { - const bool lalloc = (nc_attlen > attlen); - int *pintatt = lalloc ? (int *) (Malloc(nc_attlen * sizeof(int))) : attint; + bool needAlloc = (nc_attlen > attlen); + int *pintatt = needAlloc ? (int *) (Malloc(nc_attlen * sizeof(int))) : attint; cdf_get_att_int(fileID, ncvarid, attname, pintatt); - if (lalloc) + if (needAlloc) { memcpy(attint, pintatt, attlen * sizeof(int)); Free(pintatt); @@ -400,10 +401,10 @@ cdfGetAttDouble(int fileID, int ncvarid, char *attname, size_t attlen, double *a if (xtypeIsFloat(atttype) || xtypeIsInt(atttype)) { - const bool lalloc = (nc_attlen > attlen); - double *pdoubleatt = lalloc ? (double *) Malloc(nc_attlen * sizeof(double)) : attdouble; + bool needAlloc = (nc_attlen > attlen); + double *pdoubleatt = needAlloc ? (double *) Malloc(nc_attlen * sizeof(double)) : attdouble; cdf_get_att_double(fileID, ncvarid, attname, pdoubleatt); - if (lalloc) + if (needAlloc) { memcpy(attdouble, pdoubleatt, attlen * sizeof(double)); Free(pdoubleatt); @@ -415,7 +416,7 @@ static bool cdfCheckAttText(int fileID, int ncvarid, const char *attname) { nc_type atttype; - const int status_nc = nc_inq_atttype(fileID, ncvarid, attname, &atttype); + int status_nc = nc_inq_atttype(fileID, ncvarid, attname, &atttype); return (status_nc == NC_NOERR && (atttype == NC_CHAR @@ -469,126 +470,23 @@ cdfGetAttText(int fileID, int ncvarid, const char *attname, size_t attlen, char void cdf_scale_add(size_t size, double *data, double addoffset, double scalefactor) { - const bool laddoffset = IS_NOT_EQUAL(addoffset, 0); - const bool lscalefactor = IS_NOT_EQUAL(scalefactor, 1); + bool haveAddoffset = IS_NOT_EQUAL(addoffset, 0.0); + bool haveScalefactor = IS_NOT_EQUAL(scalefactor, 1.0); - if (laddoffset && lscalefactor) + if (haveAddoffset && haveScalefactor) { for (size_t i = 0; i < size; ++i) data[i] = data[i] * scalefactor + addoffset; } - else if (lscalefactor) + else if (haveScalefactor) { for (size_t i = 0; i < size; ++i) data[i] *= scalefactor; } - else if (laddoffset) + else if (haveAddoffset) { for (size_t i = 0; i < size; ++i) data[i] += addoffset; } } -static void -cdfCreateRecords(stream_t *streamptr, int tsID) -{ - if (tsID < 0 || (tsID >= streamptr->ntsteps && tsID > 0)) return; - - if (streamptr->tsteps[tsID].nallrecs > 0) return; - - int vlistID = streamptr->vlistID; - - tsteps_t *sourceTstep = streamptr->tsteps; - tsteps_t *destTstep = sourceTstep + tsID; - - const int nvars = vlistNvars(vlistID); - const int nrecs = vlistNrecs(vlistID); - if (nrecs <= 0) return; - - if (tsID == 0) - { - const int nvrecs = nrecs; /* use all records at first timestep */ - - streamptr->nrecs += nrecs; - - destTstep->records = (record_t *) Malloc((size_t) nrecs * sizeof(record_t)); - destTstep->nrecs = nrecs; - destTstep->nallrecs = nrecs; - destTstep->recordSize = nrecs; - destTstep->curRecID = CDI_UNDEFID; - destTstep->recIDs = (int *) Malloc((size_t) nvrecs * sizeof(int)); - ; - for (int recID = 0; recID < nvrecs; recID++) destTstep->recIDs[recID] = recID; - - record_t *records = destTstep->records; - - for (int varID = 0, recID = 0; varID < nvars; varID++) - { - const int zaxisID = vlistInqVarZaxis(vlistID, varID); - const int nlev = zaxisInqSize(zaxisID); - for (int levelID = 0; levelID < nlev; levelID++) - { - recordInitEntry(&records[recID]); - records[recID].varID = (short) varID; - records[recID].levelID = levelID; - recID++; - } - } - } - else if (tsID == 1) - { - int nvrecs = 0; - for (int varID = 0; varID < nvars; varID++) - { - if (vlistInqVarTimetype(vlistID, varID) != TIME_CONSTANT) - { - int zaxisID = vlistInqVarZaxis(vlistID, varID); - nvrecs += zaxisInqSize(zaxisID); - } - } - - streamptr->nrecs += nvrecs; - - destTstep->records = (record_t *) Malloc((size_t) nrecs * sizeof(record_t)); - destTstep->nrecs = nvrecs; - destTstep->nallrecs = nrecs; - destTstep->recordSize = nrecs; - destTstep->curRecID = CDI_UNDEFID; - - memcpy(destTstep->records, sourceTstep->records, (size_t) nrecs * sizeof(record_t)); - - if (nvrecs) - { - destTstep->recIDs = (int *) Malloc((size_t) nvrecs * sizeof(int)); - for (int recID = 0, vrecID = 0; recID < nrecs; recID++) - { - int varID = destTstep->records[recID].varID; - if (vlistInqVarTimetype(vlistID, varID) != TIME_CONSTANT) - { - destTstep->recIDs[vrecID++] = recID; - } - } - } - } - else - { - if (streamptr->tsteps[1].records == 0) cdfCreateRecords(streamptr, 1); - - const int nvrecs = streamptr->tsteps[1].nrecs; - - streamptr->nrecs += nvrecs; - - destTstep->records = (record_t *) Malloc((size_t) nrecs * sizeof(record_t)); - destTstep->nrecs = nvrecs; - destTstep->nallrecs = nrecs; - destTstep->recordSize = nrecs; - destTstep->curRecID = CDI_UNDEFID; - - memcpy(destTstep->records, sourceTstep->records, (size_t) nrecs * sizeof(record_t)); - - destTstep->recIDs = (int *) Malloc((size_t) nvrecs * sizeof(int)); - - memcpy(destTstep->recIDs, streamptr->tsteps[1].recIDs, (size_t) nvrecs * sizeof(int)); - } -} - static int cdf_time_dimid(int fileID, int ndims, int nvars, ncdim_t *ncdims) { @@ -598,7 +496,7 @@ cdf_time_dimid(int fileID, int ndims, int nvars, ncdim_t *ncdims) { dimname[0] = 0; cdf_inq_dimname(fileID, ncdims[dimid].dimid, dimname); - if (strIsEqual(dimname, "time") || strIsEqual(dimname, "Time")) return dimid; + if ((dimname[0] = 'T' || dimname[0] == 't') && dimname[1] == 'i' && dimname[2] == 'm' && dimname[3] == 'e') return dimid; } for (int varid = 0; varid < nvars; ++varid) @@ -624,7 +522,7 @@ cdf_time_dimid(int fileID, int ndims, int nvars, ncdim_t *ncdims) if (strStartsWith(sbuf, "units")) { cdfGetAttText(fileID, varid, "units", sizeof(sbuf), sbuf); - strToLower(sbuf); + str_to_lower(sbuf); if (is_time_units(sbuf)) return dimids[0]; } @@ -650,12 +548,12 @@ init_ncdims(int ndims, ncdim_t *ncdims) } static void -init_ncvars(int nvars, ncvar_t *ncvars) +init_ncvars(int nvars, ncvar_t *ncvars, int ncid) { for (int ncvarid = 0; ncvarid < nvars; ncvarid++) { ncvar_t *ncvar = &ncvars[ncvarid]; - ncvar->ncid = CDI_UNDEFID; + ncvar->ncid = ncid; ncvar->varStatus = UndefVar; ncvar->ignoreVar = false; ncvar->isCubeSphere = false; @@ -699,8 +597,8 @@ init_ncvars(int nvars, ncvar_t *ncvars) ncvar->truncation = 0; ncvar->position = 0; ncvar->numLPE = 0; - ncvar->defmissval = false; - ncvar->deffillval = false; + ncvar->missvalDefined = false; + ncvar->fillvalDefined = false; ncvar->xtype = 0; ncvar->gmapid = CDI_UNDEFID; ncvar->positive = 0; @@ -708,26 +606,33 @@ init_ncvars(int nvars, ncvar_t *ncvars) for (int i = 0; i < MAX_DIMS_CDF; ++i) ncvar->dimids[i] = CDI_UNDEFID; for (int i = 0; i < MAX_DIMS_CDF; ++i) ncvar->dimtype[i] = CDI_UNDEFID; for (int i = 0; i < MAX_DIMS_CDF; ++i) ncvar->chunks[i] = 0; - ncvar->chunked = false; + ncvar->isChunked = false; ncvar->chunkType = CDI_UNDEFID; ncvar->chunkSize = CDI_UNDEFID; + ncvar->chunkCacheSize = 0; + ncvar->chunkCacheNelems = 0; + ncvar->chunkCachePreemption = 0.0; + ncvar->gridSize = 0; + ncvar->numLevels = 0; ncvar->natts = 0; ncvar->atts = NULL; ncvar->vctsize = 0; ncvar->vct = NULL; ncvar->missval = 0; ncvar->fillval = 0; - ncvar->addoffset = 0; - ncvar->scalefactor = 1; - ncvar->ldeflate = false; - ncvar->lszip = false; - ncvar->lunsigned = false; - ncvar->lvalidrange = false; + ncvar->addoffset = 0.0; + ncvar->scalefactor = 1.0; + ncvar->hasFilter = false; + ncvar->hasDeflate = false; + ncvar->hasSzip = false; + ncvar->isUnsigned = false; + ncvar->validrangeDefined = false; ncvar->validrange[0] = VALIDMISS; ncvar->validrange[1] = VALIDMISS; ncvar->typeOfEnsembleForecast = -1; ncvar->numberOfForecastsInEnsemble = -1; ncvar->perturbationNumber = -1; + ncvar->unitsLen = 0; memset(ncvar->name, 0, CDI_MAX_NAME); memset(ncvar->longname, 0, CDI_MAX_NAME); memset(ncvar->stdname, 0, CDI_MAX_NAME); @@ -796,14 +701,14 @@ scan_hybrid_formulaterms(int ncid, int ncfvarid, int *avarid, int *bvarid, int * if (status_nc == NC_NOERR) { // clang-format off - if ( strIsEqual(tagname, "ap:") ) *avarid = dimvarid; - else if ( strIsEqual(tagname, "a:") ) *avarid = dimvarid; - else if ( strIsEqual(tagname, "b:") ) *bvarid = dimvarid; - else if ( strIsEqual(tagname, "ps:") ) *psvarid = dimvarid; - else if ( strIsEqual(tagname, "p0:") ) *p0varid = dimvarid; + if (str_is_equal(tagname, "ap:")) *avarid = dimvarid; + else if (str_is_equal(tagname, "a:") ) *avarid = dimvarid; + else if (str_is_equal(tagname, "b:") ) *bvarid = dimvarid; + else if (str_is_equal(tagname, "ps:")) *psvarid = dimvarid; + else if (str_is_equal(tagname, "p0:")) *p0varid = dimvarid; // clang-format on } - else if (!strIsEqual(tagname, "ps:")) + else if (!str_is_equal(tagname, "ps:")) { Warning("%s - %s", nc_strerror(status_nc), varname); } @@ -849,7 +754,7 @@ isHybridSigmaPressureCoordinate(int ncid, int ncvarid, ncvar_t *ncvars, const nc bool status = false; ncvar_t *ncvar = &ncvars[ncvarid]; - if (strIsEqual(ncvar->stdname, "atmosphere_hybrid_sigma_pressure_coordinate")) + if (str_is_equal(ncvar->stdname, "atmosphere_hybrid_sigma_pressure_coordinate")) { CDI_Convention = CDI_CONVENTION_CF; @@ -878,16 +783,16 @@ isHybridSigmaPressureCoordinate(int ncid, int ncvarid, ncvar_t *ncvars, const nc ncvars[avarid2].varStatus = CoordVar; ncvars[bvarid2].varStatus = CoordVar; - const int ndims2 = ncvars[avarid2].ndims; - const int dimid2 = ncvars[avarid2].dimids[0]; - const size_t dimlen2 = ncdims[dimid2].len; + int ndims2 = ncvars[avarid2].ndims; + int dimid2 = ncvars[avarid2].dimids[0]; + size_t dimlen2 = ncdims[dimid2].len; if ((ndims2 == 2 && dimid == ncvars[avarid2].dimids[0]) || (ndims2 == 1 && dimlen == dimlen2 - 1)) { double px = 1; if (p0varid1 != -1 && p0varid1 == p0varid2) cdf_get_var_double(ncid, p0varid2, &px); - const size_t vctsize = (dimlen + 1) * 2; + size_t vctsize = (dimlen + 1) * 2; double *vct = (double *) Malloc(vctsize * sizeof(double)); readVCT(ncid, ndims2, dimlen, dimlen2, avarid2, bvarid2, vct); @@ -906,7 +811,7 @@ isHybridSigmaPressureCoordinate(int ncid, int ncvarid, ncvar_t *ncvars, const nc } static void -cdf_set_cdi_attr(int ncid, int ncvarid, int attnum, int cdiID, int varID) +cdf_set_cdi_attr(int ncid, int ncvarid, int attnum, int cdiID, int varID, bool removeFillValue) { nc_type atttype; size_t attlen; @@ -915,6 +820,9 @@ cdf_set_cdi_attr(int ncid, int ncvarid, int attnum, int cdiID, int varID) cdf_inq_attname(ncid, ncvarid, attnum, attname); cdf_inq_attlen(ncid, ncvarid, attname, &attlen); cdf_inq_atttype(ncid, ncvarid, attname, &atttype); + + if (removeFillValue && str_is_equal("_FillValue", attname)) return; + if (xtypeIsInt(atttype)) { int attint; @@ -938,7 +846,7 @@ cdf_set_cdi_attr(int ncid, int ncvarid, int attnum, int cdiID, int varID) double attflt; double *pattflt = (attlen > 1) ? (double *) malloc(attlen * sizeof(double)) : &attflt; cdfGetAttDouble(ncid, ncvarid, attname, attlen, pattflt); - const int datatype = (atttype == NC_FLOAT) ? CDI_DATATYPE_FLT32 : CDI_DATATYPE_FLT64; + int datatype = (atttype == NC_FLOAT) ? CDI_DATATYPE_FLT32 : CDI_DATATYPE_FLT64; cdiDefAttFlt(cdiID, varID, attname, datatype, (int) attlen, pattflt); if (attlen > 1) free(pattflt); } @@ -1015,49 +923,48 @@ cdfScanAttrAxis(ncvar_t *ncvars, ncdim_t *ncdims, int ncvarid, const char *attst if (attlen != nvdims) return; - for (int i = 0; i < attlen; ++i) - if (attstring[i] != '-' && attstring[i] != 't' && attstring[i] != 'z' && attstring[i] != 'y' && attstring[i] != 'x') return; + static const char accept[] = "-tTzZyYxX"; + if ((int) strspn(attstring, accept) != attlen) return; while (attlen--) { - const int attchr = attstring[attlen]; - if (attchr == 't') - { - if (attlen != 0) Warning("axis attribute 't' not on first position!"); - cdf_set_dim(ncvar, attlen, T_AXIS); - } - else if (attchr == 'z') + int dimtype; + bool setVar = false; + switch (attstring[attlen]) { + case 't': + case 'T': + if (attlen != 0) Warning("axis attribute 't' not on first position"); + dimtype = T_AXIS; + break; + case 'z': + case 'Z': ncvar->zdim = dimidsp[attlen]; - cdf_set_dim(ncvar, attlen, Z_AXIS); + dimtype = Z_AXIS; - if (ncvar->ndims == 1) - { - cdf_set_var(ncvar, CoordVar); - ncdims[ncvar->dimids[0]].dimtype = Z_AXIS; - } - } - else if (attchr == 'y') - { + setVar = ncvar->ndims == 1; + break; + case 'y': + case 'Y': ncvar->ydim = dimidsp[attlen]; - cdf_set_dim(ncvar, attlen, Y_AXIS); + dimtype = Y_AXIS; - if (ncvar->ndims == 1) - { - cdf_set_var(ncvar, CoordVar); - ncdims[ncvar->dimids[0]].dimtype = Y_AXIS; - } - } - else if (attchr == 'x') - { + setVar = ncvar->ndims == 1; + break; + case 'x': + case 'X': ncvar->xdim = dimidsp[attlen]; - cdf_set_dim(ncvar, attlen, X_AXIS); + dimtype = X_AXIS; - if (ncvar->ndims == 1) - { - cdf_set_var(ncvar, CoordVar); - ncdims[ncvar->dimids[0]].dimtype = X_AXIS; - } + setVar = ncvar->ndims == 1; + break; + default: continue; + } + cdf_set_dim(ncvar, attlen, dimtype); + if (setVar) + { + cdf_set_var(ncvar, CoordVar); + ncdims[ncvar->dimids[0]].dimtype = dimtype; } } } @@ -1094,6 +1001,21 @@ cdf_get_cell_varid(char *attstring, int ncid) return nc_cell_id; } +static void +set_extra_attr(char *buf, int nvdims, const size_t *chunks) +{ + size_t pos = strlen(buf); + static const char prefix[] = "chunks="; + memcpy(buf + pos, prefix, sizeof(prefix)); + pos += sizeof(prefix) - 1; + for (int i = nvdims - 1; i >= 0; --i) + { + pos += (size_t) (sprintf(buf + pos, "%zu%s", chunks[i], i > 0 ? "x" : "")); + } + buf[pos] = ' '; + buf[pos + 1] = 0; +} + static void cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timedimid, int modelID, int format) { @@ -1115,7 +1037,7 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed for (int ncvarid = 0; ncvarid < nvars; ncvarid++) { ncvar_t *ncvar = &ncvars[ncvarid]; - const int ncid = ncvar->ncid; + int ncid = ncvar->ncid; int *dimidsp = ncvar->dimids; cdf_inq_var(ncid, ncvarid, name, &xtype, &nvdims, dimidsp, &nvatts); @@ -1136,52 +1058,57 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed #ifdef HAVE_NETCDF4 if (format == NC_FORMAT_NETCDF4_CLASSIC || format == NC_FORMAT_NETCDF4) { - int shuffle = 0, deflate = 0, deflate_level = 0; - nc_inq_var_deflate(ncid, ncvarid, &shuffle, &deflate, &deflate_level); - if (deflate > 0) ncvar->ldeflate = true; + int shuffle = 0, deflate = 0, deflateLevel = 0; + nc_inq_var_deflate(ncid, ncvarid, &shuffle, &deflate, &deflateLevel); + if (deflate > 0) ncvar->hasDeflate = true; #ifdef HAVE_NC_DEF_VAR_SZIP int options_mask = 0, pixels_per_block = 0; nc_inq_var_szip(ncid, ncvarid, &options_mask, &pixels_per_block); - if (options_mask && pixels_per_block) ncvar->lszip = true; + if (options_mask && pixels_per_block) ncvar->hasSzip = true; #endif - /* - size_t cache_size, nelems; - float preemption; - nc_get_chunk_cache(&cache_size, &nelems, &preemption); - printf("cache_size %lu nelems %lu preemption %g\n", cache_size, nelems, preemption); - nc_get_var_chunk_cache(ncid, ncvarid, &cache_size, &nelems, &preemption); - printf("varid %d cache_size %lu nelems %lu preemption %g\n", ncvarid, cache_size, nelems, preemption); - */ + unsigned filterId; + size_t numParams; + nc_inq_var_filter(ncid, ncvarid, &filterId, &numParams, NULL); + if (filterId > 0) ncvar->hasFilter = true; + if (filterId > 0 && numParams <= 16 && CDI_Debug) + { + unsigned int params[16]; + nc_inq_var_filter(ncid, ncvarid, &filterId, &numParams, params); + fprintf(stderr, "%s: filterId=%d params=", ncvar->name, filterId); + for (int i = 0; i < (int) numParams; ++i) fprintf(stderr, " %u", params[i]); + fprintf(stderr, "\n"); + } + size_t chunks[nvdims]; - int storage_in; - if (nc_inq_var_chunking(ncid, ncvarid, &storage_in, chunks) == NC_NOERR) + int storageIn; + if (nc_inq_var_chunking(ncid, ncvarid, &storageIn, chunks) == NC_NOERR) { - if (storage_in == NC_CHUNKED) + if (storageIn == NC_CHUNKED) { - ncvar->chunked = true; + ncvar->isChunked = true; for (int i = 0; i < nvdims; ++i) ncvar->chunks[i] = chunks[i]; if (CDI_Debug) { - fprintf(stderr, "%s: chunking %d %d %d chunks ", name, storage_in, NC_CONTIGUOUS, NC_CHUNKED); + fprintf(stderr, "%s: chunking %d %d %d chunks ", name, storageIn, NC_CONTIGUOUS, NC_CHUNKED); for (int i = 0; i < nvdims; ++i) fprintf(stderr, "%zu ", chunks[i]); fprintf(stderr, "\n"); } - { - char *buf = ncvar->extra; - size_t pos = strlen(buf); - static const char prefix[] = "chunks="; - memcpy(buf + pos, prefix, sizeof(prefix)); - pos += sizeof(prefix) - 1; - for (int i = nvdims - 1; i >= 0; --i) - { - pos += (size_t) (sprintf(buf + pos, "%zu%s", chunks[i], i > 0 ? "x" : "")); - } - buf[pos] = ' '; - buf[pos + 1] = 0; - } + + set_extra_attr(ncvar->extra, nvdims, chunks); } } + + size_t size; + size_t nelems; + float preemption; + if (nc_get_var_chunk_cache(ncid, ncvarid, &size, &nelems, &preemption) == NC_NOERR) + { + ncvar->chunkCacheSize = size; + ncvar->chunkCacheNelems = nelems; + ncvar->chunkCachePreemption = preemption; + if (CDI_Debug) fprintf(stderr, "%s: chunkCacheSize=%zu nelems=%zu preemption=%g\n", name, size, nelems, preemption); + } } #endif @@ -1216,8 +1143,8 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed cdf_inq_attlen(ncid, ncvarid, attname, &attlen); size_t attstringsize = sizeof(attstring); - const bool isText = xtypeIsText(atttype); - const bool isNumber = (xtypeIsFloat(atttype) || xtypeIsInt(atttype)); + bool isText = xtypeIsText(atttype), isNumber = xtypeIsFloat(atttype) || xtypeIsInt(atttype); + bool isRealization = false, isEnsembleMembers = false, isForecastInitType = false; if (isText) { cdfGetAttText(ncid, ncvarid, attname, sizeof(attstring), attstring); @@ -1225,35 +1152,36 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed if (attstringsize > CDI_MAX_NAME) attstringsize = CDI_MAX_NAME; } - if (isText && strIsEqual(attname, "long_name")) + if (isText && str_is_equal(attname, "long_name")) { memcpy(ncvar->longname, attstring, attstringsize); } - else if (isText && strIsEqual(attname, "standard_name")) + else if (isText && str_is_equal(attname, "standard_name")) { memcpy(ncvar->stdname, attstring, attstringsize); } - else if (isText && strIsEqual(attname, "units")) + else if (isText && str_is_equal(attname, "units")) { + ncvar->unitsLen = attstringsize; memcpy(ncvar->units, attstring, attstringsize); } - else if (isText && strIsEqual(attname, "calendar")) + else if (isText && str_is_equal(attname, "calendar")) { ncvar->hasCalendar = true; } - else if (isText && strIsEqual(attname, "param")) + else if (isText && str_is_equal(attname, "param")) { int pnum = 0, pcat = 255, pdis = 255; sscanf(attstring, "%d.%d.%d", &pnum, &pcat, &pdis); ncvar->param = cdiEncodeParam(pnum, pcat, pdis); cdf_set_var(ncvar, DataVar); } - else if (isNumber && strIsEqual(attname, "code")) + else if (isNumber && str_is_equal(attname, "code")) { cdfGetAttInt(ncid, ncvarid, attname, 1, &ncvar->code); cdf_set_var(ncvar, DataVar); } - else if (isNumber && strIsEqual(attname, "table")) + else if (isNumber && str_is_equal(attname, "table")) { int tablenum; cdfGetAttInt(ncid, ncvarid, attname, 1, &tablenum); @@ -1265,17 +1193,17 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed } cdf_set_var(ncvar, DataVar); } - else if (isText && strIsEqual(attname, "trunc_type")) + else if (isText && str_is_equal(attname, "trunc_type")) { - if (strIsEqual(attstring, "Triangular")) ncvar->gridtype = GRID_SPECTRAL; + if (str_is_equal(attstring, "Triangular")) ncvar->gridtype = GRID_SPECTRAL; } - else if (isText && (strIsEqual(attname, "grid_type") || strIsEqual(attname, "CDI_grid_type"))) + else if (isText && (str_is_equal(attname, "grid_type") || str_is_equal(attname, "CDI_grid_type"))) { - strToLower(attstring); + str_to_lower(attstring); cdf_set_gridtype(attstring, &ncvar->gridtype); cdf_set_var(ncvar, DataVar); } - else if (isText && strIsEqual(attname, "CDI_grid_latitudes")) + else if (isText && str_is_equal(attname, "CDI_grid_latitudes")) { int nc_yvar_id; int status = nc_inq_varid(ncid, attstring, &nc_yvar_id); @@ -1289,7 +1217,7 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed cdf_set_var(ncvar, DataVar); } - else if (isText && strIsEqual(attname, "CDI_grid_reduced_points")) + else if (isText && str_is_equal(attname, "CDI_grid_reduced_points")) { int nc_rpvar_id; int status = nc_inq_varid(ncid, attstring, &nc_rpvar_id); @@ -1303,29 +1231,29 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed cdf_set_var(ncvar, DataVar); } - else if (isNumber && strIsEqual(attname, "CDI_grid_num_LPE")) + else if (isNumber && str_is_equal(attname, "CDI_grid_num_LPE")) { cdfGetAttInt(ncid, ncvarid, attname, 1, &ncvar->numLPE); } - else if (isText && strIsEqual(attname, "level_type")) + else if (isText && str_is_equal(attname, "level_type")) { - strToLower(attstring); + str_to_lower(attstring); cdf_set_zaxistype(attstring, &ncvar->zaxistype); cdf_set_var(ncvar, DataVar); } - else if (isNumber && strIsEqual(attname, "trunc_count")) + else if (isNumber && str_is_equal(attname, "trunc_count")) { cdfGetAttInt(ncid, ncvarid, attname, 1, &ncvar->truncation); } - else if (isNumber && strIsEqual(attname, "truncation")) + else if (isNumber && str_is_equal(attname, "truncation")) { cdfGetAttInt(ncid, ncvarid, attname, 1, &ncvar->truncation); } - else if (isNumber && strIsEqual(attname, "number_of_grid_in_reference")) + else if (isNumber && str_is_equal(attname, "number_of_grid_in_reference")) { cdfGetAttInt(ncid, ncvarid, attname, 1, &ncvar->position); } - else if (isNumber && strIsEqual(attname, "add_offset")) + else if (isNumber && str_is_equal(attname, "add_offset")) { cdfGetAttDouble(ncid, ncvarid, attname, 1, &ncvar->addoffset); /* @@ -1335,7 +1263,7 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed */ // (also used for lon/lat) cdf_set_var(ncvar, DataVar); } - else if (isNumber && strIsEqual(attname, "scale_factor")) + else if (isNumber && str_is_equal(attname, "scale_factor")) { cdfGetAttDouble(ncid, ncvarid, attname, 1, &ncvar->scalefactor); /* @@ -1345,7 +1273,7 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed */ // (also used for lon/lat) cdf_set_var(ncvar, DataVar); } - else if (isText && strIsEqual(attname, "climatology")) + else if (isText && str_is_equal(attname, "climatology")) { int ncboundsid; int status = nc_inq_varid(ncid, attstring, &ncboundsid); @@ -1359,7 +1287,7 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed else Warning("%s - %s", nc_strerror(status), attstring); } - else if (isText && strIsEqual(attname, "bounds")) + else if (isText && str_is_equal(attname, "bounds")) { int ncboundsid; int status = nc_inq_varid(ncid, attstring, &ncboundsid); @@ -1372,23 +1300,23 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed else Warning("%s - %s", nc_strerror(status), attstring); } - else if (isText && strIsEqual(attname, "formula_terms")) + else if (isText && str_is_equal(attname, "formula_terms")) { ncvar->hasFormulaterms = true; } - else if (isText && strIsEqual(attname, "cell_measures") + else if (isText && str_is_equal(attname, "cell_measures") && (nc_cell_id = cdf_get_cell_varid(attstring, ncid)) != CDI_UNDEFID) { ncvar->cellarea = nc_cell_id; ncvars[nc_cell_id].varStatus = CoordVar; cdf_set_var(ncvar, DataVar); } - else if (isText && (strIsEqual(attname, "associate") || strIsEqual(attname, "coordinates"))) + else if (isText && (str_is_equal(attname, "associate") || str_is_equal(attname, "coordinates"))) { bool lstop = false; char *pstring = attstring; - for (int i = 0; i < MAX_COORDVARS; i++) + for (int i = 0; i < MAX_COORDVARS && !lstop; i++) { while (isspace((int) *pstring)) pstring++; if (*pstring == 0) break; @@ -1415,7 +1343,7 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed int k; for (k = 0; k < nchecked_vars; ++k) - if (strIsEqual(checked_vars[k], varname)) break; + if (str_is_equal(checked_vars[k], varname)) break; if (k == nchecked_vars) { @@ -1423,13 +1351,11 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed Warning("%s - >%s<", nc_strerror(status), varname); } } - - if (lstop) break; } cdf_set_var(ncvar, DataVar); } - else if (isText && strIsEqual(attname, "auxiliary_variable")) + else if (isText && str_is_equal(attname, "auxiliary_variable")) { bool lstop = false; char *pstring = attstring; @@ -1462,7 +1388,7 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed cdf_set_var(ncvar, DataVar); } - else if (isText && strIsEqual(attname, "grid_mapping")) + else if (isText && str_is_equal(attname, "grid_mapping")) { int nc_gmap_id; int status = nc_inq_varid(ncid, attstring, &nc_gmap_id); @@ -1476,13 +1402,13 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed cdf_set_var(ncvar, DataVar); } - else if (isText && strIsEqual(attname, "positive")) + else if (isText && str_is_equal(attname, "positive")) { - strToLower(attstring); + str_to_lower(attstring); - if (strIsEqual(attstring, "down")) + if (str_is_equal(attstring, "down")) ncvar->positive = POSITIVE_DOWN; - else if (strIsEqual(attstring, "up")) + else if (str_is_equal(attstring, "up")) ncvar->positive = POSITIVE_UP; if (ncvar->ndims == 1) @@ -1501,99 +1427,99 @@ cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int timed ncvar->atts[ncvar->natts++] = iatt; } } - else if (isNumber && strIsEqual(attname, "_FillValue")) + else if (isNumber && str_is_equal(attname, "_FillValue")) { cdfGetAttDouble(ncid, ncvarid, attname, 1, &ncvar->fillval); - ncvar->deffillval = true; + ncvar->fillvalDefined = true; // cdf_set_var(ncvar, DataVar); } - else if (isNumber && strIsEqual(attname, "missing_value")) + else if (isNumber && str_is_equal(attname, "missing_value")) { cdfGetAttDouble(ncid, ncvarid, attname, 1, &ncvar->missval); - ncvar->defmissval = true; + ncvar->missvalDefined = true; // cdf_set_var(ncvar, DataVar); } - else if (isNumber && strIsEqual(attname, "valid_range") && attlen == 2) + else if (isNumber && str_is_equal(attname, "valid_range") && attlen == 2) { - if (ncvar->lvalidrange == false) + if (ncvar->validrangeDefined == false) { - bool lignore = (xtypeIsFloat(atttype) != xtypeIsFloat(xtype)); - if (!CDI_Ignore_Valid_Range && lignore == false) + bool ignoreDatatype = (xtypeIsFloat(atttype) != xtypeIsFloat(xtype)); + if (!CDI_Ignore_Valid_Range && ignoreDatatype == false) { cdfGetAttDouble(ncid, ncvarid, attname, 2, ncvar->validrange); - ncvar->lvalidrange = (ncvar->validrange[0] <= ncvar->validrange[1]); - if (((int) ncvar->validrange[0]) == 0 && ((int) ncvar->validrange[1]) == 255) ncvar->lunsigned = true; + ncvar->validrangeDefined = (ncvar->validrange[0] <= ncvar->validrange[1]); + if (((int) ncvar->validrange[0]) == 0 && ((int) ncvar->validrange[1]) == 255) ncvar->isUnsigned = true; // cdf_set_var(ncvar, DataVar); } - else if (lignore) + else if (ignoreDatatype) { Warning("Inconsistent data type for attribute %s:valid_range, ignored!", name); } } } - else if (isNumber && strIsEqual(attname, "valid_min") && attlen == 1) + else if (isNumber && str_is_equal(attname, "valid_min") && attlen == 1) { - bool lignore = (xtypeIsFloat(atttype) != xtypeIsFloat(xtype)); - if (!CDI_Ignore_Valid_Range && lignore == false) + bool ignoreDatatype = (xtypeIsFloat(atttype) != xtypeIsFloat(xtype)); + if (!CDI_Ignore_Valid_Range && ignoreDatatype == false) { cdfGetAttDouble(ncid, ncvarid, attname, 1, &(ncvar->validrange)[0]); - ncvar->lvalidrange = true; + ncvar->validrangeDefined = true; } - else if (lignore) + else if (ignoreDatatype) { Warning("Inconsistent data type for attribute %s:valid_min, ignored!", name); } } - else if (isNumber && strIsEqual(attname, "valid_max") && attlen == 1) + else if (isNumber && str_is_equal(attname, "valid_max") && attlen == 1) { - bool lignore = (xtypeIsFloat(atttype) != xtypeIsFloat(xtype)); - if (!CDI_Ignore_Valid_Range && lignore == false) + bool ignoreDatatype = (xtypeIsFloat(atttype) != xtypeIsFloat(xtype)); + if (!CDI_Ignore_Valid_Range && ignoreDatatype == false) { cdfGetAttDouble(ncid, ncvarid, attname, 1, &(ncvar->validrange)[1]); - ncvar->lvalidrange = true; + ncvar->validrangeDefined = true; } - else if (lignore) + else if (ignoreDatatype) { Warning("Inconsistent data type for attribute %s:valid_max, ignored!", name); } } - else if (isText && strIsEqual(attname, "_Unsigned")) + else if (isText && str_is_equal(attname, "_Unsigned")) { - strToLower(attstring); - if (strIsEqual(attstring, "true")) + str_to_lower(attstring); + if (str_is_equal(attstring, "true")) { - ncvar->lunsigned = true; + ncvar->isUnsigned = true; /* - ncvar->lvalidrange = true; + ncvar->validrangeDefined = true; ncvar->validrange[0] = 0; ncvar->validrange[1] = 255; */ } // cdf_set_var(ncvar, DataVar); } - else if (isText && strIsEqual(attname, "cdi")) + else if (isText && str_is_equal(attname, "cdi")) { - strToLower(attstring); + str_to_lower(attstring); - if (strIsEqual(attstring, "ignore")) + if (str_is_equal(attstring, "ignore")) { ncvar->ignoreVar = true; cdf_set_var(ncvar, CoordVar); } } else if (isNumber - && (strIsEqual(attname, "realization") || strIsEqual(attname, "ensemble_members") - || strIsEqual(attname, "forecast_init_type"))) + && ((isRealization = str_is_equal(attname, "realization")) + || (isEnsembleMembers = str_is_equal(attname, "ensemble_members")) + || (isForecastInitType = str_is_equal(attname, "forecast_init_type")))) { int temp; cdfGetAttInt(ncid, ncvarid, attname, 1, &temp); - if (strIsEqual(attname, "realization")) - ncvar->perturbationNumber = temp; - else if (strIsEqual(attname, "ensemble_members")) - ncvar->numberOfForecastsInEnsemble = temp; - else if (strIsEqual(attname, "forecast_init_type")) - ncvar->typeOfEnsembleForecast = temp; + // clang-format off + if (isRealization) ncvar->perturbationNumber = temp; + else if (isEnsembleMembers) ncvar->numberOfForecastsInEnsemble = temp; + else if (isForecastInitType) ncvar->typeOfEnsembleForecast = temp; + // clang-format on cdf_set_var(ncvar, DataVar); } @@ -1619,21 +1545,21 @@ cdfVerifyVarAttr(int nvars, ncvar_t *ncvars, ncdim_t *ncdims) for (int ncvarid = 0; ncvarid < nvars; ncvarid++) { ncvar_t *ncvar = &ncvars[ncvarid]; - const int ncid = ncvar->ncid; + int ncid = ncvar->ncid; const int *dimidsp = ncvar->dimids; - const int nvdims = ncvar->ndims; - const int nvatts = ncvar->natts; + int nvdims = ncvar->ndims; + int nvatts = ncvar->natts; for (int i = 0; i < nvatts; i++) { - const int attnum = ncvar->atts[i]; + int attnum = ncvar->atts[i]; cdf_inq_attname(ncid, ncvarid, attnum, attname); cdf_inq_attlen(ncid, ncvarid, attname, &attlen); cdf_inq_atttype(ncid, ncvarid, attname, &atttype); size_t attstringsize = sizeof(attstring); - const bool isText = xtypeIsText(atttype); - // const bool isNumber = (xtypeIsFloat(atttype) || xtypeIsInt(atttype)); + bool isText = xtypeIsText(atttype); + // bool isNumber = (xtypeIsFloat(atttype) || xtypeIsInt(atttype)); if (isText) { @@ -1641,12 +1567,12 @@ cdfVerifyVarAttr(int nvars, ncvar_t *ncvars, ncdim_t *ncdims) attstringsize = strlen(attstring) + 1; if (attstringsize > CDI_MAX_NAME) attstringsize = CDI_MAX_NAME; - if (strIsEqual(attname, "axis")) + if (str_is_equal(attname, "axis")) { - cdfScanAttrAxis(ncvars, ncdims, ncvarid, strToLower(attstring), nvdims, dimidsp); + cdfScanAttrAxis(ncvars, ncdims, ncvarid, attstring, nvdims, dimidsp); } /* - else if (strIsEqual(attname, "standard_name")) + else if (str_is_equal(attname, "standard_name")) { memcpy(ncvar->stdname, attstring, attstringsize); } @@ -1702,7 +1628,6 @@ cdf_set_dimtype(int nvars, ncvar_t *ncvars, ncdim_t *ncdims) int allcdims = lcdim; if (!lxdim && ncvar->xvarid != CDI_UNDEFID && ncvars[ncvar->xvarid].ndims == 0) lxdim = true; - if (!lydim && ncvar->yvarid != CDI_UNDEFID && ncvars[ncvar->yvarid].ndims == 0) lydim = true; if (lxdim && (lydim || ncvar->gridtype == GRID_UNSTRUCTURED)) @@ -1751,7 +1676,7 @@ cdf_set_dimtype(int nvars, ncvar_t *ncvars, ncdim_t *ncdims) { bool lxdim = false, lydim = false, lzdim = false /*, ltdim = false */; int lcdim = 0; - const int ndims = ncvar->ndims; + int ndims = ncvar->ndims; for (int i = 0; i < ndims; i++) { int dimtype = ncvar->dimtype[i]; @@ -1762,7 +1687,7 @@ cdf_set_dimtype(int nvars, ncvar_t *ncvars, ncdim_t *ncdims) // ltdim |= (dimtype == T_AXIS); } - const int allcdims = lcdim; + int allcdims = lcdim; if (!lxdim && ncvar->xvarid != CDI_UNDEFID && ncvars[ncvar->xvarid].ndims == 0) lxdim = true; if (!lydim && ncvar->yvarid != CDI_UNDEFID && ncvars[ncvar->yvarid].ndims == 0) lydim = true; @@ -1772,6 +1697,7 @@ cdf_set_dimtype(int nvars, ncvar_t *ncvars, ncdim_t *ncdims) { if (ncvar->dimtype[i] == -1) { + int dimtype; if (!lxdim) { if (lcdim && ncvar->xvarid == CDI_UNDEFID) @@ -1780,7 +1706,7 @@ cdf_set_dimtype(int nvars, ncvar_t *ncvars, ncdim_t *ncdims) ncvar->xvarid = cdimvar; lcdim--; } - cdf_set_dim(ncvar, i, X_AXIS); + dimtype = X_AXIS; lxdim = true; } else if (!lydim && ncvar->gridtype != GRID_UNSTRUCTURED) @@ -1793,7 +1719,7 @@ cdf_set_dimtype(int nvars, ncvar_t *ncvars, ncdim_t *ncdims) ncvar->yvarid = cdimvar; lcdim--; } - cdf_set_dim(ncvar, i, Y_AXIS); + dimtype = Y_AXIS; lydim = true; } else if (!lzdim) @@ -1805,9 +1731,12 @@ cdf_set_dimtype(int nvars, ncvar_t *ncvars, ncdim_t *ncdims) lcdim--; ncvars[cdimvar].zaxistype = ZAXIS_CHAR; } - cdf_set_dim(ncvar, i, Z_AXIS); + dimtype = Z_AXIS; lzdim = true; } + else + continue; + cdf_set_dim(ncvar, i, dimtype); } } if (lcdim > 0) Warning("Could not assign all character coordinates to data variable!"); @@ -1872,17 +1801,17 @@ verify_coordinates_vars_1(int ncid, int ndims, ncdim_t *ncdims, ncvar_t *ncvars, { ncvar->zaxistype = ZAXIS_PRESSURE; } - else if (strIsEqual(ncvar->units, "level") || strIsEqual(ncvar->units, "1")) + else if (str_is_equal(ncvar->units, "level") || str_is_equal(ncvar->units, "1")) { - if (strIsEqual(ncvar->longname, "hybrid level at layer midpoints")) + if (str_is_equal(ncvar->longname, "hybrid level at layer midpoints")) ncvar->zaxistype = ZAXIS_HYBRID; else if (strStartsWith(ncvar->longname, "hybrid level at midpoints")) ncvar->zaxistype = ZAXIS_HYBRID; - else if (strIsEqual(ncvar->longname, "hybrid level at layer interfaces")) + else if (str_is_equal(ncvar->longname, "hybrid level at layer interfaces")) ncvar->zaxistype = ZAXIS_HYBRID_HALF; else if (strStartsWith(ncvar->longname, "hybrid level at interfaces")) ncvar->zaxistype = ZAXIS_HYBRID_HALF; - else if (strIsEqual(ncvar->units, "level")) + else if (str_is_equal(ncvar->units, "level")) ncvar->zaxistype = ZAXIS_GENERIC; } else if (is_DBL_axis(ncvar->longname)) @@ -1891,21 +1820,19 @@ verify_coordinates_vars_1(int ncid, int ndims, ncdim_t *ncdims, ncvar_t *ncvars, } else if (is_height_units(ncvar->units)) { - if (is_depth_axis(ncvar->stdname, ncvar->longname)) - ncvar->zaxistype = ZAXIS_DEPTH_BELOW_SEA; - else if (is_height_axis(ncvar->stdname, ncvar->longname)) - ncvar->zaxistype = ZAXIS_HEIGHT; - else if (is_altitude_axis(ncvar->stdname, ncvar->longname)) - ncvar->zaxistype = ZAXIS_ALTITUDE; + // clang-format off + if (is_depth_axis(ncvar->stdname, ncvar->longname)) ncvar->zaxistype = ZAXIS_DEPTH_BELOW_SEA; + else if (is_height_axis(ncvar->stdname, ncvar->longname)) ncvar->zaxistype = ZAXIS_HEIGHT; + else if (is_altitude_axis(ncvar->stdname, ncvar->longname)) ncvar->zaxistype = ZAXIS_ALTITUDE; + // clang-format on } } else { - if ((strIsEqual(ncvar->longname, "generalized_height") || strIsEqual(ncvar->longname, "generalized height")) - && strIsEqual(ncvar->stdname, "height")) - ncvar->zaxistype = ZAXIS_REFERENCE; - else if (strIsEqual(ncvar->stdname, "air_pressure")) - ncvar->zaxistype = ZAXIS_PRESSURE; + // clang-format off + if (is_reference_axis(ncvar->stdname, ncvar->longname)) ncvar->zaxistype = ZAXIS_REFERENCE; + else if (str_is_equal(ncvar->stdname, "air_pressure")) ncvar->zaxistype = ZAXIS_PRESSURE; + // clang-format on } if (!ncvar->isLon && (ncvar->longname[0] != 0) && !ncvar->isLat && (ncvar->longname[1] != 0)) @@ -1970,18 +1897,15 @@ verify_coordinates_vars_2(stream_t *streamptr, int nvars, ncvar_t *ncvars) ncvar->isYaxis = true; continue; } - else if (ncvar->zaxistype == CDI_UNDEFID && (strIsEqual(ncvar->units, "level") || strIsEqual(ncvar->units, "1"))) + else if (ncvar->zaxistype == CDI_UNDEFID && (str_is_equal(ncvar->units, "level") || str_is_equal(ncvar->units, "1"))) { - if (strIsEqual(ncvar->longname, "hybrid level at layer midpoints")) - ncvar->zaxistype = ZAXIS_HYBRID; - else if (strStartsWith(ncvar->longname, "hybrid level at midpoints")) - ncvar->zaxistype = ZAXIS_HYBRID; - else if (strIsEqual(ncvar->longname, "hybrid level at layer interfaces")) - ncvar->zaxistype = ZAXIS_HYBRID_HALF; - else if (strStartsWith(ncvar->longname, "hybrid level at interfaces")) - ncvar->zaxistype = ZAXIS_HYBRID_HALF; - else if (strIsEqual(ncvar->units, "level")) - ncvar->zaxistype = ZAXIS_GENERIC; + // clang-format off + if (str_is_equal(ncvar->longname, "hybrid level at layer midpoints")) ncvar->zaxistype = ZAXIS_HYBRID; + else if (strStartsWith(ncvar->longname, "hybrid level at midpoints")) ncvar->zaxistype = ZAXIS_HYBRID; + else if (str_is_equal(ncvar->longname, "hybrid level at layer interfaces")) ncvar->zaxistype = ZAXIS_HYBRID_HALF; + else if (strStartsWith(ncvar->longname, "hybrid level at interfaces")) ncvar->zaxistype = ZAXIS_HYBRID_HALF; + else if (str_is_equal(ncvar->units, "level")) ncvar->zaxistype = ZAXIS_GENERIC; + // clang-format on continue; } else if (ncvar->zaxistype == CDI_UNDEFID && is_pressure_units(ncvar->units)) @@ -1996,19 +1920,19 @@ verify_coordinates_vars_2(stream_t *streamptr, int nvars, ncvar_t *ncvars) } else if (is_height_units(ncvar->units)) { - if (is_depth_axis(ncvar->stdname, ncvar->longname)) - ncvar->zaxistype = ZAXIS_DEPTH_BELOW_SEA; - else if (is_height_axis(ncvar->stdname, ncvar->longname)) - ncvar->zaxistype = ZAXIS_HEIGHT; + // clang-format off + if (is_depth_axis(ncvar->stdname, ncvar->longname)) ncvar->zaxistype = ZAXIS_DEPTH_BELOW_SEA; + else if (is_height_axis(ncvar->stdname, ncvar->longname)) ncvar->zaxistype = ZAXIS_HEIGHT; + // clang-format on continue; } } - else if (strIsEqual(ncvar->stdname, "region") || strIsEqual(ncvar->stdname, "area_type") - || cdfInqDatatype(streamptr, ncvar->xtype, ncvar->lunsigned) == CDI_DATATYPE_UINT8) + else if (str_is_equal(ncvar->stdname, "region") || str_is_equal(ncvar->stdname, "area_type") + || cdfInqDatatype(streamptr, ncvar->xtype, ncvar->isUnsigned) == CDI_DATATYPE_UINT8) { ncvar->isCharAxis = true; } - else if (strIsEqual(ncvar->stdname, "air_pressure")) + else if (str_is_equal(ncvar->stdname, "air_pressure")) ncvar->zaxistype = ZAXIS_PRESSURE; // not needed anymore for rotated grids @@ -2032,7 +1956,7 @@ verify_coordinates_vars_2(stream_t *streamptr, int nvars, ncvar_t *ncvars) static void grid_set_chunktype(grid_t *grid, ncvar_t *ncvar) { - if (ncvar->chunked) + if (ncvar->isChunked) { int ndims = ncvar->ndims; @@ -2057,8 +1981,8 @@ grid_set_chunktype(grid_t *grid, ncvar_t *ncvar) // define all input grids static void -cdf_load_vals(size_t size, int ndims, int varid, ncvar_t *ncvar, double **gridvals, struct xyValGet *valsGet, int ntdims, - size_t *start, size_t *count) +cdf_load_vals(size_t size, int ndims, int varid, ncvar_t *ncvar, double **gridvals, struct xyValGet *valsGet, bool hasTimeDim, + bool readPart, size_t *start, size_t *count) { if (CDI_Netcdf_Lazy_Grid_Load) { @@ -2077,7 +2001,7 @@ cdf_load_vals(size_t size, int ndims, int varid, ncvar_t *ncvar, double **gridva else { *gridvals = (double *) Malloc(size * sizeof(double)); - if (ntdims == 1) + if (hasTimeDim || readPart) cdf_get_vara_double(ncvar->ncid, varid, start, count, *gridvals); else cdf_get_var_double(ncvar->ncid, varid, *gridvals); @@ -2102,7 +2026,8 @@ cdf_load_cvals(size_t size, int varid, ncvar_t *ncvar, char ***gridvals, size_t #endif static void -cdf_load_bounds(size_t size, ncvar_t *ncvar, double **gridbounds, struct cdfLazyGridIds *cellBoundsGet) +cdf_load_bounds(size_t size, ncvar_t *ncvar, double **gridbounds, struct cdfLazyGridIds *cellBoundsGet, bool readPart, + size_t *start, size_t *count) { if (CDI_Netcdf_Lazy_Grid_Load) { @@ -2113,7 +2038,10 @@ cdf_load_bounds(size_t size, ncvar_t *ncvar, double **gridbounds, struct cdfLazy else { *gridbounds = (double *) Malloc(size * sizeof(double)); - cdf_get_var_double(ncvar->ncid, ncvar->bounds, *gridbounds); + if (readPart) + cdf_get_vara_double(ncvar->ncid, ncvar->bounds, start, count, *gridbounds); + else + cdf_get_var_double(ncvar->ncid, ncvar->bounds, *gridbounds); } } @@ -2140,7 +2068,7 @@ cdf_load_bounds_cube_sphere(size_t bxsize, size_t bysize, size_t size, ncvar_t * for (size_t j = 0; j < (bysize - 1); ++j) for (size_t i = 0; i < (bxsize - 1); ++i) { - const size_t offset = k * bysize * bxsize; + size_t offset = k * bysize * bxsize; pbounds[m + 0] = bounds[offset + (j + 1) * bxsize + i]; pbounds[m + 1] = bounds[offset + j * bxsize + i]; pbounds[m + 2] = bounds[offset + j * bxsize + (i + 1)]; @@ -2257,7 +2185,7 @@ cdf_check_gridtype(int *gridtype, bool isLon, bool isLat, size_t xsize, size_t y static bool cdf_read_xcoord(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncdim_t *ncdims, ncvar_t *ncvar, int xvarid, ncvar_t *axisvar, - size_t *xsize, size_t ysize, int ntdims, size_t *start, size_t *count, bool *isLon) + size_t *xsize, size_t ysize, bool hasTimeDim, bool readPart, size_t *start, size_t *count, bool *isLon) { grid_t *grid = &lazyGrid->base; bool skipvar = true; @@ -2265,22 +2193,22 @@ cdf_read_xcoord(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncdim_t *ncdi int ndims = axisvar->ndims; size_t size = 0; - if (xtypeIsText(axisvar->xtype)) + if (ndims == 1 && xtypeIsText(axisvar->xtype)) { ncvar->varStatus = CoordVar; - Warning("Unsupported coordinate type (char/string), skipped variable %s!", ncvar->name); + Warning("Unsupported x-coordinate type (char/string), skipped variable %s!", ncvar->name); return true; } - const int datatype = cdfInqDatatype(streamptr, axisvar->xtype, axisvar->lunsigned); + int datatype = cdfInqDatatype(streamptr, axisvar->xtype, axisvar->isUnsigned); - if ((ndims - ntdims) == 2) + if ((ndims - hasTimeDim) == 2) { // Check size of 2 dimensional coordinates variables int dimid = axisvar->dimids[ndims - 2]; - const size_t dimsize1 = ncdims[dimid].len; + size_t dimsize1 = ncdims[dimid].len; dimid = axisvar->dimids[ndims - 1]; - const size_t dimsize2 = ncdims[dimid].len; + size_t dimsize2 = ncdims[dimid].len; if (datatype == CDI_DATATYPE_UINT8) { @@ -2295,13 +2223,13 @@ cdf_read_xcoord(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncdim_t *ncdi skipvar = (dimsize1 * dimsize2 != size); } } - else if ((ndims - ntdims) == 1) + else if ((ndims - hasTimeDim) == 1) { size = *xsize; // Check size of 1 dimensional coordinates variables - const int dimid = axisvar->dimids[ndims - 1]; - const size_t dimsize = ncdims[dimid].len; - skipvar = (dimsize != size); + int dimid = axisvar->dimids[ndims - 1]; + size_t dimsize = ncdims[dimid].len; + skipvar = readPart ? false : (dimsize != size); } else if (ndims == 0 && *xsize == 0) { @@ -2331,7 +2259,7 @@ cdf_read_xcoord(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncdim_t *ncdi #endif } else - cdf_load_vals(size, ndims, xvarid, axisvar, &grid->x.vals, &lazyGrid->xValsGet, ntdims, start, count); + cdf_load_vals(size, ndims, xvarid, axisvar, &grid->x.vals, &lazyGrid->xValsGet, hasTimeDim, readPart, start, count); cdf_copy_grid_axis_attr(axisvar, &grid->x); @@ -2340,7 +2268,7 @@ cdf_read_xcoord(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncdim_t *ncdi static bool cdf_read_ycoord(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncdim_t *ncdims, ncvar_t *ncvar, int yvarid, ncvar_t *axisvar, - size_t xsize, size_t *ysize, int ntdims, size_t *start, size_t *count, bool *isLat) + size_t xsize, size_t *ysize, bool hasTimeDim, bool readPart, size_t *start, size_t *count, bool *isLat) { grid_t *grid = &lazyGrid->base; bool skipvar = true; @@ -2348,22 +2276,22 @@ cdf_read_ycoord(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncdim_t *ncdi int ndims = axisvar->ndims; size_t size = 0; - if (xtypeIsText(axisvar->xtype)) + if (ndims == 1 && xtypeIsText(axisvar->xtype)) { ncvar->varStatus = CoordVar; - Warning("Unsupported coordinate type (char/string), skipped variable %s!", ncvar->name); + Warning("Unsupported y-coordinate type (char/string), skipped variable %s!", ncvar->name); return true; } - const int datatype = cdfInqDatatype(streamptr, axisvar->xtype, axisvar->lunsigned); + int datatype = cdfInqDatatype(streamptr, axisvar->xtype, axisvar->isUnsigned); - if ((ndims - ntdims) == 2) + if ((ndims - hasTimeDim) == 2) { // Check size of 2 dimensional coordinates variables int dimid = axisvar->dimids[ndims - 2]; - const size_t dimsize1 = ncdims[dimid].len; + size_t dimsize1 = ncdims[dimid].len; dimid = axisvar->dimids[ndims - 1]; - const size_t dimsize2 = ncdims[dimid].len; + size_t dimsize2 = ncdims[dimid].len; if (datatype == CDI_DATATYPE_UINT8) { @@ -2378,12 +2306,12 @@ cdf_read_ycoord(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncdim_t *ncdi skipvar = (dimsize1 * dimsize2 != size); } } - else if ((ndims - ntdims) == 1) + else if ((ndims - hasTimeDim) == 1) { size = (*ysize) ? *ysize : xsize; - const int dimid = axisvar->dimids[ndims - 1]; - const size_t dimsize = ncdims[dimid].len; - skipvar = (dimsize != size); + int dimid = axisvar->dimids[ndims - 1]; + size_t dimsize = ncdims[dimid].len; + skipvar = readPart ? false : (dimsize != size); } else if (ndims == 0 && *ysize == 0) { @@ -2413,19 +2341,36 @@ cdf_read_ycoord(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncdim_t *ncdi #endif } else - cdf_load_vals(size, ndims, yvarid, axisvar, &grid->y.vals, &lazyGrid->yValsGet, ntdims, start, count); + cdf_load_vals(size, ndims, yvarid, axisvar, &grid->y.vals, &lazyGrid->yValsGet, hasTimeDim, readPart, start, count); cdf_copy_grid_axis_attr(axisvar, &grid->y); return false; } +typedef struct +{ + long start; + long count; + bool readPart; +} GridPart; + +static void +gridpart_init(GridPart *gridPart) +{ + gridPart->start = -1; + gridPart->count = -1; + gridPart->readPart = false; +} + static bool cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t *ncvar, ncvar_t *ncvars, ncdim_t *ncdims, - int timedimid, int xvarid, int yvarid, size_t xsize, size_t ysize, int *vdimid) + int timedimid, int xvarid, int yvarid, size_t xsize, size_t ysize, int *vdimid, const GridPart *gridPart) { grid_t *grid = &lazyGrid->base; size_t size = 0; + size_t start[3] = { 0, 0, 0 }, count[3] = { 1, 1, 1 }; + bool readPart = false; grid->datatype = CDI_DATATYPE_FLT64; @@ -2436,12 +2381,11 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t } else { - size_t start[3] = { 0, 0, 0 }, count[3] = { 1, 1, 1 }; - int ntdims = 0; + bool hasTimeDim = false; if (xvarid != CDI_UNDEFID && yvarid != CDI_UNDEFID) { - const int ndims = ncvars[xvarid].ndims; + int ndims = ncvars[xvarid].ndims; if (ndims != ncvars[yvarid].ndims && !ncvars[xvarid].isCharAxis && !ncvars[yvarid].isCharAxis) { Warning("Inconsistent grid structure for variable %s!", ncvar->name); @@ -2459,7 +2403,7 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t cdf_inq_dimlen(ncvar->ncid, ncdims[timedimid].dimid, &ntsteps); if (ltwarn && ntsteps > 1) Warning("Time varying grids unsupported, using grid at time step 1!"); ltwarn = false; - ntdims = 1; + hasTimeDim = true; count[1] = ysize; count[2] = xsize; } @@ -2471,11 +2415,17 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t ncvar->yvarid = yvarid = CDI_UNDEFID; } } + else if (gridPart && gridPart->readPart) + { + start[0] = gridPart->start; + count[0] = gridPart->count; + readPart = true; + } } if (xvarid != CDI_UNDEFID) { - if (!ncvar->isCubeSphere && (ncvars[xvarid].ndims - ntdims) > 2) + if (!ncvar->isCubeSphere && (ncvars[xvarid].ndims - hasTimeDim) > 2) { Warning("Coordinates variable %s has too many dimensions (%d), skipped!", ncvars[xvarid].name, ncvars[xvarid].ndims); // ncvar->xvarid = CDI_UNDEFID; @@ -2485,7 +2435,7 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t if (yvarid != CDI_UNDEFID) { - if (!ncvar->isCubeSphere && (ncvars[yvarid].ndims - ntdims) > 2) + if (!ncvar->isCubeSphere && (ncvars[yvarid].ndims - hasTimeDim) > 2) { Warning("Coordinates variable %s has too many dimensions (%d), skipped!", ncvars[yvarid].name, ncvars[yvarid].ndims); // ncvar->yvarid = CDI_UNDEFID; @@ -2496,25 +2446,22 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t bool isLon = false, isLat = false; if (xvarid != CDI_UNDEFID) - if (cdf_read_xcoord(streamptr, lazyGrid, ncdims, ncvar, xvarid, &ncvars[xvarid], &xsize, ysize, ntdims, start, count, - &isLon)) + if (cdf_read_xcoord(streamptr, lazyGrid, ncdims, ncvar, xvarid, &ncvars[xvarid], &xsize, ysize, hasTimeDim, readPart, start, + count, &isLon)) return true; if (yvarid != CDI_UNDEFID) - if (cdf_read_ycoord(streamptr, lazyGrid, ncdims, ncvar, yvarid, &ncvars[yvarid], xsize, &ysize, ntdims, start, count, - &isLat)) + if (cdf_read_ycoord(streamptr, lazyGrid, ncdims, ncvar, yvarid, &ncvars[yvarid], xsize, &ysize, hasTimeDim, readPart, start, + count, &isLat)) return true; - if (ncvar->gridtype == GRID_UNSTRUCTURED) - size = xsize; - else if (ncvar->gridtype == GRID_GAUSSIAN_REDUCED) - size = xsize; - else if (ysize == 0) - size = xsize; - else if (xsize == 0) - size = ysize; - else - size = xsize * ysize; + // clang-format off + if (ncvar->gridtype == GRID_UNSTRUCTURED) size = xsize; + else if (ncvar->gridtype == GRID_GAUSSIAN_REDUCED) size = xsize; + else if (ysize == 0) size = xsize; + else if (xsize == 0) size = ysize; + else size = xsize * ysize; + // clang-format on if (ncvar->gridtype == CDI_UNDEFID || ncvar->gridtype == GRID_GENERIC) cdf_check_gridtype(&ncvar->gridtype, isLon, isLat, xsize, ysize, grid); @@ -2527,12 +2474,12 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t } else if (gridtype == GRID_PROJECTION && ncvar->gridtype == GRID_LONLAT) { - const int gmapvarid = ncvar->gmapid; + int gmapvarid = ncvar->gmapid; if (gmapvarid != CDI_UNDEFID && cdfCheckAttText(ncvar->ncid, gmapvarid, "grid_mapping_name")) { char attstring[CDI_MAX_NAME]; cdfGetAttText(ncvar->ncid, gmapvarid, "grid_mapping_name", CDI_MAX_NAME, attstring); - if (strIsEqual(attstring, "latitude_longitude")) gridtype = ncvar->gridtype; + if (str_is_equal(attstring, "latitude_longitude")) gridtype = ncvar->gridtype; } } @@ -2551,11 +2498,11 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t if (xvarid != CDI_UNDEFID && CDI_Read_Cell_Corners) { grid->x.flag = 1; - const int bvarid = ncvars[xvarid].bounds; + int bvarid = ncvars[xvarid].bounds; if (bvarid != CDI_UNDEFID) { - const int ndims = ncvars[xvarid].ndims; - const int nbdims = ncvars[bvarid].ndims; + int ndims = ncvars[xvarid].ndims; + int nbdims = ncvars[bvarid].ndims; if (nbdims == 2 || nbdims == 3) { if (ncvars[bvarid].dimids[0] == timedimid) @@ -2567,8 +2514,8 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t else if (ncvar->isCubeSphere) { grid->nvertex = 4; - const size_t bxsize = ncdims[ncvars[bvarid].dimids[2]].len; - const size_t bysize = ncdims[ncvars[bvarid].dimids[1]].len; + size_t bxsize = ncdims[ncvars[bvarid].dimids[2]].len; + size_t bysize = ncdims[ncvars[bvarid].dimids[1]].len; cdf_load_bounds_cube_sphere(bxsize, bysize, size * (size_t) grid->nvertex, &ncvars[xvarid], &grid->x.bounds, &lazyGrid->xBoundsGet); } @@ -2576,7 +2523,13 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t { *vdimid = ncvars[bvarid].dimids[nbdims - 1]; grid->nvertex = (int) ncdims[*vdimid].len; - cdf_load_bounds(size * (size_t) grid->nvertex, &ncvars[xvarid], &grid->x.bounds, &lazyGrid->xBoundsGet); + if (readPart) + { + start[1] = 0; + count[1] = grid->nvertex; + } + cdf_load_bounds(size * (size_t) grid->nvertex, &ncvars[xvarid], &grid->x.bounds, &lazyGrid->xBoundsGet, + readPart, start, count); } else { @@ -2590,11 +2543,11 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t if (yvarid != CDI_UNDEFID && CDI_Read_Cell_Corners) { grid->y.flag = 1; - const int bvarid = ncvars[yvarid].bounds; + int bvarid = ncvars[yvarid].bounds; if (bvarid != CDI_UNDEFID) { - const int ndims = ncvars[yvarid].ndims; - const int nbdims = ncvars[bvarid].ndims; + int ndims = ncvars[yvarid].ndims; + int nbdims = ncvars[bvarid].ndims; if (nbdims == 2 || nbdims == 3) { if (ncvars[bvarid].dimids[0] == timedimid) @@ -2606,8 +2559,8 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t else if (ncvar->isCubeSphere) { grid->nvertex = 4; - const size_t bxsize = ncdims[ncvars[bvarid].dimids[2]].len; - const size_t bysize = ncdims[ncvars[bvarid].dimids[1]].len; + size_t bxsize = ncdims[ncvars[bvarid].dimids[2]].len; + size_t bysize = ncdims[ncvars[bvarid].dimids[1]].len; cdf_load_bounds_cube_sphere(bxsize, bysize, size * (size_t) grid->nvertex, &ncvars[yvarid], &grid->y.bounds, &lazyGrid->yBoundsGet); } @@ -2618,7 +2571,13 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t *vdimid = ncvars[bvarid].dimids[nbdims - 1]; grid->nvertex = (int) ncdims[*vdimid].len; } - cdf_load_bounds(size * (size_t) grid->nvertex, &ncvars[yvarid], &grid->y.bounds, &lazyGrid->yBoundsGet); + if (readPart) + { + start[1] = 0; + count[1] = grid->nvertex; + } + cdf_load_bounds(size * (size_t) grid->nvertex, &ncvars[yvarid], &grid->y.bounds, &lazyGrid->yBoundsGet, + readPart, start, count); } else { @@ -2646,18 +2605,18 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t if (ncvars[ncvar->rpvarid].ndims == 1) { grid->size = size; - const int dimid = ncvars[ncvar->rpvarid].dimids[0]; - const size_t len = ncdims[dimid].len; + int dimid = ncvars[ncvar->rpvarid].dimids[0]; + size_t len = ncdims[dimid].len; grid->y.size = len; grid->reducedPointsSize = len; grid->reducedPoints = (int *) Malloc(len * sizeof(int)); cdf_get_var_int(ncvar->ncid, ncvar->rpvarid, grid->reducedPoints); grid->np = ncvar->numLPE; - const int bvarid = (yvarid == CDI_UNDEFID) ? CDI_UNDEFID : ncvars[yvarid].bounds; + int bvarid = (yvarid == CDI_UNDEFID) ? CDI_UNDEFID : ncvars[yvarid].bounds; if (bvarid != CDI_UNDEFID) { - const int nbdims = ncvars[bvarid].ndims; + int nbdims = ncvars[bvarid].ndims; if (nbdims == 2 || nbdims == 3) { if (*vdimid == CDI_UNDEFID) @@ -2665,7 +2624,8 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t *vdimid = ncvars[bvarid].dimids[nbdims - 1]; grid->nvertex = (int) ncdims[*vdimid].len; } - cdf_load_bounds(size * (size_t) grid->nvertex, &ncvars[yvarid], &grid->y.bounds, &lazyGrid->yBoundsGet); + cdf_load_bounds(size * (size_t) grid->nvertex, &ncvars[yvarid], &grid->y.bounds, &lazyGrid->yBoundsGet, + false, NULL, NULL); } } } @@ -2709,7 +2669,7 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t if (grid->size == 0) { - const int ndims = ncvar->ndims; + int ndims = ncvar->ndims; int *dimtype = ncvar->dimtype; if (ndims == 0 || (ndims == 1 && dimtype[0] == T_AXIS) || (ndims == 1 && dimtype[0] == Z_AXIS) || (ndims == 2 && dimtype[0] == T_AXIS && dimtype[1] == Z_AXIS)) @@ -2731,7 +2691,7 @@ cdf_read_coordinates(stream_t *streamptr, struct cdfLazyGrid *lazyGrid, ncvar_t } static bool -cdf_set_unstructured_par(ncvar_t *ncvar, grid_t *grid, int *xdimid, int *ydimid, GridInfo *gridInfo) +cdf_set_unstructured_par(ncvar_t *ncvar, grid_t *grid, int *xdimid, int *ydimid, GridInfo *gridInfo, bool readPart) { int ndims = ncvar->ndims; int *dimtype = ncvar->dimtype; @@ -2741,12 +2701,11 @@ cdf_set_unstructured_par(ncvar_t *ncvar, grid_t *grid, int *xdimid, int *ydimid, for (int i = 0; i < ndims; i++) { - if (dimtype[i] == X_AXIS) - xdimidx = i; - else if (dimtype[i] == Y_AXIS) - ydimidx = i; - else if (dimtype[i] == Z_AXIS) - zdimid = ncvar->dimids[i]; + // clang-format off + if (dimtype[i] == X_AXIS) xdimidx = i; + else if (dimtype[i] == Y_AXIS) ydimidx = i; + else if (dimtype[i] == Z_AXIS) zdimid = ncvar->dimids[i]; + // clang-format on } if (*xdimid != CDI_UNDEFID && *ydimid != CDI_UNDEFID && zdimid == CDI_UNDEFID) @@ -2776,10 +2735,13 @@ cdf_set_unstructured_par(ncvar_t *ncvar, grid_t *grid, int *xdimid, int *ydimid, return true; } - if (gridInfo->number_of_grid_used != CDI_UNDEFID) - cdiDefVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDUSED, gridInfo->number_of_grid_used); - if (ncvar->position > 0) cdiDefVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDINREFERENCE, ncvar->position); - if (!cdiUUIDIsNull(gridInfo->uuid)) cdiDefVarKeyBytes(&grid->keys, CDI_KEY_UUID, gridInfo->uuid, CDI_UUID_SIZE); + if (!readPart) + { + if (gridInfo->number_of_grid_used != CDI_UNDEFID) + cdiDefVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDUSED, gridInfo->number_of_grid_used); + if (ncvar->position > 0) cdiDefVarKeyInt(&grid->keys, CDI_KEY_NUMBEROFGRIDINREFERENCE, ncvar->position); + if (!cdiUUIDIsNull(gridInfo->uuid)) cdiDefVarKeyBytes(&grid->keys, CDI_KEY_UUID, gridInfo->uuid, CDI_UUID_SIZE); + } return false; } @@ -2796,7 +2758,8 @@ cdf_read_mapping_atts(int ncid, int gmapvarid, int projID) int nvatts; cdf_inq_varnatts(ncid, gmapvarid, &nvatts); - for (int attnum = 0; attnum < nvatts; ++attnum) cdf_set_cdi_attr(ncid, gmapvarid, attnum, projID, CDI_GLOBAL); + bool removeFillValue = true; + for (int attnum = 0; attnum < nvatts; ++attnum) cdf_set_cdi_attr(ncid, gmapvarid, attnum, projID, CDI_GLOBAL, removeFillValue); } static void @@ -2809,7 +2772,7 @@ cdf_set_grid_to_similar_vars(ncvar_t *ncvar1, ncvar_t *ncvar2, int gridtype, int const int *dimtype2 = ncvar2->dimtype; const int *dimids2 = ncvar2->dimids; - const int ndims2 = ncvar2->ndims; + int ndims2 = ncvar2->ndims; for (int i = 0; i < ndims2; i++) { if (dimtype2[i] == X_AXIS) @@ -2865,11 +2828,26 @@ cdf_set_grid_to_similar_vars(ncvar_t *ncvar1, ncvar_t *ncvar2, int gridtype, int ncvar2->gridID = ncvar1->gridID; ncvar2->chunkType = ncvar1->chunkType; ncvar2->chunkSize = ncvar1->chunkSize; + ncvar2->gridSize = ncvar1->gridSize; } } } } +static void +destroy_grid(struct cdfLazyGrid *lazyGrid, grid_t *grid) +{ + if (lazyGrid) + { + if (CDI_Netcdf_Lazy_Grid_Load) cdfLazyGridDestroy(lazyGrid); + if (grid) + { + grid_free(grid); + Free(grid); + } + } +} + static int cdf_define_all_grids(stream_t *streamptr, ncgrid_t *ncgrid, int vlistID, ncdim_t *ncdims, int nvars, ncvar_t *ncvars, GridInfo *gridInfo) @@ -2879,17 +2857,19 @@ cdf_define_all_grids(stream_t *streamptr, ncgrid_t *ncgrid, int vlistID, ncdim_t ncvar_t *ncvar = &ncvars[ncvarid]; if (ncvar->varStatus == DataVar && ncvar->gridID == CDI_UNDEFID) { - const int ndims = ncvar->ndims; + GridPart gridPart; + gridpart_init(&gridPart); + int ndims = ncvar->ndims; int *dimtype = ncvar->dimtype; int vdimid = CDI_UNDEFID; struct addIfNewRes projAdded = { .Id = CDI_UNDEFID, .isNew = 0 }, gridAdded = { .Id = CDI_UNDEFID, .isNew = 0 }; int xdimid = CDI_UNDEFID, ydimid = CDI_UNDEFID; - const int nydims = cdf_get_xydimid(ndims, ncvar->dimids, dimtype, &xdimid, &ydimid); + int nydims = cdf_get_xydimid(ndims, ncvar->dimids, dimtype, &xdimid, &ydimid); int xaxisid = (xdimid != CDI_UNDEFID) ? ncdims[xdimid].ncvarid : CDI_UNDEFID; int yaxisid = (ydimid != CDI_UNDEFID) ? ncdims[ydimid].ncvarid : CDI_UNDEFID; - const int xvarid = (ncvar->xvarid != CDI_UNDEFID) ? ncvar->xvarid : xaxisid; - const int yvarid = (ncvar->yvarid != CDI_UNDEFID) ? ncvar->yvarid : yaxisid; + int xvarid = (ncvar->xvarid != CDI_UNDEFID) ? ncvar->xvarid : xaxisid; + int yvarid = (ncvar->yvarid != CDI_UNDEFID) ? ncvar->yvarid : yaxisid; size_t xsize = (xdimid != CDI_UNDEFID) ? ncdims[xdimid].len : 0; size_t ysize = (ydimid != CDI_UNDEFID) ? ncdims[ydimid].len : 0; @@ -2903,7 +2883,7 @@ cdf_define_all_grids(stream_t *streamptr, ncgrid_t *ncgrid, int vlistID, ncdim_t } } - const int gmapvarid = ncvar->gmapid; + int gmapvarid = ncvar->gmapid; bool lproj = (gmapvarid != CDI_UNDEFID); if (!lproj && xaxisid != CDI_UNDEFID && xaxisid != xvarid && yaxisid != CDI_UNDEFID && yaxisid != yvarid) lproj = true; @@ -2917,16 +2897,16 @@ cdf_define_all_grids(stream_t *streamptr, ncgrid_t *ncgrid, int vlistID, ncdim_t ysize = xsize; } - const bool lgrid = !(lproj && ncvar->xvarid == CDI_UNDEFID); + bool lgrid = !(lproj && ncvar->xvarid == CDI_UNDEFID); - const bool lunstructured = (xdimid != CDI_UNDEFID && xdimid == ydimid && nydims == 0); - if ((ncvar->gridtype == CDI_UNDEFID || ncvar->gridtype == GRID_GENERIC) && lunstructured) + bool isUnstructured = (xdimid != CDI_UNDEFID && xdimid == ydimid && nydims == 0); + if ((ncvar->gridtype == CDI_UNDEFID || ncvar->gridtype == GRID_GENERIC) && isUnstructured) ncvar->gridtype = GRID_UNSTRUCTURED; struct cdfLazyGrid *lazyGrid = NULL, *lazyProj = NULL; { - const int gridtype = (!lgrid) ? GRID_PROJECTION : ncvar->gridtype; + int gridtype = (!lgrid) ? GRID_PROJECTION : ncvar->gridtype; if (CDI_Netcdf_Lazy_Grid_Load) { cdfLazyGridRenew(&lazyGrid, gridtype); @@ -2944,8 +2924,37 @@ cdf_define_all_grids(stream_t *streamptr, ncgrid_t *ncgrid, int vlistID, ncdim_t xaxisid = (xdimid != CDI_UNDEFID) ? ncdims[xdimid].ncvarid : CDI_UNDEFID; yaxisid = (ydimid != CDI_UNDEFID) ? ncdims[ydimid].ncvarid : CDI_UNDEFID; + // process query information if available + CdiQuery *query = streamptr->query; + if (query) + { + if (ncvar->gridtype != GRID_UNSTRUCTURED) + { + Warning("Query parameter cell is only available for unstructured grids, skipped variable %s!", ncvar->name); + ncvar->varStatus = UndefVar; + continue; + } + + int numCellidx = cdiQueryNumCellidx(query); + if (numCellidx > 0) + { + size_t start = cdiQueryGetCellidx(query, 0); + size_t count = (numCellidx == 2) ? cdiQueryGetCellidx(query, 1) : 1; + if ((start + count) <= xsize) + { + cdiQueryCellidx(query, start); + if (numCellidx == 2) cdiQueryCellidx(query, count); + xsize = count; + ysize = count; + gridPart.start = start - 1; + gridPart.count = count; + gridPart.readPart = true; + } + } + } + if (cdf_read_coordinates(streamptr, lazyGrid, ncvar, ncvars, ncdims, gridInfo->timedimid, xvarid, yvarid, xsize, ysize, - &vdimid)) + &vdimid, &gridPart)) continue; if (gridInfo->number_of_grid_used != CDI_UNDEFID && (grid->type == CDI_UNDEFID || grid->type == GRID_GENERIC) @@ -2953,13 +2962,13 @@ cdf_define_all_grids(stream_t *streamptr, ncgrid_t *ncgrid, int vlistID, ncdim_t grid->type = GRID_UNSTRUCTURED; if (!ncvar->isCubeSphere && grid->type == GRID_UNSTRUCTURED) - if (cdf_set_unstructured_par(ncvar, grid, &xdimid, &ydimid, gridInfo)) continue; + if (cdf_set_unstructured_par(ncvar, grid, &xdimid, &ydimid, gridInfo, gridPart.readPart)) continue; if (lgrid && lproj) { int dimid; cdf_read_coordinates(streamptr, lazyProj, ncvar, ncvars, ncdims, gridInfo->timedimid, xaxisid, yaxisid, xsize, ysize, - &dimid); + &dimid, NULL); } if (CDI_Debug) @@ -2977,17 +2986,18 @@ cdf_define_all_grids(stream_t *streamptr, ncgrid_t *ncgrid, int vlistID, ncdim_t gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 1); ncvar->gridID = gridAdded.Id; + ncvar->gridSize = grid->size; - const int gridID = ncvar->gridID; + int gridID = ncvar->gridID; if (lproj && gmapvarid != CDI_UNDEFID) { - const bool gridIsNew = lgrid ? projAdded.isNew : gridAdded.isNew; + bool gridIsNew = lgrid ? projAdded.isNew : gridAdded.isNew; if (gridIsNew) { - const int projID = lgrid ? grid->proj : gridID; - const int ncid = ncvars[gmapvarid].ncid; - const int gmapvartype = ncvars[gmapvarid].xtype; + int projID = lgrid ? grid->proj : gridID; + int ncid = ncvars[gmapvarid].ncid; + int gmapvartype = ncvars[gmapvarid].xtype; cdiDefKeyInt(projID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARTYPE, gmapvartype); const char *gmapvarname = ncvars[gmapvarid].name; cdf_read_mapping_atts(ncid, gmapvarid, projID); @@ -2996,11 +3006,17 @@ cdf_define_all_grids(stream_t *streamptr, ncgrid_t *ncgrid, int vlistID, ncdim_t } } - if (grid->type == GRID_UNSTRUCTURED && gridInfo->gridfile[0] != 0) gridDefReference(gridID, gridInfo->gridfile); + if (grid->type == GRID_UNSTRUCTURED && gridInfo->gridfile[0] != 0 && !gridPart.readPart) + gridDefReference(gridID, gridInfo->gridfile); - if (ncvar->chunked) grid_set_chunktype(grid, ncvar); + if (ncvar->isChunked) grid_set_chunktype(grid, ncvar); - const int gridindex = vlistGridIndex(vlistID, gridID); + int gridindex = vlistGridIndex(vlistID, gridID); + if (gridPart.readPart) + { + ncgrid[gridindex].start = gridPart.start; + ncgrid[gridindex].count = gridPart.count; + } ncgrid[gridindex].gridID = gridID; if (grid->type == GRID_TRAJECTORY) { @@ -3028,25 +3044,8 @@ cdf_define_all_grids(stream_t *streamptr, ncgrid_t *ncgrid, int vlistID, ncdim_t if (gridAdded.isNew) lazyGrid = NULL; if (projAdded.isNew) lazyProj = NULL; - if (lazyGrid) - { - if (CDI_Netcdf_Lazy_Grid_Load) cdfLazyGridDestroy(lazyGrid); - if (grid) - { - grid_free(grid); - Free(grid); - } - } - - if (lazyProj) - { - if (CDI_Netcdf_Lazy_Grid_Load) cdfLazyGridDestroy(lazyProj); - if (proj) - { - grid_free(proj); - Free(proj); - } - } + if (lazyGrid) destroy_grid(lazyGrid, grid); + if (lazyProj) destroy_grid(lazyProj, proj); } } @@ -3067,8 +3066,8 @@ cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nvar ncvar_t *ncvar = &ncvars[ncvarid]; if (ncvar->varStatus == DataVar && ncvar->zaxisID == CDI_UNDEFID) { - bool is_scalar = false; - bool with_bounds = false; + bool isScalar = false; + bool withBounds = false; int zdimid = CDI_UNDEFID; int zvarid = CDI_UNDEFID; size_t zsize = 1; @@ -3081,7 +3080,7 @@ cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nvar if (ncvar->zvarid != -1 && ncvars[ncvar->zvarid].ndims == 0) { zvarid = ncvar->zvarid; - is_scalar = true; + isScalar = true; } else { @@ -3126,7 +3125,7 @@ cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nvar // clang-format on // don't change the name !!! /* - if ((len = strlen(pname)) > 2) + if ((len = strlen(pname)) > 2) if (pname[len-2] == '_' && isdigit((int) pname[len-1])) pname[len-2] = 0; */ #ifndef USE_MPI @@ -3155,14 +3154,14 @@ cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nvar if (ncvars[zvarid].bounds != CDI_UNDEFID) { - const int nbdims = ncvars[ncvars[zvarid].bounds].ndims; - if (nbdims == 2 || is_scalar) + int nbdims = ncvars[ncvars[zvarid].bounds].ndims; + if (nbdims == 2 || isScalar) { - const size_t nlevel = is_scalar ? 1 : ncdims[ncvars[ncvars[zvarid].bounds].dimids[0]].len; - const int nvertex = (int) ncdims[ncvars[ncvars[zvarid].bounds].dimids[1 - is_scalar]].len; + size_t nlevel = isScalar ? 1 : ncdims[ncvars[ncvars[zvarid].bounds].dimids[0]].len; + int nvertex = (int) ncdims[ncvars[ncvars[zvarid].bounds].dimids[1 - isScalar]].len; if (nlevel == zsize && nvertex == 2) { - with_bounds = true; + withBounds = true; lbounds = (double *) Malloc(4 * nlevel * sizeof(double)); ubounds = lbounds + nlevel; double *zbounds = lbounds + 2 * nlevel; @@ -3200,10 +3199,11 @@ cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nvar return CDI_EDIMSIZE; } - ncvar->zaxisID = varDefZaxis(vlistID, zaxisType, (int) zsize, zvar, (const char **) zcvals, zclength, with_bounds, - lbounds, ubounds, (int) vctsize, vct, pname, plongname, punits, zdatatype, 1, 0, -1); + ncvar->numLevels = zsize; + ncvar->zaxisID = varDefZaxis(vlistID, zaxisType, (int) zsize, zvar, (const char **) zcvals, zclength, withBounds, lbounds, + ubounds, (int) vctsize, vct, pname, plongname, punits, zdatatype, 1, 0, -1); - const int zaxisID = ncvar->zaxisID; + int zaxisID = ncvar->zaxisID; if (CDI_CMOR_Mode && zsize == 1 && zaxisType != ZAXIS_HYBRID) zaxisDefScalar(zaxisID); @@ -3225,7 +3225,7 @@ cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nvar } if (positive > 0) zaxisDefPositive(zaxisID, positive); - if (is_scalar) zaxisDefScalar(zaxisID); + if (isScalar) zaxisDefScalar(zaxisID); if (zdimid != CDI_UNDEFID) cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_DIMNAME, ncdims[zdimid].name); @@ -3239,16 +3239,16 @@ cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int nvar if (zvarid != CDI_UNDEFID) { - const int ncid = ncvars[zvarid].ncid; - const int nvatts = ncvars[zvarid].natts; + int ncid = ncvars[zvarid].ncid; + int nvatts = ncvars[zvarid].natts; for (int iatt = 0; iatt < nvatts; ++iatt) { - const int attnum = ncvars[zvarid].atts[iatt]; - cdf_set_cdi_attr(ncid, zvarid, attnum, zaxisID, CDI_GLOBAL); + int attnum = ncvars[zvarid].atts[iatt]; + cdf_set_cdi_attr(ncid, zvarid, attnum, zaxisID, CDI_GLOBAL, false); } } - const int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); + int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); streamptr->zaxisID[zaxisindex] = zdimid >= 0 ? ncdims[zdimid].dimid : zdimid; if (CDI_Debug) Message("zaxisID %d %d %s", zaxisID, ncvarid, ncvar->name); @@ -3300,13 +3300,13 @@ cdf_cmp_varname(const void *s1, const void *s2) } static void -cdf_sort_varnames(int *varids, const int nvars, const ncvar_t *ncvars) +cdf_sort_varnames(int *varids, int nvars, const ncvar_t *ncvars) { struct cdf_varinfo *varInfo = (struct cdf_varinfo *) Malloc((size_t) nvars * sizeof(struct cdf_varinfo)); for (int varID = 0; varID < nvars; varID++) { - const int ncvarid = varids[varID]; + int ncvarid = varids[varID]; varInfo[varID].varid = ncvarid; varInfo[varID].name = ncvars[ncvarid].name; } @@ -3328,20 +3328,14 @@ cdf_define_code_and_param(int vlistID, int varID) char name[CDI_MAX_NAME]; name[0] = 0; vlistInqVarName(vlistID, varID, name); - const size_t len = strlen(name); + size_t len = strlen(name); if (len > 3 && isdigit((int) name[3])) { - if (strStartsWith(name, "var")) - { - vlistDefVarCode(vlistID, varID, atoi(name + 3)); - } + if (strStartsWith(name, "var")) vlistDefVarCode(vlistID, varID, atoi(name + 3)); } else if (len > 4 && isdigit((int) name[4])) { - if (strStartsWith(name, "code")) - { - vlistDefVarCode(vlistID, varID, atoi(name + 4)); - } + if (strStartsWith(name, "code")) vlistDefVarCode(vlistID, varID, atoi(name + 4)); } else if (len > 5 && isdigit((int) name[5])) { @@ -3361,7 +3355,7 @@ cdf_define_institut_and_model_id(int vlistID, int varID) int varInstID = vlistInqVarInstitut(vlistID, varID); int varModelID = vlistInqVarModel(vlistID, varID); int varTableID = vlistInqVarTable(vlistID, varID); - const int code = vlistInqVarCode(vlistID, varID); + int code = vlistInqVarCode(vlistID, varID); if (CDI_Default_TableID != CDI_UNDEFID) { char name[CDI_MAX_NAME]; @@ -3397,10 +3391,60 @@ cdf_define_institut_and_model_id(int vlistID, int varID) if (varTableID != CDI_UNDEFID) vlistDefVarTable(vlistID, varID, varTableID); } +static int +cdf_xtype_to_numbytes(int xtype) +{ + int numBytes = 8; + + // clang-format off + if (xtype == NC_BYTE ) numBytes = 1; + else if (xtype == NC_CHAR ) numBytes = 1; + else if (xtype == NC_SHORT ) numBytes = 2; + else if (xtype == NC_INT ) numBytes = 4; + else if (xtype == NC_FLOAT ) numBytes = 4; +#ifdef HAVE_NETCDF4 + else if (xtype == NC_UBYTE ) numBytes = 1; + else if (xtype == NC_LONG ) numBytes = 4; + else if (xtype == NC_USHORT) numBytes = 2; + else if (xtype == NC_UINT ) numBytes = 4; +#endif + // clang-format on + + return numBytes; +} + +static size_t +calc_chunk_cache_size(int timedimid, ncvar_t *ncvar) +{ + size_t chunkCacheSize = ncvar->gridSize; + + chunkCacheSize *= (ncvar->dimids[0] == timedimid) ? ncvar->chunks[0] : 1; + + int zdimid = CDI_UNDEFID; + for (int i = 0; i < ncvar->ndims; i++) + { + if (ncvar->dimtype[i] == Z_AXIS) zdimid = ncvar->dimids[i]; + } + if (zdimid != CDI_UNDEFID) chunkCacheSize *= ncvar->chunks[zdimid]; + + chunkCacheSize *= cdf_xtype_to_numbytes(ncvar->xtype); + + if (CDI_Chunk_Cache_Max > 0 && chunkCacheSize > CDI_Chunk_Cache_Max) chunkCacheSize = CDI_Chunk_Cache_Max; + + return chunkCacheSize; +} + +static void +cdf_set_var_chunk_cache(ncvar_t *ncvar, int ncvarid, size_t chunckCacheSize) +{ + if (CDI_Debug) Message("%s: chunckCacheSize=%zu", ncvar->name, chunckCacheSize); + nc_set_var_chunk_cache(ncvar->ncid, ncvarid, chunckCacheSize, ncvar->chunkCacheNelems, ncvar->chunkCachePreemption); +} + // define all input data variables static void cdf_define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID, int nvars, int num_ncvars, ncvar_t *ncvars, - ncdim_t *ncdims) + ncdim_t *ncdims, int timedimid) { int *varids = (int *) Malloc((size_t) nvars * sizeof(int)); int n = 0; @@ -3414,19 +3458,29 @@ cdf_define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID, i for (int varID1 = 0; varID1 < nvars; varID1++) { - const int ncvarid = varids[varID1]; + int ncvarid = varids[varID1]; ncvar_t *ncvar = &ncvars[ncvarid]; - const int gridID = ncvar->gridID; - const int zaxisID = ncvar->zaxisID; + int gridID = ncvar->gridID; + int zaxisID = ncvar->zaxisID; stream_new_var(streamptr, gridID, zaxisID, CDI_UNDEFID); - const int varID = vlistDefVar(vlistID, gridID, zaxisID, ncvar->timetype); + int varID = vlistDefVar(vlistID, gridID, zaxisID, ncvar->timetype); #ifdef HAVE_NETCDF4 - if (ncvar->ldeflate) vlistDefVarCompType(vlistID, varID, CDI_COMPRESS_ZIP); - if (ncvar->lszip) vlistDefVarCompType(vlistID, varID, CDI_COMPRESS_SZIP); - if (ncvar->chunked && ncvar->chunkType != CDI_UNDEFID) cdiDefKeyInt(vlistID, varID, CDI_KEY_CHUNKTYPE, ncvar->chunkType); - if (ncvar->chunked && ncvar->chunkSize > 1) cdiDefKeyInt(vlistID, varID, CDI_KEY_CHUNKSIZE, ncvar->chunkSize); + if (ncvar->hasFilter) vlistDefVarCompType(vlistID, varID, CDI_COMPRESS_FILTER); + if (ncvar->hasDeflate) vlistDefVarCompType(vlistID, varID, CDI_COMPRESS_ZIP); + if (ncvar->hasSzip) vlistDefVarCompType(vlistID, varID, CDI_COMPRESS_SZIP); + if (ncvar->isChunked) + { + if (ncvar->chunkType != CDI_UNDEFID) cdiDefKeyInt(vlistID, varID, CDI_KEY_CHUNKTYPE, ncvar->chunkType); + if (ncvar->chunkSize > 1) cdiDefKeyInt(vlistID, varID, CDI_KEY_CHUNKSIZE, ncvar->chunkSize); + + size_t varChunkCacheSize = calc_chunk_cache_size(timedimid, ncvar); + if (CDI_Chunk_Cache > 0) + cdf_set_var_chunk_cache(ncvar, ncvarid, CDI_Chunk_Cache); + else if (varChunkCacheSize > ncvar->chunkCacheSize) + cdf_set_var_chunk_cache(ncvar, ncvarid, varChunkCacheSize); + } #endif streamptr->vars[varID1].defmiss = false; @@ -3438,41 +3492,41 @@ cdf_define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID, i if (ncvar->code != CDI_UNDEFID) vlistDefVarParam(vlistID, varID, cdiEncodeParam(ncvar->code, ncvar->tabnum, 255)); if (ncvar->longname[0]) cdiDefKeyString(vlistID, varID, CDI_KEY_LONGNAME, ncvar->longname); if (ncvar->stdname[0]) cdiDefKeyString(vlistID, varID, CDI_KEY_STDNAME, ncvar->stdname); - if (ncvar->units[0]) cdiDefKeyString(vlistID, varID, CDI_KEY_UNITS, ncvar->units); + if (ncvar->unitsLen > 0) cdiDefKeyString(vlistID, varID, CDI_KEY_UNITS, ncvar->units); - if (ncvar->lvalidrange) vlistDefVarValidrange(vlistID, varID, ncvar->validrange); + if (ncvar->validrangeDefined) vlistDefVarValidrange(vlistID, varID, ncvar->validrange); - if (IS_NOT_EQUAL(ncvar->addoffset, 0)) vlistDefVarAddoffset(vlistID, varID, ncvar->addoffset); - if (IS_NOT_EQUAL(ncvar->scalefactor, 1)) vlistDefVarScalefactor(vlistID, varID, ncvar->scalefactor); + if (IS_NOT_EQUAL(ncvar->addoffset, 0.0)) cdiDefKeyFloat(vlistID, varID, CDI_KEY_ADDOFFSET, ncvar->addoffset); + if (IS_NOT_EQUAL(ncvar->scalefactor, 1.0)) cdiDefKeyFloat(vlistID, varID, CDI_KEY_SCALEFACTOR, ncvar->scalefactor); - vlistDefVarDatatype(vlistID, varID, cdfInqDatatype(streamptr, ncvar->xtype, ncvar->lunsigned)); + vlistDefVarDatatype(vlistID, varID, cdfInqDatatype(streamptr, ncvar->xtype, ncvar->isUnsigned)); vlistDefVarInstitut(vlistID, varID, instID); vlistDefVarModel(vlistID, varID, modelID); if (ncvar->tableID != CDI_UNDEFID) vlistDefVarTable(vlistID, varID, ncvar->tableID); - if (ncvar->deffillval == false && ncvar->defmissval) + if (ncvar->fillvalDefined == false && ncvar->missvalDefined) { - ncvar->deffillval = true; + ncvar->fillvalDefined = true; ncvar->fillval = ncvar->missval; } - if (ncvar->deffillval) vlistDefVarMissval(vlistID, varID, ncvar->fillval); + if (ncvar->fillvalDefined) vlistDefVarMissval(vlistID, varID, ncvar->fillval); if (CDI_Debug) Message("varID = %d gridID = %d zaxisID = %d", varID, vlistInqVarGrid(vlistID, varID), vlistInqVarZaxis(vlistID, varID)); - const int gridindex = vlistGridIndex(vlistID, gridID); - const int xdimid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X]; - const int ydimid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y]; + int gridindex = vlistGridIndex(vlistID, gridID); + int xdimid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_X]; + int ydimid = streamptr->ncgrid[gridindex].ncIDs[CDF_DIMID_Y]; - const int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); - const int zdimid = streamptr->zaxisID[zaxisindex]; + int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); + int zdimid = streamptr->zaxisID[zaxisindex]; - const int ndims = ncvar->ndims; + int ndims = ncvar->ndims; static const int ipow10[4] = { 1, 10, 100, 1000 }; - const int iodim = (ncvar->timetype != TIME_CONSTANT); + int iodim = (ncvar->timetype != TIME_CONSTANT); const int *dimids = ncvar->dimids; @@ -3485,7 +3539,7 @@ cdf_define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID, i { for (int idim = iodim; idim < ndims; idim++) { - const int dimid = ncdims[dimids[idim]].dimid; + int dimid = ncdims[dimids[idim]].dimid; // clang-format off if (xdimid == dimid) ixyz += 1*ipow10[ndims-idim-1]; else if (ydimid == dimid) ixyz += 2*ipow10[ndims-idim-1]; @@ -3510,16 +3564,16 @@ cdf_define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID, i cdiDefKeyInt(vlistID, varID, CDI_KEY_PERTURBATIONNUMBER, ncvar->perturbationNumber); } - if (ncvar->extra[0] != 0) vlistDefVarExtra(vlistID, varID, ncvar->extra); + if (ncvar->extra[0] != 0) cdiDefKeyString(vlistID, varID, CDI_KEY_CHUNKS, ncvar->extra); } for (int varID = 0; varID < nvars; varID++) { - const int ncvarid = varids[varID]; + int ncvarid = varids[varID]; ncvar_t *ncvar = &ncvars[ncvarid]; - const int ncid = ncvar->ncid; - const int nvatts = ncvar->natts; - for (int iatt = 0; iatt < nvatts; ++iatt) cdf_set_cdi_attr(ncid, ncvarid, ncvar->atts[iatt], vlistID, varID); + int ncid = ncvar->ncid; + int nvatts = ncvar->natts; + for (int iatt = 0; iatt < nvatts; ++iatt) cdf_set_cdi_attr(ncid, ncvarid, ncvar->atts[iatt], vlistID, varID, false); if (ncvar->atts) Free(ncvar->atts); if (ncvar->vct) Free(ncvar->vct); @@ -3544,7 +3598,7 @@ cdf_copy_attint(int fileID, int vlistID, nc_type xtype, size_t attlen, char *att int attint[8]; int *pattint = (attlen > 8) ? (int *) malloc(attlen * sizeof(int)) : attint; cdfGetAttInt(fileID, NC_GLOBAL, attname, attlen, pattint); - const int datatype = (xtype == NC_SHORT) ? CDI_DATATYPE_INT16 : CDI_DATATYPE_INT32; + int datatype = (xtype == NC_SHORT) ? CDI_DATATYPE_INT16 : CDI_DATATYPE_INT32; cdiDefAttInt(vlistID, CDI_GLOBAL, attname, datatype, (int) attlen, pattint); if (attlen > 8) free(pattint); } @@ -3555,7 +3609,7 @@ cdf_copy_attflt(int fileID, int vlistID, nc_type xtype, size_t attlen, char *att double attflt[8]; double *pattflt = (attlen > 8) ? (double *) malloc(attlen * sizeof(double)) : attflt; cdfGetAttDouble(fileID, NC_GLOBAL, attname, attlen, pattflt); - const int datatype = (xtype == NC_FLOAT) ? CDI_DATATYPE_FLT32 : CDI_DATATYPE_FLT64; + int datatype = (xtype == NC_FLOAT) ? CDI_DATATYPE_FLT32 : CDI_DATATYPE_FLT64; cdiDefAttFlt(vlistID, CDI_GLOBAL, attname, datatype, (int) attlen, pattflt); if (attlen > 8) free(pattflt); } @@ -3564,7 +3618,7 @@ static bool check_cube_sphere(int vlistID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims) { bool isGeosData = false; - const int numNames = 4; + int numNames = 4; const char *attnames[] = { "additional_vars", "file_format_version", "gridspec_file", "grid_mapping_name" }; const char *grid_mapping = "gnomonic cubed-sphere"; char attstring[256]; @@ -3586,12 +3640,12 @@ check_cube_sphere(int vlistID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims) if (ncvar->ndims == 1) { int dimid = ncvar->dimids[0]; - if (ncdims[dimid].len == 6 && strIsEqual(nf_name, ncvar->name)) + if (ncdims[dimid].len == 6 && str_is_equal(nf_name, ncvar->name)) { isGeosData = true; nf_dimid = ncvar->dimids[0]; } - if (ncdims[dimid].len == 4 && strIsEqual(ncontact_name, ncvar->name)) ncontact_dimid = ncvar->dimids[0]; + if (ncdims[dimid].len == 4 && str_is_equal(ncontact_name, ncvar->name)) ncontact_dimid = ncvar->dimids[0]; } if (isGeosData && ncontact_dimid != -1) break; } @@ -3603,14 +3657,15 @@ check_cube_sphere(int vlistID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims) for (int varid = 0; varid < nvars; ++varid) { ncvar_t *ncvar = &ncvars[varid]; - if (strIsEqual("orientation", ncvar->name) || strIsEqual("anchor", ncvar->name) || strIsEqual("contacts", ncvar->name)) + if (str_is_equal("orientation", ncvar->name) || str_is_equal("anchor", ncvar->name) + || str_is_equal("contacts", ncvar->name)) cdf_set_var(ncvar, CoordVar); } for (int varid = 0; varid < nvars; ++varid) { ncvar_t *ncvar = &ncvars[varid]; - const int ndims = ncvar->ndims; + int ndims = ncvar->ndims; if (ndims >= 3 && ncvar->dimids[ndims - 3] == nf_dimid && ncvar->ncoordvars == 2 && ncvar->gmapid != -1) ncvar->isCubeSphere = true; } @@ -3620,14 +3675,14 @@ check_cube_sphere(int vlistID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims) for (int varid = 0; varid < nvars; ++varid) { ncvar_t *ncvar = &ncvars[varid]; - const int ndims = ncvar->ndims; + int ndims = ncvar->ndims; if (ndims == 3) { // clang-format off - if (strIsEqual("lons", ncvar->name)) xvarid = varid; - else if (strIsEqual("lats", ncvar->name)) yvarid = varid; - else if (strIsEqual("corner_lons", ncvar->name)) xboundsid = varid; - else if (strIsEqual("corner_lats", ncvar->name)) yboundsid = varid; + if (str_is_equal("lons", ncvar->name)) xvarid = varid; + else if (str_is_equal("lats", ncvar->name)) yvarid = varid; + else if (str_is_equal("corner_lons", ncvar->name)) xboundsid = varid; + else if (str_is_equal("corner_lats", ncvar->name)) yboundsid = varid; // clang-format on } if (xvarid != -1 && xboundsid != -1 && yvarid != -1 && yboundsid != -1) @@ -3648,10 +3703,9 @@ static void cdf_scan_global_attr(int fileID, int vlistID, int ngatts, int *instID, int *modelID, bool *ucla_les, unsigned char *uuidOfVGrid, GridInfo *gridInfo) { - nc_type xtype; - size_t attlen; - char attname[CDI_MAX_NAME]; - char attstring[65636]; + nc_type xtype = 0; + size_t attlen = 0; + char attname[CDI_MAX_NAME] = { 0 }; for (int iatt = 0; iatt < ngatts; iatt++) { @@ -3661,63 +3715,72 @@ cdf_scan_global_attr(int fileID, int vlistID, int ngatts, int *instID, int *mode if (xtypeIsText(xtype)) { - cdfGetAttText(fileID, NC_GLOBAL, attname, sizeof(attstring), attstring); + enum + { + attstringsize = 65636 + }; + char attstring[attstringsize] = { 0 }; - const size_t attstrlen = strlen(attstring); + cdfGetAttText(fileID, NC_GLOBAL, attname, attstringsize, attstring); + + size_t attstrlen = strlen(attstring); if (attlen > 0 && attstring[0] != 0) { - if (strIsEqual(attname, "institution")) + if (str_is_equal(attname, "institution")) { *instID = institutInq(0, 0, NULL, attstring); if (*instID == CDI_UNDEFID) *instID = institutDef(0, 0, NULL, attstring); + + cdiDefAttTxt(vlistID, CDI_GLOBAL, attname, (int) attstrlen, attstring); } - else if (strIsEqual(attname, "source")) + else if (str_is_equal(attname, "source")) { *modelID = modelInq(-1, 0, attstring); if (*modelID == CDI_UNDEFID) *modelID = modelDef(-1, 0, attstring); + + cdiDefAttTxt(vlistID, CDI_GLOBAL, attname, (int) attstrlen, attstring); } - else if (strIsEqual(attname, "Source") && strStartsWith(attstring, "UCLA-LES")) + else if (str_is_equal(attname, "Source") && strStartsWith(attstring, "UCLA-LES")) { *ucla_les = true; + cdiDefAttTxt(vlistID, CDI_GLOBAL, attname, (int) attstrlen, attstring); } /* - else if ( strIsEqual(attname, "Conventions") ) + else if ( str_is_equal(attname, "Conventions") ) { } */ - else if (strIsEqual(attname, "_NCProperties")) + else if (str_is_equal(attname, "_NCProperties")) { } - else if (strIsEqual(attname, "CDI")) + else if (str_is_equal(attname, "CDI")) { } - else if (strIsEqual(attname, "CDO")) + else if (str_is_equal(attname, "CDO")) { } /* - else if ( strIsEqual(attname, "forecast_reference_time") ) + else if ( str_is_equal(attname, "forecast_reference_time") ) { memcpy(fcreftime, attstring, attstrlen+1); } */ - else if (strIsEqual(attname, "grid_file_uri")) + else if (str_is_equal(attname, "grid_file_uri")) { memcpy(gridInfo->gridfile, attstring, attstrlen + 1); } - else if (strIsEqual(attname, "uuidOfHGrid") && attstrlen == 36) + else if (attstrlen == 36 && str_is_equal(attname, "uuidOfHGrid")) { - attstring[36] = 0; cdiStr2UUID(attstring, gridInfo->uuid); } - else if (strIsEqual(attname, "uuidOfVGrid") && attstrlen == 36) + else if (attstrlen == 36 && str_is_equal(attname, "uuidOfVGrid")) { - attstring[36] = 0; cdiStr2UUID(attstring, uuidOfVGrid); } else { - if (strIsEqual(attname, "ICON_grid_file_uri") && gridInfo->gridfile[0] == 0) + if (str_is_equal(attname, "ICON_grid_file_uri") && gridInfo->gridfile[0] == 0) memcpy(gridInfo->gridfile, attstring, attstrlen + 1); cdiDefAttTxt(vlistID, CDI_GLOBAL, attname, (int) attstrlen, attstring); @@ -3730,7 +3793,7 @@ cdf_scan_global_attr(int fileID, int vlistID, int ngatts, int *instID, int *mode } else if (xtype == NC_SHORT || xtype == NC_INT) { - if (strIsEqual(attname, "number_of_grid_used")) + if (str_is_equal(attname, "number_of_grid_used")) { gridInfo->number_of_grid_used = CDI_UNDEFID; cdfGetAttInt(fileID, NC_GLOBAL, attname, 1, &gridInfo->number_of_grid_used); @@ -3756,7 +3819,7 @@ find_leadtime(int nvars, ncvar_t *ncvars, int timedimid) { ncvar_t *ncvar = &ncvars[ncvarid]; if (ncvar->ndims == 1 && timedimid == ncvar->dimids[0]) - if (ncvar->stdname[0] && strIsEqual(ncvar->stdname, "forecast_period")) + if (ncvar->stdname[0] && str_is_equal(ncvar->stdname, "forecast_period")) { leadtime_id = ncvarid; break; @@ -3767,8 +3830,8 @@ find_leadtime(int nvars, ncvar_t *ncvars, int timedimid) } static void -find_time_vars(int nvars, ncvar_t *ncvars, ncdim_t *ncdims, int timedimid, stream_t *streamptr, bool *time_has_units, - bool *time_has_bounds, bool *time_climatology) +find_time_vars(int nvars, ncvar_t *ncvars, ncdim_t *ncdims, int timedimid, stream_t *streamptr, bool *timeHasUnits, + bool *timeHasBounds, bool *timeClimatology) { int ncvarid; @@ -3779,30 +3842,27 @@ find_time_vars(int nvars, ncvar_t *ncvars, ncdim_t *ncdims, int timedimid, strea for (ncvarid = 0; ncvarid < nvars; ncvarid++) { ncvar_t *ncvar = &ncvars[ncvarid]; - if (ncvar->ndims == 0 && strIsEqual(ncvar->name, "time")) + if (ncvar->ndims == 0 && ncvar->units[0] && str_is_equal(ncvar->name, "time")) { - if (ncvar->units[0]) - { - strcpy(timeUnitsStr, ncvar->units); - strToLower(timeUnitsStr); + strcpy(timeUnitsStr, ncvar->units); + str_to_lower(timeUnitsStr); - if (is_time_units(timeUnitsStr)) - { - streamptr->basetime.ncvarid = ncvarid; - break; - } + if (is_time_units(timeUnitsStr)) + { + streamptr->basetime.ncvarid = ncvarid; + break; } } } } else { - bool ltimevar = false; + bool hasTimeVar = false; if (ncdims[timedimid].ncvarid != CDI_UNDEFID) { streamptr->basetime.ncvarid = ncdims[timedimid].ncvarid; - ltimevar = true; + hasTimeVar = true; } for (ncvarid = 0; ncvarid < nvars; ncvarid++) @@ -3813,11 +3873,10 @@ find_time_vars(int nvars, ncvar_t *ncvars, ncdim_t *ncdims, int timedimid, strea { ncvar->varStatus = CoordVar; - if (!ltimevar) + if (!hasTimeVar) { + hasTimeVar = true; streamptr->basetime.ncvarid = ncvarid; - ltimevar = true; - if (CDI_Debug) fprintf(stderr, "timevar %s\n", ncvar->name); } else { @@ -3826,7 +3885,7 @@ find_time_vars(int nvars, ncvar_t *ncvars, ncdim_t *ncdims, int timedimid, strea } } - if (ltimevar == false) // search for WRF time description + if (hasTimeVar == false) // search for WRF time description { for (ncvarid = 0; ncvarid < nvars; ncvarid++) { @@ -3836,7 +3895,7 @@ find_time_vars(int nvars, ncvar_t *ncvars, ncdim_t *ncdims, int timedimid, strea { ncvar->isTaxis = true; streamptr->basetime.ncvarid = ncvarid; - streamptr->basetime.lwrf = true; + streamptr->basetime.isWRF = true; break; } } @@ -3845,16 +3904,16 @@ find_time_vars(int nvars, ncvar_t *ncvars, ncdim_t *ncdims, int timedimid, strea // time varID ncvarid = streamptr->basetime.ncvarid; - if (ncvarid == CDI_UNDEFID) Warning("Time variable >%s< not found!", ncdims[timedimid].name); + if (ncvarid == CDI_UNDEFID && ncdims[timedimid].len > 0) Warning("Time variable >%s< not found!", ncdims[timedimid].name); } // time varID ncvarid = streamptr->basetime.ncvarid; - if (ncvarid != CDI_UNDEFID && streamptr->basetime.lwrf == false) + if (ncvarid != CDI_UNDEFID && streamptr->basetime.isWRF == false) { ncvar_t *ncvar = &ncvars[ncvarid]; - if (ncvar->units[0] != 0) *time_has_units = true; + if (ncvar->units[0] != 0) *timeHasUnits = true; if (ncvar->bounds != CDI_UNDEFID) { @@ -3864,9 +3923,9 @@ find_time_vars(int nvars, ncvar_t *ncvars, ncdim_t *ncdims, int timedimid, strea int len = (int) ncdims[ncvars[ncvar->bounds].dimids[nbdims - 1]].len; if (len == 2 && timedimid == ncvars[ncvar->bounds].dimids[0]) { - *time_has_bounds = true; + *timeHasBounds = true; streamptr->basetime.ncvarboundsid = ncvar->bounds; - if (ncvar->isClimatology) *time_climatology = true; + if (ncvar->isClimatology) *timeClimatology = true; } } } @@ -3886,7 +3945,7 @@ read_vct_echam(int fileID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims, double * const char *name = ncvar->name; if (ncvar->ndims == 1) { - const size_t len = strlen(name); + size_t len = strlen(name); if (len == 4 && name[0] == 'h' && name[1] == 'y') { if (name[2] == 'a' && name[3] == 'i') // hyai @@ -3910,7 +3969,7 @@ read_vct_echam(int fileID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims, double * /* else if (ncvar->ndims == 0) { - const size_t len = strlen(name); + size_t len = strlen(name); if (len == 2 && name[0] == 'P' && name[1] == '0') p0_id = ncvarid; } */ @@ -3919,7 +3978,7 @@ read_vct_echam(int fileID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims, double * // read VCT if (nvcth_id != CDI_UNDEFID && vcta_id != CDI_UNDEFID && vctb_id != CDI_UNDEFID) { - const size_t vctsize = 2 * ncdims[nvcth_id].len; + size_t vctsize = 2 * ncdims[nvcth_id].len; *vct = (double *) Malloc(vctsize * sizeof(double)); cdf_get_var_double(fileID, vcta_id, *vct); cdf_get_var_double(fileID, vctb_id, *vct + vctsize / 2); @@ -4007,7 +4066,7 @@ cdf_check_variables(stream_t *streamptr, int nvars, ncvar_t *ncvars, size_t ntst continue; } - if (cdfInqDatatype(streamptr, ncvar->xtype, ncvar->lunsigned) == -1) + if (cdfInqDatatype(streamptr, ncvar->xtype, ncvar->isUnsigned) == -1) { ncvar->varStatus = CoordVar; Warning("Unsupported data type, skipped variable %s!", ncvar->name); @@ -4070,12 +4129,170 @@ cdfVerifyVars(int nvars, ncvar_t *ncvars, ncdim_t *ncdims) } } +static CdiDateTime +wrf_read_timestep(int fileID, int nctimevarid, int tsID) +{ + enum + { + // position of terminator separating date and time from rest of + dateTimeSepPos = 19, + dateTimeStrSize = 128, + }; + const size_t start[2] = { (size_t) tsID, 0 }, count[2] = { 1, dateTimeSepPos }; + char stvalue[dateTimeStrSize]; + stvalue[0] = 0; + cdf_get_vara_text(fileID, nctimevarid, start, count, stvalue); + stvalue[dateTimeSepPos] = 0; + + int year = 1, month = 1, day = 1, hour = 0, minute = 0, second = 0; + if (strlen(stvalue) == dateTimeSepPos) sscanf(stvalue, "%d-%d-%d_%d:%d:%d", &year, &month, &day, &hour, &minute, &second); + return cdiDateTime_set(cdiEncodeDate(year, month, day), cdiEncodeTime(hour, minute, second)); +} + +static double +get_timevalue(int fileID, int nctimevarid, size_t ncStepIndex) +{ + double timevalue = 0.0; + + cdf_get_var1_double(fileID, nctimevarid, &ncStepIndex, &timevalue); + + if (timevalue >= NC_FILL_DOUBLE || timevalue < -NC_FILL_DOUBLE) timevalue = 0.0; + + return timevalue; +} + +static void +cdf_read_timesteps(int numTimesteps, stream_t *streamptr, taxis_t *taxis0) +{ + streamptr->curTsID = 0; + streamptr->rtsteps = 1; + + if (numTimesteps == 0) + { + cdi_create_timesteps(numTimesteps, streamptr); + cdf_create_records(streamptr, 0); + } + else if (numTimesteps < 0) + { + } + else + { + int fileID = streamptr->fileID; + int nctimevarid = streamptr->basetime.ncvarid; + int nctimeboundsid = streamptr->basetime.ncvarboundsid; + bool hasTimesteps = (nctimevarid != CDI_UNDEFID && streamptr->basetime.hasUnits); + + int *ncStepIndices = (int *) malloc(numTimesteps * sizeof(int)); + for (int tsID = 0; tsID < numTimesteps; ++tsID) ncStepIndices[tsID] = tsID; + + CdiDateTime *vDateTimeList = NULL; + + if (hasTimesteps) + { + vDateTimeList = (CdiDateTime *) malloc(numTimesteps * sizeof(CdiDateTime)); + + if (streamptr->basetime.isWRF) + { + for (int tsID = 0; tsID < numTimesteps; ++tsID) vDateTimeList[tsID] = wrf_read_timestep(fileID, nctimevarid, tsID); + } + else + { + for (int tsID = 0; tsID < numTimesteps; ++tsID) + vDateTimeList[tsID] = cdi_decode_timeval(get_timevalue(fileID, nctimevarid, tsID), taxis0); + } + } + + // process query information if available + CdiQuery *query = streamptr->query; + if (query && cdiQueryNumStepidx(query) > 0) + { + for (int tsID = 0; tsID < numTimesteps; ++tsID) + { + if (cdiQueryStepidx(query, tsID + 1) < 0) ncStepIndices[tsID] = -1; + } + } + + int numSteps = 0; + for (int tsID = 0; tsID < numTimesteps; ++tsID) + if (ncStepIndices[tsID] >= 0) numSteps++; + + cdi_create_timesteps(numSteps, streamptr); + + for (int tsID = 0, stepID = 0; tsID < numTimesteps; ++tsID) + { + if (ncStepIndices[tsID] >= 0) + { + streamptr->tsteps[stepID].ncStepIndex = ncStepIndices[tsID]; + cdf_create_records(streamptr, stepID); + + taxis_t *taxis = &streamptr->tsteps[stepID].taxis; + ptaxisCopy(taxis, taxis0); + + if (hasTimesteps) taxis->vDateTime = vDateTimeList[tsID]; + + stepID++; + } + } + + if (ncStepIndices) free(ncStepIndices); + + if (hasTimesteps) + { + if (nctimeboundsid != CDI_UNDEFID) + { + enum + { + numBnds = 2, + tbNdims = 2 + }; + + for (int tsID = 0; tsID < numSteps; ++tsID) + { + size_t ncStepIndex = streamptr->tsteps[tsID].ncStepIndex; + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + const size_t start[tbNdims] = { ncStepIndex, 0 }; + static const size_t count[tbNdims] = { 1, numBnds }; + double timeBnds[numBnds]; + cdf_get_vara_double(fileID, nctimeboundsid, start, count, timeBnds); + for (size_t i = 0; i < numBnds; ++i) + if (timeBnds[i] >= NC_FILL_DOUBLE || timeBnds[i] < -NC_FILL_DOUBLE) timeBnds[i] = 0.0; + + taxis->vDateTime_lb = cdi_decode_timeval(timeBnds[0], taxis); + taxis->vDateTime_ub = cdi_decode_timeval(timeBnds[1], taxis); + } + } + + int leadtimeid = streamptr->basetime.leadtimeid; + if (leadtimeid != CDI_UNDEFID) + { + for (int tsID = 0; tsID < numSteps; ++tsID) + { + size_t ncStepIndex = streamptr->tsteps[tsID].ncStepIndex; + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + cdi_set_forecast_period(get_timevalue(fileID, leadtimeid, ncStepIndex), taxis); + } + } + } + + if (vDateTimeList) free(vDateTimeList); + } +} + +static void +stream_set_ncdims(stream_t *streamptr, int ndims, ncdim_t *ncdims) +{ + int n = (ndims > MAX_DIMS_PS) ? MAX_DIMS_PS : ndims; + streamptr->ncNumDims = n; + for (int i = 0; i < n; i++) streamptr->ncDimID[i] = ncdims[i].dimid; + for (int i = 0; i < n; i++) streamptr->ncDimLen[i] = ncdims[i].len; +} + int cdfInqContents(stream_t *streamptr) { - bool time_has_units = false; - bool time_has_bounds = false; - bool time_climatology = false; + bool timeHasUnits = false; + bool timeHasBounds = false; + bool timeClimatology = false; int leadtime_id = CDI_UNDEFID; int format = 0; char fcreftime[CDI_MAX_NAME]; @@ -4087,8 +4304,8 @@ cdfInqContents(stream_t *streamptr) fcreftime[0] = 0; - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; if (CDI_Debug) Message("streamID = %d, fileID = %d", streamptr->self, fileID); @@ -4096,7 +4313,7 @@ cdfInqContents(stream_t *streamptr) nc_inq_format(fileID, &format); #endif - int ndims, nvars, ngatts, unlimdimid; + int ndims = 0, nvars = 0, ngatts = 0, unlimdimid = 0; cdf_inq(fileID, &ndims, &nvars, &ngatts, &unlimdimid); if (CDI_Debug) Message("root: ndims %d, nvars %d, ngatts %d", ndims, nvars, ngatts); @@ -4116,9 +4333,7 @@ cdfInqContents(stream_t *streamptr) int ncdimid = 0; for (int dimid = 0; dimid < NC_MAX_DIMS; ++dimid) { - size_t dimlen; - int status = nc_inq_dimlen(fileID, dimid, &dimlen); - if (status == NC_NOERR) + if (nc_inq_dimlen(fileID, dimid, NULL) == NC_NOERR) { ncdims[ncdimid++].dimid = dimid; if (ncdimid == ndims) break; @@ -4158,9 +4373,7 @@ cdfInqContents(stream_t *streamptr) // alloc ncvars ncvar_t *ncvars = (ncvar_t *) Malloc((size_t) nvars * sizeof(ncvar_t)); - init_ncvars(nvars, ncvars); - - for (int ncvarid = 0; ncvarid < nvars; ++ncvarid) ncvars[ncvarid].ncid = fileID; + init_ncvars(nvars, ncvars, fileID); // scan global attributes int instID = CDI_UNDEFID; @@ -4193,6 +4406,8 @@ cdfInqContents(stream_t *streamptr) if (timedimid == ncdimid) ncdims[ncdimid].dimtype = T_AXIS; } + stream_set_ncdims(streamptr, ndims, ncdims); + if (CDI_Debug) cdf_print_vars(ncvars, nvars, "cdfScanVarAttr"); // scan attributes of all variables @@ -4227,7 +4442,7 @@ cdfInqContents(stream_t *streamptr) // if ( ncvar->varStatus != DataVar ) cdf_set_var(ncvar, CoordVar); if (ncdimid == ncvar->dimids[0] && ncdims[ncdimid].ncvarid == CDI_UNDEFID) - if (strIsEqual(ncvar->name, ncdims[ncdimid].name)) + if (str_is_equal(ncvar->name, ncdims[ncdimid].name)) { ncdims[ncdimid].ncvarid = ncvarid; ncvar->varStatus = CoordVar; @@ -4237,7 +4452,7 @@ cdfInqContents(stream_t *streamptr) } // find time vars - find_time_vars(nvars, ncvars, ncdims, timedimid, streamptr, &time_has_units, &time_has_bounds, &time_climatology); + find_time_vars(nvars, ncvars, ncdims, timedimid, streamptr, &timeHasUnits, &timeHasBounds, &timeClimatology); leadtime_id = find_leadtime(nvars, ncvars, timedimid); if (leadtime_id != CDI_UNDEFID) ncvars[leadtime_id].varStatus = CoordVar; @@ -4290,25 +4505,22 @@ cdfInqContents(stream_t *streamptr) { for (int i = 0; i < ncvar->ncoordvars; i++) { - const int ncvaridc = ncvar->coordvarids[i]; + int ncvaridc = ncvar->coordvarids[i]; if (ncvaridc != CDI_UNDEFID) { ncvar_t *ncvarc = &ncvars[ncvaridc]; - if (ncvarc->isLon || ncvarc->isXaxis) - ncvar->xvarid = ncvaridc; - else if (ncvarc->isLat || ncvarc->isYaxis) - ncvar->yvarid = ncvaridc; - else if (ncvarc->isZaxis) - ncvar->zvarid = ncvaridc; - else if (ncvarc->isTaxis) - ncvar->tvarid = ncvaridc; - else if (ncvarc->isCharAxis) - ncvar->cvarids[i] = ncvaridc; + // clang-format off + if (ncvarc->isLon || ncvarc->isXaxis) ncvar->xvarid = ncvaridc; + else if (ncvarc->isLat || ncvarc->isYaxis) ncvar->yvarid = ncvaridc; + else if (ncvarc->isZaxis) ncvar->zvarid = ncvaridc; + else if (ncvarc->isTaxis) ncvar->tvarid = ncvaridc; + else if (ncvarc->isCharAxis) ncvar->cvarids[i] = ncvaridc; else if (ncvarc->printWarning) { Warning("Coordinates variable %s can't be assigned!", ncvarc->name); ncvarc->printWarning = false; } + // clang-format on } } } @@ -4322,6 +4534,17 @@ cdfInqContents(stream_t *streamptr) double *vct = NULL; if (!isHybridCF) read_vct_echam(fileID, nvars, ncvars, ncdims, &vct, &vctsize); + // process query information if available + CdiQuery *query = streamptr->query; + if (query && cdiQueryNumNames(query) > 0) + { + for (int ncvarid = 0; ncvarid < nvars; ++ncvarid) + { + ncvar_t *ncvar = &ncvars[ncvarid]; + if (ncvar->varStatus == DataVar && cdiQueryName(query, ncvar->name) < 0) ncvar->varStatus = CoordVar; + } + } + if (CDI_Debug) cdf_print_vars(ncvars, nvars, "cdf_define_all_grids"); // define all grids @@ -4355,92 +4578,89 @@ cdfInqContents(stream_t *streamptr) if (ntsteps == 0 && streamptr->basetime.ncdimid == CDI_UNDEFID && streamptr->basetime.ncvarid != CDI_UNDEFID) ntsteps = 1; - streamptr->ntsteps = (long) ntsteps; - // define all data variables - cdf_define_all_vars(streamptr, vlistID, instID, modelID, nvars_data, nvars, ncvars, ncdims); - - cdiCreateTimesteps(streamptr); + cdf_define_all_vars(streamptr, vlistID, instID, modelID, nvars_data, nvars, ncvars, ncdims, timedimid); // time varID int nctimevarid = streamptr->basetime.ncvarid; - if (nctimevarid != CDI_UNDEFID && (!time_has_units || streamptr->basetime.lwrf)) ncvars[nctimevarid].units[0] = 0; - if (nctimevarid != CDI_UNDEFID && time_has_units) streamptr->basetime.lunits = true; + if (nctimevarid != CDI_UNDEFID && (!timeHasUnits || streamptr->basetime.isWRF)) ncvars[nctimevarid].units[0] = 0; + if (nctimevarid != CDI_UNDEFID && timeHasUnits) streamptr->basetime.hasUnits = true; - if (time_has_units) - { - taxis_t *taxis = &streamptr->tsteps[0].taxis; + taxis_t taxis0; + ptaxisInit(&taxis0); - if (set_base_time(ncvars[nctimevarid].units, taxis) == 1) + if (timeHasUnits) + { + if (set_base_time(ncvars[nctimevarid].units, &taxis0) == 1) { nctimevarid = CDI_UNDEFID; streamptr->basetime.ncvarid = CDI_UNDEFID; - streamptr->basetime.lunits = false; + streamptr->basetime.hasUnits = false; } - if (leadtime_id != CDI_UNDEFID && taxis->type == TAXIS_RELATIVE) + if (leadtime_id != CDI_UNDEFID && taxis0.type == TAXIS_RELATIVE) { streamptr->basetime.leadtimeid = leadtime_id; - taxis->type = TAXIS_FORECAST; + taxis0.type = TAXIS_FORECAST; int timeunit = -1; if (ncvars[leadtime_id].units[0] != 0) timeunit = scan_time_units(ncvars[leadtime_id].units); - if (timeunit == -1) timeunit = taxis->unit; - taxis->fc_unit = timeunit; + if (timeunit == -1) timeunit = taxis0.unit; + taxis0.fc_unit = timeunit; - set_forecast_time(fcreftime, taxis); + set_forecast_time(fcreftime, &taxis0); } } - if (time_has_bounds) + if (timeHasBounds) { - streamptr->tsteps[0].taxis.has_bounds = true; - if (time_climatology) streamptr->tsteps[0].taxis.climatology = true; + taxis0.hasBounds = true; + if (timeClimatology) taxis0.climatology = true; } if (nctimevarid != CDI_UNDEFID) { - taxis_t *taxis = &streamptr->tsteps[0].taxis; - ptaxisDefName(taxis, ncvars[nctimevarid].name); - if (ncvars[nctimevarid].longname[0]) ptaxisDefLongname(taxis, ncvars[nctimevarid].longname); - if (ncvars[nctimevarid].units[0]) ptaxisDefUnits(taxis, ncvars[nctimevarid].units); + ptaxisDefName(&taxis0, ncvars[nctimevarid].name); + if (ncvars[nctimevarid].longname[0]) ptaxisDefLongname(&taxis0, ncvars[nctimevarid].longname); + if (ncvars[nctimevarid].units[0]) ptaxisDefUnits(&taxis0, ncvars[nctimevarid].units); int xtype = ncvars[nctimevarid].xtype; int datatype = (xtype == NC_INT) ? CDI_DATATYPE_INT32 : ((xtype == NC_FLOAT) ? CDI_DATATYPE_FLT32 : CDI_DATATYPE_FLT64); - ptaxisDefDatatype(taxis, datatype); + ptaxisDefDatatype(&taxis0, datatype); } int calendar = CDI_UNDEFID; - if (nctimevarid != CDI_UNDEFID) - if (ncvars[nctimevarid].hasCalendar) - { - char attstring[1024]; - cdfGetAttText(fileID, nctimevarid, "calendar", sizeof(attstring), attstring); - strToLower(attstring); - calendar = attribute_to_calendar(attstring); - } + if (nctimevarid != CDI_UNDEFID && ncvars[nctimevarid].hasCalendar) + { + char attstring[1024]; + cdfGetAttText(fileID, nctimevarid, "calendar", sizeof(attstring), attstring); + str_to_lower(attstring); + calendar = attribute_to_calendar(attstring); + } + + if (streamptr->basetime.isWRF) taxis0.type = TAXIS_ABSOLUTE; int taxisID; - if (streamptr->tsteps[0].taxis.type == TAXIS_FORECAST) + if (taxis0.type == TAXIS_FORECAST) { taxisID = taxisCreate(TAXIS_FORECAST); } - else if (streamptr->tsteps[0].taxis.type == TAXIS_RELATIVE) + else if (taxis0.type == TAXIS_RELATIVE) { taxisID = taxisCreate(TAXIS_RELATIVE); } else { taxisID = taxisCreate(TAXIS_ABSOLUTE); - if (!time_has_units) + if (!timeHasUnits) { taxisDefTunit(taxisID, TUNIT_DAY); - streamptr->tsteps[0].taxis.unit = TUNIT_DAY; + taxis0.unit = TUNIT_DAY; } } - if (calendar == CDI_UNDEFID && streamptr->tsteps[0].taxis.type != TAXIS_ABSOLUTE) calendar = CALENDAR_STANDARD; + if (calendar == CDI_UNDEFID && taxis0.type != TAXIS_ABSOLUTE) calendar = CALENDAR_STANDARD; #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5) #pragma GCC diagnostic push @@ -4448,8 +4668,7 @@ cdfInqContents(stream_t *streamptr) #endif if (calendar != CDI_UNDEFID) { - taxis_t *taxis = &streamptr->tsteps[0].taxis; - taxis->calendar = calendar; + taxis0.calendar = calendar; taxisDefCalendar(taxisID, calendar); } #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5) @@ -4458,12 +4677,8 @@ cdfInqContents(stream_t *streamptr) vlistDefTaxis(vlistID, taxisID); - streamptr->curTsID = 0; - streamptr->rtsteps = 1; - - (void) cdfInqTimestep(streamptr, 0); - - cdfCreateRecords(streamptr, 0); + cdf_read_timesteps(ntsteps, streamptr, &taxis0); + taxisDestroyKernel(&taxis0); // free ncdims if (ncdims) Free(ncdims); @@ -4474,128 +4689,15 @@ cdfInqContents(stream_t *streamptr) return 0; } -static void -wrf_read_timestep(int fileID, int nctimevarid, int tsID, taxis_t *taxis) -{ - const size_t start[2] = { tsID, 0 }, count[2] = { 1, 19 }; - char stvalue[128]; - stvalue[0] = 0; - cdf_get_vara_text(fileID, nctimevarid, start, count, stvalue); - stvalue[19] = 0; - { - int year = 1, month = 1, day = 1, hour = 0, minute = 0, second = 0; - if (strlen(stvalue) == 19) sscanf(stvalue, "%d-%d-%d_%d:%d:%d", &year, &month, &day, &hour, &minute, &second); - taxis->vdatetime = cdiDateTime_set(cdiEncodeDate(year, month, day), cdiEncodeTime(hour, minute, second)); - taxis->type = TAXIS_ABSOLUTE; - } -} - -static double -get_timevalue(int fileID, int nctimevarid, int tsID, timecache_t *tcache) -{ - double timevalue = 0.0; - - if (tcache) - { - if (tcache->size == 0 || (tsID < (int) tcache->startid || tsID > (int) (tcache->startid + tcache->size - 1))) - { - size_t maxvals = MAX_TIMECACHE_SIZE; - if (maxvals > tcache->maxvals) maxvals = tcache->maxvals; - tcache->startid = tsID; - // tcache->startid = (tsID/MAX_TIMECACHE_SIZE)*MAX_TIMECACHE_SIZE; - // if ( (tcache->startid + maxvals) > tcache->maxvals ) maxvals = (tcache->maxvals)%MAX_TIMECACHE_SIZE; - tcache->size = maxvals; - // fprintf(stderr, "fill time cache: %d %d %d %d %d\n", tcache->maxvals, tsID, tcache->startid, tcache->startid+maxvals-1, - // maxvals); - cdf_get_vara_double(fileID, nctimevarid, &tcache->startid, &maxvals, tcache->cache); - } - - // timevalue = tcache->cache[tsID%MAX_TIMECACHE_SIZE]; - timevalue = tcache->cache[tsID]; - } - else - { - size_t index = (size_t) tsID; - cdf_get_var1_double(fileID, nctimevarid, &index, &timevalue); - } - - if (timevalue >= NC_FILL_DOUBLE || timevalue < -NC_FILL_DOUBLE) timevalue = 0.0; - - return timevalue; -} - int cdfInqTimestep(stream_t *streamptr, int tsID) { - if (CDI_Debug) Message("streamID = %d tsID = %d", streamptr->self, tsID); - - if (tsID < 0) Error("unexpected tsID = %d", tsID); - - if (tsID < streamptr->ntsteps && streamptr->ntsteps > 0) - { - cdfCreateRecords(streamptr, tsID); - - taxis_t *taxis = &streamptr->tsteps[tsID].taxis; - if (tsID > 0) ptaxisCopy(taxis, &streamptr->tsteps[0].taxis); - - double timevalue = tsID; - - const int nctimevarid = streamptr->basetime.ncvarid; - if (nctimevarid != CDI_UNDEFID && streamptr->basetime.lunits) - { - const int fileID = streamptr->fileID; - - if (streamptr->basetime.lwrf) - { - wrf_read_timestep(fileID, nctimevarid, tsID, taxis); - } - else - { -#ifdef USE_TIMECACHE - if (streamptr->basetime.timevar_cache == NULL) - { - streamptr->basetime.timevar_cache = (timecache_t *) Malloc(sizeof(timecache_t)); - streamptr->basetime.timevar_cache->size = 0; - streamptr->basetime.timevar_cache->maxvals = streamptr->ntsteps; - } -#endif - timevalue = get_timevalue(fileID, nctimevarid, tsID, streamptr->basetime.timevar_cache); - taxis->vdatetime = cdi_decode_timeval(timevalue, taxis); - } - - const int nctimeboundsid = streamptr->basetime.ncvarboundsid; - if (nctimeboundsid != CDI_UNDEFID) - { - { - const size_t start[2] = { tsID, 1 }, count[2] = { 0, 1 }; - cdf_get_vara_double(fileID, nctimeboundsid, start, count, &timevalue); - if (timevalue >= NC_FILL_DOUBLE || timevalue < -NC_FILL_DOUBLE) timevalue = 0.0; - - taxis->vdatetime_lb = cdi_decode_timeval(timevalue, taxis); - } - - { - const size_t start[2] = { tsID, 1 }, count[2] = { 1, 1 }; - cdf_get_vara_double(fileID, nctimeboundsid, start, count, &timevalue); - if (timevalue >= NC_FILL_DOUBLE || timevalue < -NC_FILL_DOUBLE) timevalue = 0.0; - - taxis->vdatetime_ub = cdi_decode_timeval(timevalue, taxis); - } - } - - const int leadtimeid = streamptr->basetime.leadtimeid; - if (leadtimeid != CDI_UNDEFID) - { - timevalue = get_timevalue(fileID, leadtimeid, tsID, NULL); - cdiSetForecastPeriod(timevalue, taxis); - } - } - } + if (tsID < 0 || tsID >= streamptr->ntsteps) Error("tsID=%d out of range (0-%d)!", tsID, streamptr->ntsteps - 1); streamptr->curTsID = tsID; - long nrecs = streamptr->tsteps[tsID].nrecs; + int numRecs = streamptr->tsteps[tsID].nrecs; - return (int) nrecs; + return numRecs; } #endif diff --git a/src/stream_cdf_o.c b/src/stream_cdf_o.c index 719d8be57b5952b21df7ee2bff419d1de5d77717..c9359a13abccd82c339a8f8ac82a5d246ac4a81e 100644 --- a/src/stream_cdf_o.c +++ b/src/stream_cdf_o.c @@ -8,7 +8,10 @@ #include "cdi_int.h" #include "cdi_uuid.h" #include "stream_cdf.h" +#include "stream_cdf_postdef.h" #include "cdf_int.h" +#include "cdf_util.h" +#include "namespace.h" #include "vlist.h" #include "zaxis.h" @@ -17,15 +20,15 @@ static const char bndsName[] = "bnds"; void cdfCopyRecord(stream_t *streamptr2, stream_t *streamptr1) { - const int vlistID1 = streamptr1->vlistID; - const int tsID = streamptr1->curTsID; - const int vrecID = streamptr1->tsteps[tsID].curRecID; - const int recID = streamptr1->tsteps[tsID].recIDs[vrecID]; - const int ivarID = streamptr1->tsteps[tsID].records[recID].varID; - const int gridID = vlistInqVarGrid(vlistID1, ivarID); - const size_t datasize = gridInqSize(gridID); - const int datatype = vlistInqVarDatatype(vlistID1, ivarID); - const int memtype = (datatype != CDI_DATATYPE_FLT32) ? MEMTYPE_DOUBLE : MEMTYPE_FLOAT; + int vlistID1 = streamptr1->vlistID; + int tsID = streamptr1->curTsID; + int vrecID = streamptr1->tsteps[tsID].curRecID; + int recID = streamptr1->tsteps[tsID].recIDs[vrecID]; + int ivarID = streamptr1->tsteps[tsID].records[recID].varID; + int gridID = vlistInqVarGrid(vlistID1, ivarID); + size_t datasize = gridInqSize(gridID); + int datatype = vlistInqVarDatatype(vlistID1, ivarID); + int memtype = (datatype != CDI_DATATYPE_FLT32) ? MEMTYPE_DOUBLE : MEMTYPE_FLOAT; void *data = Malloc(datasize * ((memtype == MEMTYPE_DOUBLE) ? sizeof(double) : sizeof(float))); @@ -42,58 +45,6 @@ cdfDefRecord(stream_t *streamptr) (void) streamptr; } -void -cdfDefTimestep(stream_t *streamptr, int tsID) -{ - const int fileID = streamptr->fileID; - - if (CDI_Debug) Message("streamID = %d, fileID = %d, tsID = %d", streamptr->self, fileID, tsID); - - taxis_t *taxis = &streamptr->tsteps[tsID].taxis; - - if (streamptr->ncmode == 1) - { - cdf_enddef(fileID); - streamptr->ncmode = 2; - } - - if (streamptr->accessmode == 0) - { - cdfEndDef(streamptr); - } - - double timeValue = cdi_encode_timeval(taxis->vdatetime, &streamptr->tsteps[0].taxis); - if (CDI_Debug) Message("tsID = %d timeValue = %f", tsID, timeValue); - - int ncvarid = streamptr->basetime.ncvarid; - size_t index = (size_t) tsID; - cdf_put_var1_double(fileID, ncvarid, &index, &timeValue); - - if (taxis->has_bounds) - { - ncvarid = streamptr->basetime.ncvarboundsid; - if (ncvarid == CDI_UNDEFID) Error("Call to taxisWithBounds() missing!"); - - timeValue = cdi_encode_timeval(taxis->vdatetime_lb, &streamptr->tsteps[0].taxis); - size_t start[2] = { tsID, 0 }, count[2] = { 1, 1 }; - cdf_put_vara_double(fileID, ncvarid, start, count, &timeValue); - - timeValue = cdi_encode_timeval(taxis->vdatetime_ub, &streamptr->tsteps[0].taxis); - start[0] = (size_t) tsID; - count[0] = 1; - start[1] = 1; - count[1] = 1; - cdf_put_vara_double(fileID, ncvarid, start, count, &timeValue); - } - - ncvarid = streamptr->basetime.leadtimeid; - if (taxis->type == TAXIS_FORECAST && ncvarid != CDI_UNDEFID) - { - timeValue = taxis->fc_period; - cdf_put_var1_double(fileID, ncvarid, &index, &timeValue); - } -} - static void cdfDefComplex(stream_t *streamptr, int gridID, int gridIndex) { @@ -104,8 +55,8 @@ cdfDefComplex(stream_t *streamptr, int gridID, int gridIndex) { if (ncgrid[index].ncIDs[CDF_DIMID_X] != CDI_UNDEFID) { - const int gridID0 = ncgrid[index].gridID; - const int gridtype0 = gridInqType(gridID0); + int gridID0 = ncgrid[index].gridID; + int gridtype0 = gridInqType(gridID0); if (gridtype0 == GRID_SPECTRAL || gridtype0 == GRID_FOURIER) { dimID = ncgrid[index].ncIDs[CDF_DIMID_X]; @@ -116,13 +67,23 @@ cdfDefComplex(stream_t *streamptr, int gridID, int gridIndex) { static const char axisname[] = "nc2"; - const size_t dimlen = 2; - const int fileID = streamptr->fileID; + size_t dimlen = 2; + int fileID = streamptr->fileID; + + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } - if (streamptr->ncmode == 2) cdf_redef(fileID); cdf_def_dim(fileID, axisname, dimlen, &dimID); - cdf_enddef(fileID); - streamptr->ncmode = 2; + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } } dimIDEstablished: @@ -174,12 +135,12 @@ cdfDefSPorFC(stream_t *streamptr, int gridID, int gridIndex, char *restrict axis { ncgrid_t *ncgrid = streamptr->ncgrid; - const size_t dimlen = gridInqSize(gridID) / 2; + size_t dimlen = gridInqSize(gridID) / 2; struct idSearch search = cdfSearchIDBySize(0, (size_t) gridIndex, ncgrid, CDF_DIMID_Y, gridRefType, (int) dimlen, gridInqType, cdfGridInqHalfSize); int dimID = search.foundID; - const int iz = search.numNonMatching; + int iz = search.numNonMatching; if (dimID == CDI_UNDEFID) { @@ -189,12 +150,20 @@ cdfDefSPorFC(stream_t *streamptr, int gridID, int gridIndex, char *restrict axis else sprintf(&axisname[3], "%1d", iz + 1); - if (streamptr->ncmode == 2) cdf_redef(fileID); + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } cdf_def_dim(fileID, axisname, dimlen, &dimID); - cdf_enddef(fileID); - streamptr->ncmode = 2; + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } } ncgrid[gridIndex].gridID = gridID; @@ -224,6 +193,8 @@ static const struct cdfDefGridAxisInqs const double *(*axisBoundsPtr)(int gridID); enum cdfIDIdx dimIdx, varIdx; char axisSym; + enum gridPropInq valsQueryKey, bndsQueryKey; + char axisPanoplyName[4]; } gridInqsX = { .axisSize = gridInqXsize, .axisVal = gridInqXval, @@ -232,6 +203,9 @@ static const struct cdfDefGridAxisInqs .dimIdx = CDF_DIMID_X, .varIdx = CDF_VARID_X, .axisSym = 'X', + .valsQueryKey = GRID_PROP_XVALS, + .bndsQueryKey = GRID_PROP_XBOUNDS, + .axisPanoplyName = "Lon", }, gridInqsY = { .axisSize = gridInqYsize, .axisVal = gridInqYval, @@ -240,6 +214,9 @@ static const struct cdfDefGridAxisInqs .dimIdx = CDF_DIMID_Y, .varIdx = CDF_VARID_Y, .axisSym = 'Y', + .valsQueryKey = GRID_PROP_YVALS, + .bndsQueryKey = GRID_PROP_YBOUNDS, + .axisPanoplyName = "Lat", }; static void @@ -249,20 +226,24 @@ cdfPutGridStdAtts(int fileID, int ncvarid, int gridID, int dimtype) int axisKey = (dimtype == 'Z') ? CDI_GLOBAL : ((dimtype == 'X') ? CDI_XAXIS : CDI_YAXIS); - char stdname[CDI_MAX_NAME]; - int length = CDI_MAX_NAME; - cdiInqKeyString(gridID, axisKey, CDI_KEY_STDNAME, stdname, &length); - if (stdname[0] && (len = strlen(stdname))) cdf_put_att_text(fileID, ncvarid, "standard_name", len, stdname); - - char longname[CDI_MAX_NAME]; - length = CDI_MAX_NAME; - cdiInqKeyString(gridID, axisKey, CDI_KEY_LONGNAME, longname, &length); - if (longname[0] && (len = strlen(longname))) cdf_put_att_text(fileID, ncvarid, "long_name", len, longname); - - char units[CDI_MAX_NAME]; - length = CDI_MAX_NAME; - cdiInqKeyString(gridID, axisKey, CDI_KEY_UNITS, units, &length); - if (units[0] && (len = strlen(units))) cdf_put_att_text(fileID, ncvarid, "units", len, units); + { + char stdname[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, axisKey, CDI_KEY_STDNAME, stdname, &length); + if (stdname[0] && (len = strlen(stdname))) cdf_put_att_text(fileID, ncvarid, "standard_name", len, stdname); + } + { + char longname[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, axisKey, CDI_KEY_LONGNAME, longname, &length); + if (longname[0] && (len = strlen(longname))) cdf_put_att_text(fileID, ncvarid, "long_name", len, longname); + } + { + char units[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, axisKey, CDI_KEY_UNITS, units, &length); + if (units[0] && (len = strlen(units))) cdf_put_att_text(fileID, ncvarid, "units", len, units); + } } static int @@ -276,27 +257,36 @@ grid_inq_xtype(int gridID) static void cdfDefTrajLatLon(stream_t *streamptr, int gridID, int gridIndex, const struct cdfDefGridAxisInqs *inqs) { - const nc_type xtype = grid_inq_xtype(gridID); + nc_type xtype = grid_inq_xtype(gridID); ncgrid_t *ncgrid = streamptr->ncgrid; - const size_t dimlen = inqs->axisSize(gridID); + size_t dimlen = inqs->axisSize(gridID); if (dimlen != 1) Error("%c size isn't 1 for %s grid!", inqs->axisSym, gridNamePtr(gridInqType(gridID))); int ncvarid = ncgrid[gridIndex].ncIDs[inqs->dimIdx]; if (ncvarid == CDI_UNDEFID) { int dimNcID = streamptr->basetime.ncvarid; - const int fileID = streamptr->fileID; - if (streamptr->ncmode == 2) cdf_redef(fileID); + int fileID = streamptr->fileID; + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + cdf_redef(fileID); + switchNCMode = true; + streamptr->ncmode = 1; + } char axisname[CDI_MAX_NAME]; - const int axistype = (inqs->axisSym == 'X') ? CDI_XAXIS : CDI_YAXIS; + int axistype = (inqs->axisSym == 'X') ? CDI_XAXIS : CDI_YAXIS; int length = CDI_MAX_NAME; cdiInqKeyString(gridID, axistype, CDI_KEY_NAME, axisname, &length); cdf_def_var(fileID, axisname, xtype, 1, &dimNcID, &ncvarid); cdfPutGridStdAtts(fileID, ncvarid, gridID, inqs->axisSym); - cdf_enddef(fileID); - streamptr->ncmode = 2; + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } } ncgrid[gridIndex].gridID = gridID; @@ -324,7 +314,7 @@ checkDimName(int fileID, size_t dimlen, char *dimname) int dimid = CDI_UNDEFID; char name[CDI_MAX_NAME]; - const size_t len = strlen(dimname); + size_t len = strlen(dimname); memcpy(name, dimname, len + 1); do @@ -332,7 +322,7 @@ checkDimName(int fileID, size_t dimlen, char *dimname) if (iz) sprintf(name + len, "_%u", iz + 1); int dimid0; - const int status = nc_inq_dimid(fileID, name, &dimid0); + int status = nc_inq_dimid(fileID, name, &dimid0); if (status != NC_NOERR) break; size_t dimlen0; cdf_inq_dimlen(fileID, dimid0, &dimlen0); @@ -359,7 +349,7 @@ checkGridName(char *axisname, int fileID) // check that the name is not already defined unsigned iz = 0; - const size_t axisnameLen = strlen(axisname); + size_t axisnameLen = strlen(axisname); memcpy(axisname2, axisname, axisnameLen + 1); do @@ -383,14 +373,14 @@ checkZaxisName(char *axisname, int fileID, int vlistID, int zaxisID, int nzaxis) // check that the name is not already defined unsigned iz = 0; - const size_t axisnameLen = strlen(axisname); + size_t axisnameLen = strlen(axisname); memcpy(axisname2, axisname, axisnameLen + 1); do { if (iz) sprintf(axisname2 + axisnameLen, "_%u", iz + 1); int ncdimid; - const int status = nc_inq_varid(fileID, axisname2, &ncdimid); + int status = nc_inq_varid(fileID, axisname2, &ncdimid); if (status != NC_NOERR) { if (iz) @@ -398,11 +388,11 @@ checkZaxisName(char *axisname, int fileID, int vlistID, int zaxisID, int nzaxis) // check that the name does not exist for other zaxes for (int index = 0; index < nzaxis; index++) { - const int zaxisID0 = vlistZaxis(vlistID, index); + int zaxisID0 = vlistZaxis(vlistID, index); if (zaxisID != zaxisID0) { const char *axisname0 = zaxisInqNamePtr(zaxisID0); - if (strcmp(axisname0, axisname2) == 0) goto nextSuffix; + if (str_is_equal(axisname0, axisname2)) goto nextSuffix; } } } @@ -418,37 +408,177 @@ checkZaxisName(char *axisname, int fileID, int vlistID, int zaxisID, int nzaxis) return (int) iz; } +struct cdfPostDefPutVar +{ + int fileID, ncvarid; + union + { + const void *array; + int int1; + } values; +}; + +static void +cdfDelayedPutVarDouble(void *data) +{ + struct cdfPostDefPutVar *put = (struct cdfPostDefPutVar *) data; + cdf_put_var_double(put->fileID, put->ncvarid, (const double *) put->values.array); +} + +static void +cdfDelayedPutVarInt1(void *data) +{ + struct cdfPostDefPutVar *put = (struct cdfPostDefPutVar *) data; + cdf_put_var_int(put->fileID, put->ncvarid, &put->values.int1); +} + +void +cdfDelayedPutVarDeepCleanup(void *data) +{ + struct cdfPostDefPutVar *what = (struct cdfPostDefPutVar *) data; + Free((void *) what->values.array); + Free(what); +} + +static void +cdfPostDefActionApply(size_t numActions, struct cdfPostDefAction *actions) +{ + for (size_t i = 0; i < numActions; ++i) actions[i].action(actions[i].data); +} + +static void +cdfPostDefActionListDelete(struct cdfPostDefActionList *list) +{ + struct cdfPostDefAction *actions = list->actions; + for (size_t i = 0, len = list->len; i < len; ++i) + { + void (*cleanup)(void *) = actions[i].cleanup; + void *data = actions[i].data; + if (cleanup == (void (*)(void *))(void (*)(void)) memFree) + Free(data); + else + cleanup(data); + } + Free(list); +} + +struct cdfPostDefActionList * +cdfPostDefActionAdd(struct cdfPostDefActionList *list, struct cdfPostDefAction addendum) +{ + size_t appendPos = list ? list->len : 0; + if (!list || list->size == list->len) + { + enum + { + initialListSize = 1 + }; + size_t newSize = list ? (list->size * 2) : initialListSize, newLen = list ? list->len + 1 : 1, + newAllocSize = sizeof(struct cdfPostDefActionList) + newSize * sizeof(struct cdfPostDefAction); + list = (struct cdfPostDefActionList *) Realloc(list, newAllocSize); + list->size = newSize; + list->len = newLen; + } + else + ++(list->len); + list->actions[appendPos] = addendum; + return list; +} + +static struct cdfPostDefActionList * +cdfPostDefActionConcat(struct cdfPostDefActionList *listA, const struct cdfPostDefActionList *listB) +{ + size_t appendPos = listA ? listA->len : 0, appendLen = listB ? listB->len : 0; + if (appendLen) + { + size_t newLen = appendPos + appendLen; + if (!listA || listA->size < newLen) + { + enum + { + initialListSize = 1 + }; + size_t newSize = listA ? listA->size : initialListSize; + while (newSize < newLen) newSize *= 2; + size_t newAllocSize = sizeof(struct cdfPostDefActionList) + newSize * sizeof(struct cdfPostDefAction); + listA = (struct cdfPostDefActionList *) Realloc(listA, newAllocSize); + listA->size = newSize; + listA->len = newLen; + } + else + listA->len = newLen; + struct cdfPostDefAction *restrict actionsA = listA->actions; + const struct cdfPostDefAction *restrict actionsB = listB->actions; + for (size_t i = 0; i < appendLen; ++i) actionsA[appendPos + i] = actionsB[i]; + } + return listA; +} + +void +cdfPostDefActionAddPutVal(struct cdfPostDefActionList **list_, int fileID, int ncvarid, const double *values, + void (*cleanup)(void *)) +{ + struct cdfPostDefPutVar *delayedPutVals = (struct cdfPostDefPutVar *) Malloc(sizeof(*delayedPutVals)); + delayedPutVals->values.array = values; + delayedPutVals->fileID = fileID; + delayedPutVals->ncvarid = ncvarid; + *list_ = cdfPostDefActionAdd( + *list_, (struct cdfPostDefAction){ .data = (void *) delayedPutVals, .action = cdfDelayedPutVarDouble, .cleanup = cleanup }); +} + +static inline void +cdfPostDefActionAddPut1Int(struct cdfPostDefActionList **list_, int fileID, int ncvarid, int iVal, void (*cleanup)(void *)) +{ + struct cdfPostDefPutVar *delayedPutVals = (struct cdfPostDefPutVar *) Malloc(sizeof(*delayedPutVals)); + delayedPutVals->values.int1 = iVal; + delayedPutVals->fileID = fileID; + delayedPutVals->ncvarid = ncvarid; + *list_ = cdfPostDefActionAdd( + *list_, (struct cdfPostDefAction){ .data = (void *) delayedPutVals, .action = cdfDelayedPutVarInt1, .cleanup = cleanup }); +} + static void +cdfGridCompress(int fileID, int ncvarid, size_t gridsize, int filetype, int comptype, size_t *chunks) +{ +#ifdef HAVE_NETCDF4 + if (gridsize >= 32 && comptype == CDI_COMPRESS_ZIP + && (filetype == CDI_FILETYPE_NC4 || filetype == CDI_FILETYPE_NC4C || filetype == CDI_FILETYPE_NCZARR)) + { + cdf_def_var_chunking(fileID, ncvarid, NC_CHUNKED, chunks); + cdfDefVarDeflate(fileID, ncvarid, 1); + } +#endif +} + +static struct cdfPostDefActionList * cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridIndex, int ndims, bool addVarToGrid, const struct cdfDefGridAxisInqs *gridAxisInq, int axisKey, char axisLetter, void (*finishCyclicBounds)(double *pbounds, size_t dimlen, const double *pvals)) { int dimID = CDI_UNDEFID; - const int fileID = streamptr->fileID; - const size_t dimlen = gridAxisInq->axisSize(gridID); - const nc_type xtype = grid_inq_xtype(gridID); + size_t dimlen = gridAxisInq->axisSize(gridID); + nc_type xtype = grid_inq_xtype(gridID); ncgrid_t *ncgrid = streamptr->ncgrid; - const double *pvals = gridAxisInq->axisValsPtr(gridID); + bool hasVals = gridInqPropPresence(gridID, gridAxisInq->valsQueryKey); char dimname[CDI_MAX_NAME + 3]; dimname[0] = 0; int length = sizeof(dimname); - if (ndims && pvals == NULL) cdiInqKeyString(gridID, axisKey, CDI_KEY_DIMNAME, dimname, &length); + if (ndims && hasVals) cdiInqKeyString(gridID, axisKey, CDI_KEY_DIMNAME, dimname, &length); for (int index = 0; index < gridIndex; ++index) { - const int gridID0 = ncgrid[index].gridID; + int gridID0 = ncgrid[index].gridID; assert(gridID0 != CDI_UNDEFID); - const int gridtype0 = gridInqType(gridID0); + int gridtype0 = gridInqType(gridID0); if (gridtype0 == GRID_GAUSSIAN || gridtype0 == GRID_LONLAT || gridtype0 == GRID_PROJECTION || gridtype0 == GRID_GENERIC) { - const size_t dimlen0 = gridAxisInq->axisSize(gridID0); + size_t dimlen0 = gridAxisInq->axisSize(gridID0); char dimname0[CDI_MAX_NAME]; dimname0[0] = 0; length = sizeof(dimname0); if (dimname[0]) cdiInqKeyString(gridID0, axisKey, CDI_KEY_DIMNAME, dimname0, &length); - const bool lname = dimname0[0] ? strcmp(dimname, dimname0) == 0 : true; + bool lname = dimname0[0] ? str_is_equal(dimname, dimname0) : true; if (dimlen == dimlen0 && lname) { double (*inqVal)(int gridID, SizeType index) = gridAxisInq->axisVal; @@ -462,18 +592,25 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridIndex, int ndims, bool } } + struct cdfPostDefActionList *delayed = NULL; if (dimID == CDI_UNDEFID) { - int ncvarid = CDI_UNDEFID, ncbvarid = CDI_UNDEFID; + int ncvarid = CDI_UNDEFID; char axisname[CDI_MAX_NAME]; length = CDI_MAX_NAME; cdiInqKeyString(gridID, axisKey, CDI_KEY_NAME, axisname, &length); + int fileID = streamptr->fileID; if (axisname[0] == 0) Error("axis name undefined!"); checkGridName(axisname, fileID); - const size_t axisnameLen = strlen(axisname); + size_t axisnameLen = strlen(axisname); - if (streamptr->ncmode == 2) cdf_redef(fileID); + bool switchNCMode = streamptr->ncmode == 2 && (hasVals || ndims); + if (switchNCMode) + { + cdf_redef(fileID); + streamptr->ncmode = 1; + } if (ndims) { @@ -483,64 +620,82 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridIndex, int ndims, bool if (dimID == CDI_UNDEFID) cdf_def_dim(fileID, dimname, dimlen, &dimID); } - bool gen_bounds = false; - const bool grid_is_cyclic = gridIsCircular(gridID) > 0; - double *pbounds = NULL; - if (pvals) + if (hasVals) { cdf_def_var(fileID, axisname, xtype, ndims, &dimID, &ncvarid); + int chunkSize = 0; + int chunkType = CDI_CHUNK_GRID; + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_CHUNKTYPE, &chunkType); + cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_CHUNKSIZE, &chunkSize); + if (chunkSize > 0) chunkType = CDI_CHUNK_AUTO; + + if (chunkType == CDI_CHUNK_GRID && dimlen > ChunkSizeLim) chunkType = CDI_CHUNK_LINES; + + size_t chunk = calc_chunksize_x(chunkType, chunkSize, dimlen, true); + cdfGridCompress(fileID, ncvarid, dimlen, streamptr->filetype, streamptr->comptype, &chunk); + cdfPutGridStdAtts(fileID, ncvarid, gridID, axisLetter); { char axisStr[2] = { axisLetter, '\0' }; cdf_put_att_text(fileID, ncvarid, "axis", 1, axisStr); } + cdfFuncPtrPostDefActionGridProp mycdfPostDefActionGridProp + = (cdfFuncPtrPostDefActionGridProp) namespaceSwitchGet(NSSWITCH_CDF_POSTDEFACTION_GRID_PROP).func; + mycdfPostDefActionGridProp(streamptr, gridID, ncvarid, gridAxisInq->valsQueryKey, &delayed); + bool genBounds = false, hasBounds = gridInqPropPresence(gridID, gridAxisInq->bndsQueryKey); + bool grid_is_cyclic = gridIsCircular(gridID) > 0; + double *restrict pbounds; size_t nvertex = gridInqNvertex(gridID); - pbounds = (double *) gridAxisInq->axisBoundsPtr(gridID); - - if (CDI_CMOR_Mode && grid_is_cyclic && !pbounds) + if (CDI_CMOR_Mode && grid_is_cyclic && !hasBounds) { - gen_bounds = true; + const double *pvals = gridAxisInq->axisValsPtr(gridID); + genBounds = true; nvertex = 2; pbounds = (double *) Malloc(2 * dimlen * sizeof(double)); for (size_t i = 0; i < dimlen - 1; ++i) { - pbounds[i * 2 + 1] = (pvals[i] + pvals[i + 1]) / 2; - pbounds[(i + 1) * 2] = (pvals[i] + pvals[i + 1]) / 2; + pbounds[i * 2 + 1] = (pvals[i] + pvals[i + 1]) * 0.5; + pbounds[i * 2 + 2] = (pvals[i] + pvals[i + 1]) * 0.5; } finishCyclicBounds(pbounds, dimlen, pvals); } + else + pbounds = (double *) gridAxisInq->axisBoundsPtr(gridID); int nvdimID = CDI_UNDEFID; if (pbounds) { if (nc_inq_dimid(fileID, bndsName, &nvdimID) != NC_NOERR) cdf_def_dim(fileID, bndsName, nvertex, &nvdimID); } - if (pbounds && nvdimID != CDI_UNDEFID) + if ((hasBounds || genBounds) && nvdimID != CDI_UNDEFID) { char boundsname[CDI_MAX_NAME]; memcpy(boundsname, axisname, axisnameLen); boundsname[axisnameLen] = '_'; memcpy(boundsname + axisnameLen + 1, bndsName, sizeof(bndsName)); int dimIDs[2] = { dimID, nvdimID }; + int ncbvarid; cdf_def_var(fileID, boundsname, xtype, 2, dimIDs, &ncbvarid); cdf_put_att_text(fileID, ncvarid, "bounds", axisnameLen + sizeof(bndsName), boundsname); + cdfPostDefActionAddPutVal(&delayed, fileID, ncbvarid, pbounds, + genBounds ? cdfDelayedPutVarDeepCleanup : (void (*)(void *))(void (*)(void)) memFree); } } - cdf_enddef(fileID); - streamptr->ncmode = 2; - - if (ncvarid != CDI_UNDEFID) cdf_put_var_double(fileID, ncvarid, pvals); - if (ncbvarid != CDI_UNDEFID) cdf_put_var_double(fileID, ncbvarid, pbounds); - if (gen_bounds) Free(pbounds); + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } if (ndims == 0 || addVarToGrid) ncgrid[gridIndex].ncIDs[(axisLetter == 'X') ? CDF_VARID_X : CDF_VARID_Y] = ncvarid; } ncgrid[gridIndex].gridID = gridID; ncgrid[gridIndex].ncIDs[(axisLetter == 'X') ? CDF_DIMID_X : CDF_DIMID_Y] = dimID; + return delayed; } static void @@ -557,34 +712,22 @@ finishCyclicYBounds(double *pbounds, size_t dimlen, const double *pvals) pbounds[2 * dimlen - 1] = copysign(90.0, pvals[dimlen - 1]); } -static void +static struct cdfPostDefActionList * cdfDefXaxis(stream_t *streamptr, int gridID, int gridIndex, int ndims, bool addVarToGrid) { - cdfDefAxisCommon(streamptr, gridID, gridIndex, ndims, addVarToGrid, &gridInqsX, CDI_XAXIS, 'X', finishCyclicXBounds); + return cdfDefAxisCommon(streamptr, gridID, gridIndex, ndims, addVarToGrid, &gridInqsX, CDI_XAXIS, 'X', finishCyclicXBounds); } -static void +static struct cdfPostDefActionList * cdfDefYaxis(stream_t *streamptr, int gridID, int gridIndex, int ndims, bool addVarToGrid) { - cdfDefAxisCommon(streamptr, gridID, gridIndex, ndims, addVarToGrid, &gridInqsY, CDI_YAXIS, 'Y', finishCyclicYBounds); -} - -static void -cdfGridCompress(int fileID, int ncvarid, size_t gridsize, int filetype, int comptype, size_t *chunks) -{ -#ifdef HAVE_NETCDF4 - if (gridsize > 1 && comptype == CDI_COMPRESS_ZIP && (filetype == CDI_FILETYPE_NC4 || filetype == CDI_FILETYPE_NC4C)) - { - cdf_def_var_chunking(fileID, ncvarid, NC_CHUNKED, chunks); - cdfDefVarDeflate(fileID, ncvarid, 1); - } -#endif + return cdfDefAxisCommon(streamptr, gridID, gridIndex, ndims, addVarToGrid, &gridInqsY, CDI_YAXIS, 'Y', finishCyclicYBounds); } static void cdfDefGridReference(stream_t *streamptr, int gridID) { - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; int number = 0; cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, &number); @@ -606,30 +749,92 @@ cdfDefGridUUID(stream_t *streamptr, int gridID) char uuidStr[uuidNumHexChars + 1] = { 0 }; if (cdiUUID2Str(uuid, uuidStr) == uuidNumHexChars) { - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; // if (streamptr->ncmode == 2) cdf_redef(fileID); cdf_put_att_text(fileID, NC_GLOBAL, "uuidOfHGrid", uuidNumHexChars, uuidStr); - // if (streamptr->ncmode == 2 cdf_enddef(fileID); + // if (streamptr->ncmode == 2 cdf_enddef(fileID, streamptr->self); + } + } +} + +void +cdfPostDefActionGridProp(stream_t *streamptr, int gridID, int ncvarid, enum gridPropInq gridProp, + struct cdfPostDefActionList **delayed) +{ + const void *valsPtr = NULL; + switch (gridProp) + { + case GRID_PROP_MASK: + case GRID_PROP_MASK_GME: Error("unsupported key: %d", (int) gridProp); break; + case GRID_PROP_XVALS: valsPtr = gridInqXvalsPtr(gridID); break; + case GRID_PROP_YVALS: valsPtr = gridInqYvalsPtr(gridID); break; + case GRID_PROP_AREA: valsPtr = gridInqAreaPtr(gridID); break; + case GRID_PROP_XBOUNDS: valsPtr = gridInqXboundsPtr(gridID); break; + case GRID_PROP_YBOUNDS: valsPtr = gridInqYboundsPtr(gridID); break; + } + cdfPostDefActionAddPutVal(delayed, streamptr->fileID, ncvarid, (const double *) valsPtr, + (void (*)(void *))(void (*)(void)) memFree); +} + +static int +cdfDefIrregularGridAxisSetup(stream_t *streamptr, int gridID, nc_type xtype, int varID, size_t dimlens, int ndims, int dimIDs[], + size_t *chunks, const struct cdfDefGridAxisInqs *inqs, struct cdfPostDefActionList **delayed) +{ + int ncvarid = CDI_UNDEFID; + int fileID = streamptr->fileID; + if (gridInqPropPresence(gridID, inqs->valsQueryKey)) + { + char axisname[CDI_MAX_NAME]; + int length = CDI_MAX_NAME; + cdiInqKeyString(gridID, varID, CDI_KEY_NAME, axisname, &length); + checkGridName(axisname, fileID); + cdf_def_var(fileID, axisname, xtype, ndims - 1, dimIDs, &ncvarid); + cdfGridCompress(fileID, ncvarid, dimlens, streamptr->filetype, streamptr->comptype, chunks); + + cdfPutGridStdAtts(fileID, ncvarid, gridID, inqs->axisSym); + cdfFuncPtrPostDefActionGridProp mycdfPostDefActionGridProp + = (cdfFuncPtrPostDefActionGridProp) namespaceSwitchGet(NSSWITCH_CDF_POSTDEFACTION_GRID_PROP).func; + mycdfPostDefActionGridProp(streamptr, gridID, ncvarid, inqs->valsQueryKey, delayed); + + // attribute for Panoply + if (!CDI_CMOR_Mode && ndims == 3) cdf_put_att_text(fileID, ncvarid, "_CoordinateAxisType", 3, inqs->axisPanoplyName); + + if (gridInqPropPresence(gridID, inqs->bndsQueryKey) && dimIDs[ndims - 1] != CDI_UNDEFID) + { + size_t axisnameLen = strlen(axisname); + axisname[axisnameLen] = '_'; + memcpy(axisname + axisnameLen + 1, bndsName, sizeof(bndsName)); + int ncbvarid; + cdf_def_var(fileID, axisname, xtype, ndims, dimIDs, &ncbvarid); + cdfGridCompress(fileID, ncbvarid, dimlens, streamptr->filetype, streamptr->comptype, chunks); + + cdf_put_att_text(fileID, ncvarid, "bounds", axisnameLen + sizeof(bndsName), axisname); + mycdfPostDefActionGridProp(streamptr, gridID, ncbvarid, inqs->bndsQueryKey, delayed); } } + return ncvarid; } struct cdfDefIrregularGridCommonIDs { int xdimID, ydimID, ncxvarid, ncyvarid, ncavarid; + struct cdfPostDefActionList *delayed; }; static struct cdfDefIrregularGridCommonIDs cdfDefIrregularGridCommon(stream_t *streamptr, int gridID, size_t xsize, size_t ysize, int ndims, const char *xdimname_default, size_t nvertex, const char *vdimname_default, bool setVdimname) { - const nc_type xtype = grid_inq_xtype(gridID); + nc_type xtype = grid_inq_xtype(gridID); int xdimID = CDI_UNDEFID; int ydimID = CDI_UNDEFID; - int ncxvarid = CDI_UNDEFID, ncyvarid = CDI_UNDEFID, ncavarid = CDI_UNDEFID; - int ncbxvarid = CDI_UNDEFID, ncbyvarid = CDI_UNDEFID; - const int fileID = streamptr->fileID; - if (streamptr->ncmode == 2) cdf_redef(fileID); + int fileID = streamptr->fileID; + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + cdf_redef(fileID); + streamptr->ncmode = 1; + } { char xdimname[CDI_MAX_NAME + 3]; @@ -688,7 +893,7 @@ cdfDefIrregularGridCommon(stream_t *streamptr, int gridID, size_t xsize, size_t dimIDs[0] = ydimID; dimIDs[1] = xdimID; } - else /* ndims == 2 */ + else // ndims == 2 { chunks[0] = calc_chunksize_x(chunkType, chunkSize, xsize, (ydimID == CDI_UNDEFID)); dimIDs[0] = xdimID; @@ -696,62 +901,14 @@ cdfDefIrregularGridCommon(stream_t *streamptr, int gridID, size_t xsize, size_t cdfDefGridUUID(streamptr, gridID); } - const double *xvalsPtr = gridInqXvalsPtr(gridID), *xboundsPtr = NULL; - if (xvalsPtr) - { - char xaxisname[CDI_MAX_NAME]; - int length = CDI_MAX_NAME; - cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_NAME, xaxisname, &length); - checkGridName(xaxisname, fileID); - cdf_def_var(fileID, xaxisname, xtype, ndims - 1, dimIDs, &ncxvarid); - cdfGridCompress(fileID, ncxvarid, gridsize, streamptr->filetype, streamptr->comptype, chunks); - - cdfPutGridStdAtts(fileID, ncxvarid, gridID, 'X'); - - // attribute for Panoply - if (!CDI_CMOR_Mode && ndims == 3) cdf_put_att_text(fileID, ncxvarid, "_CoordinateAxisType", 3, "Lon"); + struct cdfPostDefActionList *delayed = NULL; + int ncxvarid + = cdfDefIrregularGridAxisSetup(streamptr, gridID, xtype, CDI_XAXIS, gridsize, ndims, dimIDs, chunks, &gridInqsX, &delayed); + int ncyvarid + = cdfDefIrregularGridAxisSetup(streamptr, gridID, xtype, CDI_YAXIS, gridsize, ndims, dimIDs, chunks, &gridInqsY, &delayed); - if ((xboundsPtr = gridInqXboundsPtr(gridID)) && nvdimID != CDI_UNDEFID) - { - const size_t xaxisnameLen = strlen(xaxisname); - xaxisname[xaxisnameLen] = '_'; - memcpy(xaxisname + xaxisnameLen + 1, bndsName, sizeof(bndsName)); - cdf_def_var(fileID, xaxisname, xtype, ndims, dimIDs, &ncbxvarid); - cdfGridCompress(fileID, ncbxvarid, gridsize, streamptr->filetype, streamptr->comptype, chunks); - - cdf_put_att_text(fileID, ncxvarid, "bounds", xaxisnameLen + sizeof(bndsName), xaxisname); - } - } - - const double *yvalsPtr = gridInqYvalsPtr(gridID), *yboundsPtr = NULL; - if (yvalsPtr) - { - char yaxisname[CDI_MAX_NAME]; - gridInqYname(gridID, yaxisname); - checkGridName(yaxisname, fileID); - - cdf_def_var(fileID, yaxisname, xtype, ndims - 1, dimIDs, &ncyvarid); - cdfGridCompress(fileID, ncyvarid, gridsize, streamptr->filetype, streamptr->comptype, chunks); - - cdfPutGridStdAtts(fileID, ncyvarid, gridID, 'Y'); - - // attribute for Panoply - if (!CDI_CMOR_Mode && ndims == 3) cdf_put_att_text(fileID, ncyvarid, "_CoordinateAxisType", 3, "Lat"); - - if ((yboundsPtr = gridInqYboundsPtr(gridID)) && nvdimID != CDI_UNDEFID) - { - const size_t yaxisnameLen = strlen(yaxisname); - yaxisname[yaxisnameLen] = '_'; - memcpy(yaxisname + yaxisnameLen + 1, bndsName, sizeof(bndsName)); - cdf_def_var(fileID, yaxisname, xtype, ndims, dimIDs, &ncbyvarid); - cdfGridCompress(fileID, ncbyvarid, gridsize, streamptr->filetype, streamptr->comptype, chunks); - - cdf_put_att_text(fileID, ncyvarid, "bounds", yaxisnameLen + sizeof(bndsName), yaxisname); - } - } - - const double *areaPtr = gridInqAreaPtr(gridID); - if (areaPtr) + int ncavarid = CDI_UNDEFID; + if (gridInqPropPresence(gridID, GRID_PROP_AREA)) { static const char yaxisname_[] = "cell_area"; static const char units[] = "m2"; @@ -763,30 +920,30 @@ cdfDefIrregularGridCommon(stream_t *streamptr, int gridID, size_t xsize, size_t cdf_put_att_text(fileID, ncavarid, "standard_name", sizeof(stdname) - 1, stdname); cdf_put_att_text(fileID, ncavarid, "long_name", sizeof(longname) - 1, longname); cdf_put_att_text(fileID, ncavarid, "units", sizeof(units) - 1, units); + cdfFuncPtrPostDefActionGridProp mycdfPostDefActionGridProp + = (cdfFuncPtrPostDefActionGridProp) namespaceSwitchGet(NSSWITCH_CDF_POSTDEFACTION_GRID_PROP).func; + mycdfPostDefActionGridProp(streamptr, gridID, ncavarid, GRID_PROP_AREA, &delayed); } - cdf_enddef(fileID); - streamptr->ncmode = 2; - - if (ncxvarid != CDI_UNDEFID) cdf_put_var_double(fileID, ncxvarid, xvalsPtr); - if (ncbxvarid != CDI_UNDEFID) cdf_put_var_double(fileID, ncbxvarid, xboundsPtr); - if (ncyvarid != CDI_UNDEFID) cdf_put_var_double(fileID, ncyvarid, yvalsPtr); - if (ncbyvarid != CDI_UNDEFID) cdf_put_var_double(fileID, ncbyvarid, yboundsPtr); - if (ncavarid != CDI_UNDEFID) cdf_put_var_double(fileID, ncavarid, areaPtr); + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } return (struct cdfDefIrregularGridCommonIDs){ - .xdimID = xdimID, .ydimID = ydimID, .ncxvarid = ncxvarid, .ncyvarid = ncyvarid, .ncavarid = ncavarid + .xdimID = xdimID, .ydimID = ydimID, .ncxvarid = ncxvarid, .ncyvarid = ncyvarid, .ncavarid = ncavarid, .delayed = delayed }; } -static void +static struct cdfPostDefActionList * cdfDefCurvilinear(stream_t *streamptr, int gridID, int gridIndex) { ncgrid_t *ncgrid = streamptr->ncgrid; - const size_t dimlen = gridInqSize(gridID); - const size_t xdimlen = gridInqXsize(gridID); - const size_t ydimlen = gridInqYsize(gridID); + size_t dimlen = gridInqSize(gridID); + size_t xdimlen = gridInqXsize(gridID); + size_t ydimlen = gridInqYsize(gridID); int xdimID = CDI_UNDEFID, ydimID = CDI_UNDEFID; int ncxvarid = CDI_UNDEFID, ncyvarid = CDI_UNDEFID, ncavarid = CDI_UNDEFID; @@ -796,10 +953,10 @@ cdfDefCurvilinear(stream_t *streamptr, int gridID, int gridIndex) { struct idSearch search = cdfSearchIDBySize(ofs, (size_t) gridIndex, ncgrid, CDF_DIMID_X, GRID_CURVILINEAR, (int) dimlen, gridInqType, gridInqSize); - const size_t index = search.foundIdx; + size_t index = search.foundIdx; if (index != SIZE_MAX) { - const int gridID0 = ncgrid[index].gridID; + int gridID0 = ncgrid[index].gridID; if (IS_EQUAL(gridInqXval(gridID0, 0), gridInqXval(gridID, 0)) && IS_EQUAL(gridInqXval(gridID0, dimlen - 1), gridInqXval(gridID, dimlen - 1)) && IS_EQUAL(gridInqYval(gridID0, 0), gridInqYval(gridID, 0)) @@ -817,15 +974,18 @@ cdfDefCurvilinear(stream_t *streamptr, int gridID, int gridIndex) } while (false); + struct cdfPostDefActionList *delayed = NULL; if (xdimID == CDI_UNDEFID || ydimID == CDI_UNDEFID) { struct cdfDefIrregularGridCommonIDs createdIDs = cdfDefIrregularGridCommon( - streamptr, gridID, xdimlen, ydimlen, 3, "x", 4, "nv4", gridInqXboundsPtr(gridID) || gridInqYboundsPtr(gridID)); + streamptr, gridID, xdimlen, ydimlen, 3, "x", 4, "nv4", + gridInqPropPresence(gridID, GRID_PROP_XBOUNDS) || gridInqPropPresence(gridID, GRID_PROP_YBOUNDS)); xdimID = createdIDs.xdimID; ydimID = createdIDs.ydimID; ncxvarid = createdIDs.ncxvarid; ncyvarid = createdIDs.ncyvarid; ncavarid = createdIDs.ncavarid; + delayed = createdIDs.delayed; } ncgrid[gridIndex].gridID = gridID; @@ -834,14 +994,15 @@ cdfDefCurvilinear(stream_t *streamptr, int gridID, int gridIndex) ncgrid[gridIndex].ncIDs[CDF_VARID_X] = ncxvarid; ncgrid[gridIndex].ncIDs[CDF_VARID_Y] = ncyvarid; ncgrid[gridIndex].ncIDs[CDF_VARID_A] = ncavarid; + return delayed; } -static void +static struct cdfPostDefActionList * cdfDefUnstructured(stream_t *streamptr, int gridID, int gridIndex) { ncgrid_t *ncgrid = streamptr->ncgrid; - const size_t dimlen = gridInqSize(gridID); + size_t dimlen = gridInqSize(gridID); int dimID = CDI_UNDEFID; int ncxvarid = CDI_UNDEFID, ncyvarid = CDI_UNDEFID, ncavarid = CDI_UNDEFID; @@ -851,10 +1012,10 @@ cdfDefUnstructured(stream_t *streamptr, int gridID, int gridIndex) { struct idSearch search = cdfSearchIDBySize(ofs, (size_t) gridIndex, ncgrid, CDF_DIMID_X, GRID_UNSTRUCTURED, (int) dimlen, gridInqType, gridInqSize); - const size_t index = search.foundIdx; + size_t index = search.foundIdx; if (index != SIZE_MAX) { - const int gridID0 = ncgrid[index].gridID; + int gridID0 = ncgrid[index].gridID; if (gridInqNvertex(gridID0) == gridInqNvertex(gridID) && IS_EQUAL(gridInqXval(gridID0, 0), gridInqXval(gridID, 0)) && IS_EQUAL(gridInqXval(gridID0, dimlen - 1), gridInqXval(gridID, dimlen - 1)) && IS_EQUAL(gridInqYval(gridID0, 0), gridInqYval(gridID, 0)) @@ -872,15 +1033,17 @@ cdfDefUnstructured(stream_t *streamptr, int gridID, int gridIndex) } while (false); + struct cdfPostDefActionList *delayed = NULL; if (dimID == CDI_UNDEFID) { - const size_t nvertex = (size_t) gridInqNvertex(gridID); + size_t nvertex = (size_t) gridInqNvertex(gridID); struct cdfDefIrregularGridCommonIDs createdIDs = cdfDefIrregularGridCommon(streamptr, gridID, dimlen, 1, 2, "ncells", nvertex, "vertices", nvertex > 0); dimID = createdIDs.xdimID; ncxvarid = createdIDs.ncxvarid; ncyvarid = createdIDs.ncyvarid; ncavarid = createdIDs.ncavarid; + delayed = createdIDs.delayed; } ncgrid[gridIndex].gridID = gridID; @@ -888,34 +1051,46 @@ cdfDefUnstructured(stream_t *streamptr, int gridID, int gridIndex) ncgrid[gridIndex].ncIDs[CDF_VARID_X] = ncxvarid; ncgrid[gridIndex].ncIDs[CDF_VARID_Y] = ncyvarid; ncgrid[gridIndex].ncIDs[CDF_VARID_A] = ncavarid; + return delayed; } +struct attTxtTab +{ + const char *txt; + size_t txtLen; +}; + struct attTxtTab2 { const char *attName, *attVal; size_t valLen; }; -static void +static struct cdfPostDefActionList * cdf_def_vct_echam(stream_t *streamptr, int zaxisID) { - const int type = zaxisInqType(zaxisID); - if (type == ZAXIS_HYBRID || type == ZAXIS_HYBRID_HALF) - { - const int ilev = zaxisInqVctSize(zaxisID) / 2; - if (ilev == 0) return; + int type = zaxisInqType(zaxisID); - const int mlev = ilev - 1; + int ilev; + struct cdfPostDefActionList *delayed = NULL; + if ((type == ZAXIS_HYBRID || type == ZAXIS_HYBRID_HALF) && (ilev = zaxisInqVctSize(zaxisID) / 2) != 0) + { + int mlev = ilev - 1; if (streamptr->vct.ilev > 0) { if (streamptr->vct.ilev != ilev) Error("More than one VCT for each file unsupported!"); - return; + return delayed; } - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; - if (streamptr->ncmode == 2) cdf_redef(fileID); + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } int ncdimid = -1, ncdimid2 = -1; int hyaiid, hybiid, hyamid = -1, hybmid = -1; @@ -948,7 +1123,7 @@ cdf_def_vct_echam(stream_t *streamptr, int zaxisID) { tabLen = sizeof(tab) / sizeof(tab[0]) }; - const int ids[tabLen] = { hyaiid, hyaiid, hybiid, hybiid }; + int ids[tabLen] = { hyaiid, hyaiid, hybiid, hybiid }; for (size_t i = 0; i < tabLen; ++i) cdf_put_att_text(fileID, ids[i], tab[i].attName, tab[i].valLen, tab[i].attVal); } @@ -965,158 +1140,174 @@ cdf_def_vct_echam(stream_t *streamptr, int zaxisID) { tabLen = sizeof(tab) / sizeof(tab[0]) }; - const int ids[tabLen] = { hyamid, hyamid, hybmid, hybmid }; + int ids[tabLen] = { hyamid, hyamid, hybmid, hybmid }; for (size_t i = 0; i < tabLen; ++i) cdf_put_att_text(fileID, ids[i], tab[i].attName, tab[i].valLen, tab[i].attVal); } - cdf_enddef(fileID); - streamptr->ncmode = 2; + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } const double *vctptr = zaxisInqVctPtr(zaxisID); - cdf_put_var_double(fileID, hyaiid, vctptr); - cdf_put_var_double(fileID, hybiid, vctptr + ilev); - - size_t count = 1; - for (int i = 0; i < mlev; i++) - { - size_t start = (size_t) i; - double mval = (vctptr[i] + vctptr[i + 1]) * 0.5; - cdf_put_vara_double(fileID, hyamid, &start, &count, &mval); - mval = (vctptr[ilev + i] + vctptr[ilev + i + 1]) * 0.5; - cdf_put_vara_double(fileID, hybmid, &start, &count, &mval); - } + cdfPostDefActionAddPutVal(&delayed, fileID, hyaiid, vctptr, (void (*)(void *))(void (*)(void)) memFree); + cdfPostDefActionAddPutVal(&delayed, fileID, hybiid, vctptr + ilev, (void (*)(void *))(void (*)(void)) memFree); + { + double *restrict amidVal = (double *) Malloc((size_t) mlev * sizeof(*amidVal)); + for (size_t i = 0; i < (size_t) mlev; ++i) amidVal[i] = (vctptr[i] + vctptr[i + 1]) * 0.5; + cdfPostDefActionAddPutVal(&delayed, fileID, hyamid, amidVal, cdfDelayedPutVarDeepCleanup); + } + { + double *restrict bmidVal = (double *) Malloc((size_t) mlev * sizeof(*bmidVal)); + for (size_t i = 0; i < (size_t) mlev; ++i) bmidVal[i] = (vctptr[(size_t) ilev + i] + vctptr[(size_t) ilev + i + 1]) * 0.5; + cdfPostDefActionAddPutVal(&delayed, fileID, hybmid, bmidVal, cdfDelayedPutVarDeepCleanup); + } } + return delayed; } -static void +static struct cdfPostDefActionList * cdf_def_vct_cf(stream_t *streamptr, int zaxisID, int nclevID, int ncbndsID, int p0status, double p0value) { - const int type = zaxisInqType(zaxisID); - if (type == ZAXIS_HYBRID || type == ZAXIS_HYBRID_HALF) - { - const int ilev = zaxisInqVctSize(zaxisID) / 2; - if (ilev == 0) return; + int type = zaxisInqType(zaxisID); - const int mlev = ilev - 1; - int hyaiid = 0, hybiid = 0, hyamid, hybmid; + struct cdfPostDefActionList *delayed = NULL; + int ilev; + if ((type == ZAXIS_HYBRID || type == ZAXIS_HYBRID_HALF) && (ilev = zaxisInqVctSize(zaxisID) / 2) != 0) + { + int mlev = ilev - 1; if (streamptr->vct.ilev > 0) { if (streamptr->vct.ilev != ilev) Error("more than one VCT for each file unsupported!"); - return; + return delayed; } - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; - if (streamptr->ncmode == 2) cdf_redef(fileID); + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + cdf_redef(fileID); + streamptr->ncmode = 1; + } - int dimIDs[2]; - dimIDs[0] = nclevID; - dimIDs[1] = ncbndsID; + int dimIDs[2] = { nclevID, ncbndsID }; streamptr->vct.mlev = mlev; streamptr->vct.ilev = ilev; streamptr->vct.mlevID = nclevID; streamptr->vct.ilevID = nclevID; + int hyamid, hybmid; cdf_def_var(fileID, (p0status == 0) ? "a" : "ap", NC_DOUBLE, 1, dimIDs, &hyamid); cdf_def_var(fileID, "b", NC_DOUBLE, 1, dimIDs, &hybmid); { - static const char lname[] = "vertical coordinate formula term: ap(k)"; - cdf_put_att_text(fileID, hyamid, "long_name", sizeof(lname) - 1, lname); + static const char anametab[][10] = { "long_name", "units" }; + static const char lname_v_a[] = "vertical coordinate formula term: ap(k)", + lname_v_b[] = "vertical coordinate formula term: b(k)", units_v_a[] = "Pa", units_v_b[] = "1"; + static struct attTxtTab attvtab[][2] = { { { lname_v_a, sizeof(lname_v_a) - 1 }, { units_v_a, sizeof(units_v_a) - 1 } }, + { { lname_v_b, sizeof(lname_v_b) - 1 }, { units_v_b, sizeof(units_v_b) - 1 } } }; + int termid[] = { hyamid, hybmid }; + enum + { + numTerms = sizeof(termid) / sizeof(termid[0]), + numAtts = sizeof(anametab) / sizeof(anametab[0]), + }; + for (size_t termIdx = 0; termIdx < numTerms; ++termIdx) + for (size_t attIdx = 0; attIdx < numAtts; ++attIdx) + cdf_put_att_text(fileID, termid[termIdx], anametab[attIdx], attvtab[termIdx][attIdx].txtLen, + attvtab[termIdx][attIdx].txt); + } + double *restrict vctptr = (double *) zaxisInqVctPtr(zaxisID); + if (p0status == 0 && IS_NOT_EQUAL(p0value, 0)) + { + double *restrict temp = (double *) Malloc((size_t) ilev * sizeof(*temp)); + for (size_t i = 0; i < (size_t) ilev; ++i) temp[i] = vctptr[i] / p0value; + vctptr = temp; + } - static const char units[] = "Pa"; - cdf_put_att_text(fileID, hyamid, "units", sizeof(units) - 1, units); + { + double *restrict mlevValA = (double *) Malloc((size_t) mlev * sizeof(*mlevValA)); + for (size_t i = 0; i < (size_t) mlev; ++i) mlevValA[i] = (vctptr[i] + vctptr[i + 1]) * 0.5; + cdfPostDefActionAddPutVal(&delayed, fileID, hyamid, mlevValA, cdfDelayedPutVarDeepCleanup); } { - static const char lname[] = "vertical coordinate formula term: b(k)"; - cdf_put_att_text(fileID, hybmid, "long_name", sizeof(lname) - 1, lname); - - static const char units[] = "1"; - cdf_put_att_text(fileID, hybmid, "units", sizeof(units) - 1, units); + double *restrict mlevValB = (double *) Malloc((size_t) mlev * sizeof(*mlevValB)); + for (size_t i = 0; i < (size_t) mlev; ++i) mlevValB[i] = (vctptr[(size_t) ilev + i] + vctptr[(size_t) ilev + i + 1]) * 0.5; + cdfPostDefActionAddPutVal(&delayed, fileID, hybmid, mlevValB, cdfDelayedPutVarDeepCleanup); } if (ncbndsID != -1) { + int hyaiid, hybiid; cdf_def_var(fileID, (p0status == 0) ? "a_bnds" : "ap_bnds", NC_DOUBLE, 2, dimIDs, &hyaiid); cdf_def_var(fileID, "b_bnds", NC_DOUBLE, 2, dimIDs, &hybiid); - + static const char anametab[][10] = { "long_name", "units" }; + static const char lname_v_a[] = "vertical coordinate formula term: ap(k+1/2)", + lname_v_b[] = "vertical coordinate formula term: b(k+1/2)", units_v_a[] = "Pa", units_v_b[] = "1"; + static struct attTxtTab attvtab[][2] = { { { lname_v_a, sizeof(lname_v_a) - 1 }, { units_v_a, sizeof(units_v_a) - 1 } }, + { { lname_v_b, sizeof(lname_v_b) - 1 }, { units_v_b, sizeof(units_v_b) - 1 } } }; + int termid[] = { hyaiid, hybiid }; + enum { - static const char lname[] = "vertical coordinate formula term: ap(k+1/2)"; - cdf_put_att_text(fileID, hyaiid, "long_name", sizeof(lname) - 1, lname); + numTerms = sizeof(termid) / sizeof(termid[0]), + numAtts = sizeof(anametab) / sizeof(anametab[0]), + }; + for (size_t termIdx = 0; termIdx < numTerms; ++termIdx) + for (size_t attIdx = 0; attIdx < numAtts; ++attIdx) + cdf_put_att_text(fileID, termid[termIdx], anametab[attIdx], attvtab[termIdx][attIdx].txtLen, + attvtab[termIdx][attIdx].txt); - static const char units[] = "Pa"; - cdf_put_att_text(fileID, hyaiid, "units", sizeof(units) - 1, units); + { + double *restrict ilevValA = (double *) Malloc((size_t) mlev * 2 * sizeof(*ilevValA)); + for (size_t i = 0; i < (size_t) mlev; ++i) + { + ilevValA[2 * i] = vctptr[i]; + ilevValA[2 * i + 1] = vctptr[i + 1]; + } + cdfPostDefActionAddPutVal(&delayed, fileID, hyaiid, ilevValA, cdfDelayedPutVarDeepCleanup); } { - static const char lname[] = "vertical coordinate formula term: b(k+1/2)"; - cdf_put_att_text(fileID, hybiid, "long_name", sizeof(lname) - 1, lname); - - static const char units[] = "1"; - cdf_put_att_text(fileID, hybiid, "units", sizeof(units) - 1, units); + double *restrict ilevValB = (double *) Malloc((size_t) mlev * 2 * sizeof(*ilevValB)); + for (size_t i = 0; i < (size_t) mlev; ++i) + { + ilevValB[2 * i] = vctptr[(size_t) ilev + i]; + ilevValB[2 * i + 1] = vctptr[(size_t) ilev + i + 1]; + } + cdfPostDefActionAddPutVal(&delayed, fileID, hybiid, ilevValB, cdfDelayedPutVarDeepCleanup); } } + if (p0status == 0 && IS_NOT_EQUAL(p0value, 0)) Free(vctptr); - cdf_enddef(fileID); - streamptr->ncmode = 2; - - const int vctsize = zaxisInqVctSize(zaxisID); - double *vct = (double *) malloc(vctsize * sizeof(double)); - ; - zaxisInqVct(zaxisID, vct); - - if (p0status == 0 && IS_NOT_EQUAL(p0value, 0)) - for (int i = 0; i < vctsize / 2; ++i) vct[i] /= p0value; - - double *tarray = (double *) malloc(ilev * 2 * sizeof(double)); - - if (ncbndsID != -1) + if (switchNCMode) { - for (int i = 0; i < mlev; ++i) - { - tarray[2 * i] = vct[i]; - tarray[2 * i + 1] = vct[i + 1]; - } - cdf_put_var_double(fileID, hyaiid, tarray); - - for (int i = 0; i < mlev; ++i) - { - tarray[2 * i] = vct[ilev + i]; - tarray[2 * i + 1] = vct[ilev + i + 1]; - } - cdf_put_var_double(fileID, hybiid, tarray); + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; } - - for (int i = 0; i < mlev; ++i) tarray[i] = (vct[i] + vct[i + 1]) * 0.5; - cdf_put_var_double(fileID, hyamid, tarray); - - for (int i = 0; i < mlev; ++i) tarray[i] = (vct[ilev + i] + vct[ilev + i + 1]) * 0.5; - cdf_put_var_double(fileID, hybmid, tarray); - - free(tarray); - free(vct); } + return delayed; } -struct attTxtTab -{ - const char *txt; - size_t txtLen; -}; - -static void +static struct cdfPostDefActionList * cdf_def_zaxis_hybrid_echam(stream_t *streamptr, int type, int *ncvaridp, int zaxisID, int zaxisindex, int xtype, size_t dimlen, int *dimID, char *axisname) { - const int fileID = streamptr->fileID; - - if (streamptr->ncmode == 2) cdf_redef(fileID); + int fileID = streamptr->fileID; + struct cdfPostDefActionList *delayed = NULL; + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } cdf_def_dim(fileID, axisname, dimlen, dimID); cdf_def_var(fileID, axisname, (nc_type) xtype, 1, dimID, ncvaridp); - const int ncvarid = *ncvaridp; + int ncvarid = *ncvaridp; { static const char sname[] = "hybrid_sigma_pressure"; @@ -1135,7 +1326,7 @@ cdf_def_zaxis_hybrid_echam(stream_t *streamptr, int type, int *ncvaridp, int zax = { { { lname_i, sizeof(lname_i) - 1 }, { formula_i, sizeof(formula_i) - 1 }, { fterms_i, sizeof(fterms_i) - 1 } }, { { lname_m, sizeof(lname_m) - 1 }, { formula_m, sizeof(formula_m) - 1 }, { fterms_m, sizeof(fterms_m) - 1 } } }; - const size_t tabSelect = type == ZAXIS_HYBRID; + size_t tabSelect = type == ZAXIS_HYBRID; for (size_t i = 0; i < nAtt; ++i) cdf_put_att_text(fileID, ncvarid, attName[i], tab[tabSelect][i].txtLen, tab[tabSelect][i].txt); } @@ -1149,33 +1340,48 @@ cdf_def_zaxis_hybrid_echam(stream_t *streamptr, int type, int *ncvaridp, int zax cdf_put_att_text(fileID, ncvarid, "positive", sizeof(direction) - 1, direction); } - cdf_enddef(fileID); - streamptr->ncmode = 2; - - if (zaxisInqLevels(zaxisID, NULL)) cdf_put_var_double(fileID, ncvarid, zaxisInqLevelsPtr(zaxisID)); + if (zaxisInqLevels(zaxisID, NULL)) + cdfPostDefActionAddPutVal(&delayed, fileID, ncvarid, zaxisInqLevelsPtr(zaxisID), (void (*)(void *))(void (*)(void)) memFree); - cdf_def_vct_echam(streamptr, zaxisID); + { + struct cdfPostDefActionList *delayedVct = cdf_def_vct_echam(streamptr, zaxisID); + delayed = cdfPostDefActionConcat(delayed, delayedVct); + Free(delayedVct); + } if (*dimID == CDI_UNDEFID) streamptr->zaxisID[zaxisindex] = type == ZAXIS_HYBRID ? streamptr->vct.mlevID : streamptr->vct.ilevID; + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + + return delayed; } -static void +static struct cdfPostDefActionList * cdf_def_zaxis_hybrid_cf(stream_t *streamptr, int type, int *ncvaridp, int zaxisID, int zaxisindex, int xtype, size_t dimlen, int *dimID, char *axisname) { - const int fileID = streamptr->fileID; - if (streamptr->ncmode == 2) cdf_redef(fileID); - char psname[CDI_MAX_NAME]; int length = CDI_MAX_NAME; cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_PSNAME, psname, &length); if (psname[0] == 0) strcpy(psname, "ps"); + int fileID = streamptr->fileID; + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } + char p0name[CDI_MAX_NAME]; p0name[0] = 0; double p0value = 1; int p0varid = CDI_UNDEFID; - const int p0status = cdiInqKeyFloat(zaxisID, CDI_GLOBAL, CDI_KEY_P0VALUE, &p0value); + int p0status = cdiInqKeyFloat(zaxisID, CDI_GLOBAL, CDI_KEY_P0VALUE, &p0value); if (p0status == CDI_NOERR) { length = CDI_MAX_NAME; @@ -1183,9 +1389,9 @@ cdf_def_zaxis_hybrid_cf(stream_t *streamptr, int type, int *ncvaridp, int zaxisI if (p0name[0] == 0) strcpy(p0name, "p0"); cdf_def_var(fileID, p0name, NC_DOUBLE, 0, 0, &p0varid); static const char longname[] = "reference pressure"; - cdf_put_att_text(fileID, p0varid, "long_name", strlen(longname), longname); + cdf_put_att_text(fileID, p0varid, "long_name", sizeof(longname) - 1, longname); static const char units[] = "Pa"; - cdf_put_att_text(fileID, p0varid, "units", strlen(units), units); + cdf_put_att_text(fileID, p0varid, "units", sizeof(units) - 1, units); } char zname[CDI_MAX_NAME]; @@ -1195,53 +1401,72 @@ cdf_def_zaxis_hybrid_cf(stream_t *streamptr, int type, int *ncvaridp, int zaxisI cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, zname, &length); if (zname[0]) strcpy(axisname, zname); zlongname[0] = 0; - if (zlongname[0] == 0) strcpy(zlongname, "hybrid sigma pressure coordinate"); + size_t zlongnameLen; + if (zlongname[0] == 0) + { + static const char default_zlongname[] = "hybrid sigma pressure coordinate"; + memcpy(zlongname, default_zlongname, sizeof(default_zlongname)); + zlongnameLen = sizeof(default_zlongname) - 1; + } + else + zlongnameLen = strlen(zlongname); length = CDI_MAX_NAME; cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, zunits, &length); - if (zunits[0] == 0) strcpy(zunits, "1"); + size_t zunitsLen; + if (zunits[0] == 0) + { + zunits[0] = '1'; + zunits[1] = '\0'; + zunitsLen = 1; + } + else + zunitsLen = strlen(zunits); cdf_def_dim(fileID, axisname, dimlen, dimID); cdf_def_var(fileID, axisname, (nc_type) xtype, 1, dimID, ncvaridp); int ncvarid = *ncvaridp; { - static const char sname[] = "standard_name", sname_v[] = "atmosphere_hybrid_sigma_pressure_coordinate", axis[] = "axis", - axis_v[] = "Z", direction[] = "positive", direction_v[] = "down"; + static const char sname[] = "standard_name", lname[] = "long_name", sname_v[] = "atmosphere_hybrid_sigma_pressure_coordinate", + axis[] = "axis", axis_v[] = "Z", direction[] = "positive", direction_v[] = "down", units[] = "units"; struct attTxtTab2 tab[] = { { sname, sname_v, sizeof(sname_v) - 1 }, { axis, axis_v, sizeof(axis_v) - 1 }, { direction, direction_v, sizeof(direction_v) - 1 }, + { units, zunits, zunitsLen }, + { lname, zlongname, zlongnameLen }, }; enum { nAtt = sizeof(tab) / sizeof(tab[0]) }; for (size_t i = 0; i < nAtt; ++i) cdf_put_att_text(fileID, ncvarid, tab[i].attName, tab[i].valLen, tab[i].attVal); - - cdf_put_att_text(fileID, ncvarid, "long_name", strlen(zlongname), zlongname); - cdf_put_att_text(fileID, ncvarid, "units", strlen(zunits), zunits); } size_t len = 0; - char txt[CDI_MAX_NAME]; + char txt[CDI_MAX_NAME * 2 + 30]; if (p0status == 0) - len = (size_t) (sprintf(txt, "%s%s %s%s", "a: a b: b p0: ", p0name, "ps: ", psname)); + len = (size_t) (snprintf(txt, sizeof(txt), "%s%s %s%s", "a: a b: b p0: ", p0name, "ps: ", psname)); else - len = (size_t) (sprintf(txt, "%s%s", "ap: ap b: b ps: ", psname)); + len = (size_t) (snprintf(txt, sizeof(txt), "%s%s", "ap: ap b: b ps: ", psname)); cdf_put_att_text(fileID, ncvarid, "formula_terms", len, txt); int ncbvarid = CDI_UNDEFID; int nvdimID = CDI_UNDEFID; - double *buffer = (double *) malloc(4 * dimlen * sizeof(double)); - double *levels = buffer; - double *lbounds = buffer + 2 * dimlen; - double *ubounds = buffer + 3 * dimlen; + double *buffer = (double *) malloc(2 * dimlen * sizeof(double)); + double *lbounds = buffer; + double *ubounds = buffer + dimlen; + double *restrict levels; - if (zaxisInqLevels(zaxisID, NULL)) - zaxisInqLevels(zaxisID, levels); + bool hasLevels = zaxisInqLevels(zaxisID, NULL) != 0; + if (hasLevels) + levels = (double *) zaxisInqLevelsPtr(zaxisID); else - for (size_t i = 0; i < dimlen; ++i) levels[i] = i + 1; + { + levels = (double *) Malloc(sizeof(*levels) * dimlen); + for (size_t i = 0; i < dimlen; ++i) levels[i] = (double) (i + 1); + } if (zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL)) { @@ -1257,7 +1482,7 @@ cdf_def_zaxis_hybrid_cf(stream_t *streamptr, int type, int *ncvaridp, int zaxisI // if ( zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL) ) { - const size_t nvertex = 2; + size_t nvertex = 2; if (dimlen > 1 && nc_inq_dimid(fileID, bndsName, &nvdimID) != NC_NOERR) cdf_def_dim(fileID, bndsName, nvertex, &nvdimID); if (nvdimID != CDI_UNDEFID) @@ -1269,61 +1494,72 @@ cdf_def_zaxis_hybrid_cf(stream_t *streamptr, int type, int *ncvaridp, int zaxisI int dimIDs[2] = { *dimID, nvdimID }; cdf_def_var(fileID, axisname, (nc_type) xtype, 2, dimIDs, &ncbvarid); cdf_put_att_text(fileID, ncvarid, "bounds", axisnameLen, axisname); + size_t formulatermsLen; + if (p0status == 0) + formulatermsLen = (size_t) (sprintf(txt, "%s%s %s%s", "a: a_bnds b: b_bnds p0: ", p0name, "ps: ", psname)); + else + formulatermsLen = (size_t) (sprintf(txt, "%s%s", "ap: ap_bnds b: b_bnds ps: ", psname)); { - static const char sname[] = "standard_name", sname_v[] = "atmosphere_hybrid_sigma_pressure_coordinate"; + static const char sname[] = "standard_name", sname_v[] = "atmosphere_hybrid_sigma_pressure_coordinate", + formulaterms[] = "formula_terms", units[] = "units"; struct attTxtTab2 tab[] = { { sname, sname_v, sizeof(sname_v) - 1 }, + { units, zunits, zunitsLen }, + { formulaterms, txt, formulatermsLen }, }; enum { nAtt = sizeof(tab) / sizeof(tab[0]) }; for (size_t i = 0; i < nAtt; ++i) cdf_put_att_text(fileID, ncbvarid, tab[i].attName, tab[i].valLen, tab[i].attVal); - cdf_put_att_text(fileID, ncbvarid, "units", strlen(zunits), zunits); } - - if (p0status == 0) - len = (size_t) (sprintf(txt, "%s%s %s%s", "a: a_bnds b: b_bnds p0: ", p0name, "ps: ", psname)); - else - len = (size_t) (sprintf(txt, "%s%s", "ap: ap_bnds b: b_bnds ps: ", psname)); - cdf_put_att_text(fileID, ncbvarid, "formula_terms", len, txt); } } - cdf_enddef(fileID); - streamptr->ncmode = 2; - - cdf_put_var_double(fileID, ncvarid, levels); + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } if (p0varid != CDI_UNDEFID) cdf_put_var_double(fileID, p0varid, &p0value); + struct cdfPostDefActionList *delayed = NULL; + cdfPostDefActionAddPutVal(&delayed, fileID, ncvarid, levels, + hasLevels ? (void (*)(void *))(void (*)(void)) memFree : cdfDelayedPutVarDeepCleanup); + if (ncbvarid != CDI_UNDEFID) { - double *zbounds = buffer; + double *restrict zbounds = (double *) Malloc(2 * dimlen * sizeof(*zbounds)); for (size_t i = 0; i < dimlen; ++i) { zbounds[2 * i] = lbounds[i]; zbounds[2 * i + 1] = ubounds[i]; } - cdf_put_var_double(fileID, ncbvarid, zbounds); + cdfPostDefActionAddPutVal(&delayed, fileID, ncbvarid, zbounds, cdfDelayedPutVarDeepCleanup); } - cdf_def_vct_cf(streamptr, zaxisID, *dimID, nvdimID, p0status, p0value); + { + struct cdfPostDefActionList *delayedVct = cdf_def_vct_cf(streamptr, zaxisID, *dimID, nvdimID, p0status, p0value); + delayed = cdfPostDefActionConcat(delayed, delayedVct); + Free(delayedVct); + } if (*dimID == CDI_UNDEFID) streamptr->zaxisID[zaxisindex] = type == ZAXIS_HYBRID ? streamptr->vct.mlevID : streamptr->vct.ilevID; free(buffer); + return delayed; } -static void +static struct cdfPostDefActionList * cdf_def_zaxis_hybrid(stream_t *streamptr, int type, int *ncvarid, int zaxisID, int zaxisindex, int xtype, size_t dimlen, int *dimID, char *axisname) { - void (*def_zaxis_hybrid_delegate)(stream_t * streamptr, int type, int *ncvarid, int zaxisID, int zaxisindex, int xtype, - size_t dimlen, int *dimID, char *axisname) + struct cdfPostDefActionList *(*def_zaxis_hybrid_delegate)(stream_t * streamptr, int type, int *ncvarid, int zaxisID, + int zaxisindex, int xtype, size_t dimlen, int *dimID, char *axisname) = ((!CDI_CMOR_Mode && CDI_Convention == CDI_CONVENTION_ECHAM) || type == ZAXIS_HYBRID_HALF) ? cdf_def_zaxis_hybrid_echam : cdf_def_zaxis_hybrid_cf; - def_zaxis_hybrid_delegate(streamptr, type, ncvarid, zaxisID, zaxisindex, xtype, dimlen, dimID, axisname); + return def_zaxis_hybrid_delegate(streamptr, type, ncvarid, zaxisID, zaxisindex, xtype, dimlen, dimID, axisname); } static void @@ -1337,10 +1573,20 @@ cdfDefZaxisUUID(stream_t *streamptr, int zaxisID) char uuidStr[uuidNumHexChars + 1] = { 0 }; if (cdiUUID2Str(uuid, uuidStr) == uuidNumHexChars) { - const int fileID = streamptr->fileID; - if (streamptr->ncmode == 2) cdf_redef(fileID); + int fileID = streamptr->fileID; + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } + cdf_put_att_text(fileID, NC_GLOBAL, "uuidOfVGrid", uuidNumHexChars, uuidStr); - if (streamptr->ncmode == 2) cdf_enddef(fileID); + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } } } } @@ -1349,13 +1595,13 @@ cdfDefZaxisUUID(stream_t *streamptr, int zaxisID) static void cdfDefZaxisChar(stream_t *streamptr, int zaxisID, char *axisname, int *dimID, size_t dimlen, int zaxisindex) { - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; int ncvarID = CDI_UNDEFID; if (streamptr->ncmode == 2) cdf_redef(fileID); // Check StrlenID char strlen[8] = "strlen\0"; - const size_t clen = (size_t) zaxisInqCLen(zaxisID); + size_t clen = (size_t) zaxisInqCLen(zaxisID); if (clen == 0) Error("Maximal string length value is 0.\nA given character axis requires a dimension to save the maximal string length."); int strlenID = CDI_UNDEFID; @@ -1394,7 +1640,7 @@ cdfDefZaxisChar(stream_t *streamptr, int zaxisID, char *axisname, int *dimID, si cdfDefineAttributes(zaxisID, CDI_GLOBAL, fileID, ncvarID); streamptr->nczvarID[zaxisindex] = ncvarID; - cdf_enddef(fileID); + cdf_enddef(fileID, streamptr->self); // Write Stringvalues size_t start[2], count[2]; @@ -1426,37 +1672,30 @@ zaxis_inq_xtype(int zaxisID) return xtype; } -static void +static struct cdfPostDefActionList * cdfDefZaxis(stream_t *streamptr, int zaxisID) { // char zaxisname0[CDI_MAX_NAME]; - int dimID = CDI_UNDEFID; int ncvarid = CDI_UNDEFID, ncbvarid = CDI_UNDEFID; - const int xtype = zaxis_inq_xtype(zaxisID); - - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; - - const int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); + int xtype = zaxis_inq_xtype(zaxisID); - const int nzaxis = vlistNzaxis(vlistID); - - const size_t dimlen = (size_t) zaxisInqSize(zaxisID); - const int type = zaxisInqType(zaxisID); + size_t dimlen = (size_t) zaxisInqSize(zaxisID); + int type = zaxisInqType(zaxisID); int ndims = 1; + struct cdfPostDefActionList *delayed = NULL; if (dimlen == 1) { - bool is_scalar = zaxisInqScalar(zaxisID) > 0; - if (!is_scalar && CDI_CMOR_Mode) + bool isScalar = zaxisInqScalar(zaxisID) > 0; + if (!isScalar && CDI_CMOR_Mode) { - is_scalar = true; + isScalar = true; zaxisDefScalar(zaxisID); } - if (is_scalar) ndims = 0; - if (CDI_Reduce_Dim) return; + if (isScalar) ndims = 0; + if (CDI_Reduce_Dim) return delayed; switch (type) { @@ -1473,129 +1712,132 @@ cdfDefZaxis(stream_t *streamptr, int zaxisID) case ZAXIS_SEDIMENT_BOTTOM: case ZAXIS_SEDIMENT_BOTTOM_TA: case ZAXIS_SEDIMENT_BOTTOM_TW: - case ZAXIS_MIX_LAYER: return; + case ZAXIS_MIX_LAYER: return delayed; } } + int vlistID = streamptr->vlistID; char axisname[CDI_MAX_NAME]; int length = CDI_MAX_NAME; cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, axisname, &length); + int zaxisindex = vlistZaxisIndex(vlistID, zaxisID); + int nzaxis = vlistNzaxis(vlistID); + int fileID = streamptr->fileID; - if (dimID == CDI_UNDEFID) - { - checkZaxisName(axisname, fileID, vlistID, zaxisID, nzaxis); + checkZaxisName(axisname, fileID, vlistID, zaxisID, nzaxis); - char dimname[CDI_MAX_NAME + 3]; - dimname[0] = 0; - if (dimname[0] == 0) strcpy(dimname, axisname); + char dimname[CDI_MAX_NAME + 3]; + dimname[0] = 0; + if (dimname[0] == 0) strcpy(dimname, axisname); - if (type == ZAXIS_REFERENCE) cdfDefZaxisUUID(streamptr, zaxisID); + if (type == ZAXIS_REFERENCE) cdfDefZaxisUUID(streamptr, zaxisID); - if (type == ZAXIS_HYBRID || type == ZAXIS_HYBRID_HALF) - { - cdf_def_zaxis_hybrid(streamptr, type, &ncvarid, zaxisID, zaxisindex, xtype, dimlen, &dimID, axisname); + int dimID; + if (type == ZAXIS_HYBRID || type == ZAXIS_HYBRID_HALF) + { + delayed = cdf_def_zaxis_hybrid(streamptr, type, &ncvarid, zaxisID, zaxisindex, xtype, dimlen, &dimID, axisname); - int natts; - cdiInqNatts(zaxisID, CDI_GLOBAL, &natts); - if (natts > 0 && streamptr->ncmode == 2) cdf_redef(fileID); - cdfDefineAttributes(zaxisID, CDI_GLOBAL, fileID, ncvarid); - if (natts > 0 && streamptr->ncmode == 2) cdf_enddef(fileID); - } + int natts; + cdiInqNatts(zaxisID, CDI_GLOBAL, &natts); + cdfDefineAttributes(zaxisID, CDI_GLOBAL, fileID, ncvarid); + } #ifndef USE_MPI - else if (type == ZAXIS_CHAR) - cdfDefZaxisChar(streamptr, zaxisID, axisname, &dimID, dimlen, zaxisindex); + else if (type == ZAXIS_CHAR) + cdfDefZaxisChar(streamptr, zaxisID, axisname, &dimID, dimlen, zaxisindex); #endif - else - { - dimID = checkDimName(fileID, dimlen, dimname); + else + { + dimID = checkDimName(fileID, dimlen, dimname); - if (streamptr->ncmode == 2) cdf_redef(fileID); + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } - if (ndims && dimID == CDI_UNDEFID) cdf_def_dim(fileID, dimname, dimlen, &dimID); + if (ndims && dimID == CDI_UNDEFID) cdf_def_dim(fileID, dimname, dimlen, &dimID); - if (zaxisInqLevels(zaxisID, NULL)) - { - cdf_def_var(fileID, axisname, (nc_type) xtype, ndims, &dimID, &ncvarid); + if (zaxisInqLevels(zaxisID, NULL)) + { + cdf_def_var(fileID, axisname, (nc_type) xtype, ndims, &dimID, &ncvarid); - cdfPutGridStdAtts(fileID, ncvarid, zaxisID, 'Z'); + cdfPutGridStdAtts(fileID, ncvarid, zaxisID, 'Z'); + { + int positive = zaxisInqPositive(zaxisID); + static const char positive_up[] = "up", positive_down[] = "down"; + static const struct attTxtTab tab[2] = { + { positive_up, sizeof(positive_up) - 1 }, + { positive_down, sizeof(positive_down) - 1 }, + }; + if (positive == POSITIVE_UP || positive == POSITIVE_DOWN) { - const int positive = zaxisInqPositive(zaxisID); - static const char positive_up[] = "up", positive_down[] = "down"; - static const struct attTxtTab tab[2] = { - { positive_up, sizeof(positive_up) - 1 }, - { positive_down, sizeof(positive_down) - 1 }, - }; - if (positive == POSITIVE_UP || positive == POSITIVE_DOWN) - { - const size_t select = (positive == POSITIVE_DOWN); - cdf_put_att_text(fileID, ncvarid, "positive", tab[select].txtLen, tab[select].txt); - } + size_t select = (positive == POSITIVE_DOWN); + cdf_put_att_text(fileID, ncvarid, "positive", tab[select].txtLen, tab[select].txt); } - cdf_put_att_text(fileID, ncvarid, "axis", 1, "Z"); - - if (zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL)) - { - int nvdimID = CDI_UNDEFID; - const size_t nvertex = 2; - if (nc_inq_dimid(fileID, bndsName, &nvdimID) != NC_NOERR) cdf_def_dim(fileID, bndsName, nvertex, &nvdimID); - - if (nvdimID != CDI_UNDEFID) - { - const size_t axisnameLen = strlen(axisname); - axisname[axisnameLen] = '_'; - memcpy(axisname + axisnameLen + 1, bndsName, sizeof(bndsName)); - int dimIDs[2]; - dimIDs[0] = dimID; - dimIDs[ndims] = nvdimID; - cdf_def_var(fileID, axisname, (nc_type) xtype, ndims + 1, dimIDs, &ncbvarid); - cdf_put_att_text(fileID, ncvarid, "bounds", strlen(axisname), axisname); - } - } - - cdfDefineAttributes(zaxisID, CDI_GLOBAL, fileID, ncvarid); - } - - cdf_enddef(fileID); - streamptr->ncmode = 2; + } + cdf_put_att_text(fileID, ncvarid, "axis", 1, "Z"); + cdfPostDefActionAddPutVal(&delayed, fileID, ncvarid, zaxisInqLevelsPtr(zaxisID), + (void (*)(void *))(void (*)(void)) memFree); - if (zaxisInqLevels(zaxisID, NULL)) + if (zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL)) { - cdf_put_var_double(fileID, ncvarid, zaxisInqLevelsPtr(zaxisID)); + int nvdimID = CDI_UNDEFID; + size_t nvertex = 2; + if (nc_inq_dimid(fileID, bndsName, &nvdimID) != NC_NOERR) cdf_def_dim(fileID, bndsName, nvertex, &nvdimID); - if (ncbvarid != CDI_UNDEFID) + if (nvdimID != CDI_UNDEFID) { - double *buffer = (double *) malloc(4 * dimlen * sizeof(double)); - double *zbounds = buffer; - double *lbounds = buffer + 2 * dimlen; - double *ubounds = buffer + 3 * dimlen; - zaxisInqLbounds(zaxisID, lbounds); - zaxisInqUbounds(zaxisID, ubounds); - for (size_t i = 0; i < dimlen; ++i) - { - zbounds[2 * i] = lbounds[i]; - zbounds[2 * i + 1] = ubounds[i]; - } - - cdf_put_var_double(fileID, ncbvarid, zbounds); - - free(buffer); + { + size_t axisnameLen = strlen(axisname); + axisname[axisnameLen] = '_'; + memcpy(axisname + axisnameLen + 1, bndsName, sizeof(bndsName)); + int dimIDs[2]; + dimIDs[0] = dimID; + dimIDs[ndims] = nvdimID; + cdf_def_var(fileID, axisname, (nc_type) xtype, ndims + 1, dimIDs, &ncbvarid); + cdf_put_att_text(fileID, ncvarid, "bounds", axisnameLen + sizeof(bndsName), axisname); + } + { + double *restrict zbounds = (double *) Malloc(4 * dimlen * sizeof(*zbounds)), + *restrict lbounds = zbounds + 2 * dimlen, *restrict ubounds = zbounds + 3 * dimlen; + zaxisInqLbounds(zaxisID, lbounds); + zaxisInqUbounds(zaxisID, ubounds); + for (size_t i = 0; i < dimlen; ++i) + { + zbounds[2 * i] = lbounds[i]; + zbounds[2 * i + 1] = ubounds[i]; + } + zbounds = (double *) Realloc(zbounds, 2 * dimlen * sizeof(*zbounds)); + cdfPostDefActionAddPutVal(&delayed, fileID, ncbvarid, zbounds, cdfDelayedPutVarDeepCleanup); + } } - - if (ndims == 0) streamptr->nczvarID[zaxisindex] = ncvarid; } + cdfDefineAttributes(zaxisID, CDI_GLOBAL, fileID, ncvarid); } + + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + + if (zaxisInqLevels(zaxisID, NULL) && ndims == 0) streamptr->nczvarID[zaxisindex] = ncvarid; } if (dimID != CDI_UNDEFID) streamptr->zaxisID[zaxisindex] = dimID; + return delayed; } -static void +static struct cdfPostDefActionList * cdf_def_mapping(stream_t *streamptr, int gridID) { + struct cdfPostDefActionList *delayed = NULL; + int natts; cdiInqNatts(gridID, CDI_GLOBAL, &natts); - if (natts == 0) return; + if (natts == 0) return delayed; int datatype = -1; int status = cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARTYPE, &datatype); @@ -1605,20 +1847,29 @@ cdf_def_mapping(stream_t *streamptr, int gridID) cdiInqKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARNAME, gmapvarname, &length); if (!gmapvarname[0]) strcpy(gmapvarname, "crs"); - const int fileID = streamptr->fileID; - if (streamptr->ncmode == 2) cdf_redef(fileID); + int fileID = streamptr->fileID; + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } int ncvarid; - const int ncerrcode = nc_def_var(fileID, gmapvarname, (nc_type) gmapvartype, 0, NULL, &ncvarid); + int ncerrcode = nc_def_var(fileID, gmapvarname, gmapvartype, 0, NULL, &ncvarid); if (ncerrcode == NC_NOERR) cdfDefineAttributes(gridID, CDI_GLOBAL, fileID, ncvarid); - cdf_enddef(fileID); + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } - if (ncerrcode == NC_NOERR && gmapvartype != NC_CHAR) + if (ncerrcode == NC_NOERR && !xtypeIsText(gmapvartype)) { - int dummy = 1; - cdf_put_var_int(fileID, ncvarid, &dummy); + cdfPostDefActionAddPut1Int(&delayed, fileID, ncvarid, 1, (void (*)(void *))(void (*)(void)) memFree); } + return delayed; } static void @@ -1626,17 +1877,17 @@ cdfDefCharacter(stream_t *streamptr, int gridID, int gridIndex, int cdiAxisID, i { if (streamptr->ncgrid[gridIndex].ncIDs[CDF_DIMID_X] != CDI_UNDEFID) return; - const bool isXaxis = (cdiAxisID == CDI_XAXIS); + bool isXaxis = (cdiAxisID == CDI_XAXIS); - const size_t dimlen = isXaxis ? gridInqXsize(gridID) : gridInqYsize(gridID); + size_t dimlen = isXaxis ? gridInqXsize(gridID) : gridInqYsize(gridID); ncgrid_t *ncgrid = streamptr->ncgrid; // Check for all grids up to gridIndex whether it already is defined for (int index = 0; index < gridIndex; index++) { - const int gridID0 = ncgrid[index].gridID; - const int gridtype0 = gridInqType(gridID0); + int gridID0 = ncgrid[index].gridID; + int gridtype0 = gridInqType(gridID0); if (gridtype0 == GRID_CHARXY) { if (gridInqXIsc(gridID0) == strlen && (size_t) gridInqXsize(gridID0) == dimlen) @@ -1646,7 +1897,7 @@ cdfDefCharacter(stream_t *streamptr, int gridID, int gridIndex, int cdiAxisID, i } } - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; if (streamptr->ncmode == 2) cdf_redef(fileID); @@ -1689,7 +1940,7 @@ cdfDefCharacter(stream_t *streamptr, int gridID, int gridIndex, int cdiAxisID, i cdf_def_var(fileID, axisname, NC_CHAR, 2, dimIDs, &ncaxisid); cdfPutGridStdAtts(fileID, ncaxisid, gridID, isXaxis ? 'X' : 'Y'); - cdf_enddef(fileID); + cdf_enddef(fileID, streamptr->self); // Write Var @@ -1718,16 +1969,16 @@ cdfDefRgrid(stream_t *streamptr, int gridID, int gridIndex) ncgrid[gridIndex].gridID = gridID; { - const size_t dimlen = gridInqSize(gridID); + size_t dimlen = gridInqSize(gridID); struct idSearch search = cdfSearchIDBySize(0, (size_t) gridIndex, ncgrid, CDF_DIMID_X, GRID_GAUSSIAN_REDUCED, (int) dimlen, gridInqType, gridInqSize); - const int iz = search.numNonMatching; + int iz = search.numNonMatching; int dimID = search.foundID; if (dimID == CDI_UNDEFID) { - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; char axisname[16] = "rgridX"; if (iz == 0) @@ -1735,47 +1986,63 @@ cdfDefRgrid(stream_t *streamptr, int gridID, int gridIndex) else sprintf(&axisname[5], "%1d", iz + 1); - if (streamptr->ncmode == 2) cdf_redef(fileID); + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } cdf_def_dim(fileID, axisname, dimlen, &dimID); - cdf_enddef(fileID); - streamptr->ncmode = 2; + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } } ncgrid[gridIndex].ncIDs[CDF_DIMID_X] = dimID; } { - const size_t dimlen = gridInqYsize(gridID); + size_t dimlen = gridInqYsize(gridID); struct idSearch search = cdfSearchIDBySize(0, (size_t) gridIndex, ncgrid, CDF_DIMID_RP, GRID_GAUSSIAN_REDUCED, (int) dimlen, gridInqType, gridInqSize); - const int iz = search.numNonMatching; + int iz = search.numNonMatching; int dimID = search.foundID; if (dimID == CDI_UNDEFID) { - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; char axisname[32] = "reduced_pointsX"; if (iz == 0) axisname[14] = '\0'; else - sprintf(&axisname[5], "%1d", iz + 1); + sprintf(&axisname[14], "%1d", iz + 1); - if (streamptr->ncmode == 2) cdf_redef(fileID); + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } cdf_def_dim(fileID, axisname, dimlen, &dimID); int ncvarid = CDI_UNDEFID; int ndims = 1; - const nc_type xtype = NC_INT; + nc_type xtype = NC_INT; cdf_def_var(fileID, axisname, xtype, ndims, &dimID, &ncvarid); - cdf_enddef(fileID); - streamptr->ncmode = 2; + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } int *reducedPoints = (int *) Malloc(dimlen * sizeof(int)); gridInqReducedPoints(gridID, reducedPoints); @@ -1790,12 +2057,12 @@ cdfDefRgrid(stream_t *streamptr, int gridID, int gridIndex) } static void -cdfDefGdim(stream_t *streamptr, int gridID, int gridIndex) +cdf_define_generic_dim(stream_t *streamptr, int gridID, int gridIndex) { ncgrid_t *ncgrid = streamptr->ncgrid; int dimID = CDI_UNDEFID; - const size_t dimlen = gridInqSize(gridID); + size_t dimlen = gridInqSize(gridID); if (gridInqYsize(gridID) == 0) { @@ -1815,49 +2082,78 @@ cdfDefGdim(stream_t *streamptr, int gridID, int gridIndex) { int fileID = streamptr->fileID; char dimname[CDI_MAX_NAME]; - strcpy(dimname, "gsize"); + int length = sizeof(dimname); + cdiInqKeyString(gridID, CDI_GLOBAL, CDI_KEY_DIMNAME, dimname, &length); + if (dimname[0] == 0) strcpy(dimname, "gsize"); dimID = checkDimName(fileID, dimlen, dimname); - if (streamptr->ncmode == 2) cdf_redef(fileID); + if (dimID == CDI_UNDEFID) + { + bool switchNCMode = streamptr->ncmode == 2; + if (switchNCMode) + { + streamptr->ncmode = 1; + cdf_redef(fileID); + } - if (dimID == CDI_UNDEFID) cdf_def_dim(fileID, dimname, dimlen, &dimID); + cdf_def_dim(fileID, dimname, dimlen, &dimID); - cdf_enddef(fileID); - streamptr->ncmode = 2; + if (switchNCMode) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + } } ncgrid[gridIndex].gridID = gridID; ncgrid[gridIndex].ncIDs[CDF_DIMID_X] = dimID; } -static void -cdfDefGrid(stream_t *streamptr, int gridID, int gridIndex) +static struct cdfPostDefActionList * +cdf_define_grid(stream_t *streamptr, int gridID, int gridIndex) { - if (streamptr->ncgrid[gridIndex].ncIDs[CDF_DIMID_X] != CDI_UNDEFID) return; + struct cdfPostDefActionList *delayed = NULL; + + if (streamptr->ncgrid[gridIndex].ncIDs[CDF_DIMID_X] != CDI_UNDEFID) return delayed; - const int gridtype = gridInqType(gridID); - const size_t size = gridInqSize(gridID); + int gridtype = gridInqType(gridID); + size_t size = gridInqSize(gridID); if (CDI_Debug) Message("gridtype = %d size = %zu", gridtype, size); if (CDI_Reduce_Dim && size == 1) // no grid information { streamptr->ncgrid[gridIndex].gridID = gridID; - return; + return delayed; } if (gridtype == GRID_GAUSSIAN || gridtype == GRID_LONLAT || gridtype == GRID_PROJECTION) { - const int ndims = !(gridtype == GRID_LONLAT && size == 1 && !gridInqHasDims(gridID)); - const size_t xsize = gridInqXsize(gridID); - const size_t ysize = gridInqYsize(gridID); + int ndims = !(gridtype == GRID_LONLAT && size == 1 && !gridInqHasDims(gridID)); + size_t xsize = gridInqXsize(gridID); + size_t ysize = gridInqYsize(gridID); - if (xsize) cdfDefXaxis(streamptr, gridID, gridIndex, ndims, false); - if (ysize) cdfDefYaxis(streamptr, gridID, gridIndex, ndims, false); - if (ndims == 1 && xsize == 0 && ysize == 0 && gridtype == GRID_PROJECTION) cdfDefGdim(streamptr, gridID, gridIndex); + if (xsize) + { + struct cdfPostDefActionList *xdelayed = cdfDefXaxis(streamptr, gridID, gridIndex, ndims, false); + delayed = cdfPostDefActionConcat(delayed, xdelayed); + Free(xdelayed); + } + if (ysize) + { + struct cdfPostDefActionList *ydelayed = cdfDefYaxis(streamptr, gridID, gridIndex, ndims, false); + delayed = cdfPostDefActionConcat(delayed, ydelayed); + Free(ydelayed); + } - cdf_def_mapping(streamptr, gridID); + if (ndims == 1 && xsize == 0 && ysize == 0 && gridtype == GRID_PROJECTION) + cdf_define_generic_dim(streamptr, gridID, gridIndex); + + struct cdfPostDefActionList *mdelayed = cdf_def_mapping(streamptr, gridID); + delayed = cdfPostDefActionConcat(delayed, mdelayed); + Free(mdelayed); } else if (gridtype == GRID_GENERIC) { @@ -1868,21 +2164,32 @@ cdfDefGrid(stream_t *streamptr, int gridID, int gridIndex) } else { - const size_t xsize = gridInqXsize(gridID); - const size_t ysize = gridInqYsize(gridID); + size_t xsize = gridInqXsize(gridID); + size_t ysize = gridInqYsize(gridID); + + if (xsize > 0) + { + struct cdfPostDefActionList *xdelayed = cdfDefXaxis(streamptr, gridID, gridIndex, 1, false); + delayed = cdfPostDefActionConcat(delayed, xdelayed); + Free(xdelayed); + } + if (ysize > 0) + { + struct cdfPostDefActionList *ydelayed = cdfDefYaxis(streamptr, gridID, gridIndex, 1, false); + delayed = cdfPostDefActionConcat(delayed, ydelayed); + Free(ydelayed); + } - if (xsize) cdfDefXaxis(streamptr, gridID, gridIndex, 1, false); - if (ysize) cdfDefYaxis(streamptr, gridID, gridIndex, 1, false); - if (xsize == 0 && ysize == 0) cdfDefGdim(streamptr, gridID, gridIndex); + if (xsize == 0 && ysize == 0) cdf_define_generic_dim(streamptr, gridID, gridIndex); } } else if (gridtype == GRID_CURVILINEAR) { - cdfDefCurvilinear(streamptr, gridID, gridIndex); + delayed = cdfDefCurvilinear(streamptr, gridID, gridIndex); } else if (gridtype == GRID_UNSTRUCTURED) { - cdfDefUnstructured(streamptr, gridID, gridIndex); + delayed = cdfDefUnstructured(streamptr, gridID, gridIndex); } else if (gridtype == GRID_GAUSSIAN_REDUCED) { @@ -1921,51 +2228,78 @@ cdfDefGrid(stream_t *streamptr, int gridID, int gridIndex) { Error("Unsupported grid type: %s", gridNamePtr(gridtype)); } + return delayed; } void cdfDefCoordinateVars(stream_t *streamptr) { - const int vlistID = streamptr->vlistID; + int vlistID = streamptr->vlistID; if (vlistID == CDI_UNDEFID) Error("Internal problem! vlist undefined for streamptr %p", streamptr); if (vlistHasTime(vlistID)) cdfDefTime(streamptr); - const int ngrids = vlistNgrids(vlistID); + int ngrids = vlistNgrids(vlistID); if (2 * ngrids > MAX_GRIDS_PS) Error("Internal problem! Too many grids per stream (max=%d)\n", MAX_GRIDS_PS); + + struct cdfPostDefActionList *delayed = NULL; + + ncgrid_t *restrict ncgrid = streamptr->ncgrid; for (int index = 0; index < 2 * ngrids; ++index) { - streamptr->ncgrid[index].gridID = CDI_UNDEFID; - for (size_t i = 0; i < CDF_SIZE_ncIDs; ++i) streamptr->ncgrid[index].ncIDs[i] = CDI_UNDEFID; + ncgrid[index].gridID = CDI_UNDEFID; + for (size_t i = 0; i < CDF_SIZE_ncIDs; ++i) ncgrid[index].ncIDs[i] = CDI_UNDEFID; } for (int index = 0; index < ngrids; ++index) { - const int gridID = vlistGrid(vlistID, index); - cdfDefGrid(streamptr, gridID, index); + int gridID = vlistGrid(vlistID, index); + struct cdfPostDefActionList *griddelayed = cdf_define_grid(streamptr, gridID, index); + delayed = cdfPostDefActionConcat(delayed, griddelayed); + Free(griddelayed); } { int index = ngrids - 1; for (int i = 0; i < ngrids; ++i) { - const int gridID = vlistGrid(vlistID, i); - const int projID = gridInqProj(gridID); - if (projID != CDI_UNDEFID) cdfDefGrid(streamptr, projID, ++index); + int gridID = vlistGrid(vlistID, i); + int projID = gridInqProj(gridID); + if (projID != CDI_UNDEFID) + { + struct cdfPostDefActionList *griddelayed = cdf_define_grid(streamptr, projID, ++index); + delayed = cdfPostDefActionConcat(delayed, griddelayed); + Free(griddelayed); + } } } - const int nzaxis = vlistNzaxis(vlistID); + int nzaxis = vlistNzaxis(vlistID); for (int index = 0; index < nzaxis; ++index) { - const int zaxisID = vlistZaxis(vlistID, index); - if (streamptr->zaxisID[index] == CDI_UNDEFID) cdfDefZaxis(streamptr, zaxisID); + int zaxisID = vlistZaxis(vlistID, index); + if (streamptr->zaxisID[index] == CDI_UNDEFID) + { + struct cdfPostDefActionList *zaxisdelayed = cdfDefZaxis(streamptr, zaxisID); + delayed = cdfPostDefActionConcat(delayed, zaxisdelayed); + Free(zaxisdelayed); + } } if (streamptr->ncmode != 2) { - cdf_enddef(streamptr->fileID); + cdf_enddef(streamptr->fileID, streamptr->self); streamptr->ncmode = 2; } + + int nvars = vlistNvars(vlistID); + for (int varID = 0; varID < nvars; varID++) cdfDefVar(streamptr, varID); + + cdfEndDef(streamptr); + if (delayed) + { + cdfPostDefActionApply(delayed->len, delayed->actions); + cdfPostDefActionListDelete(delayed); + } } #endif diff --git a/src/stream_cdf_postdef.h b/src/stream_cdf_postdef.h new file mode 100644 index 0000000000000000000000000000000000000000..af3a896369e65f03c874ebe62f0d1537ae268060 --- /dev/null +++ b/src/stream_cdf_postdef.h @@ -0,0 +1,34 @@ +#ifndef STREAM_CDF_POSTDEF_H +#define STREAM_CDF_POSTDEF_H + +#include <stdlib.h> + +#include "cdi_int.h" + +struct cdfPostDefAction +{ + void *data; + void (*action)(void *data); + void (*cleanup)(void *data); +}; + +struct cdfPostDefActionList +{ + size_t size, len; + struct cdfPostDefAction actions[]; +}; + +void cdfPostDefActionGridProp(stream_t *streamptr, int gridID, int ncvarid, enum gridPropInq gridProp, + struct cdfPostDefActionList **delayed); + +typedef void (*cdfFuncPtrPostDefActionGridProp)(stream_t *streamptr, int gridID, int ncvarid, enum gridPropInq gridProp, + struct cdfPostDefActionList **delayed); + +struct cdfPostDefActionList *cdfPostDefActionAdd(struct cdfPostDefActionList *list, struct cdfPostDefAction addendum); + +void cdfDelayedPutVarDeepCleanup(void *data); + +void cdfPostDefActionAddPutVal(struct cdfPostDefActionList **delayed, int fileID, int ncvarid, const double *values, + void (*cleanup)(void *)); + +#endif diff --git a/src/stream_cdf_time.c b/src/stream_cdf_time.c index c7828d8f70b77d164febbec7bc06e8dc2ff7abdf..602394d383697fa7c7928dcac79f9461acc6a731 100644 --- a/src/stream_cdf_time.c +++ b/src/stream_cdf_time.c @@ -9,8 +9,10 @@ #include "cdi.h" #include "cdi_int.h" +#include "dmemory.h" #include "stream_cdf.h" #include "cdf_int.h" +#include "vlist.h" static int cdfDefTimeBounds(int fileID, int nctimevarid, int nctimedimid, const char *taxis_name, taxis_t *taxis) @@ -52,31 +54,30 @@ cdfDefTimeBounds(int fileID, int nctimevarid, int nctimedimid, const char *taxis return time_bndsid; } -static void -cdfDefTimeUnits(char *unitstr, taxis_t *taxis) +static const char * +cdfGetTimeUnits(taxis_t *taxis) { + const char *unitstr; if (taxis->units && taxis->units[0]) { - strcpy(unitstr, taxis->units); + unitstr = taxis->units; } else { - unitstr[0] = 0; - if (taxis->type == TAXIS_ABSOLUTE) { static const char *const unitstrfmt[3] = { "year as %Y.%f", "month as %Y%m.%f", "day as %Y%m%d.%f" }; size_t fmtidx = (taxis->unit == TUNIT_YEAR ? 0 : (taxis->unit == TUNIT_MONTH ? 1 : 2)); - strcpy(unitstr, unitstrfmt[fmtidx]); + unitstr = unitstrfmt[fmtidx]; } else { - const int year = taxis->rdatetime.date.year; - const int month = taxis->rdatetime.date.month; - const int day = taxis->rdatetime.date.day; - const int hour = taxis->rdatetime.time.hour; - const int minute = taxis->rdatetime.time.minute; - const int second = taxis->rdatetime.time.second; + const int year = taxis->rDateTime.date.year; + const int month = taxis->rDateTime.date.month; + const int day = taxis->rDateTime.date.day; + const int hour = taxis->rDateTime.time.hour; + const int minute = taxis->rDateTime.time.minute; + const int second = taxis->rDateTime.time.second; int timeunit = (taxis->unit != -1) ? taxis->unit : TUNIT_HOUR; if (timeunit == TUNIT_QUARTER) @@ -86,16 +87,17 @@ cdfDefTimeUnits(char *unitstr, taxis_t *taxis) else if (timeunit == TUNIT_3HOURS || timeunit == TUNIT_6HOURS || timeunit == TUNIT_12HOURS) timeunit = TUNIT_HOUR; - sprintf(unitstr, "%s since %d-%d-%d %02d:%02d:%02d", tunitNamePtr(timeunit), year, month, day, hour, minute, second); + char *unitstr_ = ptaxisAllocUnits(taxis, CDF_MAX_TIME_UNIT_STR); + sprintf(unitstr_, "%s since %d-%d-%d %02d:%02d:%02d", tunitNamePtr(timeunit), year, month, day, hour, minute, second); + unitstr = unitstr_; } } + return unitstr; } -static void -cdfDefForecastTimeUnits(char *unitstr, int timeunit) +static const char * +cdfGetForecastTimeUnits(int timeunit) { - unitstr[0] = 0; - if (timeunit == -1) timeunit = TUNIT_HOUR; else if (timeunit == TUNIT_QUARTER) @@ -105,7 +107,7 @@ cdfDefForecastTimeUnits(char *unitstr, int timeunit) else if (timeunit == TUNIT_3HOURS || timeunit == TUNIT_6HOURS || timeunit == TUNIT_12HOURS) timeunit = TUNIT_HOUR; - strcpy(unitstr, tunitNamePtr(timeunit)); + return tunitNamePtr(timeunit); } static void @@ -147,7 +149,7 @@ cdfDefTime(stream_t *streamptr) if (streamptr->ncmode == 0) streamptr->ncmode = 1; if (streamptr->ncmode == 2) cdf_redef(fileID); - taxis_t *taxis = &streamptr->tsteps[0].taxis; + taxis_t *taxis = taxisPtr(vlistInqTaxis(streamptr->vlistID)); const char *taxisName = (taxis->name && taxis->name[0]) ? taxis->name : defaultTimeAxisName; @@ -174,7 +176,7 @@ cdfDefTime(stream_t *streamptr) #ifdef HAVE_NETCDF4 if (timeDimLen == NC_UNLIMITED && (streamptr->filetype == CDI_FILETYPE_NC4 || streamptr->filetype == CDI_FILETYPE_NC4C)) { - const size_t chunk = 512; + static const size_t chunk = 512; cdf_def_var_chunking(fileID, timeVarId, NC_CHUNKED, &chunk); } #endif @@ -185,12 +187,31 @@ cdfDefTime(stream_t *streamptr) if (taxis->longname && taxis->longname[0]) cdf_put_att_text(fileID, timeVarId, "long_name", strlen(taxis->longname), taxis->longname); - if (taxis->has_bounds) streamptr->basetime.ncvarboundsid = cdfDefTimeBounds(fileID, timeVarId, timeDimId, taxisName, taxis); + if (taxis->hasBounds) streamptr->basetime.ncvarboundsid = cdfDefTimeBounds(fileID, timeVarId, timeDimId, taxisName, taxis); - char unitsStr[CDI_MAX_NAME]; - cdfDefTimeUnits(unitsStr, taxis); - size_t len = strlen(unitsStr); - if (len) cdf_put_att_text(fileID, timeVarId, "units", len, unitsStr); + char unitsStr_[CDF_MAX_TIME_UNIT_STR]; + const char *unitsStr; + size_t unitsStrLen; + if (taxis->units && taxis->units[0]) + { + unitsStr = taxis->units; + unitsStrLen = strlen(taxis->units); + } + else + { + /* define bogus value since at this time, streamDefTimestep has + * not been called yet + * but since taxis->units is not set, it clearly will not + * exceed the size of unitstr_, i.e. when defining the units + * attribute to this value, a later redefinition will not + * cause a recreation of on-disk data + */ + for (size_t i = 0; i < CDF_MAX_TIME_UNIT_STR; ++i) unitsStr_[i] = 'a'; + unitsStr_[CDF_MAX_TIME_UNIT_STR - 1] = '\0'; + unitsStr = unitsStr_; + unitsStrLen = CDF_MAX_TIME_UNIT_STR - 1; + } + cdf_put_att_text(fileID, timeVarId, "units", unitsStrLen, unitsStr); if (taxis->calendar != -1) cdfDefCalendar(fileID, timeVarId, taxis->calendar); @@ -206,14 +227,67 @@ cdfDefTime(stream_t *streamptr) static const char longName[] = "Time elapsed since the start of the forecast"; cdf_put_att_text(fileID, leadtimeid, "long_name", sizeof(longName) - 1, longName); - cdfDefForecastTimeUnits(unitsStr, taxis->fc_unit); - len = strlen(unitsStr); + unitsStr = cdfGetForecastTimeUnits(taxis->fc_unit); + size_t len = strlen(unitsStr); if (len) cdf_put_att_text(fileID, leadtimeid, "units", len, unitsStr); } cdf_put_att_text(fileID, timeVarId, "axis", 1, "T"); - if (streamptr->ncmode == 2) cdf_enddef(fileID); + if (streamptr->ncmode == 2) cdf_enddef(fileID, streamptr->self); +} + +void +cdfDefTimestep(stream_t *streamptr, int tsID, size_t valCount) +{ + const int time_varid = streamptr->basetime.ncvarid; + if (time_varid != CDI_UNDEFID && tsID == 0) + { + taxis_t *taxis = taxisPtr(vlistInqTaxis(streamptr->vlistID)); + const int fileID = streamptr->fileID; + const char *unitstr = cdfGetTimeUnits(taxis); + const size_t len = strlen(unitstr); + if (len) cdf_put_att_text(fileID, time_varid, "units", len, unitstr); + } + + const int fileID = streamptr->fileID; + + if (CDI_Debug) Message("streamID = %d, fileID = %d, tsID = %d", streamptr->self, fileID, tsID); + + taxis_t *taxis = &streamptr->tsteps[tsID].taxis; + + if (streamptr->ncmode == 1) + { + cdf_enddef(fileID, streamptr->self); + streamptr->ncmode = 2; + } + + if (streamptr->accessmode == 0) + { + cdfEndDef(streamptr); + } + + const size_t start[2] = { [0] = (size_t) tsID, [1] = 0 }, count[2] = { [0] = valCount, [1] = 2 * valCount }; + + double timeValue[2] = { cdi_encode_timeval(taxis->vDateTime, &streamptr->tsteps[0].taxis) }; + if (CDI_Debug) Message("tsID = %d timeValue = %f", tsID, timeValue); + + int ncvarid = streamptr->basetime.ncvarid; + cdf_put_vara_double(fileID, ncvarid, start, count, timeValue); + + if (taxis->hasBounds) + { + ncvarid = streamptr->basetime.ncvarboundsid; + if (ncvarid == CDI_UNDEFID) Error("Call to taxisWithBounds() missing!"); + + timeValue[0] = cdi_encode_timeval(taxis->vDateTime_lb, &streamptr->tsteps[0].taxis); + timeValue[1] = cdi_encode_timeval(taxis->vDateTime_ub, &streamptr->tsteps[0].taxis); + cdf_put_vara_double(fileID, ncvarid, start, count, timeValue); + } + + ncvarid = streamptr->basetime.leadtimeid; + if (taxis->type == TAXIS_FORECAST && ncvarid != CDI_UNDEFID) + cdf_put_vara_double(fileID, ncvarid, start, count, &taxis->fc_period); } #endif diff --git a/src/stream_cgribex.c b/src/stream_cgribex.c index d1074481fbd3825db9c07e5418fb6d3eafcdf915..0d0dde101c555358e8954928f84727325a9e46e1 100644 --- a/src/stream_cgribex.c +++ b/src/stream_cgribex.c @@ -10,7 +10,6 @@ #include "cdi_int.h" #include "file.h" #include "varscan.h" -#include "datetime.h" #include "stream_scan.h" #include "stream_grb.h" #include "stream_cgribex.h" @@ -200,9 +199,9 @@ cgribexGetTimeUnit(int *isec1) case ISEC1_TABLE4_12HOURS: timeunit = TUNIT_12HOURS; break; case ISEC1_TABLE4_DAY: timeunit = TUNIT_DAY; break; default: - if ( lprint ) + if (lprint) { - Message("GRIB time unit %d unsupported!", ISEC1_TimeUnit); + Warning("GRIB time unit %d unsupported!", ISEC1_TimeUnit); lprint = false; } break; @@ -236,9 +235,9 @@ cgribexGetTsteptype(int timerange) case 5: tsteptype = TSTEP_DIFF; break; case 10: tsteptype = TSTEP_INSTANT3; break; default: - if ( lprint ) + if (lprint) { - Message("Time range indicator %d unsupported, set to 0!", timerange); + Warning("Time range indicator %d unsupported, set to 0!", timerange); lprint = false; } break; @@ -594,7 +593,10 @@ cgribexAddRecord(stream_t *streamptr, cgribexrec_t *cgribexp, int param, size_t } } else - Free(gridptr); + { + grid_free(gridptr); + Free(gridptr); + } const int zaxistype = grib1ltypeToZaxisType(leveltype); if (zaxistype == ZAXIS_HYBRID || zaxistype == ZAXIS_HYBRID_HALF) @@ -759,17 +761,30 @@ cgribexSkipRecords(const int fileID) } } +static CdiDateTime +cgribexDateTimeX(int *isec1, CdiDateTime *sDateTime) +{ + int vdate = 0, sdate = 0, vtime = 0, stime = 0; + gribDateTimeX(isec1, &vdate, &vtime, &sdate, &stime); + + sDateTime->date = cdiDate_set(sdate); + sDateTime->time = cdiTime_set(stime); + + return cdiDateTime_set(vdate, vtime); +} + int cgribexScanTimestep1(stream_t *streamptr) { + CdiDateTime vDateTime0; + cdiDateTime_init(&vDateTime0); int lmv = 0, iret = 0; off_t recpos = 0; void *gribbuffer = NULL; size_t buffersize = 0; int leveltype = 0, level1 = 0, level2 = 0; - CmpDateTime datetime0 = { .date = 10101, .time = 0 }; unsigned recID; - int nrecs_scanned = 0; + int nrecsScanned = 0; bool warn_time = true; bool warn_numavg = true; bool fcast = false; @@ -818,7 +833,7 @@ cgribexScanTimestep1(stream_t *streamptr) int *isec1 = cgribexp->sec1; - nrecs_scanned++; + nrecsScanned++; cgribexDecodeHeader(cgribexp, (int *) gribbuffer, (int) recsize, &lmv, &iret); const int param = cdiEncodeParam(ISEC1_Parameter, ISEC1_CodeTable, 255); @@ -826,28 +841,21 @@ cgribexScanTimestep1(stream_t *streamptr) cgribexGetLevel(isec1, &leveltype, &level1, &level2); - int vdate, sdate; - int vtime, stime; - gribDateTimeX(isec1, &vdate, &vtime, &sdate, &stime); - CmpDateTime datetime = { .date = vdate, .time = vtime }; + CdiDateTime sDateTime; + const CdiDateTime vDateTime = cgribexDateTimeX(isec1, &sDateTime); if (nrecs == 0) { - datetime0 = datetime; + vDateTime0 = vDateTime; fcast = cgribexTimeIsFC(isec1); taxis->unit = cgribexGetTimeUnit(isec1); - taxis->rdatetime = cdiDateTime_set(gribRefDate(isec1), gribRefTime(isec1)); - taxis->sdate = sdate; - taxis->stime = stime; - taxis->vdatetime = cdiDateTime_set(vdate, vtime); + taxis->rDateTime = cdiDateTime_set(gribRefDate(isec1), gribRefTime(isec1)); + taxis->sDateTime = sDateTime; + taxis->vDateTime = vDateTime; } else { - if (sdate < taxis->sdate || (sdate == taxis->sdate && stime < taxis->stime)) - { - taxis->sdate = sdate; - taxis->stime = stime; - } + if (cdiDateTime_isLT(sDateTime, taxis->sDateTime)) taxis->sDateTime = sDateTime; compvar_t compVar = cgribexVarSet(param, level1, level2, leveltype, ISEC1_TimeRange); record_t *records = streamptr->tsteps[tsID].records; @@ -860,19 +868,19 @@ cgribexScanTimestep1(stream_t *streamptr) { if (recID < nrecs) break; if (warn_time) - if (datetime_differ(datetime, datetime0)) + if (cdiDateTime_isNE(vDateTime, vDateTime0)) { - gribWarning("Inconsistent verification time!", nrecs_scanned, tsID + 1, paramstr, level1, level2); + gribWarning("Inconsistent verification time!", nrecsScanned, tsID + 1, paramstr, level1, level2); warn_time = false; } } else { - if (datetime_differ(datetime, datetime0)) break; + if (cdiDateTime_isNE(vDateTime, vDateTime0)) break; if (recID < nrecs) { - gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID + 1, paramstr, level1, level2); + gribWarning("Parameter already exist, skipped!", nrecsScanned, tsID + 1, paramstr, level1, level2); continue; } } @@ -894,7 +902,8 @@ cgribexScanTimestep1(stream_t *streamptr) nrecs++; if (CDI_Debug) - Message("Read record %2d (id=%s lev1=%d lev2=%d) %8d %6d", nrecs_scanned, paramstr, level1, level2, vdate, vtime); + Message("Read record %2d (id=%s lev1=%d lev2=%d) %s", nrecsScanned, paramstr, level1, level2, + CdiDateTime_string(vDateTime)); cgribexAddRecord(streamptr, cgribexp, param, recsize, recpos, comptype, lmv, iret); } @@ -925,10 +934,11 @@ cgribexScanTimestep1(stream_t *streamptr) int cgribexScanTimestep2(stream_t *streamptr) { + CdiDateTime vDateTime0; + cdiDateTime_init(&vDateTime0); int lmv = 0, iret = 0; off_t recpos = 0; int leveltype = 0, level1 = 0, level2 = 0; - CmpDateTime datetime0 = { INT_MIN, INT_MIN }; int recID = 0; bool warn_numavg = true; char paramstr[32]; @@ -957,7 +967,7 @@ cgribexScanTimestep2(stream_t *streamptr) const int nrecords = streamScanInitRecords2(streamptr); - int nrecs_scanned = nrecords; + int nrecsScanned = nrecords; int rindex = 0; while (true) { @@ -978,7 +988,7 @@ cgribexScanTimestep2(stream_t *streamptr) grbDecompress(recsize, &buffersize, &gribbuffer); - nrecs_scanned++; + nrecsScanned++; cgribexDecodeHeader(cgribexp, (int *) gribbuffer, (int) recsize, &lmv, &iret); const int param = cdiEncodeParam(ISEC1_Parameter, ISEC1_CodeTable, 255); @@ -986,36 +996,29 @@ cgribexScanTimestep2(stream_t *streamptr) cgribexGetLevel(isec1, &leveltype, &level1, &level2); - int vdate, sdate; - int vtime, stime; - gribDateTimeX(isec1, &vdate, &vtime, &sdate, &stime); - CmpDateTime datetime = { .date = vdate, .time = vtime }; + CdiDateTime sDateTime; + const CdiDateTime vDateTime = cgribexDateTimeX(isec1, &sDateTime); if (rindex == 0) { - datetime0 = datetime; + vDateTime0 = vDateTime; const int taxisID = vlistInqTaxis(vlistID); if (taxisInqType(taxisID) == TAXIS_RELATIVE) { taxis->type = TAXIS_RELATIVE; - taxis->rdatetime = cdiDateTime_set(gribRefDate(isec1), gribRefTime(isec1)); + taxis->rDateTime = cdiDateTime_set(gribRefDate(isec1), gribRefTime(isec1)); } else { taxis->type = TAXIS_ABSOLUTE; } taxis->unit = cgribexGetTimeUnit(isec1); - taxis->vdatetime = cdiDateTime_set(vdate, vtime); - taxis->sdate = sdate; - taxis->stime = stime; + taxis->vDateTime = vDateTime; + taxis->sDateTime = sDateTime; } else { - if (sdate < taxis->sdate || (sdate == taxis->sdate && stime < taxis->stime)) - { - taxis->sdate = sdate; - taxis->stime = stime; - } + if (cdiDateTime_isLT(sDateTime, taxis->sDateTime)) taxis->sDateTime = sDateTime; } const int tsteptype = cgribexGetTsteptype(ISEC1_TimeRange); @@ -1037,7 +1040,7 @@ cgribexScanTimestep2(stream_t *streamptr) if (recID == nrecords) { - gribWarning("Parameter not defined at timestep 1!", nrecs_scanned, tsID + 1, paramstr, level1, level2); + gribWarning("Parameter not defined at timestep 1!", nrecsScanned, tsID + 1, paramstr, level1, level2); return CDI_EUFSTRUCT; } @@ -1057,9 +1060,9 @@ cgribexScanTimestep2(stream_t *streamptr) { if (records[recID].used) { - if (datetime_differ(datetime, datetime0)) break; + if (cdiDateTime_isNE(vDateTime, vDateTime0)) break; - gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID + 1, paramstr, level1, level2); + gribWarning("Parameter already exist, skipped!", nrecsScanned, tsID + 1, paramstr, level1, level2); continue; } else @@ -1070,7 +1073,8 @@ cgribexScanTimestep2(stream_t *streamptr) } if (CDI_Debug) - Message("Read record %2d (id=%s lev1=%d lev2=%d) %8d %6d", nrecs_scanned, paramstr, level1, level2, vdate, vtime); + Message("Read record %2d (id=%s lev1=%d lev2=%d) %s", nrecsScanned, paramstr, level1, level2, + CdiDateTime_string(vDateTime)); if (cgribexVarCompare(compVar, streamptr->tsteps[tsID].records[recID], 0) != 0) { @@ -1100,14 +1104,10 @@ cgribexScanTimestep2(stream_t *streamptr) int nrecs = 0; for (recID = 0; recID < nrecords; recID++) { - if (!records[recID].used) - { - vlistDefVarTimetype(vlistID, records[recID].varID, TIME_CONSTANT); - } + if (records[recID].used) + nrecs++; else - { - nrecs++; - } + vlistDefVarTimetype(vlistID, records[recID].varID, TIME_CONSTANT); } streamptr->tsteps[tsID].nrecs = nrecs; @@ -1124,10 +1124,11 @@ cgribexScanTimestep2(stream_t *streamptr) int cgribexScanTimestep(stream_t *streamptr) { + CdiDateTime vDateTime0; + cdiDateTime_init(&vDateTime0); int lmv = 0, iret = 0; off_t recpos = 0; int leveltype = 0, level1 = 0, level2 = 0; - CmpDateTime datetime0 = { INT_MIN, INT_MIN }; int vrecID, recID = 0; bool warn_numavg = true; int nrecs = 0; @@ -1153,7 +1154,7 @@ cgribexScanTimestep(stream_t *streamptr) fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); - int nrecs_scanned = streamptr->tsteps[0].nallrecs + streamptr->tsteps[1].nrecs * (tsID - 1); + int nrecsScanned = streamptr->tsteps[0].nallrecs + streamptr->tsteps[1].nrecs * (tsID - 1); int rindex = 0; while (true) { @@ -1167,8 +1168,6 @@ cgribexScanTimestep(stream_t *streamptr) break; } - if (rindex >= nrecs) break; - ensureBufferSize(recsize, &buffersize, &gribbuffer); size_t readsize = recsize; @@ -1180,7 +1179,7 @@ cgribexScanTimestep(stream_t *streamptr) grbDecompress(recsize, &buffersize, &gribbuffer); - nrecs_scanned++; + nrecsScanned++; cgribexDecodeHeader(cgribexp, (int *) gribbuffer, (int) recsize, &lmv, &iret); const int param = cdiEncodeParam(ISEC1_Parameter, ISEC1_CodeTable, 255); @@ -1188,39 +1187,32 @@ cgribexScanTimestep(stream_t *streamptr) cgribexGetLevel(isec1, &leveltype, &level1, &level2); - int vdate, sdate; - int vtime, stime; - gribDateTimeX(isec1, &vdate, &vtime, &sdate, &stime); - CmpDateTime datetime = { .date = vdate, .time = vtime }; + CdiDateTime sDateTime; + const CdiDateTime vDateTime = cgribexDateTimeX(isec1, &sDateTime); if (rindex == nrecs) break; if (rindex == 0) { - datetime0 = datetime; + vDateTime0 = vDateTime; const int vlistID = streamptr->vlistID; const int taxisID = vlistInqTaxis(vlistID); if (taxisInqType(taxisID) == TAXIS_RELATIVE) { taxis->type = TAXIS_RELATIVE; - taxis->rdatetime = cdiDateTime_set(gribRefDate(isec1), gribRefTime(isec1)); + taxis->rDateTime = cdiDateTime_set(gribRefDate(isec1), gribRefTime(isec1)); } else { taxis->type = TAXIS_ABSOLUTE; } taxis->unit = cgribexGetTimeUnit(isec1); - taxis->vdatetime = cdiDateTime_set(vdate, vtime); - taxis->sdate = sdate; - taxis->stime = stime; + taxis->vDateTime = vDateTime; + taxis->sDateTime = sDateTime; } else { - if (sdate < taxis->sdate || (sdate == taxis->sdate && stime < taxis->stime)) - { - taxis->sdate = sdate; - taxis->stime = stime; - } + if (cdiDateTime_isLT(sDateTime, taxis->sDateTime)) taxis->sDateTime = sDateTime; } if (ISEC1_AvgNum) @@ -1231,9 +1223,6 @@ cgribexScanTimestep(stream_t *streamptr) taxis->numavg = ISEC1_AvgNum; } - datetime.date = vdate; - datetime.time = vtime; - compvar_t compVar = cgribexVarSet(param, level1, level2, leveltype, ISEC1_TimeRange); for (vrecID = 0; vrecID < nrecs; vrecID++) @@ -1244,7 +1233,7 @@ cgribexScanTimestep(stream_t *streamptr) if (vrecID == nrecs) { - gribWarning("Parameter not defined at timestep 1!", nrecs_scanned, tsID + 1, paramstr, level1, level2); + gribWarning("Parameter not defined at timestep 1!", nrecsScanned, tsID + 1, paramstr, level1, level2); if (CDI_Inventory_Mode == 1) return CDI_EUFSTRUCT; @@ -1264,10 +1253,10 @@ cgribexScanTimestep(stream_t *streamptr) char paramstr_[32]; cdiParamToString(param, paramstr_, sizeof(paramstr_)); - if (datetime_differ(datetime, datetime0)) break; + if (cdiDateTime_isNE(vDateTime, vDateTime0)) break; if (CDI_Debug) - gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID + 1, paramstr_, level1, level2); + gribWarning("Parameter already exist, skipped!", nrecsScanned, tsID + 1, paramstr_, level1, level2); continue; } @@ -1279,7 +1268,8 @@ cgribexScanTimestep(stream_t *streamptr) } if (CDI_Debug) - Message("Read record %2d (id=%s lev1=%d lev2=%d) %8d %6d", nrecs_scanned, paramstr, level1, level2, vdate, vtime); + Message("Read record %2d (id=%s lev1=%d lev2=%d) %s", nrecsScanned, paramstr, level1, level2, + CdiDateTime_string(vDateTime)); if (cgribexVarCompare(compVar, records[recID], 0) != 0) { @@ -1303,7 +1293,7 @@ cgribexScanTimestep(stream_t *streamptr) if (vrecID < nrecs) { cdiParamToString(records[recID].param, paramstr, sizeof(paramstr)); - gribWarning("Parameter not found!", nrecs_scanned, tsID + 1, paramstr, records[recID].ilevel, records[recID].ilevel2); + gribWarning("Parameter not found!", nrecsScanned, tsID + 1, paramstr, records[recID].ilevel, records[recID].ilevel2); return CDI_EUFSTRUCT; } @@ -1452,16 +1442,12 @@ cgribexDefParam(int *isec1, int param) } static int -cgribexDefTimerange(int tsteptype, int factor, int calendar, int rdate, int rtime, int vdate, int vtime, int sdate, int stime, +cgribexDefTimerange(int tsteptype, int factor, int calendar, CdiDateTime rDateTime, CdiDateTime vDateTime, CdiDateTime sDateTime, int *pip1, int *pip2) { - CdiDateTime rDateTime = cdiDateTime_set(rdate, rtime); JulianDate julianDate1 = julianDate_encode(calendar, rDateTime); - - CdiDateTime vDateTime = cdiDateTime_set(vdate, vtime); JulianDate julianDate2 = julianDate_encode(calendar, vDateTime); - - JulianDate julianDate = julianDate_sub(julianDate2, julianDate1); + const JulianDate julianDate = julianDate_sub(julianDate2, julianDate1); int timerange = -1; int ip1 = 0, ip2 = 0; @@ -1471,14 +1457,11 @@ cgribexDefTimerange(int tsteptype, int factor, int calendar, int rdate, int rtim if ((ip > 255) && (tsteptype == TSTEP_INSTANT)) tsteptype = TSTEP_INSTANT3; int ipx = 0; - if (sdate != 0 && (tsteptype == TSTEP_RANGE || tsteptype == TSTEP_AVG || tsteptype == TSTEP_ACCUM || tsteptype == TSTEP_DIFF)) + if (!cdiDateTime_isNull(sDateTime) + && (tsteptype == TSTEP_RANGE || tsteptype == TSTEP_AVG || tsteptype == TSTEP_ACCUM || tsteptype == TSTEP_DIFF)) { - CdiDateTime sDateTime = cdiDateTime_set(sdate, stime); julianDate2 = julianDate_encode(calendar, sDateTime); - - julianDate = julianDate_sub(julianDate2, julianDate1); - - ipx = (int) lround(julianDate_to_seconds(julianDate) / factor); + ipx = (int) lround(julianDate_to_seconds(julianDate_sub(julianDate2, julianDate1)) / factor); } // clang-format off @@ -1503,11 +1486,11 @@ cgribexDefTimerange(int tsteptype, int factor, int calendar, int rdate, int rtim } static int -cgribexDefDateTime(int *isec1, int timeunit, int date, int time) +cgribexDefDateTime(int *isec1, int timeunit, CdiDateTime dt) { - int year, month, day, hour, minute, second; - cdiDecodeDate(date, &year, &month, &day); - cdiDecodeTime(time, &hour, &minute, &second); + int year, month, day, hour, minute, second, ms; + cdiDate_decode(dt.date, &year, &month, &day); + cdiTime_decode(dt.time, &hour, &minute, &second, &ms); int century = year / 100; @@ -1555,7 +1538,7 @@ cgribexDefDateTime(int *isec1, int timeunit, int date, int time) } static void -cgribexDefTime(int *isec1, int vdate, int vtime, int tsteptype, int numavg, int taxisID) +cgribexDefTime(int *isec1, CdiDateTime vDateTime, int tsteptype, int numavg, int taxisID) { int timetype = TAXIS_ABSOLUTE; int timeunit = TUNIT_HOUR; @@ -1570,26 +1553,20 @@ cgribexDefTime(int *isec1, int vdate, int vtime, int tsteptype, int numavg, int { const int calendar = taxisInqCalendar(taxisID); - int rdate = taxisInqRdate(taxisID); - int rtime = taxisInqRtime(taxisID); - if (vdate < rdate || (vdate == rdate && vtime < rtime)) - { - rdate = vdate; - rtime = vtime; - } + CdiDateTime rDateTime = taxisInqRdatetime(taxisID); + if (cdiDateTime_isLT(vDateTime, rDateTime)) rDateTime = vDateTime; - int sdate = taxisInqSdate(taxisID); - int stime = taxisInqStime(taxisID); + CdiDateTime sDateTime = taxisInqSdatetime(taxisID); - int factor = cgribexDefDateTime(isec1, timeunit, rdate, rtime); + int factor = cgribexDefDateTime(isec1, timeunit, rDateTime); int ip1 = 0, ip2 = 0; - int timerange = cgribexDefTimerange(tsteptype, factor, calendar, rdate, rtime, vdate, vtime, sdate, stime, &ip1, &ip2); + int timerange = cgribexDefTimerange(tsteptype, factor, calendar, rDateTime, vDateTime, sDateTime, &ip1, &ip2); if (ip2 > 0xFF && timeunit < TUNIT_YEAR) { timeunit++; - factor = cgribexDefDateTime(isec1, timeunit, rdate, rtime); - timerange = cgribexDefTimerange(tsteptype, factor, calendar, rdate, rtime, vdate, vtime, sdate, stime, &ip1, &ip2); + factor = cgribexDefDateTime(isec1, timeunit, rDateTime); + timerange = cgribexDefTimerange(tsteptype, factor, calendar, rDateTime, vDateTime, sDateTime, &ip1, &ip2); } if (timerange == -1 || timerange == 1 || timerange == 3) timetype = TAXIS_ABSOLUTE; @@ -1620,7 +1597,7 @@ cgribexDefTime(int *isec1, int vdate, int vtime, int tsteptype, int numavg, int if (timetype == TAXIS_ABSOLUTE) { - (void) cgribexDefDateTime(isec1, timeunit, vdate, vtime); + (void) cgribexDefDateTime(isec1, timeunit, vDateTime); /* if ( numavg > 0 ) @@ -1915,7 +1892,7 @@ cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int levelID) if (zaxistype == ZAXIS_GENERIC && ltype == 0) { - Message("Changed zaxis type from %s to %s", zaxisNamePtr(zaxistype), zaxisNamePtr(ZAXIS_PRESSURE)); + Warning("Changed zaxis type from %s to %s", zaxisNamePtr(zaxistype), zaxisNamePtr(ZAXIS_PRESSURE)); zaxistype = ZAXIS_PRESSURE; zaxisChangeType(zaxisID, zaxistype); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, "Pa"); @@ -2068,7 +2045,7 @@ cgribexDefEnsembleVar(int *isec1, int vlistID, int varID) } size_t -cgribexEncode(int memtype, int varID, int levelID, int vlistID, int gridID, int zaxisID, int vdate, int vtime, int tsteptype, +cgribexEncode(int memtype, int varID, int levelID, int vlistID, int gridID, int zaxisID, CdiDateTime vDateTime, int tsteptype, int numavg, size_t datasize, const void *data, size_t nmiss, void *gribbuffer, size_t gribbuffersize) { cgribexrec_t *cgribexp = (cgribexrec_t *) cgribexNew(); @@ -2112,7 +2089,7 @@ cgribexEncode(int memtype, int varID, int levelID, int vlistID, int gridID, int cdiInqKeyInt(vlistID, varID, CDI_KEY_UVRELATIVETOGRID, &uvRelativeToGrid); cgribexDefParam(isec1, param); - cgribexDefTime(isec1, vdate, vtime, tsteptype, numavg, vlistInqTaxis(vlistID)); + cgribexDefTime(isec1, vDateTime, tsteptype, numavg, vlistInqTaxis(vlistID)); cgribexDefGrid(isec1, isec2, fsec2, isec4, gridID, uvRelativeToGrid); cgribexDefLevel(isec1, isec2, fsec2, zaxisID, levelID); diff --git a/src/stream_cgribex.h b/src/stream_cgribex.h index 96e9f5db39f570891ad7f49bcbf10bd3fd785f3c..7bf1376176cb0edf9fcbbe220cb1299e244c101c 100644 --- a/src/stream_cgribex.h +++ b/src/stream_cgribex.h @@ -11,8 +11,9 @@ int cgribexScanTimestep(stream_t *streamptr); int cgribexDecode(int memtype, void *cgribexp, void *gribbuffer, size_t gribsize, void *data, size_t datasize, int unreduced, size_t *nmiss, double missval); -size_t cgribexEncode(int memtype, int varID, int levelID, int vlistID, int gridID, int zaxisID, int vdate, int vtime, int tsteptype, - int numavg, size_t datasize, const void *data, size_t nmiss, void *gribbuffer, size_t gribbuffersize); +size_t cgribexEncode(int memtype, int varID, int levelID, int vlistID, int gridID, int zaxisID, CdiDateTime vDateTime, + int tsteptype, int numavg, size_t datasize, const void *data, size_t nmiss, void *gribbuffer, + size_t gribbuffersize); void *cgribex_handle_new_from_meassage(void *gribbuffer, size_t recsize); void cgribex_handle_delete(void *gh); diff --git a/src/stream_ext.c b/src/stream_ext.c index e0b7c26f662e5a656f8e65f51751ba4ad6367079..9184f631adb5267ebc90a8cc86a5356e3530ee12 100644 --- a/src/stream_ext.c +++ b/src/stream_ext.c @@ -11,7 +11,6 @@ #include "stream_scan.h" #include "stream_ext.h" #include "varscan.h" -#include "datetime.h" #include "extra.h" #include "get_num_missvals.h" #include "exse.h" @@ -79,14 +78,14 @@ int extInqRecord(stream_t *streamptr, int *varID, int *levelID) static void ext_read_recordSP(stream_t *streamptr, float *data, size_t *nmiss) { - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; - const int tsID = streamptr->curTsID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsID = streamptr->curTsID; - const int vrecID = streamptr->tsteps[tsID].curRecID; - const int recID = streamptr->tsteps[tsID].recIDs[vrecID]; - const int varID = streamptr->tsteps[tsID].records[recID].varID; - const off_t recpos = streamptr->tsteps[tsID].records[recID].position; + int vrecID = streamptr->tsteps[tsID].curRecID; + int recID = streamptr->tsteps[tsID].recIDs[vrecID]; + int varID = streamptr->tsteps[tsID].records[recID].varID; + off_t recpos = streamptr->tsteps[tsID].records[recID].position; fileSetPos(fileID, recpos, SEEK_SET); @@ -97,8 +96,8 @@ ext_read_recordSP(stream_t *streamptr, float *data, size_t *nmiss) extInqHeader(extp, header); extInqDataSP(extp, data); - const double missval = vlistInqVarMissval(vlistID, varID); - const size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); + double missval = vlistInqVarMissval(vlistID, varID); + size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); if (vlistInqVarNumber(vlistID, varID) == CDI_REAL) *nmiss = get_num_missvalsSP(size, data, missval); @@ -111,14 +110,14 @@ ext_read_recordSP(stream_t *streamptr, float *data, size_t *nmiss) static void ext_read_recordDP(stream_t *streamptr, double *data, size_t *nmiss) { - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; - const int tsID = streamptr->curTsID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsID = streamptr->curTsID; - const int vrecID = streamptr->tsteps[tsID].curRecID; - const int recID = streamptr->tsteps[tsID].recIDs[vrecID]; - const int varID = streamptr->tsteps[tsID].records[recID].varID; - const off_t recpos = streamptr->tsteps[tsID].records[recID].position; + int vrecID = streamptr->tsteps[tsID].curRecID; + int recID = streamptr->tsteps[tsID].recIDs[vrecID]; + int varID = streamptr->tsteps[tsID].records[recID].varID; + off_t recpos = streamptr->tsteps[tsID].records[recID].position; fileSetPos(fileID, recpos, SEEK_SET); @@ -129,8 +128,8 @@ ext_read_recordDP(stream_t *streamptr, double *data, size_t *nmiss) extInqHeader(extp, header); extInqDataDP(extp, data); - const double missval = vlistInqVarMissval(vlistID, varID); - const size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); + double missval = vlistInqVarMissval(vlistID, varID); + size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); if (vlistInqVarNumber(vlistID, varID) == CDI_REAL) *nmiss = get_num_missvalsDP(size, data, missval); @@ -167,7 +166,7 @@ extDefRecord(stream_t *streamptr) header[0] = record->vdate; header[1] = pnum; header[2] = record->ilevel; - const int gridID = record->gridID; + int gridID = record->gridID; cdi_check_gridsize_int_limit("EXTRA", gridInqSize(gridID)); header[3] = (int) gridInqSize(gridID); @@ -204,9 +203,9 @@ ext_write_record(stream_t *streamptr, int memtype, const void *data) static void extAddRecord(stream_t *streamptr, int param, int level, size_t xysize, size_t recsize, off_t position, int prec, int number) { - const int vlistID = streamptr->vlistID; - const int tsID = streamptr->curTsID; - const int recID = recordNewEntry(streamptr, tsID); + int vlistID = streamptr->vlistID; + int tsID = streamptr->curTsID; + int recID = recordNewEntry(streamptr, tsID); record_t *record = &streamptr->tsteps[tsID].records[recID]; record->size = recsize; @@ -220,11 +219,15 @@ extAddRecord(stream_t *streamptr, int param, int level, size_t xysize, size_t re grid->x.size = xysize; grid->y.size = 0; struct addIfNewRes gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 0); - const int gridID = gridAdded.Id; - if (!gridAdded.isNew) Free(grid); + int gridID = gridAdded.Id; + if (!gridAdded.isNew) + { + grid_free(grid); + Free(grid); + } - const int leveltype = ZAXIS_GENERIC; - const int datatype = extInqDatatype(prec, number); + int leveltype = ZAXIS_GENERIC; + int datatype = extInqDatatype(prec, number); int varID, levelID = 0; varAddRecord(recID, param, gridID, leveltype, 0, level, 0, 0, 0, datatype, &varID, &levelID, TSTEP_INSTANT, 0, -1, NULL, NULL, @@ -242,8 +245,9 @@ extAddRecord(stream_t *streamptr, int param, int level, size_t xysize, size_t re static void extScanTimestep1(stream_t *streamptr) { + CdiDateTime datetime0; + cdiDateTime_init(&datetime0); int header[4]; - CmpDateTime datetime0 = { INT_MIN, INT_MIN }; off_t recpos = 0; extrec_t *extp = (extrec_t *) streamptr->record->objectp; @@ -253,7 +257,7 @@ extScanTimestep1(stream_t *streamptr) if (tsID != 0) Error("Internal problem! tstepsNewEntry returns %d", tsID); taxis_t *taxis = &streamptr->tsteps[tsID].taxis; - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; int nrecs = 0; while (true) @@ -265,22 +269,22 @@ extScanTimestep1(stream_t *streamptr) break; } - const size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); extInqHeader(extp, header); - const int vdate = header[0]; - const int vtime = 0; - const int rcode = header[1]; - const int rlevel = header[2]; - const int rxysize = header[3]; - const int param = cdiEncodeParam(rcode, 255, 255); - CmpDateTime datetime = { .date = vdate, .time = vtime }; + int vdate = header[0]; + int vtime = 0; + int rcode = header[1]; + int rlevel = header[2]; + int rxysize = header[3]; + int param = cdiEncodeParam(rcode, 255, 255); + CdiDateTime datetime = cdiDateTime_set(vdate, vtime); if (nrecs == 0) { datetime0 = datetime; - taxis->vdatetime = cdiDateTime_set(vdate, vtime); + taxis->vDateTime = datetime; } else { @@ -288,7 +292,7 @@ extScanTimestep1(stream_t *streamptr) for (int recID = 0; recID < nrecs; recID++) if (param == records[recID].param && rlevel == records[recID].ilevel) goto tstepScanLoopFinished; - if (datetime_differ(datetime, datetime0)) Warning("Inconsistent verification time for code %d level %d", rcode, rlevel); + if (cdiDateTime_isNE(datetime, datetime0)) Warning("Inconsistent verification time for code %d level %d", rcode, rlevel); } nrecs++; @@ -303,11 +307,11 @@ tstepScanLoopFinished: cdi_generate_vars(streamptr); - const int taxisID = taxisCreate(TAXIS_ABSOLUTE); + int taxisID = taxisCreate(TAXIS_ABSOLUTE); taxis->type = TAXIS_ABSOLUTE; - taxis->rdatetime = taxis->vdatetime; + taxis->rDateTime = taxis->vDateTime; - const int vlistID = streamptr->vlistID; + int vlistID = streamptr->vlistID; vlistDefTaxis(vlistID, taxisID); vlist_check_contents(vlistID); @@ -327,8 +331,8 @@ extScanTimestep2(stream_t *streamptr) streamptr->curTsID = 1; - const int fileID = streamptr->fileID; - const int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; int tsID = streamptr->rtsteps; if (tsID != 1) Error("Internal problem! unexpected timestep %d", tsID + 1); @@ -340,7 +344,7 @@ extScanTimestep2(stream_t *streamptr) cdi_create_records(streamptr, tsID); record_t *records = streamptr->tsteps[tsID].records; - const int nrecords = streamScanInitRecords2(streamptr); + int nrecords = streamScanInitRecords2(streamptr); for (int rindex = 0; rindex <= nrecords; rindex++) { @@ -351,20 +355,20 @@ extScanTimestep2(stream_t *streamptr) break; } - const size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); extInqHeader(extp, header); - const int vdate = header[0]; - const int vtime = 0; - const int rcode = header[1]; - const int rlevel = header[2]; - const int param = cdiEncodeParam(rcode, 255, 255); + int vdate = header[0]; + int vtime = 0; + int rcode = header[1]; + int rlevel = header[2]; + int param = cdiEncodeParam(rcode, 255, 255); if (rindex == 0) { taxis->type = TAXIS_ABSOLUTE; - taxis->vdatetime = cdiDateTime_set(vdate, vtime); + taxis->vDateTime = cdiDateTime_set(vdate, vtime); } bool nextstep = false; @@ -409,14 +413,10 @@ extScanTimestep2(stream_t *streamptr) int nrecs = 0; for (int recID = 0; recID < nrecords; recID++) { - if (!records[recID].used) - { - vlistDefVarTimetype(vlistID, records[recID].varID, TIME_CONSTANT); - } + if (records[recID].used) + nrecs++; else - { - nrecs++; - } + vlistDefVarTimetype(vlistID, records[recID].varID, TIME_CONSTANT); } streamptr->tsteps[tsID].nrecs = nrecs; @@ -434,7 +434,7 @@ extInqContents(stream_t *streamptr) extScanTimestep1(streamptr); - const int status = (streamptr->ntsteps == -1) ? extScanTimestep2(streamptr) : 0; + int status = (streamptr->ntsteps == -1) ? extScanTimestep2(streamptr) : 0; fileSetPos(streamptr->fileID, 0, SEEK_SET); @@ -459,7 +459,7 @@ extScanTimestep(stream_t *streamptr) nrecs = streamScanInitRecords(streamptr, tsID); - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); @@ -472,24 +472,24 @@ extScanTimestep(stream_t *streamptr) break; } - const size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); extInqHeader(extp, header); - const int vdate = header[0]; - const int vtime = 0; - const int rcode = header[1]; - const int rlevel = header[2]; - const int param = cdiEncodeParam(rcode, 255, 255); + int vdate = header[0]; + int vtime = 0; + int rcode = header[1]; + int rlevel = header[2]; + int param = cdiEncodeParam(rcode, 255, 255); // if ( rindex == nrecs ) break; gcc-4.5 internal compiler error if (rindex == nrecs) continue; - const int recID = streamptr->tsteps[tsID].recIDs[rindex]; + int recID = streamptr->tsteps[tsID].recIDs[rindex]; if (rindex == 0) { taxis->type = TAXIS_ABSOLUTE; - taxis->vdatetime = cdiDateTime_set(vdate, vtime); + taxis->vDateTime = cdiDateTime_set(vdate, vtime); } if (param != records[recID].param || rlevel != records[recID].ilevel) @@ -556,17 +556,17 @@ extReadVarSliceDP(stream_t *streamptr, int varID, int levID, double *data, size_ void *extp = streamptr->record->objectp; - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; - const double missval = vlistInqVarMissval(vlistID, varID); - const size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); - const int tsid = streamptr->curTsID; + double missval = vlistInqVarMissval(vlistID, varID); + size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); + int tsid = streamptr->curTsID; - const off_t currentfilepos = fileGetPos(fileID); + off_t currentfilepos = fileGetPos(fileID); - const int recID = streamptr->vars[varID].recordTable[0].recordID[levID]; - const off_t recpos = streamptr->tsteps[tsid].records[recID].position; + int recID = streamptr->vars[varID].recordTable[0].recordID[levID]; + off_t recpos = streamptr->tsteps[tsid].records[recID].position; fileSetPos(fileID, recpos, SEEK_SET); extRead(fileID, extp); int header[4]; @@ -586,9 +586,9 @@ extReadVarDP(stream_t *streamptr, int varID, double *data, size_t *nmiss) { if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); - const int vlistID = streamptr->vlistID; - const size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); - const size_t nlevs = (size_t) streamptr->vars[varID].recordTable[0].nlevs; + int vlistID = streamptr->vlistID; + size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); + size_t nlevs = (size_t) streamptr->vars[varID].recordTable[0].nlevs; for (size_t levID = 0; levID < nlevs; levID++) extReadVarSliceDP(streamptr, varID, (int) levID, &data[levID * gridsize], nmiss); } @@ -598,18 +598,19 @@ extWriteVarSliceDP(stream_t *streamptr, int varID, int levID, const double *data { if (CDI_Debug) Message("streamID = %d varID = %d levID = %d", streamptr->self, varID, levID); - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; - const int tsID = streamptr->curTsID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsID = streamptr->curTsID; + CdiDateTime vDateTime = streamptr->tsteps[tsID].taxis.vDateTime; int pdis, pcat, pnum; cdiDecodeParam(vlistInqVarParam(vlistID, varID), &pnum, &pcat, &pdis); int header[4]; - header[0] = (int) cdiDate_get(streamptr->tsteps[tsID].taxis.vdatetime.date); + header[0] = (int) cdiDate_get(vDateTime.date); header[1] = pnum; header[2] = (int) lround(zaxisInqLevel(vlistInqVarZaxis(vlistID, varID), levID)); - const int gridID = vlistInqVarGrid(vlistID, varID); + int gridID = vlistInqVarGrid(vlistID, varID); cdi_check_gridsize_int_limit("EXTRA", gridInqSize(gridID)); header[3] = (int) gridInqSize(gridID); @@ -626,9 +627,9 @@ extWriteVarDP(stream_t *streamptr, int varID, const double *data) { if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); - const int vlistID = streamptr->vlistID; - const size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); - const size_t nlevs = (size_t) zaxisInqSize(vlistInqVarZaxis(vlistID, varID)); + int vlistID = streamptr->vlistID; + size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); + size_t nlevs = (size_t) zaxisInqSize(vlistInqVarZaxis(vlistID, varID)); for (size_t levID = 0; levID < nlevs; levID++) extWriteVarSliceDP(streamptr, varID, (int) levID, &data[levID * gridsize]); } diff --git a/src/stream_gribapi.c b/src/stream_gribapi.c index 35b71ef61ccaf98ed6d6bff3b682ddb3258e0260..f880196d55d19b2030c289ad328fdb69ef0d160b 100644 --- a/src/stream_gribapi.c +++ b/src/stream_gribapi.c @@ -13,7 +13,6 @@ #include "stream_grb.h" #include "stream_gribapi.h" #include "varscan.h" -#include "datetime.h" #include "vlist.h" #include "subtype.h" @@ -46,7 +45,7 @@ gribapiGetZaxisType(long editionNumber, int grib_ltype) } static int -getTimeunits(const long unitsOfTime) +getTimeunits(long unitsOfTime) { switch (unitsOfTime) { @@ -63,7 +62,7 @@ getTimeunits(const long unitsOfTime) } static double -timeunit_factor(const int tu1, const int tu2) +timeunit_factor(int tu1, int tu2) { if (tu2 == TUNIT_HOUR) { @@ -98,7 +97,7 @@ gribapiGetSteps(grib_handle *gh, int timeunits, int *startStep, int *endStep) { long unitsOfTime; int status = grib_get_long(gh, "stepUnits", &unitsOfTime); - const int timeunits2 = (status == 0) ? getTimeunits(unitsOfTime) : timeunits; + int timeunits2 = (status == 0) ? getTimeunits(unitsOfTime) : timeunits; // timeunits2 = gribapiGetTimeUnits(gh); long lpar; @@ -139,18 +138,20 @@ gribapiGetDataDateTime(grib_handle *gh) } static void -gribapiSetDataDateTime(grib_handle *gh, int datadate, int datatime) +gribapiSetDataDateTime(grib_handle *gh, CdiDateTime dataDateTime) { - GRIB_CHECK(my_grib_set_long(gh, "dataDate", (long) datadate), 0); - int hour, minute, second; - cdiDecodeTime(datatime, &hour, &minute, &second); + long dataDate = (long) cdiDate_get(dataDateTime.date); + GRIB_CHECK(my_grib_set_long(gh, "dataDate", (long) dataDate), 0); + + int hour, minute, second, ms; + cdiTime_decode(dataDateTime.time, &hour, &minute, &second, &ms); GRIB_CHECK(my_grib_set_long(gh, "hour", hour), 0); GRIB_CHECK(my_grib_set_long(gh, "minute", minute), 0); GRIB_CHECK(my_grib_set_long(gh, "second", second), 0); } static int -gribapiGetTimeUnitFactor(const int timeUnits) +gribapiGetTimeUnitFactor(int timeUnits) { static bool lprint = true; switch (timeUnits) @@ -173,11 +174,11 @@ gribapiGetTimeUnitFactor(const int timeUnits) return 0; } -static void -gribapiGetValidityDateTime(grib_handle *gh, int *vDate, int *vTime, int *sDate, int *sTime) +static CdiDateTime +gribapiGetValidityDateTime(grib_handle *gh, CdiDateTime *sDateTime) { - *sDate = 0; - *sTime = 0; + CdiDateTime vDateTime; + cdiDateTime_init(sDateTime); long sigofrtime = 3; if (gribEditionNumber(gh) > 1) @@ -189,15 +190,13 @@ gribapiGetValidityDateTime(grib_handle *gh, int *vDate, int *vTime, int *sDate, == 3) // XXX: This looks like a bug to me, because timeRangeIndicator == 3 does not seem to have the same meaning as // significanceOfReferenceTime == 3. I would recommend replacing this condition with `if(!gribapiTimeIsFC())`. { - CdiDateTime vDateTime = gribapiGetDataDateTime(gh); - *vDate = (int) cdiDate_get(vDateTime.date); - *vTime = cdiTime_get(vDateTime.time); + vDateTime = gribapiGetDataDateTime(gh); } else { CdiDateTime rDateTime = gribapiGetDataDateTime(gh); - const int timeUnits = gribapiGetTimeUnits(gh); + int timeUnits = gribapiGetTimeUnits(gh); int startStep = 0, endStep = 0; gribapiGetSteps(gh, timeUnits, &startStep, &endStep); @@ -206,24 +205,21 @@ gribapiGetValidityDateTime(grib_handle *gh, int *vDate, int *vTime, int *sDate, extern int CGRIBEX_grib_calendar; JulianDate julianDate = julianDate_encode(CGRIBEX_grib_calendar, rDateTime); - const int64_t timeUnitFactor = gribapiGetTimeUnitFactor(timeUnits); + int64_t timeUnitFactor = gribapiGetTimeUnitFactor(timeUnits); // if (startStep > 0) { JulianDate julianDate2 = julianDate_add_seconds(julianDate, timeUnitFactor * startStep); - CdiDateTime sDateTime = julianDate_decode(CGRIBEX_grib_calendar, julianDate2); - sDateTime.time.second = 0; - *sDate = (int) cdiDate_get(sDateTime.date); - *sTime = cdiTime_get(sDateTime.time); + *sDateTime = julianDate_decode(CGRIBEX_grib_calendar, julianDate2); } - julianDate = julianDate_add_seconds(julianDate, timeUnitFactor * endStep); - rDateTime = julianDate_decode(CGRIBEX_grib_calendar, julianDate); + rDateTime = julianDate_decode(CGRIBEX_grib_calendar, julianDate_add_seconds(julianDate, timeUnitFactor * endStep)); } - *vDate = (int) cdiDate_get(rDateTime.date); - *vTime = cdiTime_get(rDateTime.time); + vDateTime = rDateTime; } + + return vDateTime; } static void @@ -274,7 +270,7 @@ grib1GetLevel(grib_handle *gh, int *leveltype, int *lbounds, int *level1, int *l } static double -grib2ScaleFactor(const long factor) +grib2ScaleFactor(long factor) { switch (factor) { @@ -404,10 +400,25 @@ gribapiGetString(grib_handle *gh, const char *key, char *string, size_t length) fprintf(stderr, "grib_get_string(gh, \"%s\", ...) failed!\n", key); GRIB_CHECK(ret, 0); } - if (length == 8 && memcmp(string, "unknown", length) == 0) - string[0] = 0; - else if (length == 2 && memcmp(string, "~", length) == 0) - string[0] = 0; + // clang-format off + if (length == 8 && memcmp(string, "unknown", length) == 0) string[0] = 0; + else if (length == 2 && memcmp(string, "~", length) == 0) string[0] = 0; + // clang-format on +} + +static void +param_to_name(int param, char *name) +{ + int pdis, pcat, pnum; + cdiDecodeParam(param, &pnum, &pcat, &pdis); + if (pdis == 255) + { + sprintf(name, "code%d", pnum); + } + else + { + sprintf(name, "param%d.%d.%d", pnum, pcat, pdis); + } } static int @@ -461,7 +472,7 @@ gribapiGetNameKeys(grib_handle *gh, int varID) if (string[0]) varDefKeyString(varID, CDI_KEY_UNITS, string); string[0] = 0; - const int status = grib_get_string(gh, "cfName", string, &vlen); + int status = grib_get_string(gh, "cfName", string, &vlen); if (status != 0 || vlen <= 1 || strncmp(string, "unknown", 7) == 0) string[0] = 0; if (string[0]) varDefKeyString(varID, CDI_KEY_STDNAME, string); } @@ -664,15 +675,14 @@ gribapiDefProjSTERE(grib_handle *gh, int gridID) static void gribapiAddRecord(stream_t *streamptr, int param, grib_handle *gh, size_t recsize, off_t position, int datatype, int comptype, const char *varname, int leveltype1, int leveltype2, int lbounds, int level1, int level2, int level_sf, - int level_unit, VarScanKeys *scanKeys, const var_tile_t *tiles, int lread_additional_keys, void *fdbItem) + int level_unit, VarScanKeys *scanKeys, const var_tile_t *tiles, bool lread_additional_keys, void *fdbItem) { - const int vlistID = streamptr->vlistID; - const int tsID = streamptr->curTsID; - const int recID = recordNewEntry(streamptr, tsID); + int vlistID = streamptr->vlistID; + int tsID = streamptr->curTsID; + int recID = recordNewEntry(streamptr, tsID); record_t *record = &streamptr->tsteps[tsID].records[recID]; - const int tsteptype = gribapiGetTsteptype(gh); - int numavg = 0; + int tsteptype = gribapiGetTsteptype(gh); // fprintf(stderr, "param %d %d %d %d\n", param, level1, level2, leveltype1); @@ -693,21 +703,37 @@ gribapiAddRecord(stream_t *streamptr, int param, grib_handle *gh, size_t recsize strncpy(record->varname, varname, sizeof(record->varname) - 1); record->varname[sizeof(record->varname) - 1] = 0; + streamptr->tsteps[tsID].nallrecs++; + streamptr->nrecs++; + + // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + + CdiQuery *query = streamptr->query; + if (query && cdiQueryName(query, varname) < 0) + { + record->used = false; + return; + } + + // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + grid_t *grid = (grid_t *) Malloc(sizeof(*grid)); - const bool uvRelativeToGrid = gribapiGetGrid(gh, grid); + bool uvRelativeToGrid = gribapiGetGrid(gh, grid); struct addIfNewRes gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 0); - const int gridID = gridAdded.Id; + int gridID = gridAdded.Id; + // clang-format off if (!gridAdded.isNew) - Free(grid); - else if (grid->projtype == CDI_PROJ_RLL) - gribapiDefProjRLL(gh, gridID); - else if (grid->projtype == CDI_PROJ_LCC) - gribapiDefProjLCC(gh, gridID); - else if (grid->projtype == CDI_PROJ_STERE) - gribapiDefProjSTERE(gh, gridID); + { + grid_free(grid); + Free(grid); + } + else if (grid->projtype == CDI_PROJ_RLL) gribapiDefProjRLL(gh, gridID); + else if (grid->projtype == CDI_PROJ_LCC) gribapiDefProjLCC(gh, gridID); + else if (grid->projtype == CDI_PROJ_STERE) gribapiDefProjSTERE(gh, gridID); + // clang-format on - const int zaxistype = gribapiGetZaxisType(gribEditionNumber(gh), leveltype1); + int zaxistype = gribapiGetZaxisType(gribEditionNumber(gh), leveltype1); switch (zaxistype) { @@ -717,7 +743,7 @@ gribapiAddRecord(stream_t *streamptr, int param, grib_handle *gh, size_t recsize long lpar; GRIB_CHECK(grib_get_long(gh, "NV", &lpar), 0); /* FIXME: assert(lpar >= 0) */ - const size_t vctsize = (size_t) lpar; + size_t vctsize = (size_t) lpar; if (vctsize > 0) { double *vctptr = (double *) Malloc(vctsize * sizeof(double)); @@ -815,9 +841,6 @@ gribapiAddRecord(stream_t *streamptr, int param, grib_handle *gh, size_t recsize } } - streamptr->tsteps[tsID].nallrecs++; - streamptr->nrecs++; - if (CDI_Debug) Message("varID = %d param = %d zaxistype = %d gridID = %d levelID = %d", varID, param, zaxistype, gridID, levelID); } @@ -828,7 +851,7 @@ gribapiVarSet(int param, int level1, int level2, int leveltype, int tsteptype, s { compvar2_t compVar; memset(&compVar, 0, sizeof(compvar2_t)); - const size_t maxlen = sizeof(compVar.name); + size_t maxlen = sizeof(compVar.name); size_t len = strlen(name); if (len > maxlen) len = maxlen; @@ -877,7 +900,7 @@ gribapiVarCompare(compvar2_t compVar, record_t record, int flag) static grib_handle * gribapiGetDiskRepresentation(size_t recsize, size_t *buffersize, void **gribbuffer, int *outDatatype, int *outCompressionType) { - const int gribversion = (int) ((char *) *gribbuffer)[7]; + int gribversion = (int) ((char *) *gribbuffer)[7]; if (gribversion <= 1) *outCompressionType = grbDecompress(recsize, buffersize, gribbuffer); @@ -904,7 +927,7 @@ gribapiGetDiskRepresentation(size_t recsize, size_t *buffersize, void **gribbuff if (lieee) { long precision; - const int status = grib_get_long(gh, "precision", &precision); + int status = grib_get_long(gh, "precision", &precision); *outDatatype = (status == 0 && precision == 1) ? CDI_DATATYPE_FLT32 : CDI_DATATYPE_FLT64; } else @@ -929,7 +952,7 @@ typedef enum } checkTimeResult; static checkTimeResult -checkTime(stream_t *streamptr, compvar2_t compVar, const CmpDateTime *verificationTime, const CmpDateTime *expectedVTime) +checkTime(stream_t *streamptr, compvar2_t compVar, CdiDateTime verificationTime, CdiDateTime expectedVTime) { // First determine whether the current record exists already. int recID = 0; @@ -937,10 +960,10 @@ checkTime(stream_t *streamptr, compvar2_t compVar, const CmpDateTime *verificati { if (gribapiVarCompare(compVar, streamptr->tsteps[0].records[recID], 1) == 0) break; } - const bool recordExists = (recID < streamptr->nrecs); + bool recordExists = (recID < streamptr->nrecs); // Then we need to know whether the verification time is consistent. - const bool consistentTime = !memcmp(verificationTime, expectedVTime, sizeof(*verificationTime)); + bool consistentTime = cdiDateTime_isEQ(verificationTime, expectedVTime); // Finally, we make a decision. if (CDI_Inventory_Mode == 1) @@ -1014,26 +1037,26 @@ fdbScanTimesteps(stream_t *streamptr) numTimesteps = remove_duplicate_timesteps(recordInfoList, numRecords, numTimesteps, timestepRecordOffset); if (CDI_Debug) Message("numRecords=%d numTimesteps=%d", numRecords, numTimesteps); - CmpDateTime datetime0 = { .date = 10101, .time = 0 }; + CdiDateTime vDateTime0; + cdiDateTime_init(&vDateTime0); int fcast = 0; streamptr->curTsID = 0; - const int tsIDnew = tstepsNewEntry(streamptr); + int tsIDnew = tstepsNewEntry(streamptr); if (tsIDnew != 0) Error("Internal problem! tstepsNewEntry returns %d", tsIDnew); taxis_t *taxis = &streamptr->tsteps[tsIDnew].taxis; for (int recID = 0; recID < numRecords; recID++) { - const long recsize = fdb_read_record(fdbHandle, fdbItemList[recID], &buffersize, &gribbuffer); + long recsize = fdb_read_record(fdbHandle, fdbItemList[recID], &buffersize, &gribbuffer); int datatype, comptype = 0; gh = gribapiGetDiskRepresentation(recsize, &buffersize, &gribbuffer, &datatype, &comptype); GRIB_CHECK(my_grib_set_double(gh, "missingValue", CDI_Default_Missval), 0); - const int param = gribapiGetParam(gh); int leveltype1 = -1, leveltype2 = -1, lbounds, level_sf, level_unit; var_tile_t tiles = dummy_tiles; int level1 = 0, level2 = 0; @@ -1042,38 +1065,36 @@ fdbScanTimesteps(stream_t *streamptr) char varname[256]; gribapiGetString(gh, "shortName", varname, sizeof(varname)); - int vDate, sDate; - int vTime, sTime; - gribapiGetValidityDateTime(gh, &vDate, &vTime, &sDate, &sTime); - CmpDateTime datetime = { .date = vDate, .time = vTime }; + int param = gribapiGetParam(gh); + + CdiDateTime sDateTime; + CdiDateTime vDateTime = gribapiGetValidityDateTime(gh, &sDateTime); VarScanKeys scanKeys = gribapiGetScanKeys(gh); if (recID == 0) { - datetime0 = datetime; - taxis->rdatetime = gribapiGetDataDateTime(gh); + vDateTime0 = vDateTime; + taxis->rDateTime = gribapiGetDataDateTime(gh); fcast = gribapiTimeIsFC(gh); if (fcast) taxis->unit = gribapiGetTimeUnits(gh); - taxis->fdate = (int) cdiDate_get(taxis->rdatetime.date); - taxis->ftime = cdiTime_get(taxis->rdatetime.time); - taxis->sdate = sDate; - taxis->stime = sTime; - taxis->vdatetime = cdiDateTime_set(vDate, vTime); + taxis->fDateTime = taxis->rDateTime; + taxis->sDateTime = sDateTime; + taxis->vDateTime = vDateTime; } if (CDI_Debug) { char paramstr[32]; cdiParamToString(param, paramstr, sizeof(paramstr)); - Message("%4d name=%s id=%s ltype=%d lev1=%d lev2=%d vdate=%lld vtime=%d", recID + 1, varname, paramstr, leveltype1, - level1, level2, vDate, vTime); + Message("%4d name=%s id=%s ltype=%d lev1=%d lev2=%d vDateTime=%s", recID + 1, varname, paramstr, leveltype1, level1, + level2, CdiDateTime_string(vDateTime)); } var_tile_t *ptiles = memcmp(&tiles, &dummy_tiles, sizeof(var_tile_t)) ? &tiles : NULL; int recpos = 0; gribapiAddRecord(streamptr, param, gh, recsize, recpos, datatype, comptype, varname, leveltype1, leveltype2, lbounds, level1, - level2, level_sf, level_unit, &scanKeys, ptiles, 1, fdbItemList[recID]); + level2, level_sf, level_unit, &scanKeys, ptiles, true, fdbItemList[recID]); fdbItemList[recID] = NULL; grib_handle_delete(gh); @@ -1099,12 +1120,12 @@ fdbScanTimesteps(stream_t *streamptr) for (int tsID = 1; tsID < numTimesteps; tsID++) { - const int recordOffset = timestepRecordOffset[tsID]; - const int vdate = recordInfoList[recordOffset].date; - const int vtime = recordInfoList[recordOffset].time * 100; + int recordOffset = timestepRecordOffset[tsID]; + int vdate = recordInfoList[recordOffset].date; + int vtime = recordInfoList[recordOffset].time * 100; // printf("timestep=%d recOffset=%d date=%d time=%d\n", tsID + 1, recordOffset, vdate, vtime); - const int tsIDnext = tstepsNewEntry(streamptr); + int tsIDnext = tstepsNewEntry(streamptr); if (tsIDnext != tsID) Error("Internal error. tsID = %d", tsID); streamptr->tsteps[tsID - 1].next = true; @@ -1115,10 +1136,10 @@ fdbScanTimesteps(stream_t *streamptr) cdi_create_records(streamptr, tsID); record_t *records = streamptr->tsteps[tsID].records; - const int nrecs = (tsID == 1) ? streamScanInitRecords2(streamptr) : streamScanInitRecords(streamptr, tsID); + int nrecs = (tsID == 1) ? streamScanInitRecords2(streamptr) : streamScanInitRecords(streamptr, tsID); if (nrecs != numRecords) Error("Internal error. nrecs = %d", nrecs); - taxis->vdatetime = cdiDateTime_set(vdate, vtime); + taxis->vDateTime = cdiDateTime_set(vdate, vtime); int rindex = 0; for (int recID = 0; recID < numRecords; recID++) @@ -1153,28 +1174,29 @@ fdbScanTimesteps(stream_t *streamptr) int gribapiScanTimestep1(stream_t *streamptr) { + CdiDateTime vDateTime0; + cdiDateTime_init(&vDateTime0); off_t recpos = 0; void *gribbuffer = NULL; size_t buffersize = 0; - CmpDateTime datetime0 = { .date = 10101, .time = 0 }; - int nrecs_scanned = 0; // Only used for debug output. + int nrecsScanned = 0; // Only used for debug output. bool warn_time = true; int fcast = 0; grib_handle *gh = NULL; streamptr->curTsID = 0; - const int tsID = tstepsNewEntry(streamptr); + int tsID = tstepsNewEntry(streamptr); if (tsID != 0) Error("Internal problem! tstepsNewEntry returns %d", tsID); taxis_t *taxis = &streamptr->tsteps[tsID].taxis; - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; unsigned nrecs = 0; while (true) { - const size_t recsize = gribGetSize(fileID); + size_t recsize = gribGetSize(fileID); recpos = fileGetPos(fileID); if (recsize == 0) @@ -1189,13 +1211,13 @@ gribapiScanTimestep1(stream_t *streamptr) // Search for next 'GRIB', read the following record, and position file offset after it. if (gribRead(fileID, gribbuffer, &readsize)) break; + nrecsScanned++; + int datatype, comptype = 0; gh = gribapiGetDiskRepresentation(recsize, &buffersize, &gribbuffer, &datatype, &comptype); - nrecs_scanned++; GRIB_CHECK(my_grib_set_double(gh, "missingValue", CDI_Default_Missval), 0); - const int param = gribapiGetParam(gh); int leveltype1 = -1, leveltype2 = -1, lbounds, level_sf, level_unit; var_tile_t tiles = dummy_tiles; int level1 = 0, level2 = 0; @@ -1204,50 +1226,47 @@ gribapiScanTimestep1(stream_t *streamptr) char varname[256]; gribapiGetString(gh, "shortName", varname, sizeof(varname)); - int vDate, sDate; - int vTime, sTime; - gribapiGetValidityDateTime(gh, &vDate, &vTime, &sDate, &sTime); - CmpDateTime datetime = { .date = vDate, .time = vTime }; + int param = gribapiGetParam(gh); + + if (!varname[0]) param_to_name(param, varname); + + CdiDateTime sDateTime; + CdiDateTime vDateTime = gribapiGetValidityDateTime(gh, &sDateTime); VarScanKeys scanKeys = gribapiGetScanKeys(gh); if (nrecs == 0) { - datetime0 = datetime; - taxis->rdatetime = gribapiGetDataDateTime(gh); + vDateTime0 = vDateTime; + taxis->rDateTime = gribapiGetDataDateTime(gh); fcast = gribapiTimeIsFC(gh); if (fcast) taxis->unit = gribapiGetTimeUnits(gh); - taxis->fdate = (int) cdiDate_get(taxis->rdatetime.date); - taxis->ftime = cdiTime_get(taxis->rdatetime.time); - taxis->sdate = sDate; - taxis->stime = sTime; - taxis->vdatetime = cdiDateTime_set(vDate, vTime); + taxis->fDateTime = taxis->rDateTime; + taxis->sDateTime = sDateTime; + taxis->vDateTime = vDateTime; } else { - if (sDate < taxis->sdate || (sDate == taxis->sdate && sTime < taxis->stime)) - { - taxis->sdate = sDate; - taxis->stime = sTime; - } + if (cdiDateTime_isLT(sDateTime, taxis->sDateTime)) taxis->sDateTime = sDateTime; - const int tsteptype = gribapiGetTsteptype(gh); - const size_t gridsize = gribapiGetGridsize(gh); + int tsteptype = gribapiGetTsteptype(gh); + size_t gridsize = gribapiGetGridsize(gh); checkTimeResult result = checkTime( - streamptr, gribapiVarSet(param, level1, level2, leveltype1, tsteptype, gridsize, varname, scanKeys, tiles), &datetime, - &datetime0); + streamptr, gribapiVarSet(param, level1, level2, leveltype1, tsteptype, gridsize, varname, scanKeys, tiles), vDateTime, + vDateTime0); if (result == CHECKTIME_STOP) { + nrecsScanned--; break; } else if (result == CHECKTIME_SKIP) { - gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID + 1, varname, param, level1, level2); + gribWarning("Parameter already exist, skipped!", nrecsScanned, tsID + 1, varname, param, level1, level2); continue; } else if (result == CHECKTIME_INCONSISTENT && warn_time) { - gribWarning("Inconsistent verification time!", nrecs_scanned, tsID + 1, varname, param, level1, level2); + gribWarning("Inconsistent verification time!", nrecsScanned, tsID + 1, varname, param, level1, level2); warn_time = false; } assert(result == CHECKTIME_OK || result == CHECKTIME_INCONSISTENT); @@ -1259,13 +1278,13 @@ gribapiScanTimestep1(stream_t *streamptr) { char paramstr[32]; cdiParamToString(param, paramstr, sizeof(paramstr)); - Message("%4u %8d name=%s id=%s ltype=%d lev1=%d lev2=%d vdate=%lld vtime=%d", nrecs, (int) recpos, varname, paramstr, - leveltype1, level1, level2, vDate, vTime); + Message("%4u %8d name=%s id=%s ltype=%d lev1=%d lev2=%d vDateTime=%s", nrecs, (int) recpos, varname, paramstr, leveltype1, + level1, level2, CdiDateTime_string(vDateTime)); } var_tile_t *ptiles = memcmp(&tiles, &dummy_tiles, sizeof(var_tile_t)) ? &tiles : NULL; gribapiAddRecord(streamptr, param, gh, recsize, recpos, datatype, comptype, varname, leveltype1, leveltype2, lbounds, level1, - level2, level_sf, level_unit, &scanKeys, ptiles, 1, NULL); + level2, level_sf, level_unit, &scanKeys, ptiles, true, NULL); grib_handle_delete(gh); gh = NULL; @@ -1277,13 +1296,20 @@ gribapiScanTimestep1(stream_t *streamptr) if (nrecs == 0) return CDI_EUFSTRUCT; + if (streamptr->query) + { + int numEntries = cdiQueryNumEntries(streamptr->query); + int numEntriesFound = cdiQueryNumEntriesFound(streamptr->query); + cdiQueryPrintEntriesNotFound(streamptr->query); + if (numEntriesFound == 0 || (CDI_Query_Abort && numEntries != numEntriesFound)) return CDI_EQENF; + } + cdi_generate_vars(streamptr); taxis->type = fcast ? TAXIS_RELATIVE : TAXIS_ABSOLUTE; int taxisID = taxisCreate(taxis->type); - // printf("1: %d %6d %d %6d %d %6d\n", taxis->rdate, taxis->rtime, taxis->sdate, taxis->stime, taxis->vdate, taxis->vtime); - const int vlistID = streamptr->vlistID; + int vlistID = streamptr->vlistID; vlistDefTaxis(vlistID, taxisID); streamScanResizeRecords1(streamptr); @@ -1300,17 +1326,18 @@ gribapiScanTimestep1(stream_t *streamptr) int gribapiScanTimestep2(stream_t *streamptr) { + CdiDateTime vDateTime0; + cdiDateTime_init(&vDateTime0); int rstatus = 0; off_t recpos = 0; - CmpDateTime datetime0 = { INT_MIN, INT_MIN }; // int gridID; int recID; grib_handle *gh = NULL; streamptr->curTsID = 1; - const int fileID = streamptr->fileID; - const int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; void *gribbuffer = streamptr->record->buffer; size_t buffersize = streamptr->record->buffersize; @@ -1325,15 +1352,12 @@ gribapiScanTimestep2(stream_t *streamptr) cdi_create_records(streamptr, tsID); record_t *records = streamptr->tsteps[tsID].records; - const int nrecords = streamScanInitRecords2(streamptr); + int nrecords = streamScanInitRecords2(streamptr); - int nrecs_scanned = nrecords; // Only used for debug output - int rindex = 0; - while (true) + int nrecsScanned = nrecords; // Only used for debug output + for (int rindex = 0; rindex <= nrecords; ++rindex) { - if (rindex > nrecords) break; - - const size_t recsize = gribGetSize(fileID); + size_t recsize = gribGetSize(fileID); recpos = fileGetPos(fileID); if (recsize == 0) { @@ -1348,11 +1372,10 @@ gribapiScanTimestep2(stream_t *streamptr) grbDecompress(recsize, &buffersize, &gribbuffer); - nrecs_scanned++; + nrecsScanned++; gh = grib_handle_new_from_message(NULL, gribbuffer, recsize); GRIB_CHECK(my_grib_set_double(gh, "missingValue", CDI_Default_Missval), 0); - const int param = gribapiGetParam(gh); int level1 = 0, level2 = 0, leveltype1, leveltype2, lbounds, level_sf, level_unit; var_tile_t tiles = dummy_tiles; gribGetLevel(gh, &leveltype1, &leveltype2, &lbounds, &level1, &level2, &level_sf, &level_unit, &tiles); @@ -1360,46 +1383,40 @@ gribapiScanTimestep2(stream_t *streamptr) char varname[256]; gribapiGetString(gh, "shortName", varname, sizeof(varname)); - int vDate, sDate; - int vTime, sTime; - gribapiGetValidityDateTime(gh, &vDate, &vTime, &sDate, &sTime); - CmpDateTime datetime = { .date = vDate, .time = vTime }; + int param = gribapiGetParam(gh); + + if (!varname[0]) param_to_name(param, varname); + + CdiDateTime sDateTime; + CdiDateTime vDateTime = gribapiGetValidityDateTime(gh, &sDateTime); if (rindex == 0) { - datetime0 = datetime; - const int taxisID = vlistInqTaxis(vlistID); + vDateTime0 = vDateTime; + int taxisID = vlistInqTaxis(vlistID); if (taxisInqType(taxisID) == TAXIS_RELATIVE) { taxis->type = TAXIS_RELATIVE; taxis->unit = gribapiGetTimeUnits(gh); - taxis->rdatetime = gribapiGetDataDateTime(gh); + taxis->rDateTime = gribapiGetDataDateTime(gh); } else { taxis->type = TAXIS_ABSOLUTE; } - taxis->fdate = (int) cdiDate_get(taxis->rdatetime.date); - taxis->ftime = cdiTime_get(taxis->rdatetime.time); - taxis->vdatetime = cdiDateTime_set(vDate, vTime); - taxis->sdate = sDate; - taxis->stime = sTime; - // printf("2: %d %6d %d %6d %d %6d\n", taxis->rdate, taxis->rtime, taxis->sdate, taxis->stime, taxis->vdate, - // taxis->vtime); + taxis->fDateTime = taxis->rDateTime; + taxis->vDateTime = vDateTime; + taxis->sDateTime = sDateTime; } else { - if (sDate < taxis->sdate || (sDate == taxis->sdate && sTime < taxis->stime)) - { - taxis->sdate = sDate; - taxis->stime = sTime; - } + if (cdiDateTime_isLT(sDateTime, taxis->sDateTime)) taxis->sDateTime = sDateTime; } VarScanKeys scanKeys = gribapiGetScanKeys(gh); - const int tsteptype = gribapiGetTsteptype(gh); - const size_t gridsize = gribapiGetGridsize(gh); + int tsteptype = gribapiGetTsteptype(gh); + size_t gridsize = gribapiGetGridsize(gh); compvar2_t compVar = gribapiVarSet(param, level1, level2, leveltype1, tsteptype, gridsize, varname, scanKeys, tiles); for (recID = 0; recID < nrecords; recID++) @@ -1409,12 +1426,12 @@ gribapiScanTimestep2(stream_t *streamptr) { if (CDI_Inventory_Mode == 1) { - gribWarning("Parameter not defined at timestep 1!", nrecs_scanned, tsID + 1, varname, param, level1, level2); + gribWarning("Parameter not defined at timestep 1!", nrecsScanned, tsID + 1, varname, param, level1, level2); return CDI_EUFSTRUCT; } else { - gribWarning("Parameter not defined at timestep 1, skipped!", nrecs_scanned, tsID + 1, varname, param, level1, level2); + gribWarning("Parameter not defined at timestep 1, skipped!", nrecsScanned, tsID + 1, varname, param, level1, level2); continue; } } @@ -1425,9 +1442,9 @@ gribapiScanTimestep2(stream_t *streamptr) break; else { - if (datetime_differ(datetime, datetime0)) break; + if (cdiDateTime_isNE(vDateTime, vDateTime0)) break; - gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID + 1, varname, param, level1, level2); + gribWarning("Parameter already exist, skipped!", nrecsScanned, tsID + 1, varname, param, level1, level2); continue; } } @@ -1439,8 +1456,8 @@ gribapiScanTimestep2(stream_t *streamptr) { char paramstr[32]; cdiParamToString(param, paramstr, sizeof(paramstr)); - Message("%4d %8d name=%s id=%s ltype=%d lev1=%d lev2=%d vdate=%lld vtime=%d", nrecs_scanned, (int) recpos, varname, - paramstr, leveltype1, level1, level2, vDate, vTime); + Message("%4d %8lld name=%s id=%s ltype=%d lev1=%d lev2=%d vDateTime=%s", nrecsScanned, (long long) recpos, varname, + paramstr, leveltype1, level1, level2, CdiDateTime_string(vDateTime)); } if (gribapiVarCompare(compVar, records[recID], 0) != 0) @@ -1453,14 +1470,12 @@ gribapiScanTimestep2(stream_t *streamptr) records[recID].position = recpos; records[recID].size = recsize; - const int varID = records[recID].varID; + int varID = records[recID].varID; if (tsteptype != vlistInqVarTsteptype(vlistID, varID)) vlistDefVarTsteptype(vlistID, varID, tsteptype); grib_handle_delete(gh); gh = NULL; - - rindex++; } if (gh) grib_handle_delete(gh); @@ -1468,14 +1483,10 @@ gribapiScanTimestep2(stream_t *streamptr) int nrecs = 0; for (recID = 0; recID < nrecords; recID++) { - if (!records[recID].used) - { - vlistDefVarTimetype(vlistID, records[recID].varID, TIME_CONSTANT); - } + if (records[recID].used) + nrecs++; else - { - nrecs++; - } + vlistDefVarTimetype(vlistID, records[recID].varID, TIME_CONSTANT); } streamptr->tsteps[tsID].nrecs = nrecs; @@ -1495,7 +1506,6 @@ gribapiScanTimestep(stream_t *streamptr) int vrecID, recID = -1; int nrecs = 0; int vlistID = streamptr->vlistID; - int tsID = streamptr->rtsteps; taxis_t *taxis = &streamptr->tsteps[tsID].taxis; @@ -1509,22 +1519,20 @@ gribapiScanTimestep(stream_t *streamptr) nrecs = streamScanInitRecords(streamptr, tsID); - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); - int nrecs_scanned = streamptr->tsteps[0].nallrecs + streamptr->tsteps[1].nrecs * (tsID - 1); // Only used for debug output. - int rindex = 0; + int nrecsScanned = streamptr->tsteps[0].nallrecs + streamptr->tsteps[1].nrecs * (tsID - 1); // Only used for debug output. off_t recpos = 0; - CmpDateTime datetime0 = { INT_MIN, INT_MIN }; + CdiDateTime vDateTime0; + cdiDateTime_init(&vDateTime0); grib_handle *gh = NULL; char varname[256]; - while (true) + for (int rindex = 0; rindex <= nrecs; ++rindex) { varname[0] = 0; - if (rindex > nrecs) break; - - const size_t recsize = gribGetSize(fileID); + size_t recsize = gribGetSize(fileID); recpos = fileGetPos(fileID); if (recsize == 0) { @@ -1532,8 +1540,6 @@ gribapiScanTimestep(stream_t *streamptr) break; } - if (rindex >= nrecs) break; - ensureBufferSize(recsize, &buffersize, &gribbuffer); size_t readsize = recsize; @@ -1545,59 +1551,52 @@ gribapiScanTimestep(stream_t *streamptr) grbDecompress(recsize, &buffersize, &gribbuffer); - nrecs_scanned++; + nrecsScanned++; gh = grib_handle_new_from_message(NULL, gribbuffer, recsize); GRIB_CHECK(my_grib_set_double(gh, "missingValue", CDI_Default_Missval), 0); - const int param = gribapiGetParam(gh); int level1 = 0, level2 = 0, leveltype1, leveltype2 = -1, lbounds, level_sf, level_unit; var_tile_t tiles = dummy_tiles; gribGetLevel(gh, &leveltype1, &leveltype2, &lbounds, &level1, &level2, &level_sf, &level_unit, &tiles); + CdiDateTime sDateTime; + CdiDateTime vDateTime = gribapiGetValidityDateTime(gh, &sDateTime); + + if (rindex == nrecs) break; + gribapiGetString(gh, "shortName", varname, sizeof(varname)); - int vDate, sDate; - int vTime, sTime; - gribapiGetValidityDateTime(gh, &vDate, &vTime, &sDate, &sTime); - CmpDateTime datetime = { .date = vDate, .time = vTime }; + int param = gribapiGetParam(gh); - if (rindex == nrecs) break; + if (!varname[0]) param_to_name(param, varname); if (rindex == 0) { - datetime0 = datetime; - const int taxisID = vlistInqTaxis(vlistID); + vDateTime0 = vDateTime; + int taxisID = vlistInqTaxis(vlistID); if (taxisInqType(taxisID) == TAXIS_RELATIVE) { taxis->type = TAXIS_RELATIVE; taxis->unit = gribapiGetTimeUnits(gh); - taxis->rdatetime = gribapiGetDataDateTime(gh); + taxis->rDateTime = gribapiGetDataDateTime(gh); } else { taxis->type = TAXIS_ABSOLUTE; } - taxis->fdate = (int) cdiDate_get(taxis->rdatetime.date); - taxis->ftime = cdiTime_get(taxis->rdatetime.time); - taxis->vdatetime = cdiDateTime_set(vDate, vTime); - taxis->sdate = sDate; - taxis->stime = sTime; - // printf("n: %d %6d %d %6d %d %6d\n", taxis->rdate, taxis->rtime, taxis->sdate, taxis->stime, taxis->vdate, - // taxis->vtime); + taxis->fDateTime = taxis->rDateTime; + taxis->vDateTime = vDateTime; + taxis->sDateTime = sDateTime; } else { - if (sDate < taxis->sdate || (sDate == taxis->sdate && sTime < taxis->stime)) - { - taxis->sdate = sDate; - taxis->stime = sTime; - } + if (cdiDateTime_isLT(sDateTime, taxis->sDateTime)) taxis->sDateTime = sDateTime; } VarScanKeys scanKeys = gribapiGetScanKeys(gh); - const int tsteptype = gribapiGetTsteptype(gh); - const size_t gridsize = gribapiGetGridsize(gh); + int tsteptype = gribapiGetTsteptype(gh); + size_t gridsize = gribapiGetGridsize(gh); compvar2_t compVar = gribapiVarSet(param, level1, level2, leveltype1, tsteptype, gridsize, varname, scanKeys, tiles); for (vrecID = 0; vrecID < nrecs; vrecID++) @@ -1610,12 +1609,12 @@ gribapiScanTimestep(stream_t *streamptr) { if (CDI_Inventory_Mode == 1) { - gribWarning("Parameter not defined at timestep 1!", nrecs_scanned, tsID + 1, varname, param, level1, level2); + gribWarning("Parameter not defined at timestep 1!", nrecsScanned, tsID + 1, varname, param, level1, level2); return CDI_EUFSTRUCT; } else { - gribWarning("Parameter not defined at timestep 1, skipped!", nrecs_scanned, tsID + 1, varname, param, level1, + gribWarning("Parameter not defined at timestep 1, skipped!", nrecsScanned, tsID + 1, varname, param, level1, level2); continue; } @@ -1625,10 +1624,10 @@ gribapiScanTimestep(stream_t *streamptr) { if (records[recID].used) { - if (datetime_differ(datetime, datetime0)) break; + if (cdiDateTime_isNE(vDateTime, vDateTime0)) break; if (CDI_Debug) - gribWarning("Parameter already exist, skipped!", nrecs_scanned, tsID + 1, varname, param, level1, level2); + gribWarning("Parameter already exist, skipped!", nrecsScanned, tsID + 1, varname, param, level1, level2); continue; } @@ -1637,7 +1636,8 @@ gribapiScanTimestep(stream_t *streamptr) records[recID].used = true; streamptr->tsteps[tsID].recIDs[rindex] = recID; - if (CDI_Debug) Message("%4d %8d %4d %8d %8lld %6d", rindex + 1, (int) recpos, param, level1, vDate, vTime); + if (CDI_Debug) + Message("%4d %8lld %4d %8d %8s", rindex + 1, (long long) recpos, param, level1, CdiDateTime_string(vDateTime)); if (gribapiVarCompare(compVar, records[recID], 0) != 0) { @@ -1649,12 +1649,10 @@ gribapiScanTimestep(stream_t *streamptr) records[recID].position = recpos; records[recID].size = recsize; - if (CDI_Debug) Message("%4d %8d %4d %8d %8lld %6d", rindex, (int) recpos, param, level1, vDate, vTime); + if (CDI_Debug) Message("%4d %8lld %4d %8d %s", rindex, (long long) recpos, param, level1, CdiDateTime_string(vDateTime)); grib_handle_delete(gh); gh = NULL; - - rindex++; } if (gh) grib_handle_delete(gh); @@ -1667,7 +1665,7 @@ gribapiScanTimestep(stream_t *streamptr) if (vrecID < nrecs) { - gribWarning("Parameter not found!", nrecs_scanned, tsID + 1, varname, records[recID].param, records[recID].ilevel, + gribWarning("Parameter not found!", nrecsScanned, tsID + 1, varname, records[recID].param, records[recID].ilevel, records[recID].ilevel2); return CDI_EUFSTRUCT; } @@ -1753,7 +1751,9 @@ gribapiDecode(void *gribbuffer, size_t gribsize, void *data, size_t gridsize, in static void gribapiDefInstitut(grib_handle *gh, int vlistID, int varID) { - int instID = (vlistInqInstitut(vlistID) != CDI_UNDEFID) ? vlistInqInstitut(vlistID) : vlistInqVarInstitut(vlistID, varID); + int instID = vlistInqInstitut(vlistID); + + if (instID == CDI_UNDEFID) instID = vlistInqVarInstitut(vlistID, varID); if (instID != CDI_UNDEFID) { @@ -1784,7 +1784,8 @@ gribapiDefInstitut(grib_handle *gh, int vlistID, int varID) static void gribapiDefModel(grib_handle *gh, int vlistID, int varID) { - int modelID = (vlistInqModel(vlistID) != CDI_UNDEFID) ? vlistInqModel(vlistID) : vlistInqVarModel(vlistID, varID); + int modelID = vlistInqModel(vlistID); + if (modelID == CDI_UNDEFID) modelID = vlistInqVarModel(vlistID, varID); if (modelID != CDI_UNDEFID) GRIB_CHECK(my_grib_set_long(gh, "generatingProcessIdentifier", modelInqGribID(modelID)), 0); } @@ -1861,7 +1862,7 @@ gribapiDefParam(int editionNumber, grib_handle *gh, int param, const char *name, } static int -getTimeunitFactor(const int timeunit) +getTimeunitFactor(int timeunit) { switch (timeunit) { @@ -1878,7 +1879,7 @@ getTimeunitFactor(const int timeunit) } static int -grib2ProDefTempHasStatisticalDef(const int proDefTempNum) +grib2ProDefTempHasStatisticalDef(int proDefTempNum) { switch (proDefTempNum) { @@ -1905,7 +1906,7 @@ grib2ProDefTempHasStatisticalDef(const int proDefTempNum) } static int -getUnitsOfTime(const int timeunit) +getUnitsOfTime(int timeunit) { switch (timeunit) { @@ -1977,7 +1978,7 @@ gribapiDefSteptype(int editionNumber, grib_handle *gh, int productDefinitionTemp } static void -gribapiDefDateTimeAbs(int editionNumber, grib_handle *gh, int date, int time, int productDefinitionTemplate, +gribapiDefDateTimeAbs(int editionNumber, grib_handle *gh, CdiDateTime dateTime, int productDefinitionTemplate, int typeOfGeneratingProcess, int tsteptype, int gcinit) { (void) gribapiDefSteptype(editionNumber, gh, productDefinitionTemplate, typeOfGeneratingProcess, tsteptype, gcinit); @@ -1985,63 +1986,52 @@ gribapiDefDateTimeAbs(int editionNumber, grib_handle *gh, int date, int time, in if (editionNumber > 1) GRIB_CHECK(my_grib_set_long(gh, "significanceOfReferenceTime", 0), 0); if (editionNumber > 1) GRIB_CHECK(my_grib_set_long(gh, "stepRange", 0), 0); - if (date == 0) date = 10101; - gribapiSetDataDateTime(gh, date, time); + if (cdiDateTime_isNull(dateTime)) dateTime.date = cdiDate_set(10101); + gribapiSetDataDateTime(gh, dateTime); } static int -gribapiDefDateTimeRel(int editionNumber, grib_handle *gh, int fdate, int ftime, int vdate, int vtime, int sdate, int stime, +gribapiDefDateTimeRel(int editionNumber, grib_handle *gh, CdiDateTime fDateTime, CdiDateTime vDateTime, CdiDateTime sDateTime, int productDefinitionTemplate, int typeOfGeneratingProcess, int tsteptype, int timeunit, int calendar, int gcinit) { int status = -1; - CdiDateTime fDateTime = cdiDateTime_set(fdate, ftime); JulianDate julianDate1 = julianDate_encode(calendar, fDateTime); - if (vdate == 0 && vtime == 0) - { - vdate = fdate; - vtime = ftime; - } + if (cdiDateTime_isNull(vDateTime)) vDateTime = fDateTime; - CdiDateTime vDateTime = cdiDateTime_set(vdate, vtime); JulianDate julianDate2 = julianDate_encode(calendar, vDateTime); - JulianDate julianDate = julianDate_sub(julianDate2, julianDate1); - const int factor = getTimeunitFactor(timeunit); + int factor = getTimeunitFactor(timeunit); if (!(int) (fmod(julianDate_to_seconds(julianDate), factor))) { - const int proDefTempNum + int proDefTempNum = gribapiDefSteptype(editionNumber, gh, productDefinitionTemplate, typeOfGeneratingProcess, tsteptype, gcinit); gribapiDefStepUnits(editionNumber, gh, timeunit, proDefTempNum, gcinit); long startStep = 0; - const double endStepF = julianDate_to_seconds(julianDate) / factor; - const long maxStep = (editionNumber > 1) ? INT_MAX : 65000; + double endStepF = julianDate_to_seconds(julianDate) / factor; + long maxStep = (editionNumber > 1) ? INT_MAX : 65000; if (endStepF > maxStep) return status; long endStep = lround(endStepF); bool hasStartDate = (tsteptype == TSTEP_RANGE || tsteptype == TSTEP_AVG || tsteptype == TSTEP_ACCUM || tsteptype == TSTEP_DIFF || tsteptype == TSTEP_MIN || tsteptype == TSTEP_MAX || tsteptype == TSTEP_RMS || tsteptype == TSTEP_SD || tsteptype == TSTEP_COV || tsteptype == TSTEP_RATIO || tsteptype == TSTEP_SUM); - if (sdate != 0 && hasStartDate) + if (!cdiDateTime_isNull(sDateTime) && hasStartDate) { - CdiDateTime sDateTime = cdiDateTime_set(sdate, stime); julianDate2 = julianDate_encode(calendar, sDateTime); - - julianDate = julianDate_sub(julianDate2, julianDate1); - - startStep = lround(julianDate_to_seconds(julianDate) / factor); + startStep = lround(julianDate_to_seconds(julianDate_sub(julianDate2, julianDate1)) / factor); } if (editionNumber > 1) GRIB_CHECK(my_grib_set_long(gh, "significanceOfReferenceTime", 1), 0); if (editionNumber > 1) GRIB_CHECK(my_grib_set_long(gh, "stepRange", 0), 0); - if (fdate == 0) fdate = 10101; - gribapiSetDataDateTime(gh, fdate, ftime); + if (cdiDateTime_isNull(fDateTime)) fDateTime.date = cdiDate_set(10101); + gribapiSetDataDateTime(gh, fDateTime); // printf(">>>>> tsteptype %d startStep %ld endStep %ld\n", tsteptype, startStep, endStep); @@ -2071,8 +2061,8 @@ gribapiDefDateTimeRel(int editionNumber, grib_handle *gh, int fdate, int ftime, } static void -gribapiDefTime(int editionNumber, int productDefinitionTemplate, int typeOfGeneratingProcess, grib_handle *gh, int vdate, int vtime, - int tsteptype, int numavg, int taxisID, int gcinit) +gribapiDefTime(int editionNumber, int productDefinitionTemplate, int typeOfGeneratingProcess, grib_handle *gh, + CdiDateTime vDateTime, int tsteptype, int numavg, int taxisID, int gcinit) { UNUSED(numavg); @@ -2080,39 +2070,28 @@ gribapiDefTime(int editionNumber, int productDefinitionTemplate, int typeOfGener if (typeOfGeneratingProcess == 196) { - vdate = 10101; - vtime = 0; + vDateTime = cdiDateTime_set(10101, 0); taxistype = TAXIS_ABSOLUTE; } if (taxistype == TAXIS_RELATIVE) { - const int timeunit = taxisInqTunit(taxisID); - const int calendar = taxisInqCalendar(taxisID); + int timeunit = taxisInqTunit(taxisID); + int calendar = taxisInqCalendar(taxisID); - int fdate = taxisInqFdate(taxisID); - int ftime = taxisInqFtime(taxisID); - if (fdate == CDI_UNDEFID) - { - fdate = taxisInqRdate(taxisID); - ftime = taxisInqRtime(taxisID); - } - if (vdate < fdate || (vdate == fdate && vtime < ftime)) - { - fdate = vdate; - ftime = vtime; - } + CdiDateTime fDateTime = taxisInqFdatetime(taxisID); + if (cdiDateTime_isNull(fDateTime)) fDateTime = taxisInqRdatetime(taxisID); + if (cdiDateTime_isLT(vDateTime, fDateTime)) fDateTime = vDateTime; - const int sdate = taxisInqSdate(taxisID); - const int stime = taxisInqStime(taxisID); + CdiDateTime sDateTime = taxisInqSdatetime(taxisID); - int status = gribapiDefDateTimeRel(editionNumber, gh, fdate, ftime, vdate, vtime, sdate, stime, productDefinitionTemplate, + int status = gribapiDefDateTimeRel(editionNumber, gh, fDateTime, vDateTime, sDateTime, productDefinitionTemplate, typeOfGeneratingProcess, tsteptype, timeunit, calendar, gcinit); if (status != 0) taxistype = TAXIS_ABSOLUTE; } if (taxistype == TAXIS_ABSOLUTE) - gribapiDefDateTimeAbs(editionNumber, gh, vdate, vtime, productDefinitionTemplate, typeOfGeneratingProcess, tsteptype, gcinit); + gribapiDefDateTimeAbs(editionNumber, gh, vDateTime, productDefinitionTemplate, typeOfGeneratingProcess, tsteptype, gcinit); } static void @@ -2236,8 +2215,8 @@ radiusToShapeOfTheEarth(double radius) static void gribapiDefGridLCC(grib_handle *gh, int editionNumber, int gridID, int uvRelativeToGrid) { - const long xsize = (long) gridInqXsize(gridID); - const long ysize = (long) gridInqYsize(gridID); + long xsize = (long) gridInqXsize(gridID); + long ysize = (long) gridInqYsize(gridID); struct CDI_GridProjParams gpp; gridInqParamsLCC(gridID, &gpp); @@ -2250,7 +2229,7 @@ gribapiDefGridLCC(grib_handle *gh, int editionNumber, int gridID, int uvRelative if (gpp.xval_0 < 0.0) gpp.xval_0 += 360.0; if (gpp.lon_0 < 0.0) gpp.lon_0 += 360.0; - const bool lsouth = (gpp.lat_1 < 0.0); + bool lsouth = (gpp.lat_1 < 0.0); if (lsouth) { gpp.lat_1 = -gpp.lat_2; @@ -2279,12 +2258,12 @@ gribapiDefGridLCC(grib_handle *gh, int editionNumber, int gridID, int uvRelative GRIB_CHECK(my_grib_set_double(gh, "Latin2InDegrees", gpp.lat_2), 0); GRIB_CHECK(my_grib_set_long(gh, "projectionCentreFlag", projflag), 0); - const long shapeOfTheEarth = radiusToShapeOfTheEarth(gpp.a); + long shapeOfTheEarth = radiusToShapeOfTheEarth(gpp.a); if (shapeOfTheEarth) GRIB_CHECK(my_grib_set_long(gh, "shapeOfTheEarth", shapeOfTheEarth), 0); if (uvRelativeToGrid >= 0) GRIB_CHECK(my_grib_set_long(gh, "uvRelativeToGrid", uvRelativeToGrid), 0); - const long earthIsOblate = (IS_EQUAL(gpp.a, 6378160.0) && IS_EQUAL(gpp.rf, 297.0)); + long earthIsOblate = (IS_EQUAL(gpp.a, 6378160.0) && IS_EQUAL(gpp.rf, 297.0)); if (earthIsOblate) GRIB_CHECK(my_grib_set_long(gh, "earthIsOblate", earthIsOblate), 0); int scanflag = 0; @@ -2295,8 +2274,8 @@ gribapiDefGridLCC(grib_handle *gh, int editionNumber, int gridID, int uvRelative static void gribapiDefGridSTERE(grib_handle *gh, int gridID) { - const long xsize = (long) gridInqXsize(gridID); - const long ysize = (long) gridInqYsize(gridID); + long xsize = (long) gridInqXsize(gridID); + long ysize = (long) gridInqYsize(gridID); struct CDI_GridProjParams gpp; gridInqParamsSTERE(gridID, &gpp); @@ -2304,8 +2283,8 @@ gribapiDefGridSTERE(grib_handle *gh, int gridID) if (gpp.xval_0 < 0.0) gpp.xval_0 += 360.0; int projflag = 0; - const double xinc = gridInqXinc(gridID); - const double yinc = gridInqYinc(gridID); + double xinc = gridInqXinc(gridID); + double yinc = gridInqYinc(gridID); static const char mesg[] = "polar_stereographic"; size_t len = sizeof(mesg) - 1; @@ -2319,11 +2298,11 @@ gribapiDefGridSTERE(grib_handle *gh, int gridID) GRIB_CHECK(my_grib_set_double(gh, "latitudeOfFirstGridPointInDegrees", gpp.yval_0), 0); GRIB_CHECK(my_grib_set_double(gh, "LaDInDegrees", gpp.lat_1), 0); GRIB_CHECK(my_grib_set_double(gh, "orientationOfTheGridInDegrees", gpp.lon_0), 0); - const long southPoleOnProjectionPlane = IS_EQUAL(gpp.lat_0, -90.0); + long southPoleOnProjectionPlane = IS_EQUAL(gpp.lat_0, -90.0); GRIB_CHECK(my_grib_set_double(gh, "southPoleOnProjectionPlane", southPoleOnProjectionPlane), 0); GRIB_CHECK(my_grib_set_long(gh, "projectionCentreFlag", projflag), 0); - const long shapeOfTheEarth = radiusToShapeOfTheEarth(gpp.a); + long shapeOfTheEarth = radiusToShapeOfTheEarth(gpp.a); if (shapeOfTheEarth) GRIB_CHECK(my_grib_set_long(gh, "shapeOfTheEarth", shapeOfTheEarth), 0); GRIB_CHECK(my_grib_set_long(gh, "resolutionAndComponentFlags", 8), 0); @@ -2396,7 +2375,7 @@ gribapiDefGridUnstructured(grib_handle *gh, int gridID) static void gribapiDefGridSpectral(grib_handle *gh, int gridID) { - const int trunc = gridInqTrunc(gridID); + int trunc = gridInqTrunc(gridID); enum { numTruncAtt = 3 @@ -2446,10 +2425,10 @@ gribapiDefPackingType(grib_handle *gh, bool lieee, bool lspectral, bool lcomplex static void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype, int datatype, int uvRelativeToGrid) { - const size_t gridsize = gridInqSize(gridID); + size_t gridsize = gridInqSize(gridID); bool gridIsRotated = false; bool gridIsCurvilinear = false; - const int gridtype = grbGetGridtype(&gridID, gridsize, &gridIsRotated, &gridIsCurvilinear); + int gridtype = grbGetGridtype(&gridID, gridsize, &gridIsRotated, &gridIsCurvilinear); bool lieee = (editionNumber == 2 && (datatype == CDI_DATATYPE_FLT32 || datatype == CDI_DATATYPE_FLT64)); bool lspectral = (gridtype == GRID_SPECTRAL); @@ -2548,9 +2527,11 @@ gribapiDefLevelType(grib_handle *gh, int gcinit, const char *keyname, long level } static void -grib1DefLevel(grib_handle *gh, int gcinit, long leveltype, bool hasBounds, double level, double dlevel1, double dlevel2) +grib1DefLevel(grib_handle *gh, int gcinit, long leveltype1, long leveltype2, bool hasBounds, double level, double dlevel1, + double dlevel2) { - gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", leveltype); + (void) leveltype2; + gribapiDefLevelType(gh, gcinit, "indicatorOfTypeOfLevel", leveltype1); if (hasBounds) { @@ -2600,15 +2581,23 @@ gribapiDefLevel(int editionNumber, grib_handle *gh, int zaxisID, int levelID, in if (zaxistype == ZAXIS_GENERIC && ltype == 0) { - Message("Changed zaxis type from %s to %s", zaxisNamePtr(zaxistype), zaxisNamePtr(ZAXIS_PRESSURE)); + Warning("Changed zaxis type from %s to %s", zaxisNamePtr(zaxistype), zaxisNamePtr(ZAXIS_PRESSURE)); zaxistype = ZAXIS_PRESSURE; zaxisChangeType(zaxisID, zaxistype); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, "Pa"); } - long grib_ltype = (editionNumber <= 1) ? zaxisTypeToGrib1ltype(zaxistype) : zaxisTypeToGrib2ltype(zaxistype); + long grib_ltype; + { + int (*ltypeMap)(int grib_ltype) = editionNumber <= 1 ? zaxisTypeToGrib1ltype : zaxisTypeToGrib2ltype; + grib_ltype = ltypeMap(zaxistype); + } long grib_ltype2 = (ltype != ltype2 && ltype2 != -1) ? ltype2 : grib_ltype; + void (*defLevel)(grib_handle * gh, int gcinit, long leveltype1, long leveltype2, bool hasBounds, double level, double dlevel1, + double dlevel2) + = editionNumber <= 1 ? grib1DefLevel : grib2DefLevel; + switch (zaxistype) { case ZAXIS_SURFACE: @@ -2621,27 +2610,22 @@ gribapiDefLevel(int editionNumber, grib_handle *gh, int zaxisID, int levelID, in { if (zaxistype == ZAXIS_HEIGHT) { - const double sf = zaxis_units_to_meter(zaxisID); + double sf = zaxis_units_to_meter(zaxisID); level *= sf; dlevel1 *= sf; dlevel2 *= sf; } - if (editionNumber <= 1) - { - grib1DefLevel(gh, gcinit, grib_ltype, hasBounds, level, dlevel1, dlevel2); - } - else - { - /* PRODUCT DEFINITION TEMPLATE NUMBER 32: + /* GRIB2: PRODUCT DEFINITION TEMPLATE NUMBER 32: - "Analysis or forecast at a horizontal level or in a horizontal layer at a point - in time for simulate (synthetic) satellite data" + "Analysis or forecast at a horizontal level or in a + horizontal layer at a point in time for simulate + (synthetic) satellite data" - The key/value pairs that are set in "grib2DefLevel" do not exist for this template. - */ - if (proddef_template_num != 32) grib2DefLevel(gh, gcinit, grib_ltype, grib_ltype2, hasBounds, level, dlevel1, dlevel2); - } + The key/value pairs that are set in "grib2DefLevel" do not + exist for this template. */ + if (editionNumber <= 1 || proddef_template_num != 32) + defLevel(gh, gcinit, grib_ltype, grib_ltype2, hasBounds, level, dlevel1, dlevel2); break; } @@ -2658,25 +2642,17 @@ gribapiDefLevel(int editionNumber, grib_handle *gh, int zaxisID, int levelID, in case ZAXIS_MIX_LAYER: case ZAXIS_ATMOSPHERE: { - if (editionNumber <= 1) - grib1DefLevel(gh, gcinit, grib_ltype, hasBounds, level, dlevel1, dlevel2); - else - grib2DefLevel(gh, gcinit, grib_ltype, grib_ltype2, hasBounds, level, dlevel1, dlevel2); - - break; + defLevel(gh, gcinit, grib_ltype, grib_ltype, hasBounds, level, dlevel1, dlevel2); } + break; case ZAXIS_HYBRID: case ZAXIS_HYBRID_HALF: { if (editionNumber <= 1) { grib_ltype = hasBounds ? GRIB1_LTYPE_HYBRID_LAYER : GRIB1_LTYPE_HYBRID; - grib1DefLevel(gh, gcinit, grib_ltype, hasBounds, level, dlevel1, dlevel2); - } - else - { - grib2DefLevel(gh, gcinit, grib_ltype, grib_ltype, hasBounds, level, dlevel1, dlevel2); } + defLevel(gh, gcinit, grib_ltype, grib_ltype, hasBounds, level, dlevel1, dlevel2); if (!gcinit) { @@ -2708,39 +2684,27 @@ gribapiDefLevel(int editionNumber, grib_handle *gh, int zaxisID, int levelID, in grib_ltype = GRIB1_LTYPE_ISOBARIC_PA; else level /= 100; - - grib1DefLevel(gh, gcinit, grib_ltype, hasBounds, level, dlevel1, dlevel2); - } - else - { - if (ltype2 == -1) ltype2 = GRIB2_LTYPE_ISOBARIC; - grib2DefLevel(gh, gcinit, GRIB2_LTYPE_ISOBARIC, ltype2, hasBounds, level, dlevel1, dlevel2); } + else if (ltype2 == -1) + ltype2 = GRIB2_LTYPE_ISOBARIC; + defLevel(gh, gcinit, grib_ltype, ltype2, hasBounds, level, dlevel1, dlevel2); break; } case ZAXIS_SNOW: - { - if (editionNumber <= 1) - ; // not available - else + if (editionNumber <= 1) + ; // not available + else + { grib2DefLevel(gh, gcinit, grib_ltype, grib_ltype, hasBounds, level, dlevel1, dlevel2); + } - break; - } + break; case ZAXIS_DEPTH_BELOW_LAND: { - if (editionNumber <= 1) - { - grib_ltype = hasBounds ? GRIB1_LTYPE_LANDDEPTH_LAYER : GRIB1_LTYPE_LANDDEPTH; - double sf = zaxis_units_to_centimeter(zaxisID); - grib1DefLevel(gh, gcinit, grib_ltype, hasBounds, level * sf, dlevel1 * sf, dlevel2 * sf); - } - else - { - double sf = zaxis_units_to_meter(zaxisID); - grib2DefLevel(gh, gcinit, grib_ltype, grib_ltype, hasBounds, level * sf, dlevel1 * sf, dlevel2 * sf); - } + double sf = editionNumber <= 1 ? zaxis_units_to_centimeter(zaxisID) : zaxis_units_to_meter(zaxisID); + grib_ltype = editionNumber <= 1 ? (hasBounds ? GRIB1_LTYPE_LANDDEPTH_LAYER : GRIB1_LTYPE_LANDDEPTH) : grib_ltype; + defLevel(gh, gcinit, grib_ltype, grib_ltype, hasBounds, level * sf, dlevel1 * sf, dlevel2 * sf); break; } @@ -2783,11 +2747,7 @@ gribapiDefLevel(int editionNumber, grib_handle *gh, int zaxisID, int levelID, in } case ZAXIS_GENERIC: { - if (editionNumber <= 1) - grib1DefLevel(gh, gcinit, ltype, hasBounds, level, dlevel1, dlevel2); - else - grib2DefLevel(gh, gcinit, ltype, ltype, hasBounds, level, dlevel1, dlevel2); - + defLevel(gh, gcinit, ltype, ltype, hasBounds, level, dlevel1, dlevel2); break; } default: @@ -2819,11 +2779,11 @@ gribapiSetScanningMode(grib_handle *gh, int scanningMode) // 127: reserved for testing; generated test data will be in 64 scanning mode // if (scanningMode== 127) scanningMode = 64; - const long iScansNegatively = (scanningMode & 128) / 128; - const long jScansPositively = (scanningMode & 64) / 64; - const long jPointsAreConsecutive = (scanningMode & 32) / 32; + long iScansNegatively = (scanningMode & 128) / 128; + long jScansPositively = (scanningMode & 64) / 64; + long jPointsAreConsecutive = (scanningMode & 32) / 32; - if (cdiDebugExt >= 30) + if (cdiDebugExt >= 30 && gribEditionNumber(gh) <= 1) { long paramId, levelTypeId, levelId, uvRelativeToGrid; GRIB_CHECK(grib_get_long(gh, "uvRelativeToGrid", &uvRelativeToGrid), 0); @@ -2909,10 +2869,7 @@ verticallyFlipGridDefinitionWhenScanningModeChanged(grib_handle *gh, double yfir // GRIB_CHECK(grib_get_double(gh, "latitudeOfLastGridPointInDegrees", &latitudeOfLastGridPointInDegrees), 0); // ylast // GRIB_CHECK(grib_get_double(gh, "jDirectionIncrementInDegrees", &jDirectionIncrementInDegrees), 0); // yinc - if (cdiDebugExt >= 10) - { - Message(" BEFORE: yfirst = %f; ylast = %f; yinc = %f; ", yfirst, ylast, yinc); - } + if (cdiDebugExt >= 10) Message(" BEFORE: yfirst = %f; ylast = %f; yinc = %f; ", yfirst, ylast, yinc); GRIB_CHECK(my_grib_set_double(gh, "latitudeOfFirstGridPointInDegrees", ylast), 0); GRIB_CHECK(my_grib_set_double(gh, "latitudeOfLastGridPointInDegrees", yfirst), 0); @@ -2941,7 +2898,7 @@ convertDataScanningMode(int scanModeIN, int scanModeOUT, double *data, size_t gr if (cdiDebugExt >= 30) printf("convertDataScanningMode(): Generating test data in 64 scanning mode..\n"); for (size_t j = 0; j < jDim; j++) { - const size_t jXiDim = j * iDim; + size_t jXiDim = j * iDim; for (size_t i = 0; i < iDim; i++) { idxIN = i + jXiDim; @@ -2992,7 +2949,7 @@ convertDataScanningMode(int scanModeIN, int scanModeOUT, double *data, size_t gr return; } } - double *dataCopy = (double *) malloc(gridsize * sizeof(double)); + double *dataCopy = (double *) Malloc(gridsize * sizeof(double)); memcpy((void *) dataCopy, (void *) data, gridsize * sizeof(double)); if (scanModeIN @@ -3164,11 +3121,7 @@ gribapiSetExtMode(grib_handle *gh, int gridID, size_t datasize, const void *data int scanModeIN = 0; cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_SCANNINGMODE, &scanModeIN); - if (cdiDebugExt >= 100) - { - size_t gridsize = gridInqSize(gridID); - Message("(scanModeIN=%d; gridsize=%zu", scanModeIN, gridsize); - } + if (cdiDebugExt >= 100) Message("scanModeIN=%d; gridsize=%zu", scanModeIN, gridInqSize(gridID)); if (cdiGribDataScanningMode.active) // allowed modes: <0, 64, 96>; Default is 64 { @@ -3201,11 +3154,10 @@ gribapiSetExtMode(grib_handle *gh, int gridID, size_t datasize, const void *data // #define GRIBAPIENCODETEST 1 size_t -gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisID, int vdate, int vtime, int tsteptype, int numavg, +gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisID, CdiDateTime vDateTime, int tsteptype, int numavg, size_t datasize, const void *data, size_t nmiss, void **gribbuffer, size_t *gribbuffersize, int comptype, void *gribContainer) { - void *dummy = NULL; long editionNumber = 2; // extern unsigned char _grib_template_GRIB2[]; @@ -3221,10 +3173,6 @@ gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisID, int int uvRelativeToGrid = -1; cdiInqKeyInt(vlistID, varID, CDI_KEY_UVRELATIVETOGRID, &uvRelativeToGrid); - char name[256], stdname[256]; - vlistInqVarName(vlistID, varID, name); - vlistInqVarStdname(vlistID, varID, stdname); - #ifdef GRIBAPIENCODETEST grib_handle *gh = (grib_handle *) gribHandleNew(editionNumber); #else @@ -3259,7 +3207,7 @@ gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisID, int } } - gribapiDefTime((int) editionNumber, productDefinitionTemplate, typeOfGeneratingProcess, gh, vdate, vtime, tsteptype, numavg, + gribapiDefTime((int) editionNumber, productDefinitionTemplate, typeOfGeneratingProcess, gh, vDateTime, tsteptype, numavg, vlistInqTaxis(vlistID), gc->init); { @@ -3281,7 +3229,13 @@ gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisID, int if (!gc->init) gribapiDefInstitut(gh, vlistID, varID); if (!gc->init) gribapiDefModel(gh, vlistID, varID); - if (!gc->init) gribapiDefParam((int) editionNumber, gh, param, name, stdname); + if (!gc->init) + { + char name[256], stdname[256]; + vlistInqVarName(vlistID, varID, name); + vlistInqVarStdname(vlistID, varID, stdname); + gribapiDefParam((int) editionNumber, gh, param, name, stdname); + } if (!gc->init && editionNumber == 2) { @@ -3334,6 +3288,7 @@ gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisID, int gribapiDefLevel((int) editionNumber, gh, zaxisID, levelID, gc->init, productDefinitionTemplate); vlist_t *vlistptr = vlist_to_pointer(vlistID); + int zaxisSize = zaxisInqSize(zaxisID); // if (!gc->init) { int ret = 0; @@ -3345,7 +3300,7 @@ gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisID, int if (vlistptr->vars[varID].opt_grib_kvpair[i].update) { // DR: Fix for multi-level fields (otherwise only the 1st level is correct) - if (zaxisInqSize(zaxisID) == (levelID + 1)) vlistptr->vars[varID].opt_grib_kvpair[i].update = false; + if (zaxisSize == (levelID + 1)) vlistptr->vars[varID].opt_grib_kvpair[i].update = false; if (vlistptr->vars[varID].opt_grib_kvpair[i].data_type == t_double) { @@ -3387,8 +3342,9 @@ gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisID, int } // get the size of coded message + const void *dummy = NULL; size_t recsize = 0; - GRIB_CHECK(grib_get_message(gh, (const void **) &dummy, &recsize), 0); + GRIB_CHECK(grib_get_message(gh, &dummy, &recsize), 0); recsize += 512; // add some space for possible filling *gribbuffersize = recsize; *gribbuffer = Malloc(*gribbuffersize); @@ -3404,11 +3360,11 @@ gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisID, int vlistInqVarName(vlistID, varID, cdi_name); char grb_name[256]; gribapiGetString(gh, "shortName", grb_name, sizeof(grb_name)); - strToLower(cdi_name); - strToLower(grb_name); + str_to_lower(cdi_name); + str_to_lower(grb_name); bool checkName = (!grb_name[0] && strncmp(cdi_name, "param", 5) == 0) ? false : true; if (checkName && ((strlen(cdi_name) != strlen(grb_name)) || !strStartsWith(cdi_name, grb_name))) - Message("*** GRIB2 shortName does not correspond to chosen variable name: \"%s\" (\"%s\").", + Warning("*** GRIB2 shortName does not correspond to chosen variable name: \"%s\" (\"%s\").", grb_name[0] ? grb_name : "unknown", cdi_name); } } @@ -3429,9 +3385,12 @@ void gribapiChangeParameterIdentification(grib_handle *gh, int code, int ltype, int level) { // timeRangeIndicator: could be included later - if (code != -1) GRIB_CHECK(my_grib_set_long(gh, "indicatorOfParameter", code), 0); - if (ltype != -1) GRIB_CHECK(my_grib_set_long(gh, "indicatorOfTypeOfLevel", ltype), 0); - if (level != -1) GRIB_CHECK(my_grib_set_long(gh, "level", level), 0); + if (gribEditionNumber(gh) <= 1) + { + if (code != -1) GRIB_CHECK(my_grib_set_long(gh, "indicatorOfParameter", code), 0); + if (ltype != -1) GRIB_CHECK(my_grib_set_long(gh, "indicatorOfTypeOfLevel", ltype), 0); + if (level != -1) GRIB_CHECK(my_grib_set_long(gh, "level", level), 0); + } } #endif diff --git a/src/stream_gribapi.h b/src/stream_gribapi.h index cd7f6f71b71820895fd5e2e68852dd41333212c9..b5e6def463a96112fdb0cfe6be9f7b0594474f8e 100644 --- a/src/stream_gribapi.h +++ b/src/stream_gribapi.h @@ -13,7 +13,7 @@ int gribapiScanTimestep(stream_t *streamptr); int gribapiDecode(void *gribbuffer, size_t gribsize, void *data, size_t datasize, int unreduced, size_t *nmiss, double missval); -size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisID, int vdate, int vtime, int tsteptype, int numavg, +size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisID, CdiDateTime vDateTime, int tsteptype, int numavg, size_t datasize, const void *data, size_t nmiss, void **gribbuffer, size_t *gribbuffersize, int ljpeg, void *gribContainer); diff --git a/src/stream_ieg.c b/src/stream_ieg.c index 51d01f2e2bb364eb9504f74afb0a4e7871d17ed8..537286cac728f8d3d2ede9973a6931ca79d22eb6 100644 --- a/src/stream_ieg.c +++ b/src/stream_ieg.c @@ -11,7 +11,6 @@ #include "cdi.h" #include "cdi_int.h" #include "varscan.h" -#include "datetime.h" #include "ieg.h" #include "stream_scan.h" #include "stream_ieg.h" @@ -154,7 +153,7 @@ calc_resfac(double xfirst, double xlast, double xinc, double yfirst, double ylas nMultTests = 6, }; static const double scaleFactors[nPwrOf10] = { 1000, 10000, 100000, 1000000, 10000000 }; - double vals[nMultTests] = { xfirst, xlast, xinc, yfirst, ylast, yinc }; + const double vals[nMultTests] = { xfirst, xlast, xinc, yfirst, ylast, yinc }; for (size_t j = 0; j < nPwrOf10; ++j) { @@ -315,7 +314,7 @@ iegDefLevel(int *pdb, int *gdb, double *vct, int zaxisID, int levelID) int leveltype = zaxisInqType(zaxisID); if (leveltype == ZAXIS_GENERIC) { - Message("Changed zaxis type from %s to %s", zaxisNamePtr(leveltype), zaxisNamePtr(ZAXIS_PRESSURE)); + Warning("Changed zaxis type from %s to %s", zaxisNamePtr(leveltype), zaxisNamePtr(ZAXIS_PRESSURE)); leveltype = ZAXIS_PRESSURE; zaxisChangeType(zaxisID, leveltype); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, "Pa"); @@ -435,6 +434,7 @@ iegDefRecord(stream_t *streamptr) int varID = record->varID; int levelID = record->levelID; int tsID = streamptr->curTsID; + CdiDateTime vDateTime = streamptr->tsteps[tsID].taxis.vDateTime; int gridID = vlistInqVarGrid(vlistID, varID); int zaxisID = vlistInqVarZaxis(vlistID, varID); @@ -451,7 +451,7 @@ iegDefRecord(stream_t *streamptr) IEG_P_Parameter(iegp->ipdb) = pnum; if (pdis == 255) IEG_P_CodeTable(iegp->ipdb) = pcat; - iegDefTime(iegp->ipdb, streamptr->tsteps[tsID].taxis.vdatetime, vlistInqTaxis(vlistID)); + iegDefTime(iegp->ipdb, vDateTime, vlistInqTaxis(vlistID)); iegDefGrid(iegp->igdb, gridID); iegDefLevel(iegp->ipdb, iegp->igdb, iegp->vct, zaxisID, levelID); @@ -518,9 +518,9 @@ ieg_write_record(stream_t *streamptr, int memtype, const void *data) static void iegAddRecord(stream_t *streamptr, int param, int *pdb, int *gdb, double *vct, size_t recsize, off_t position, int prec) { - const int vlistID = streamptr->vlistID; - const int tsID = streamptr->curTsID; - const int recID = recordNewEntry(streamptr, tsID); + int vlistID = streamptr->vlistID; + int tsID = streamptr->curTsID; + int recID = recordNewEntry(streamptr, tsID); record_t *record = &streamptr->tsteps[tsID].records[recID]; int level1, level2; @@ -551,8 +551,8 @@ iegAddRecord(stream_t *streamptr, int param, int *pdb, int *gdb, double *vct, si grid_t *grid = (grid_t *) Malloc(sizeof(*grid)); grid_init(grid); cdiGridTypeInit(grid, gridtype, IEG_G_NumLon(gdb) * IEG_G_NumLat(gdb)); - const size_t xsize = (size_t) IEG_G_NumLon(gdb); - const size_t ysize = (size_t) IEG_G_NumLat(gdb); + size_t xsize = (size_t) IEG_G_NumLon(gdb); + size_t ysize = (size_t) IEG_G_NumLat(gdb); grid->x.size = xsize; grid->y.size = ysize; grid->x.inc = 0; @@ -561,7 +561,7 @@ iegAddRecord(stream_t *streamptr, int param, int *pdb, int *gdb, double *vct, si int iresfac = IEG_G_ResFac(gdb); if (iresfac == 0) iresfac = 1000; - const double resfac = 1. / (double) iresfac; + double resfac = 1. / (double) iresfac; // if ( IEG_G_FirstLon != 0 || IEG_G_LastLon != 0 ) { @@ -575,7 +575,7 @@ iegAddRecord(stream_t *streamptr, int param, int *pdb, int *gdb, double *vct, si // correct xinc if necessary if (IEG_G_FirstLon(gdb) == 0 && IEG_G_LastLon(gdb) > 354000) { - const double xinc = 360. / xsize; + double xinc = 360. / xsize; // FIXME: why not use grid->x.inc != xinc as condition? if (fabs(grid->x.inc - xinc) > 0.0) { @@ -612,9 +612,12 @@ iegAddRecord(stream_t *streamptr, int param, int *pdb, int *gdb, double *vct, si } struct addIfNewRes gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 0); - const int gridID = gridAdded.Id; + int gridID = gridAdded.Id; if (!gridAdded.isNew) - Free(grid); + { + grid_free(grid); + Free(grid); + } else if (gridtype == GRID_PROJECTION) gridDefParamRLL(gridID, xpole, ypole, 0); @@ -630,9 +633,9 @@ iegAddRecord(stream_t *streamptr, int param, int *pdb, int *gdb, double *vct, si varDefVCT(vctsize, tmpvct); } - const int lbounds = IEG_P_LevelType(pdb) == IEG_LTYPE_HYBRID_LAYER ? 1 : 0; + int lbounds = IEG_P_LevelType(pdb) == IEG_LTYPE_HYBRID_LAYER ? 1 : 0; - const int datatype = iegInqDatatype(prec); + int datatype = iegInqDatatype(prec); int varID, levelID = 0; varAddRecord(recID, param, gridID, leveltype, lbounds, level1, level2, 0, 0, datatype, &varID, &levelID, TSTEP_INSTANT, 0, -1, @@ -657,8 +660,7 @@ void iegCmpRecord(stream_t *streamptr, int tsID, int recID, off_t position, int record_t *record = &streamptr->tsteps[tsID].records[recID]; - if ( param != (*record).param || level != (*record).ilevel ) - Error("inconsistent timestep"); + if (param != (*record).param || level != (*record).ilevel) Error("inconsistent timestep"); (*record).position = position; /* @@ -670,13 +672,12 @@ void iegCmpRecord(stream_t *streamptr, int tsID, int recID, off_t position, int streamptr->tsteps[tsID].nallrecs++; streamptr->nrecs++; */ - if ( CDI_Debug ) - Message("varID = %d levelID = %d", varID, levelID); + if (CDI_Debug) Message("varID = %d levelID = %d", varID, levelID); } #endif -static void -iegDateTime(int *pdb, int64_t *date, int *time) +static CdiDateTime +iegDateTime(const int *pdb) { int ryear = IEG_P_Year(pdb); int rmonth = IEG_P_Month(pdb); @@ -687,14 +688,17 @@ iegDateTime(int *pdb, int64_t *date, int *time) if (rminute == -1) rminute = 0; - *date = cdiEncodeDate(ryear, rmonth, rday); - *time = cdiEncodeTime(rhour, rminute, 0); + CdiDateTime cdiDateTime; + cdiDateTime.date = cdiDate_encode(ryear, rmonth, rday); + cdiDateTime.time = cdiTime_encode(rhour, rminute, 0, 0); + return cdiDateTime; } static void iegScanTimestep1(stream_t *streamptr) { - CmpDateTime datetime0 = { INT_MIN, INT_MIN }; + CdiDateTime datetime0; + cdiDateTime_init(&datetime0); off_t recpos; iegrec_t *iegp = (iegrec_t *) streamptr->record->objectp; @@ -704,7 +708,7 @@ iegScanTimestep1(stream_t *streamptr) if (tsID != 0) Error("Internal problem! tstepsNewEntry returns %d", tsID); taxis_t *taxis = &streamptr->tsteps[tsID].taxis; - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; int nrecs = 0; while (true) @@ -716,25 +720,22 @@ iegScanTimestep1(stream_t *streamptr) break; } - const size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); - const int prec = iegp->dprec; - const int rcode = IEG_P_Parameter(iegp->ipdb); - const int tabnum = IEG_P_CodeTable(iegp->ipdb); - const int param = cdiEncodeParam(rcode, tabnum, 255); + int prec = iegp->dprec; + int rcode = IEG_P_Parameter(iegp->ipdb); + int tabnum = IEG_P_CodeTable(iegp->ipdb); + int param = cdiEncodeParam(rcode, tabnum, 255); int rlevel = (IEG_P_LevelType(iegp->ipdb) == IEG_LTYPE_HYBRID_LAYER) ? IEG_P_Level1(iegp->ipdb) : IEG_P_Level2(iegp->ipdb); if (IEG_P_LevelType(iegp->ipdb) == 100) rlevel *= 100; - int64_t vdate = 0; - int vtime = 0; - iegDateTime(iegp->ipdb, &vdate, &vtime); - CmpDateTime datetime = { .date = vdate, .time = vtime }; + CdiDateTime datetime = iegDateTime(iegp->ipdb); if (nrecs == 0) { datetime0 = datetime; - taxis->vdatetime = cdiDateTime_set(vdate, vtime); + taxis->vDateTime = datetime; } else { @@ -742,12 +743,12 @@ iegScanTimestep1(stream_t *streamptr) for (int recID = 0; recID < nrecs; recID++) if (param == records[recID].param && rlevel == records[recID].ilevel) goto tstepScanLoopFinished; - if (datetime_differ(datetime, datetime0)) Warning("Inconsistent verification time for param %d level %d", param, rlevel); + if (cdiDateTime_isNE(datetime, datetime0)) Warning("Inconsistent verification time for param %d level %d", param, rlevel); } nrecs++; - if (CDI_Debug) Message("%4d%8d%4d%8d%8ld%6d", nrecs, (int) recpos, param, rlevel, (long) vdate, vtime); + if (CDI_Debug) Message("%4d%8d%4d%8d %s", nrecs, (int) recpos, param, rlevel, CdiDateTime_string(datetime)); iegAddRecord(streamptr, param, iegp->ipdb, iegp->igdb, iegp->vct, recsize, recpos, prec); } @@ -757,11 +758,11 @@ tstepScanLoopFinished: cdi_generate_vars(streamptr); - const int taxisID = taxisCreate(TAXIS_ABSOLUTE); + int taxisID = taxisCreate(TAXIS_ABSOLUTE); taxis->type = TAXIS_ABSOLUTE; - taxis->rdatetime = taxis->vdatetime; + taxis->rDateTime = taxis->vDateTime; - const int vlistID = streamptr->vlistID; + int vlistID = streamptr->vlistID; vlistDefTaxis(vlistID, taxisID); vlist_check_contents(vlistID); @@ -780,10 +781,10 @@ iegScanTimestep2(stream_t *streamptr) streamptr->curTsID = 1; - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; - const int tsID = streamptr->rtsteps; + int tsID = streamptr->rtsteps; if (tsID != 1) Error("Internal problem! unexpected timestep %d", tsID + 1); taxis_t *taxis = &streamptr->tsteps[tsID].taxis; @@ -793,7 +794,7 @@ iegScanTimestep2(stream_t *streamptr) cdi_create_records(streamptr, tsID); record_t *records = streamptr->tsteps[tsID].records; - const int nrecords = streamScanInitRecords2(streamptr); + int nrecords = streamScanInitRecords2(streamptr); for (int rindex = 0; rindex <= nrecords; rindex++) { @@ -804,23 +805,21 @@ iegScanTimestep2(stream_t *streamptr) break; } - const size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); - const int rcode = IEG_P_Parameter(iegp->ipdb); - const int tabnum = IEG_P_CodeTable(iegp->ipdb); - const int param = cdiEncodeParam(rcode, tabnum, 255); + int rcode = IEG_P_Parameter(iegp->ipdb); + int tabnum = IEG_P_CodeTable(iegp->ipdb); + int param = cdiEncodeParam(rcode, tabnum, 255); int rlevel = (IEG_P_LevelType(iegp->ipdb) == IEG_LTYPE_HYBRID_LAYER) ? IEG_P_Level1(iegp->ipdb) : IEG_P_Level2(iegp->ipdb); if (IEG_P_LevelType(iegp->ipdb) == 100) rlevel *= 100; - int64_t vdate = 0; - int vtime = 0; - iegDateTime(iegp->ipdb, &vdate, &vtime); + CdiDateTime datetime = iegDateTime(iegp->ipdb); if (rindex == 0) { taxis->type = TAXIS_ABSOLUTE; - taxis->vdatetime = cdiDateTime_set(vdate, vtime); + taxis->vDateTime = datetime; } bool nextstep = false; @@ -851,7 +850,7 @@ iegScanTimestep2(stream_t *streamptr) if (nextstep) break; - if (CDI_Debug) Message("%4d%8d%4d%8d%8ld%6d", rindex + 1, (int) recpos, param, rlevel, (long) vdate, vtime); + if (CDI_Debug) Message("%4d%8d%4d%8d %s", rindex + 1, (int) recpos, param, rlevel, CdiDateTime_string(datetime)); if (param != records[recID].param || rlevel != records[recID].ilevel) { @@ -867,14 +866,10 @@ iegScanTimestep2(stream_t *streamptr) int nrecs = 0; for (int recID = 0; recID < nrecords; recID++) { - if (!records[recID].used) - { - vlistDefVarTimetype(vlistID, records[recID].varID, TIME_CONSTANT); - } + if (records[recID].used) + nrecs++; else - { - nrecs++; - } + vlistDefVarTimetype(vlistID, records[recID].varID, TIME_CONSTANT); } streamptr->tsteps[tsID].nrecs = nrecs; @@ -892,7 +887,7 @@ iegInqContents(stream_t *streamptr) iegScanTimestep1(streamptr); - const int status = (streamptr->ntsteps == -1) ? iegScanTimestep2(streamptr) : 0; + int status = (streamptr->ntsteps == -1) ? iegScanTimestep2(streamptr) : 0; fileSetPos(streamptr->fileID, 0, SEEK_SET); @@ -918,7 +913,7 @@ iegScanTimestep(stream_t *streamptr) nrecs = streamScanInitRecords(streamptr, tsID); - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); @@ -931,28 +926,26 @@ iegScanTimestep(stream_t *streamptr) break; } - const size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); - const int rcode = IEG_P_Parameter(iegp->ipdb); - const int tabnum = IEG_P_CodeTable(iegp->ipdb); - const int param = cdiEncodeParam(rcode, tabnum, 255); + int rcode = IEG_P_Parameter(iegp->ipdb); + int tabnum = IEG_P_CodeTable(iegp->ipdb); + int param = cdiEncodeParam(rcode, tabnum, 255); int rlevel = (IEG_P_LevelType(iegp->ipdb) == IEG_LTYPE_HYBRID_LAYER) ? IEG_P_Level1(iegp->ipdb) : IEG_P_Level2(iegp->ipdb); if (IEG_P_LevelType(iegp->ipdb) == 100) rlevel *= 100; - int64_t vdate = 0; - int vtime = 0; - iegDateTime(iegp->ipdb, &vdate, &vtime); + CdiDateTime datetime = iegDateTime(iegp->ipdb); // if ( rindex == nrecs ) break; gcc-4.5 internal compiler error if (rindex == nrecs) continue; - const int recID = streamptr->tsteps[tsID].recIDs[rindex]; + int recID = streamptr->tsteps[tsID].recIDs[rindex]; if (rindex == 0) { taxis->type = TAXIS_ABSOLUTE; - taxis->vdatetime = cdiDateTime_set(vdate, vtime); + taxis->vDateTime = datetime; } if (param != records[recID].param || rlevel != records[recID].ilevel) @@ -965,7 +958,7 @@ iegScanTimestep(stream_t *streamptr) records[recID].position = recpos; records[recID].size = recsize; - if (CDI_Debug) Message("%4d%8d%4d%8d%8ld%6d", rindex, (int) recpos, param, rlevel, (long) vdate, vtime); + if (CDI_Debug) Message("%4d%8d%4d%8d %s", rindex, (int) recpos, param, rlevel, CdiDateTime_string(datetime)); } streamptr->rtsteps++; @@ -1063,6 +1056,7 @@ iegWriteVarSliceDP(stream_t *streamptr, int varID, int levID, const double *data int vlistID = streamptr->vlistID; int fileID = streamptr->fileID; int tsID = streamptr->curTsID; + CdiDateTime vDateTime = streamptr->tsteps[tsID].taxis.vDateTime; int gridID = vlistInqVarGrid(vlistID, varID); int zaxisID = vlistInqVarZaxis(vlistID, varID); @@ -1072,13 +1066,13 @@ iegWriteVarSliceDP(stream_t *streamptr, int varID, int levID, const double *data IEG_P_Parameter(iegp->ipdb) = pnum; if (pdis == 255) IEG_P_CodeTable(iegp->ipdb) = pcat; - iegDefTime(iegp->ipdb, streamptr->tsteps[tsID].taxis.vdatetime, vlistInqTaxis(vlistID)); + iegDefTime(iegp->ipdb, vDateTime, vlistInqTaxis(vlistID)); iegDefGrid(iegp->igdb, gridID); iegDefLevel(iegp->ipdb, iegp->igdb, iegp->vct, zaxisID, levID); iegp->dprec = iegDefDatatype(vlistInqVarDatatype(vlistID, varID)); - const size_t gridsize = gridInqSize(gridID); + size_t gridsize = gridInqSize(gridID); iegp->refval = calc_refvalDP(gridsize, data); iegDefDataDP(iegp, data); diff --git a/src/stream_record.c b/src/stream_record.c index 2f87079db8007d6da80c97966352c8893231fa69..0ef0dffa12204d72943a046b011fcdfda5af4ee0 100644 --- a/src/stream_record.c +++ b/src/stream_record.c @@ -39,48 +39,43 @@ recordInitEntry(record_t *record) int recordNewEntry(stream_t *streamptr, int tsID) { - size_t recordID = 0; - size_t recordSize = (size_t) streamptr->tsteps[tsID].recordSize; + int recordSize = streamptr->tsteps[tsID].recordSize; record_t *records = streamptr->tsteps[tsID].records; - /* - Look for a free slot in record. - (Create the table the first time through). - */ - if (!recordSize) - { - recordSize = 1; /* <<<<---- */ - records = (record_t *) Malloc(recordSize * sizeof(record_t)); - for (size_t i = 0; i < recordSize; i++) records[i].used = CDI_UNDEFID; - } - else + // Look for a free slot in record. + int recordID = 0; + if (recordSize) { while (recordID < recordSize && records[recordID].used != CDI_UNDEFID) ++recordID; } - /* - If the table overflows, double its size. - */ + else // Create the table the first time through. + { + recordSize = 1; // <<<<---- + records = (record_t *) Malloc(recordSize * sizeof(record_t)); + for (int i = recordID; i < recordSize; i++) records[i].used = CDI_UNDEFID; + } + + // If the table overflows, double its size. if (recordID == recordSize) { - if (recordSize <= INT_MAX / 2) - recordSize *= 2; - else if (recordSize < INT_MAX) - recordSize = INT_MAX; - else - Error("Cannot handle this many records!\n"); + // clang-format off + if (recordSize <= INT_MAX / 2) recordSize *= 2; + else if (recordSize < INT_MAX) recordSize = INT_MAX; + else Error("Cannot handle this many records!\n"); + // clang-format on records = (record_t *) Realloc(records, recordSize * sizeof(record_t)); - for (size_t i = recordID; i < recordSize; i++) records[i].used = CDI_UNDEFID; + for (int i = recordID; i < recordSize; i++) records[i].used = CDI_UNDEFID; } recordInitEntry(&records[recordID]); - records[recordID].used = 1; + records[recordID].used = true; - streamptr->tsteps[tsID].recordSize = (int) recordSize; + streamptr->tsteps[tsID].recordSize = recordSize; streamptr->tsteps[tsID].records = records; - return (int) recordID; + return recordID; } static void @@ -113,19 +108,21 @@ streamInqRecord(int streamID, int *varID, int *levelID) if (!streamptr->record) cdiInitRecord(streamptr); - int tsID = streamptr->curTsID; - int rindex = streamptr->tsteps[tsID].curRecID + 1; + const int tsID = streamptr->curTsID; + const int rindex = streamptr->tsteps[tsID].curRecID + 1; if (rindex >= streamptr->tsteps[tsID].nrecs) Error("record %d not available at timestep %d", rindex + 1, tsID + 1); - int recID = streamptr->tsteps[tsID].recIDs[rindex]; + const int recID = streamptr->tsteps[tsID].recIDs[rindex]; if (recID == -1 || recID >= streamptr->tsteps[tsID].nallrecs) Error("Internal problem! tsID = %d recID = %d", tsID, recID); *varID = streamptr->tsteps[tsID].records[recID].varID; - int lindex = streamptr->tsteps[tsID].records[recID].levelID; + if (*varID == -1) Error("Internal problem! varID = %d recID = %d", *varID, recID); + + const int lindex = streamptr->tsteps[tsID].records[recID].levelID; - int isub = subtypeInqActiveIndex(streamptr->vars[*varID].subtypeID); + const int isub = subtypeInqActiveIndex(streamptr->vars[*varID].subtypeID); *levelID = streamptr->vars[*varID].recordTable[isub].lindex[lindex]; if (CDI_Debug) Message("streamID = %d tsID = %d, recID = %d, varID = %d, levelID = %d", streamID, tsID, recID, *varID, *levelID); @@ -173,8 +170,8 @@ streamDefRecord(int streamID, int varID, int levelID) record->levelID = levelID; record->param = param; record->ilevel = ilevel; - record->vdate = (int) cdiDate_get(streamptr->tsteps[tsID].taxis.vdatetime.date); - record->vtime = cdiTime_get(streamptr->tsteps[tsID].taxis.vdatetime.time); + record->vdate = (int) cdiDate_get(streamptr->tsteps[tsID].taxis.vDateTime.date); + record->vtime = cdiTime_get(streamptr->tsteps[tsID].taxis.vDateTime.time); record->gridID = gridID; record->prec = vlistInqVarDatatype(vlistID, varID); @@ -246,12 +243,12 @@ cdi_create_records(stream_t *streamptr, int tsID) if (destTstep->records) return; - int vlistID = streamptr->vlistID; + const int vlistID = streamptr->vlistID; if (tsID == 0) { maxrecords = 0; - int nvars = streamptr->nvars; + const int nvars = streamptr->nvars; for (int varID = 0; varID < nvars; varID++) for (int isub = 0; isub < streamptr->vars[varID].subtypeSize; isub++) maxrecords += (unsigned) streamptr->vars[varID].recordTable[isub].nlevs; @@ -271,7 +268,7 @@ cdi_create_records(stream_t *streamptr, int tsID) maxrecords = (unsigned) sourceTstep->recordSize; if (sourceTstep->records) { - for (unsigned recID = 0; recID < maxrecords; recID++) + for (size_t recID = 0; recID < maxrecords; recID++) { int varID = sourceTstep->records[recID].varID; nrecords += (varID == CDI_UNDEFID /* varID = CDI_UNDEFID for write mode !!! */ @@ -290,8 +287,7 @@ cdi_create_records(stream_t *streamptr, int tsID) } // printf("tsID, nrecords %d %d\n", tsID, nrecords); - record_t *records = NULL; - if (maxrecords > 0) records = (record_t *) Malloc(maxrecords * sizeof(record_t)); + record_t *records = (maxrecords > 0) ? (record_t *) (Malloc(maxrecords * sizeof(record_t))) : (record_t *) NULL; destTstep->records = records; destTstep->recordSize = (int) maxrecords; @@ -308,7 +304,7 @@ cdi_create_records(stream_t *streamptr, int tsID) { memcpy(destTstep->records, sourceTstep->records, (size_t) maxrecords * sizeof(record_t)); - for (unsigned recID = 0; recID < maxrecords; recID++) + for (size_t recID = 0; recID < maxrecords; recID++) { record_t *curRecord = &sourceTstep->records[recID]; destTstep->records[recID].used = curRecord->used; @@ -330,14 +326,14 @@ cdi_create_records(stream_t *streamptr, int tsID) void streamFCopyRecord(stream_t *streamptr2, stream_t *streamptr1, const char *container_name) { - int fileID1 = streamptr1->fileID; - int fileID2 = streamptr2->fileID; - - int tsID = streamptr1->curTsID; - int vrecID = streamptr1->tsteps[tsID].curRecID; - int recID = streamptr1->tsteps[tsID].recIDs[vrecID]; - off_t recpos = streamptr1->tsteps[tsID].records[recID].position; - size_t recsize = streamptr1->tsteps[tsID].records[recID].size; + const int fileID1 = streamptr1->fileID; + const int fileID2 = streamptr2->fileID; + + const int tsID = streamptr1->curTsID; + const int vrecID = streamptr1->tsteps[tsID].curRecID; + const int recID = streamptr1->tsteps[tsID].recIDs[vrecID]; + const off_t recpos = streamptr1->tsteps[tsID].records[recID].position; + const size_t recsize = streamptr1->tsteps[tsID].records[recID].size; if (fileSetPos(fileID1, recpos, SEEK_SET) != 0) Error("Cannot seek input file for %s record copy!", container_name); diff --git a/src/stream_scan.c b/src/stream_scan.c index 68fcdaffbdf7a54c41d176fa88983163ae699bc8..05f94a182a68649fa7b88c464073bd7bcc6e0647 100644 --- a/src/stream_scan.c +++ b/src/stream_scan.c @@ -23,10 +23,9 @@ streamScanInitRecords2(stream_t *streamptr) streamptr->tsteps[1].recIDs = (int *) Malloc((size_t) nrecords * sizeof(int)); streamptr->tsteps[1].nrecs = 0; - for (int recID = 0; recID < nrecords; ++recID) streamptr->tsteps[1].recIDs[recID] = -1; - for (int recID = 0; recID < nrecords; ++recID) { + streamptr->tsteps[1].recIDs[recID] = -1; streamptr->tsteps[1].records[recID].position = streamptr->tsteps[0].records[recID].position; streamptr->tsteps[1].records[recID].size = streamptr->tsteps[0].records[recID].size; } @@ -51,7 +50,7 @@ void streamScanTimeConstAdjust(stream_t *streamptr, const taxis_t *taxis) { const int vlistID = streamptr->vlistID; - if (streamptr->ntsteps == 1 && cdiDateTime_isNull(taxis->vdatetime)) + if (streamptr->ntsteps == 1 && cdiDateTime_isNull(taxis->vDateTime)) { streamptr->ntsteps = 0; for (int varID = 0; varID < streamptr->nvars; ++varID) vlistDefVarTimetype(vlistID, varID, TIME_CONSTANT); diff --git a/src/stream_srv.c b/src/stream_srv.c index b78b96108348ec72261d8a30473fc277acee4585..42298c2085268724e859d9871293bbd0fb224799 100644 --- a/src/stream_srv.c +++ b/src/stream_srv.c @@ -9,7 +9,6 @@ #include "cdi.h" #include "cdi_int.h" #include "varscan.h" -#include "datetime.h" #include "service.h" #include "stream_scan.h" #include "stream_srv.h" @@ -75,14 +74,14 @@ int srvInqRecord(stream_t *streamptr, int *varID, int *levelID) static void srv_read_recordSP(stream_t *streamptr, float *data, size_t *nmiss) { - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; - const int tsID = streamptr->curTsID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsID = streamptr->curTsID; - const int vrecID = streamptr->tsteps[tsID].curRecID; - const int recID = streamptr->tsteps[tsID].recIDs[vrecID]; - const int varID = streamptr->tsteps[tsID].records[recID].varID; - const off_t recpos = streamptr->tsteps[tsID].records[recID].position; + int vrecID = streamptr->tsteps[tsID].curRecID; + int recID = streamptr->tsteps[tsID].recIDs[vrecID]; + int varID = streamptr->tsteps[tsID].records[recID].varID; + off_t recpos = streamptr->tsteps[tsID].records[recID].position; fileSetPos(fileID, recpos, SEEK_SET); @@ -93,8 +92,8 @@ srv_read_recordSP(stream_t *streamptr, float *data, size_t *nmiss) srvInqHeader(srvp, header); srvInqDataSP(srvp, data); - const double missval = vlistInqVarMissval(vlistID, varID); - const size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); + double missval = vlistInqVarMissval(vlistID, varID); + size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); *nmiss = get_num_missvalsSP(size, data, (float) missval); @@ -104,14 +103,14 @@ srv_read_recordSP(stream_t *streamptr, float *data, size_t *nmiss) static void srv_read_recordDP(stream_t *streamptr, double *data, size_t *nmiss) { - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; - const int tsID = streamptr->curTsID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsID = streamptr->curTsID; - const int vrecID = streamptr->tsteps[tsID].curRecID; - const int recID = streamptr->tsteps[tsID].recIDs[vrecID]; - const int varID = streamptr->tsteps[tsID].records[recID].varID; - const off_t recpos = streamptr->tsteps[tsID].records[recID].position; + int vrecID = streamptr->tsteps[tsID].curRecID; + int recID = streamptr->tsteps[tsID].recIDs[vrecID]; + int varID = streamptr->tsteps[tsID].records[recID].varID; + off_t recpos = streamptr->tsteps[tsID].records[recID].position; fileSetPos(fileID, recpos, SEEK_SET); @@ -122,8 +121,8 @@ srv_read_recordDP(stream_t *streamptr, double *data, size_t *nmiss) srvInqHeader(srvp, header); srvInqDataDP(srvp, data); - const double missval = vlistInqVarMissval(vlistID, varID); - const size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); + double missval = vlistInqVarMissval(vlistID, varID); + size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); *nmiss = get_num_missvalsDP(size, data, missval); @@ -210,9 +209,9 @@ srv_write_record(stream_t *streamptr, int memtype, const void *data) static void srv_add_record(stream_t *streamptr, int param, int level, size_t xsize, size_t ysize, size_t recsize, off_t position, int prec) { - const int vlistID = streamptr->vlistID; - const int tsID = streamptr->curTsID; - const int recID = recordNewEntry(streamptr, tsID); + int vlistID = streamptr->vlistID; + int tsID = streamptr->curTsID; + int recID = recordNewEntry(streamptr, tsID); record_t *record = &streamptr->tsteps[tsID].records[recID]; record->size = recsize; @@ -226,11 +225,15 @@ srv_add_record(stream_t *streamptr, int param, int level, size_t xsize, size_t y grid->x.size = xsize; grid->y.size = ysize; struct addIfNewRes gridAdded = cdiVlistAddGridIfNew(vlistID, grid, 0); - const int gridID = gridAdded.Id; - if (!gridAdded.isNew) Free(grid); + int gridID = gridAdded.Id; + if (!gridAdded.isNew) + { + grid_free(grid); + Free(grid); + } - const int leveltype = ZAXIS_GENERIC; - const int datatype = srvInqDatatype(prec); + int leveltype = ZAXIS_GENERIC; + int datatype = srvInqDatatype(prec); int varID, levelID = 0; varAddRecord(recID, param, gridID, leveltype, 0, level, 0, 0, 0, datatype, &varID, &levelID, TSTEP_INSTANT, 0, -1, NULL, NULL, @@ -249,7 +252,8 @@ srv_add_record(stream_t *streamptr, int param, int level, size_t xsize, size_t y static void srvScanTimestep1(stream_t *streamptr) { - CmpDateTime datetime0 = { INT_MIN, INT_MIN }; + CdiDateTime datetime0; + cdiDateTime_init(&datetime0); off_t recpos; srvrec_t *srvp = (srvrec_t *) streamptr->record->objectp; @@ -259,7 +263,7 @@ srvScanTimestep1(stream_t *streamptr) if (tsID != 0) Error("Internal problem! tstepsNewEntry returns %d", tsID); taxis_t *taxis = &streamptr->tsteps[tsID].taxis; - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; int nrecs = 0; while (true) @@ -271,25 +275,25 @@ srvScanTimestep1(stream_t *streamptr) break; } - const size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); int header[8]; srvInqHeader(srvp, header); - const int prec = srvp->dprec; - const int rcode = header[0]; - const int rlevel = header[1]; - const int vdate = header[2]; - const int vtime = header[3]; - const int rxsize = header[4]; - const int rysize = header[5]; - const int param = cdiEncodeParam(rcode, 255, 255); - CmpDateTime datetime = { .date = vdate, .time = vtime }; + int prec = srvp->dprec; + int rcode = header[0]; + int rlevel = header[1]; + int vdate = header[2]; + int vtime = header[3]; + int rxsize = header[4]; + int rysize = header[5]; + int param = cdiEncodeParam(rcode, 255, 255); + CdiDateTime datetime = cdiDateTime_set(vdate, vtime); if (nrecs == 0) { datetime0 = datetime; - taxis->vdatetime = cdiDateTime_set(vdate, vtime); + taxis->vDateTime = datetime; } else { @@ -297,7 +301,7 @@ srvScanTimestep1(stream_t *streamptr) for (int recID = 0; recID < nrecs; recID++) if (param == records[recID].param && rlevel == records[recID].ilevel) goto tstepScanLoopFinished; - if (datetime_differ(datetime, datetime0)) Warning("Inconsistent verification time for code %d level %d", rcode, rlevel); + if (cdiDateTime_isNE(datetime, datetime0)) Warning("Inconsistent verification time for code %d level %d", rcode, rlevel); } nrecs++; @@ -312,11 +316,11 @@ tstepScanLoopFinished: cdi_generate_vars(streamptr); - const int taxisID = taxisCreate(TAXIS_ABSOLUTE); + int taxisID = taxisCreate(TAXIS_ABSOLUTE); taxis->type = TAXIS_ABSOLUTE; - taxis->rdatetime = taxis->vdatetime; + taxis->rDateTime = taxis->vDateTime; - const int vlistID = streamptr->vlistID; + int vlistID = streamptr->vlistID; vlistDefTaxis(vlistID, taxisID); vlist_check_contents(vlistID); @@ -336,10 +340,10 @@ srvScanTimestep2(stream_t *streamptr) streamptr->curTsID = 1; - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; - const int tsID = streamptr->rtsteps; + int tsID = streamptr->rtsteps; if (tsID != 1) Error("Internal problem! unexpected timestep %d", tsID + 1); taxis_t *taxis = &streamptr->tsteps[tsID].taxis; @@ -349,7 +353,7 @@ srvScanTimestep2(stream_t *streamptr) cdi_create_records(streamptr, tsID); record_t *records = streamptr->tsteps[tsID].records; - const int nrecords = streamScanInitRecords2(streamptr); + int nrecords = streamScanInitRecords2(streamptr); for (int rindex = 0; rindex <= nrecords; rindex++) { @@ -360,20 +364,20 @@ srvScanTimestep2(stream_t *streamptr) break; } - const size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); srvInqHeader(srvp, header); - const int rcode = header[0]; - const int rlevel = header[1]; - const int vdate = header[2]; - const int vtime = header[3]; - const int param = cdiEncodeParam(rcode, 255, 255); + int rcode = header[0]; + int rlevel = header[1]; + int vdate = header[2]; + int vtime = header[3]; + int param = cdiEncodeParam(rcode, 255, 255); if (rindex == 0) { taxis->type = TAXIS_ABSOLUTE; - taxis->vdatetime = cdiDateTime_set(vdate, vtime); + taxis->vDateTime = cdiDateTime_set(vdate, vtime); } bool nextstep = false; @@ -418,14 +422,10 @@ srvScanTimestep2(stream_t *streamptr) int nrecs = 0; for (int recID = 0; recID < nrecords; recID++) { - if (!records[recID].used) - { - vlistDefVarTimetype(vlistID, records[recID].varID, TIME_CONSTANT); - } + if (records[recID].used) + nrecs++; else - { - nrecs++; - } + vlistDefVarTimetype(vlistID, records[recID].varID, TIME_CONSTANT); } streamptr->tsteps[tsID].nrecs = nrecs; @@ -443,7 +443,7 @@ srvInqContents(stream_t *streamptr) srvScanTimestep1(streamptr); - const int status = (streamptr->ntsteps == -1) ? srvScanTimestep2(streamptr) : 0; + int status = (streamptr->ntsteps == -1) ? srvScanTimestep2(streamptr) : 0; fileSetPos(streamptr->fileID, 0, SEEK_SET); @@ -468,7 +468,7 @@ srvScanTimestep(stream_t *streamptr) nrecs = streamScanInitRecords(streamptr, tsID); - const int fileID = streamptr->fileID; + int fileID = streamptr->fileID; fileSetPos(fileID, streamptr->tsteps[tsID].position, SEEK_SET); @@ -481,24 +481,24 @@ srvScanTimestep(stream_t *streamptr) break; } - const size_t recsize = (size_t) (fileGetPos(fileID) - recpos); + size_t recsize = (size_t) (fileGetPos(fileID) - recpos); srvInqHeader(srvp, header); - const int rcode = header[0]; - const int rlevel = header[1]; - const int vdate = header[2]; - const int vtime = header[3]; - const int param = cdiEncodeParam(rcode, 255, 255); + int rcode = header[0]; + int rlevel = header[1]; + int vdate = header[2]; + int vtime = header[3]; + int param = cdiEncodeParam(rcode, 255, 255); // if ( rindex == nrecs ) break; gcc-4.5 internal compiler error if (rindex == nrecs) continue; - const int recID = streamptr->tsteps[tsID].recIDs[rindex]; + int recID = streamptr->tsteps[tsID].recIDs[rindex]; if (rindex == 0) { taxis->type = TAXIS_ABSOLUTE; - taxis->vdatetime = cdiDateTime_set(vdate, vtime); + taxis->vDateTime = cdiDateTime_set(vdate, vtime); } if (param != records[recID].param || rlevel != records[recID].ilevel) @@ -563,14 +563,14 @@ srvReadVarSliceDP(stream_t *streamptr, int varID, int levID, double *data, size_ { if (CDI_Debug) Message("streamID = %d varID = %d levID = %d", streamptr->self, varID, levID); - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; - const int tsid = streamptr->curTsID; + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsid = streamptr->curTsID; - const off_t currentfilepos = fileGetPos(fileID); + off_t currentfilepos = fileGetPos(fileID); - const int recID = streamptr->vars[varID].recordTable[0].recordID[levID]; - const off_t recpos = streamptr->tsteps[tsid].records[recID].position; + int recID = streamptr->vars[varID].recordTable[0].recordID[levID]; + off_t recpos = streamptr->tsteps[tsid].records[recID].position; fileSetPos(fileID, recpos, SEEK_SET); @@ -583,8 +583,8 @@ srvReadVarSliceDP(stream_t *streamptr, int varID, int levID, double *data, size_ fileSetPos(fileID, currentfilepos, SEEK_SET); - const double missval = vlistInqVarMissval(vlistID, varID); - const size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); + double missval = vlistInqVarMissval(vlistID, varID); + size_t size = gridInqSize(vlistInqVarGrid(vlistID, varID)); *nmiss = get_num_missvalsDP(size, data, missval); } @@ -594,9 +594,9 @@ srvReadVarDP(stream_t *streamptr, int varID, double *data, size_t *nmiss) { if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); - const int vlistID = streamptr->vlistID; - const size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); - const size_t nlevs = (size_t) streamptr->vars[varID].recordTable[0].nlevs; + int vlistID = streamptr->vlistID; + size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); + size_t nlevs = (size_t) streamptr->vars[varID].recordTable[0].nlevs; for (size_t levID = 0; levID < nlevs; levID++) srvReadVarSliceDP(streamptr, varID, (int) levID, &data[levID * gridsize], nmiss); } @@ -606,10 +606,11 @@ srvWriteVarSliceDP(stream_t *streamptr, int varID, int levID, const double *data { if (CDI_Debug) Message("streamID = %d varID = %d levID = %d", streamptr->self, varID, levID); - const int vlistID = streamptr->vlistID; - const int fileID = streamptr->fileID; - const int tsID = streamptr->curTsID; - const int gridID = vlistInqVarGrid(vlistID, varID); + int vlistID = streamptr->vlistID; + int fileID = streamptr->fileID; + int tsID = streamptr->curTsID; + CdiDateTime vDateTime = streamptr->tsteps[tsID].taxis.vDateTime; + int gridID = vlistInqVarGrid(vlistID, varID); int pdis, pcat, pnum; cdiDecodeParam(vlistInqVarParam(vlistID, varID), &pnum, &pcat, &pdis); @@ -617,8 +618,8 @@ srvWriteVarSliceDP(stream_t *streamptr, int varID, int levID, const double *data int header[8]; header[0] = pnum; header[1] = (int) lround(zaxisInqLevel(vlistInqVarZaxis(vlistID, varID), levID)); - header[2] = (int) cdiDate_get(streamptr->tsteps[tsID].taxis.vdatetime.date); - header[3] = cdiTime_get(streamptr->tsteps[tsID].taxis.vdatetime.time); + header[2] = (int) cdiDate_get(vDateTime.date); + header[3] = cdiTime_get(vDateTime.time); size_t xsize = gridInqXsize(gridID); size_t ysize = gridInqYsize(gridID); @@ -637,7 +638,7 @@ srvWriteVarSliceDP(stream_t *streamptr, int varID, int levID, const double *data header[6] = 0; header[7] = 0; - const int datatype = vlistInqVarDatatype(vlistID, varID); + int datatype = vlistInqVarDatatype(vlistID, varID); srvrec_t *srvp = (srvrec_t *) streamptr->record->objectp; srvp->dprec = srvDefDatatype(datatype); @@ -652,9 +653,9 @@ srvWriteVarDP(stream_t *streamptr, int varID, const double *data) { if (CDI_Debug) Message("streamID = %d varID = %d", streamptr->self, varID); - const int vlistID = streamptr->vlistID; - const size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); - const size_t nlevs = (size_t) zaxisInqSize(vlistInqVarZaxis(vlistID, varID)); + int vlistID = streamptr->vlistID; + size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID)); + size_t nlevs = (size_t) zaxisInqSize(vlistInqVarZaxis(vlistID, varID)); for (size_t levID = 0; levID < nlevs; levID++) srvWriteVarSliceDP(streamptr, varID, (int) levID, &data[levID * gridsize]); } diff --git a/src/stream_write.c b/src/stream_write.c index 070bd89fa7e9fe66697834245e5c34a092ccf4ec..595f360e2096481e4c1a589cf7434f79a39b34f7 100644 --- a/src/stream_write.c +++ b/src/stream_write.c @@ -220,7 +220,7 @@ streamWriteVarSliceF(int streamID, int varID, int levelID, const float *data, Si } void -streamWriteVarChunk(int streamID, int varID, const int rect[3][2], const double *data, SizeType nmiss) +streamWriteVarChunk(int streamID, int varID, const int rect[][2], const double *data, SizeType nmiss) { void (*myCdiStreamWriteVarChunk_)(int streamID, int varID, int memtype, const int rect[3][2], const void *data, SizeType nmiss) = (void (*)(int, int, int, const int[3][2], const void *, SizeType)) namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_CHUNK_) @@ -228,6 +228,15 @@ streamWriteVarChunk(int streamID, int varID, const int rect[3][2], const double myCdiStreamWriteVarChunk_(streamID, varID, MEMTYPE_DOUBLE, rect, data, nmiss); } +void +streamWriteVarChunkF(int streamID, int varID, const int rect[][2], const float *data, SizeType nmiss) +{ + void (*myCdiStreamWriteVarChunk_)(int streamID, int varID, int memtype, const int rect[3][2], const void *data, SizeType nmiss) + = (void (*)(int, int, int, const int[3][2], const void *, SizeType)) namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_CHUNK_) + .func; + myCdiStreamWriteVarChunk_(streamID, varID, MEMTYPE_FLOAT, rect, data, nmiss); +} + // single image implementation void cdiStreamWriteVarChunk_(int streamID, int varID, int memtype, const int rect[][2], const void *data, SizeType nmiss) diff --git a/src/subtype.c b/src/subtype.c index 5fd8bd53e067192b65cdab195dd1dc3208ecfec0..7361771da8e296b391e52c8419c13f2c024769ba 100644 --- a/src/subtype.c +++ b/src/subtype.c @@ -48,7 +48,7 @@ static void subtypeDestroyP(void *subtype_ptr); static void subtypePrintP(void *subtype_ptr, FILE *fp); static int subtypeGetPackSize(void *subtype_ptr, void *context); static void subtypePack(void *subtype_ptr, void *buffer, int size, int *pos, void *context); -static int subtypeTxCode(void); +static int subtypeTxCode(void *subtype_ptr); static const resOps subtypeOps = { (int (*)(void *, void *)) subtypeCompareP, (void (*)(void *)) subtypeDestroyP, @@ -71,7 +71,7 @@ attribute_to_index(const char *key) { if (key == NULL) Error("Internal error!"); for (int i = 0; i < nSubtypeAttributes; i++) - if (strcmp(key, cdiSubtypeAttributeName[i]) == 0) return i; + if (str_is_equal(key, cdiSubtypeAttributeName[i])) return i; return -1; } @@ -543,11 +543,8 @@ keyValuePair(const char *key, int value) result.nAND = 1; result.key_value_pairs[0][0] = attribute_to_index(key); result.key_value_pairs[1][0] = value; - if (CDI_Debug) - { - Message("key %s matches %d", key, result.key_value_pairs[0][0]); - Message("%d --?-- %d", result.key_value_pairs[0][0], result.key_value_pairs[1][0]); - } + if (CDI_Debug) Message("key %s matches %d", key, result.key_value_pairs[0][0]); + if (CDI_Debug) Message("%d --?-- %d", result.key_value_pairs[0][0], result.key_value_pairs[1][0]); return result; } @@ -572,11 +569,10 @@ matchAND(subtype_query_t q1, subtype_query_t q2) result.nAND++; } + if (CDI_Debug) Message("combined criterion:"); if (CDI_Debug) - { - Message("combined criterion:"); - for (int i = 0; i < result.nAND; i++) Message("%d --?-- %d", result.key_value_pairs[0][i], result.key_value_pairs[1][i]); - } + for (int i = 0; i < result.nAND; i++) Message("%d --?-- %d", result.key_value_pairs[0][i], result.key_value_pairs[1][i]); + return result; } @@ -665,7 +661,6 @@ int subtypeCreate(int subtype) { if (CDI_Debug) Message("subtype: %d ", subtype); - Message("subtype: %d ", subtype); /* allocate new subtype */ subtype_t *subtype_ptr; @@ -888,8 +883,9 @@ subtypePack(void *subtype_ptr, void *buffer, int size, int *pos, void *context) } static int -subtypeTxCode(void) +subtypeTxCode(void *subtypePtr) { + (void) subtypePtr; Error("Not yet implemented for subtypes!"); return 0; } diff --git a/src/table.c b/src/table.c index 2178d5722bd2a473a5b97564b8e56c67c352671d..adfd845eede2b4ae27787db58a672c044dc69fb8 100644 --- a/src/table.c +++ b/src/table.c @@ -161,7 +161,7 @@ decodeForm1(char *pline, char *name, char *longname, char *units) { char *pstart, *pend; - /* FIXME: parse success isn't verified */ + // FIXME: parse success isn't verified /* long level = */ strtol(pline, &pline, 10); while (isspace((int) *pline)) pline++; @@ -178,10 +178,10 @@ decodeForm1(char *pline, char *name, char *longname, char *units) if (pline[0] == 0) return 0; - /* Format 1 : code name add mult longname [units] */ - /* FIXME: successful parse isn't verified */ + // Format 1 : code name add mult longname [units] + // FIXME: successful parse isn't verified /* double add = */ strtod(pline, &pline); - /* FIXME: successful parse isn't verified */ + // FIXME: successful parse isn't verified /* double mult = */ strtod(pline, &pline); while (isspace((int) *pline)) pline++; @@ -306,9 +306,7 @@ int tableRead(const char *tablefile) { char line[1024], *pline; - int lnr = 0; char name[256], longname[256], units[256]; - int err; int tableID = CDI_UNDEFID; FILE *tablefp = fopen(tablefile, "r"); @@ -326,9 +324,6 @@ tableRead(const char *tablefile) { size_t len = strlen(line); if (line[len - 1] == '\n') line[len - 1] = '\0'; - lnr++; - int id = CDI_UNDEFID; - int ltype = CDI_UNDEFID; name[0] = 0; longname[0] = 0; units[0] = 0; @@ -338,12 +333,13 @@ tableRead(const char *tablefile) len = strlen(pline); if (len < 4) continue; while (isspace((int) *pline)) pline++; - id = atoi(pline); + int id = atoi(pline); // if ( id > 255 ) id -= 256; if (id == 0) continue; while (isdigit((int) *pline)) pline++; + int ltype = CDI_UNDEFID; if (*pline == ';' || *pline == ':') { pline++; @@ -359,14 +355,10 @@ tableRead(const char *tablefile) while (isdigit((int) *pline)) pline++; - if (strchr(pline, '|')) - err = decodeForm2(pline, name, longname, units); - else - err = decodeForm1(pline, name, longname, units); - + int err = (strchr(pline, '|')) ? decodeForm2(pline, name, longname, units) : decodeForm1(pline, name, longname, units); if (err) continue; - if (name[0] == 0) sprintf(name, "var%d", id); + if (name[0] == 0) snprintf(name, sizeof(name), "var%d", id); tableDefEntry(tableID, id, ltype, name, longname, units); } @@ -396,8 +388,8 @@ tableFromEnv(int modelID, int tablenum) if (tablenum) tablenameLen += (size_t) (sprintf(tablename + tablenameLen, "_%03d", tablenum)); size_t lenp = 0, lenf = tablenameLen; if (tablePath) lenp = strlen(tablePath); - /* if (tablePath) printf("tablePath = %s\n", tablePath); */ - /* if (tablename) printf("tableName = %s\n", tablename); */ + // if (tablePath) printf("tablePath = %s\n", tablePath); + // if (tablename) printf("tableName = %s\n", tablename); char *tablefile = (char *) Malloc(lenp + lenf + 3); if (tablePath) { @@ -407,7 +399,7 @@ tableFromEnv(int modelID, int tablenum) else tablefile[0] = '\0'; strcat(tablefile, tablename); - /* if (tablefile) printf("tableFile = %s\n", tablefile); */ + // if (tablefile) printf("tableFile = %s\n", tablefile); int tableID = tableRead(tablefile); if (tableID != CDI_UNDEFID) @@ -415,7 +407,7 @@ tableFromEnv(int modelID, int tablenum) tableDefModelID(tableID, modelID); tableDefNum(tableID, tablenum); } - /* printf("tableID = %d %s\n", tableID, tablefile); */ + // printf("tableID = %d %s\n", tableID, tablefile); Free(tablefile); return tableID; @@ -489,8 +481,7 @@ tableInq(int modelID, int tablenum, const char *tablename) if (tableID == CDI_UNDEFID && modelID != CDI_UNDEFID) tableID = tableFromEnv(modelID, tablenum); - if (CDI_Debug) - if (tablename) Message("tableID = %d tablename = %s", tableID, tablename); + if (CDI_Debug && tablename) Message("tableID = %d tablename = %s", tableID, tablename); } return tableID; @@ -502,10 +493,7 @@ tableDef(int modelID, int tablenum, const char *tablename) int tableID = CDI_UNDEFID; if (!ParTableInit) parTableInit(); - /* - if ( ! (modelID == CDI_UNDEFID && tablenum == 0) ) - tableID = tableInq(modelID, tablenum, tablename); - */ + // if (!(modelID == CDI_UNDEFID && tablenum == 0)) tableID = tableInq(modelID, tablenum, tablename); if (tableID == CDI_UNDEFID) { tableID = tableNewEntry(); @@ -575,6 +563,17 @@ tableInqNamePtr(int tableID) return tablename; } +static size_t +max_length(size_t maxlen, const char *cstring) +{ + if (cstring) + { + size_t len = strlen(cstring); + if (len > maxlen) maxlen = len; + } + return maxlen; +} + void tableWrite(const char *ptfile, int tableID) { @@ -596,26 +595,11 @@ tableWrite(const char *ptfile, int tableID) FILE *ptfp = fopen(ptfile, "w"); int npars = parTable[tableID].npars; - for (int item = 0; item < npars; item++) { - if (parTable[tableID].pars[item].name) - { - size_t lenname = strlen(parTable[tableID].pars[item].name); - if (lenname > maxname) maxname = lenname; - } - - if (parTable[tableID].pars[item].longname) - { - size_t lenlname = strlen(parTable[tableID].pars[item].longname); - if (lenlname > maxlname) maxlname = lenlname; - } - - if (parTable[tableID].pars[item].units) - { - size_t lenunits = strlen(parTable[tableID].pars[item].units); - if (lenunits > maxunits) maxunits = lenunits; - } + maxname = max_length(maxname, parTable[tableID].pars[item].name); + maxlname = max_length(maxlname, parTable[tableID].pars[item].longname); + maxunits = max_length(maxunits, parTable[tableID].pars[item].units); } int tablenum = tableInqNum(tableID); @@ -681,29 +665,14 @@ tableFWriteC(FILE *ptfp, int tableID) partabCheckID(tableID); int npars = parTable[tableID].npars; - for (int item = 0; item < npars; item++) { - if (parTable[tableID].pars[item].name) - { - size_t lenname = strlen(parTable[tableID].pars[item].name); - if (lenname > maxname) maxname = lenname; - } - - if (parTable[tableID].pars[item].longname) - { - size_t lenlname = strlen(parTable[tableID].pars[item].longname); - if (lenlname > maxlname) maxlname = lenlname; - } - - if (parTable[tableID].pars[item].units) - { - size_t lenunits = strlen(parTable[tableID].pars[item].units); - if (lenunits > maxunits) maxunits = lenunits; - } + maxname = max_length(maxname, parTable[tableID].pars[item].name); + maxlname = max_length(maxlname, parTable[tableID].pars[item].longname); + maxunits = max_length(maxunits, parTable[tableID].pars[item].units); } - strncpy(tablename, parTable[tableID].name, sizeof(tablename)); + strncpy(tablename, parTable[tableID].name, sizeof(tablename) - 1); tablename[sizeof(tablename) - 1] = '\0'; { size_t len = strlen(tablename); @@ -764,7 +733,7 @@ tableInqParCode(int tableID, char *varname, int *code) int npars = parTable[tableID].npars; for (int item = 0; item < npars; item++) { - if (parTable[tableID].pars[item].name && strcmp(parTable[tableID].pars[item].name, varname) == 0) + if (parTable[tableID].pars[item].name && str_is_equal(parTable[tableID].pars[item].name, varname)) { *code = parTable[tableID].pars[item].id; err = 0; diff --git a/src/taxis.c b/src/taxis.c index 811e48b367a8ab2252bb76c4e653be20f5d3d070..5350c900b19918c9e613d5552cee12bd02d9faa2 100644 --- a/src/taxis.c +++ b/src/taxis.c @@ -1,4 +1,5 @@ #include <stddef.h> +#include <stdio.h> #include "cdi.h" #include "dmemory.h" @@ -10,20 +11,17 @@ #include "serialize.h" #include "resource_handle.h" #include "resource_unpack.h" +#include "normalize_month.h" static int DefaultTimeType = TAXIS_ABSOLUTE; static int DefaultTimeUnit = TUNIT_HOUR; -static const char *Timeunits[] = { - "undefined", "seconds", "minutes", "quarters", "30minutes", "hours", "3hours", "6hours", "12hours", "days", "months", "years", -}; - static int taxisCompareP(void *taxisptr1, void *taxisptr2); static void taxisDestroyP(void *taxisptr); static void taxisPrintKernel(taxis_t *taxisptr, FILE *fp); static int taxisGetPackSize(void *taxisptr, void *context); static void taxisPack(void *taxisptr, void *buf, int size, int *position, void *context); -static int taxisTxCode(void); +static int taxisTxCode(void *taxisptr); const resOps taxisOps = { taxisCompareP, taxisDestroyP, (void (*)(void *, FILE *)) taxisPrintKernel, taxisGetPackSize, taxisPack, taxisTxCode }; @@ -67,8 +65,6 @@ dup_refcount_string(char *p) #undef container_of -static int TAXIS_Debug = 0; // If set to 1, debugging - const char * taxisNamePtr(int taxisID) { @@ -79,29 +75,36 @@ taxisNamePtr(int taxisID) const char * tunitNamePtr(int unitID) { - int size = sizeof(Timeunits) / sizeof(*Timeunits); - return (unitID > 0 && unitID < size) ? Timeunits[unitID] : Timeunits[0]; + static const char Timeunits[][TAXIS_MAX_UNIT_STR_LEN + 1] = { + "undefined", "seconds", "minutes", "quarters", "30minutes", "hours", "3hours", "6hours", "12hours", "days", "months", "years", + }; + enum + { + size = sizeof(Timeunits) / sizeof(Timeunits[0]) + }; + + const char *name = unitID > 0 && unitID < size ? Timeunits[unitID] : Timeunits[0]; + + return name; } -static void -taxisDefaultValue(taxis_t *taxisptr) + +void +ptaxisInit(taxis_t *taxisptr) { taxisptr->self = CDI_UNDEFID; - taxisptr->used = false; taxisptr->datatype = CDI_DATATYPE_FLT64; taxisptr->type = DefaultTimeType; - taxisptr->sdate = 0; - taxisptr->stime = 0; - cdiDateTime_init(&taxisptr->vdatetime); - cdiDateTime_init(&taxisptr->rdatetime); - taxisptr->fdate = CDI_UNDEFID; - taxisptr->ftime = 0; taxisptr->calendar = CDI_Default_Calendar; taxisptr->unit = DefaultTimeUnit; taxisptr->numavg = 0; taxisptr->climatology = false; - taxisptr->has_bounds = false; - cdiDateTime_init(&taxisptr->vdatetime_lb); - cdiDateTime_init(&taxisptr->vdatetime_ub); + taxisptr->hasBounds = false; + cdiDateTime_init(&taxisptr->sDateTime); + cdiDateTime_init(&taxisptr->vDateTime); + cdiDateTime_init(&taxisptr->rDateTime); + cdiDateTime_init(&taxisptr->fDateTime); + cdiDateTime_init(&taxisptr->vDateTime_lb); + cdiDateTime_init(&taxisptr->vDateTime_ub); taxisptr->fc_unit = DefaultTimeUnit; taxisptr->fc_period = 0; taxisptr->name = NULL; @@ -114,7 +117,7 @@ taxisNewEntry(cdiResH resH) { taxis_t *taxisptr = (taxis_t *) Malloc(sizeof(taxis_t)); - taxisDefaultValue(taxisptr); + ptaxisInit(taxisptr); if (resH == CDI_UNDEFID) taxisptr->self = reshPut(taxisptr, &taxisOps); else @@ -126,19 +129,6 @@ taxisNewEntry(cdiResH resH) return taxisptr; } -static void -taxisInit(void) -{ - static bool taxisInitialized = false; - - if (taxisInitialized) return; - - taxisInitialized = true; - - char *env = getenv("TAXIS_DEBUG"); - if (env) TAXIS_Debug = atoi(env); -} - /* @Function taxisCreate @Title Create a Time axis @@ -173,17 +163,10 @@ taxisDefRtime(taxisID, 120000); int taxisCreate(int taxistype) { - if (CDI_Debug) Message("taxistype: %d", taxistype); - - taxisInit(); - taxis_t *taxisptr = taxisNewEntry(CDI_UNDEFID); taxisptr->type = taxistype; int taxisID = taxisptr->self; - - if (CDI_Debug) Message("taxisID: %d", taxisID); - return taxisID; } @@ -229,8 +212,6 @@ taxisDuplicate(int taxisID1) int taxisID2 = taxisptr2->self; - if (CDI_Debug) Message("taxisID2: %d", taxisID2); - ptaxisCopy(taxisptr2, taxisptr1); return taxisID2; @@ -245,11 +226,8 @@ taxisDefType(int taxisID, int taxistype) { taxisptr->type = taxistype; taxisptr->datatype = CDI_DATATYPE_FLT64; - if (taxisptr->units) - { - delete_refcount_string(taxisptr->units); - taxisptr->units = NULL; - } + delete_refcount_string(taxisptr->units); + taxisptr->units = NULL; reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } } @@ -273,9 +251,9 @@ taxisDefVdate(int taxisID, int vdate) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if ((int) cdiDate_get(taxisptr->vdatetime.date) != vdate) + if ((int) cdiDate_get(taxisptr->vDateTime.date) != vdate) { - taxisptr->vdatetime.date = cdiDate_set(vdate); + taxisptr->vDateTime.date = cdiDate_set(vdate); reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } } @@ -299,39 +277,35 @@ taxisDefVtime(int taxisID, int vtime) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if (cdiTime_get(taxisptr->vdatetime.time) != vtime) + if (cdiTime_get(taxisptr->vDateTime.time) != vtime) { - taxisptr->vdatetime.time = cdiTime_set(vtime); + taxisptr->vDateTime.time = cdiTime_set(vtime); reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } } void -taxisDefVdatetime(int taxisID, CdiDateTime vdatetime) +taxisDefVdatetime(int taxisID, CdiDateTime vDateTime) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if (cdiDateTime_isNE(taxisptr->vdatetime, vdatetime)) + if (cdiDateTime_isNE(taxisptr->vDateTime, vDateTime)) { - taxisptr->vdatetime = vdatetime; + taxisptr->vDateTime = vDateTime; reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } } void -taxisDefRdatetime(int taxisID, CdiDateTime rdatetime) +taxisDefRdatetime(int taxisID, CdiDateTime rDateTime) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if (cdiDateTime_isNE(taxisptr->rdatetime, rdatetime)) + if (cdiDateTime_isNE(taxisptr->rDateTime, rDateTime)) { - taxisptr->rdatetime = rdatetime; - - if (taxisptr->units) - { - delete_refcount_string(taxisptr->units); - taxisptr->units = NULL; - } + taxisptr->rDateTime = rDateTime; + delete_refcount_string(taxisptr->units); + taxisptr->units = NULL; reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } } @@ -355,15 +329,11 @@ taxisDefRdate(int taxisID, int rdate) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if ((int) cdiDate_get(taxisptr->rdatetime.date) != rdate) + if ((int) cdiDate_get(taxisptr->rDateTime.date) != rdate) { - taxisptr->rdatetime.date = cdiDate_set(rdate); - - if (taxisptr->units) - { - delete_refcount_string(taxisptr->units); - taxisptr->units = NULL; - } + taxisptr->rDateTime.date = cdiDate_set(rdate); + delete_refcount_string(taxisptr->units); + taxisptr->units = NULL; reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } } @@ -387,9 +357,9 @@ taxisDefRtime(int taxisID, int rtime) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if (cdiTime_get(taxisptr->rdatetime.time) != rtime) + if (cdiTime_get(taxisptr->rDateTime.time) != rtime) { - taxisptr->rdatetime.time = cdiTime_set(rtime); + taxisptr->rDateTime.time = cdiTime_set(rtime); if (taxisptr->units) { delete_refcount_string(taxisptr->units); @@ -400,53 +370,27 @@ taxisDefRtime(int taxisID, int rtime) } /* -@Function taxisDefFdate -@Title Define the forecast reference date - -@Prototype void taxisDefFdate(int taxisID, int fdate) -@Parameter - @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} - @Item fdate Forecast reference date (YYYYMMDD) - -@Description -The function @func{taxisDefFdate} defines the forecast reference date of a Time axis. - -@EndFunction -*/ -void -taxisDefFdate(int taxisID, int fdate) -{ - taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - - if (taxisptr->fdate != fdate) - { - taxisptr->fdate = fdate; - reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); - } -} - -/* -@Function taxisDefFtime -@Title Define the forecast reference time +@Function taxisDefFdatetime +@Title Define the forecast reference date/time -@Prototype void taxisDefFtime(int taxisID, int ftime) +@Prototype void taxisDefFdatetime(int taxisID, CdiDateTime fDateTime) @Parameter - @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} - @Item ftime Forecast reference time (hhmmss) + @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} + @Item fDateTime Forecast reference date/time @Description -The function @func{taxisDefFtime} defines the forecast reference time of a Time axis. +The function @func{taxisDefFdatetime} defines the forecast reference date/time of a Time axis. @EndFunction */ void -taxisDefFtime(int taxisID, int ftime) +taxisDefFdatetime(int taxisID, CdiDateTime fDateTime) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if (taxisptr->ftime != ftime) + if (cdiDateTime_isNE(taxisptr->fDateTime, fDateTime)) { - taxisptr->ftime = ftime; + taxisptr->fDateTime = fDateTime; reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } } @@ -487,11 +431,8 @@ taxisDefTunit(int taxisID, int unit) if (taxisptr->unit != unit) { taxisptr->unit = unit; - if (taxisptr->units) - { - delete_refcount_string(taxisptr->units); - taxisptr->units = NULL; - } + delete_refcount_string(taxisptr->units); + taxisptr->units = NULL; reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } } @@ -539,15 +480,15 @@ taxisDefNumavg(int taxisID, int numavg) int taxisInqType(int taxisID) { - const taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); return taxisptr->type; } int taxisHasBounds(int taxisID) { - const taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - return taxisptr->has_bounds; + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return (int) taxisptr->hasBounds; } void @@ -555,9 +496,9 @@ taxisWithBounds(int taxisID) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if (taxisptr->has_bounds == false) + if (taxisptr->hasBounds == false) { - taxisptr->has_bounds = true; + taxisptr->hasBounds = true; reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } } @@ -567,9 +508,9 @@ taxisDeleteBounds(int taxisID) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if (taxisptr->has_bounds) + if (taxisptr->hasBounds) { - taxisptr->has_bounds = false; + taxisptr->hasBounds = false; reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } } @@ -583,20 +524,16 @@ taxisCopyTimestep(int taxisID2, int taxisID1) // reference date/time and units can't be changed after streamDefVlist()! - taxisptr2->sdate = taxisptr1->sdate; - taxisptr2->stime = taxisptr1->stime; + taxisptr2->sDateTime = taxisptr1->sDateTime; + taxisptr2->vDateTime = taxisptr1->vDateTime; + taxisptr2->fDateTime = taxisptr1->fDateTime; - taxisptr2->vdatetime = taxisptr1->vdatetime; - - if (taxisptr2->has_bounds) + if (taxisptr2->hasBounds) { - taxisptr2->vdatetime_lb = taxisptr1->vdatetime_lb; - taxisptr2->vdatetime_ub = taxisptr1->vdatetime_ub; + taxisptr2->vDateTime_lb = taxisptr1->vDateTime_lb; + taxisptr2->vDateTime_ub = taxisptr1->vDateTime_ub; } - taxisptr2->fdate = taxisptr1->fdate; - taxisptr2->ftime = taxisptr1->ftime; - taxisptr2->fc_unit = taxisptr1->fc_unit; taxisptr2->fc_period = taxisptr1->fc_period; @@ -607,8 +544,8 @@ taxisCopyTimestep(int taxisID2, int taxisID1) CdiDateTime taxisInqVdatetime(int taxisID) { - const taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - return taxisptr->vdatetime; + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return taxisptr->vDateTime; } CdiDateTime @@ -616,13 +553,13 @@ taxisInqRdatetime(int taxisID) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if (cdiDateTime_isNull(taxisptr->rdatetime)) + if (cdiDateTime_isNull(taxisptr->rDateTime)) { - taxisptr->rdatetime = taxisptr->vdatetime; + taxisptr->rDateTime = taxisptr->vDateTime; reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } - return taxisptr->rdatetime; + return taxisptr->rDateTime; } /* @@ -644,31 +581,31 @@ The function @func{taxisInqVdate} returns the verification date of a Time axis. int taxisInqVdate(int taxisID) { - const taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - return (int) cdiDate_get(taxisptr->vdatetime.date); + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return (int) cdiDate_get(taxisptr->vDateTime.date); } -int -taxisInqSdate(int taxisID) +CdiDateTime +taxisInqSdatetime(int taxisID) { - const taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - return taxisptr->sdate; + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return taxisptr->sDateTime; } void taxisInqVdateBounds(int taxisID, int *vdate_lb, int *vdate_ub) { - const taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - *vdate_lb = (int) cdiDate_get(taxisptr->vdatetime_lb.date); - *vdate_ub = (int) cdiDate_get(taxisptr->vdatetime_ub.date); + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + *vdate_lb = (int) cdiDate_get(taxisptr->vDateTime_lb.date); + *vdate_ub = (int) cdiDate_get(taxisptr->vDateTime_ub.date); } void -taxisInqVdatetimeBounds(int taxisID, CdiDateTime *vdatetime_lb, CdiDateTime *vdatetime_ub) +taxisInqVdatetimeBounds(int taxisID, CdiDateTime *vDateTime_lb, CdiDateTime *vDateTime_ub) { - const taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - *vdatetime_lb = taxisptr->vdatetime_lb; - *vdatetime_ub = taxisptr->vdatetime_ub; + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + *vDateTime_lb = taxisptr->vDateTime_lb; + *vDateTime_ub = taxisptr->vDateTime_ub; } void @@ -676,27 +613,27 @@ taxisDefVdateBounds(int taxisID, int vdate_lb, int vdate_ub) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if (taxisptr->has_bounds == false || (int) cdiDate_get(taxisptr->vdatetime_lb.date) != vdate_lb - || (int) cdiDate_get(taxisptr->vdatetime_ub.date) != vdate_ub) + if (taxisptr->hasBounds == false || (int) cdiDate_get(taxisptr->vDateTime_lb.date) != vdate_lb + || (int) cdiDate_get(taxisptr->vDateTime_ub.date) != vdate_ub) { - taxisptr->vdatetime_lb.date = cdiDate_set(vdate_lb); - taxisptr->vdatetime_ub.date = cdiDate_set(vdate_ub); - taxisptr->has_bounds = true; + taxisptr->vDateTime_lb.date = cdiDate_set(vdate_lb); + taxisptr->vDateTime_ub.date = cdiDate_set(vdate_ub); + taxisptr->hasBounds = true; reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } } void -taxisDefVdatetimeBounds(int taxisID, CdiDateTime vdatetime_lb, CdiDateTime vdatetime_ub) +taxisDefVdatetimeBounds(int taxisID, CdiDateTime vDateTime_lb, CdiDateTime vDateTime_ub) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if (taxisptr->has_bounds == false || cdiDateTime_isNE(taxisptr->vdatetime_lb, vdatetime_lb) - || cdiDateTime_isNE(taxisptr->vdatetime_ub, vdatetime_ub)) + if (taxisptr->hasBounds == false || cdiDateTime_isNE(taxisptr->vDateTime_lb, vDateTime_lb) + || cdiDateTime_isNE(taxisptr->vDateTime_ub, vDateTime_ub)) { - taxisptr->vdatetime_lb = vdatetime_lb; - taxisptr->vdatetime_ub = vdatetime_ub; - taxisptr->has_bounds = true; + taxisptr->vDateTime_lb = vDateTime_lb; + taxisptr->vDateTime_ub = vDateTime_ub; + taxisptr->hasBounds = true; reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } } @@ -720,24 +657,16 @@ The function @func{taxisInqVtime} returns the verification time of a Time axis. int taxisInqVtime(int taxisID) { - const taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - // return taxisptr->vtime; - return cdiTime_get(taxisptr->vdatetime.time); -} - -int -taxisInqStime(int taxisID) -{ - const taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - return taxisptr->stime; + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + return cdiTime_get(taxisptr->vDateTime.time); } void taxisInqVtimeBounds(int taxisID, int *vtime_lb, int *vtime_ub) { - const taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - *vtime_lb = cdiTime_get(taxisptr->vdatetime_lb.time); - *vtime_ub = cdiTime_get(taxisptr->vdatetime_ub.time); + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + *vtime_lb = cdiTime_get(taxisptr->vDateTime_lb.time); + *vtime_ub = cdiTime_get(taxisptr->vDateTime_ub.time); } void @@ -745,12 +674,12 @@ taxisDefVtimeBounds(int taxisID, int vtime_lb, int vtime_ub) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if (taxisptr->has_bounds == false || cdiTime_get(taxisptr->vdatetime_lb.time) != vtime_lb - || cdiTime_get(taxisptr->vdatetime_ub.time) != vtime_ub) + if (taxisptr->hasBounds == false || cdiTime_get(taxisptr->vDateTime_lb.time) != vtime_lb + || cdiTime_get(taxisptr->vDateTime_ub.time) != vtime_ub) { - taxisptr->vdatetime_lb.time = cdiTime_set(vtime_lb); - taxisptr->vdatetime_ub.time = cdiTime_set(vtime_ub); - taxisptr->has_bounds = true; + taxisptr->vDateTime_lb.time = cdiTime_set(vtime_lb); + taxisptr->vDateTime_ub.time = cdiTime_set(vtime_ub); + taxisptr->hasBounds = true; reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } } @@ -776,13 +705,13 @@ taxisInqRdate(int taxisID) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if (cdiDateTime_isNull(taxisptr->rdatetime)) + if (cdiDateTime_isNull(taxisptr->rDateTime)) { - taxisptr->rdatetime = taxisptr->vdatetime; + taxisptr->rDateTime = taxisptr->vDateTime; reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } - return (int) cdiDate_get(taxisptr->rdatetime.date); + return (int) cdiDate_get(taxisptr->rDateTime.date); } /* @@ -806,75 +735,44 @@ taxisInqRtime(int taxisID) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if (cdiDateTime_isNull(taxisptr->rdatetime)) + if (cdiDateTime_isNull(taxisptr->rDateTime)) { - taxisptr->rdatetime = taxisptr->vdatetime; + taxisptr->rDateTime = taxisptr->vDateTime; reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } - return cdiTime_get(taxisptr->rdatetime.time); + return cdiTime_get(taxisptr->rDateTime.time); } /* -@Function taxisInqFdate -@Title Get the forecast reference date +@Function taxisInqFdatetime +@Title Get the forecast reference date/time -@Prototype int taxisInqFdate(int taxisID) +@Prototype int taxisInqFdatetime(int taxisID) @Parameter @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} or @fref{vlistInqTaxis} @Description -The function @func{taxisInqFdate} returns the forecast reference date of a Time axis. +The function @func{taxisInqFdatetime} returns the forecast reference date/time of a Time axis. @Result -@func{taxisInqFdate} returns the forecast reference date. +@func{taxisInqFdate} returns the forecast reference date/time. @EndFunction */ -int -taxisInqFdate(int taxisID) -{ - taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - - if (taxisptr->fdate == -1) - { - // rdatetime is initialized from vdatetime if empty! - taxisptr->fdate = taxisInqRdate(taxisID); - taxisptr->ftime = taxisInqRtime(taxisID); - } - - return taxisptr->fdate; -} - -/* -@Function taxisInqFtime -@Title Get the forecast reference time - -@Prototype int taxisInqFtime(int taxisID) -@Parameter - @Item taxisID Time axis ID, from a previous call to @fref{taxisCreate} or @fref{vlistInqTaxis} - -@Description -The function @func{taxisInqFtime} returns the forecast reference time of a Time axis. - -@Result -@func{taxisInqFtime} returns the forecast reference time. - -@EndFunction -*/ -int -taxisInqFtime(int taxisID) +CdiDateTime +taxisInqFdatetime(int taxisID) { taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); - if (taxisptr->fdate == -1) + if (cdiDateTime_isNull(taxisptr->fDateTime)) { - // rdatetime is initialized from vdatetime if empty! - taxisptr->fdate = taxisInqRdate(taxisID); - taxisptr->ftime = taxisInqRtime(taxisID); + // rDateTime is initialized from vDateTime if empty! + taxisptr->fDateTime = taxisInqRdatetime(taxisID); + reshSetStatus(taxisID, &taxisOps, RESH_DESYNC_IN_USE); } - return taxisptr->ftime; + return taxisptr->fDateTime; } /* @@ -899,35 +797,35 @@ The valid CDI calendar types are @func{CALENDAR_STANDARD}, @func{CALENDAR_PROLEP int taxisInqCalendar(int taxisID) { - const taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); return taxisptr->calendar; } int taxisInqTunit(int taxisID) { - const taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); return taxisptr->unit; } int taxisInqForecastTunit(int taxisID) { - const taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); return taxisptr->fc_unit; } double taxisInqForecastPeriod(int taxisID) { - const taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); return taxisptr->fc_period; } int taxisInqNumavg(int taxisID) { - const taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); + taxis_t *taxisptr = (taxis_t *) reshGetVal(taxisID, &taxisOps); return taxisptr->numavg; } @@ -949,7 +847,7 @@ ptaxisDefName(taxis_t *taxisptr, const char *name) { if (name) { - const size_t len = strlen(name); + size_t len = strlen(name); delete_refcount_string(taxisptr->name); char *taxisname = taxisptr->name = new_refcount_string(len); strcpy(taxisname, name); @@ -961,21 +859,27 @@ ptaxisDefLongname(taxis_t *taxisptr, const char *longname) { if (longname) { - const size_t len = strlen(longname); + size_t len = strlen(longname); delete_refcount_string(taxisptr->longname); char *taxislongname = taxisptr->longname = new_refcount_string(len); strcpy(taxislongname, longname); } } +char * +ptaxisAllocUnits(taxis_t *taxisptr, size_t len) +{ + delete_refcount_string(taxisptr->units); + return taxisptr->units = new_refcount_string(len); +} + void ptaxisDefUnits(taxis_t *taxisptr, const char *units) { if (units) { - const size_t len = strlen(units); - delete_refcount_string(taxisptr->units); - char *taxisunits = taxisptr->units = new_refcount_string(len); + size_t len = strlen(units); + char *taxisunits = ptaxisAllocUnits(taxisptr, len); strcpy(taxisunits, units); } } @@ -1001,7 +905,7 @@ timevalue_decode(int timeunits, double timevalue) if (timeunits == TUNIT_SECOND) { julianDate.julianDay = (int64_t) (timevalue / 86400.0); - const double seconds = timevalue - julianDate.julianDay * 86400.0; + double seconds = timevalue - julianDate.julianDay * 86400.0; julianDate.secondOfDay = round(seconds * 1000.0) / 1000.0; if (julianDate.secondOfDay < 0) { @@ -1019,7 +923,7 @@ timevalue_decode(int timeunits, double timevalue) else if (timeunits == TUNIT_DAY) { julianDate.julianDay = (int64_t) timevalue; - const double seconds = (timevalue - julianDate.julianDay) * 86400.0; + double seconds = (timevalue - julianDate.julianDay) * 86400.0; julianDate.secondOfDay = (int) lround(seconds); if (julianDate.secondOfDay < 0) { @@ -1083,12 +987,12 @@ cdi_encode_timevalue(int days, double secs, int timeunit) // convert relative time value to CdiDateTime static CdiDateTime -rtimeval2datetime(double timevalue, taxis_t *taxis) +rtimeval2datetime(double timevalue, const taxis_t *taxis) { - if (IS_EQUAL(timevalue, 0.0)) return taxis->rdatetime; + if (IS_EQUAL(timevalue, 0.0)) return taxis->rDateTime; int timeunits = taxis->unit; - const int calendar = taxis->calendar; + int calendar = taxis->calendar; if (timeunits == TUNIT_MONTH && calendar == CALENDAR_360DAYS) { @@ -1096,88 +1000,86 @@ rtimeval2datetime(double timevalue, taxis_t *taxis) timevalue *= 30; } - CdiDateTime rdatetime = taxis->rdatetime; + CdiDateTime rDateTime = taxis->rDateTime; if (timeunits == TUNIT_MONTH || timeunits == TUNIT_YEAR) { - int year = rdatetime.date.year; - int month = rdatetime.date.month; + int year = rDateTime.date.year; + int month = rDateTime.date.month; if (timeunits == TUNIT_YEAR) timevalue *= 12; - const int nmon = (int) timevalue; - const double fmon = timevalue - nmon; + int nmon = (int) timevalue; + double fmon = timevalue - nmon; month += nmon; - // clang-format off - while (month > 12) { month -= 12; year++; } - while (month < 1) { month += 12; year--; } - // clang-format on + struct YearMonth ym = normalize_month(year, month); + year = ym.year; + month = ym.month; timeunits = TUNIT_DAY; timevalue = fmon * days_per_month(calendar, year, month); - rdatetime.date.year = year; - rdatetime.date.month = month; + rDateTime.date.year = year; + rDateTime.date.month = month; } - const JulianDate julianDate = julianDate_encode(calendar, rdatetime); - const JulianDate julianDate2 = timevalue_decode(timeunits, timevalue); + JulianDate julianDate = julianDate_encode(calendar, rDateTime); + JulianDate julianDate2 = timevalue_decode(timeunits, timevalue); return julianDate_decode(calendar, julianDate_add(julianDate2, julianDate)); } // convert CdiDateTime to relative time value static double -datetime2rtimeval(CdiDateTime vdatetime, taxis_t *taxis) +datetime2rtimeval(CdiDateTime vDateTime, const taxis_t *taxis) { double value = 0.0; - const int calendar = (*taxis).calendar; - int timeunits = (*taxis).unit; - const int timeunits0 = timeunits; + int calendar = taxis->calendar; + int timeunits = taxis->unit; + int timeunits0 = timeunits; - CdiDateTime rdatetime = (*taxis).rdatetime; + CdiDateTime rDateTime = taxis->rDateTime; - if (cdiDateTime_isNull(rdatetime)) rdatetime = (*taxis).vdatetime; + if (cdiDateTime_isNull(rDateTime)) rDateTime = (*taxis).vDateTime; - if (cdiDateTime_isNull(rdatetime) && cdiDateTime_isNull(vdatetime)) return value; + if (cdiDateTime_isNull(rDateTime) && cdiDateTime_isNull(vDateTime)) return value; - const JulianDate julianDate1 = julianDate_encode(calendar, rdatetime); + JulianDate julianDate1 = julianDate_encode(calendar, rDateTime); if (timeunits == TUNIT_MONTH && calendar == CALENDAR_360DAYS) timeunits = TUNIT_DAY; if (timeunits == TUNIT_MONTH || timeunits == TUNIT_YEAR) { - const int ryear = rdatetime.date.year; - const int rmonth = rdatetime.date.month; - int year = vdatetime.date.year; - int month = vdatetime.date.month; + int ryear = rDateTime.date.year; + int rmonth = rDateTime.date.month; + int year = vDateTime.date.year; + int month = vDateTime.date.month; value = (year - ryear) * 12 - rmonth + month; int nmonth = (int) value; month -= nmonth; - // clang-format off - while (month > 12) { month -= 12; year++; } - while (month < 1) { month += 12; year--; } - // clang-format on + struct YearMonth ym = normalize_month(year, month); + year = ym.year; + month = ym.month; - const int dpm = days_per_month(calendar, year, month); + int dpm = days_per_month(calendar, year, month); - vdatetime.date.year = year; - vdatetime.date.month = month; - const JulianDate julianDate2 = julianDate_encode(calendar, vdatetime); - const JulianDate dateDifference = julianDate_sub(julianDate2, julianDate1); + vDateTime.date.year = year; + vDateTime.date.month = month; + JulianDate julianDate2 = julianDate_encode(calendar, vDateTime); + JulianDate dateDifference = julianDate_sub(julianDate2, julianDate1); value += (dateDifference.julianDay + dateDifference.secondOfDay / 86400.0) / dpm; if (timeunits == TUNIT_YEAR) value = value / 12; } else { - const JulianDate julianDate2 = julianDate_encode(calendar, vdatetime); - const JulianDate dateDifference = julianDate_sub(julianDate2, julianDate1); + JulianDate julianDate2 = julianDate_encode(calendar, vDateTime); + JulianDate dateDifference = julianDate_sub(julianDate2, julianDate1); value = cdi_encode_timevalue(dateDifference.julianDay, dateDifference.secondOfDay, timeunits); } @@ -1191,17 +1093,17 @@ datetime2rtimeval(CdiDateTime vdatetime, taxis_t *taxis) static CdiDateTime atimeval2datetime(double timevalue) { - const int64_t vdate = (int64_t) timevalue; - const double tmpval = (timevalue - vdate) * 86400.0; - const int daysec = (vdate < 0) ? (int) (-tmpval + 0.01) : (int) (tmpval + 0.01); + int64_t vdate = (int64_t) timevalue; + double tmpval = (timevalue - vdate) * 86400.0; + int daysec = (vdate < 0) ? (int) (-tmpval + 0.01) : (int) (tmpval + 0.01); int year, month, day; cdiDecodeDate(vdate, &year, &month, &day); - const int hour = daysec / 3600; - const int minute = (daysec - hour * 3600) / 60; - const int second = daysec - hour * 3600 - minute * 60; - const int ms = 0; + int hour = daysec / 3600; + int minute = (daysec - hour * 3600) / 60; + int second = daysec - hour * 3600 - minute * 60; + int ms = 0; CdiDateTime datetime; datetime.date = cdiDate_encode(year, month, day); @@ -1313,14 +1215,14 @@ split_timevalue(double timevalue, int timeunit) } void -cdiSetForecastPeriod(double timevalue, taxis_t *taxis) +cdi_set_forecast_period(double timevalue, taxis_t *taxis) { taxis->fc_period = timevalue; int timeunits = taxis->fc_unit; - const int calendar = taxis->calendar; + int calendar = taxis->calendar; - if (cdiDateTime_isNull(taxis->vdatetime) && DBL_IS_EQUAL(timevalue, 0.0)) return; + if (cdiDateTime_isNull(taxis->vDateTime) && DBL_IS_EQUAL(timevalue, 0.0)) return; if (timeunits == TUNIT_MONTH && calendar == CALENDAR_360DAYS) { @@ -1328,43 +1230,39 @@ cdiSetForecastPeriod(double timevalue, taxis_t *taxis) timevalue *= 30; } - CdiDateTime vdatetime = taxis->vdatetime; + CdiDateTime vDateTime = taxis->vDateTime; if (timeunits == TUNIT_MONTH || timeunits == TUNIT_YEAR) { - int year = vdatetime.date.year; - int month = vdatetime.date.month; + int year = vDateTime.date.year; + int month = vDateTime.date.month; if (timeunits == TUNIT_YEAR) timevalue *= 12; - const int nmon = (int) timevalue; - const double fmon = timevalue - nmon; + int nmon = (int) timevalue; + double fmon = timevalue - nmon; month -= nmon; - // clang-format off - while (month > 12) { month -= 12; year++; } - while (month < 1) { month += 12; year--; } - // clang-format on + struct YearMonth ym = normalize_month(year, month); + year = ym.year; + month = ym.month; timeunits = TUNIT_DAY; timevalue = fmon * days_per_month(calendar, year, month); - vdatetime.date.year = year; - vdatetime.date.month = month; + vDateTime.date.year = year; + vDateTime.date.month = month; } - const JulianDate julianDate = julianDate_encode(calendar, vdatetime); - const JulianDate julianDate2 = timevalue_decode(timeunits, timevalue); - - const CdiDateTime dt = julianDate_decode(calendar, julianDate_sub(julianDate, julianDate2)); + JulianDate julianDate = julianDate_encode(calendar, vDateTime); + JulianDate julianDate2 = timevalue_decode(timeunits, timevalue); - (*taxis).fdate = (int) cdiDate_get(dt.date); - (*taxis).ftime = (int) cdiTime_get(dt.time); + taxis->fDateTime = julianDate_decode(calendar, julianDate_sub(julianDate, julianDate2)); } CdiDateTime -cdi_decode_timeval(double timevalue, taxis_t *taxis) +cdi_decode_timeval(double timevalue, const taxis_t *taxis) { return (taxis->type == TAXIS_ABSOLUTE) ? split_timevalue(timevalue, taxis->unit) : rtimeval2datetime(timevalue, taxis); } @@ -1382,7 +1280,7 @@ cdi_encode_timeval(CdiDateTime datetime, taxis_t *taxis) } else if (taxis->unit == TUNIT_MONTH) { - const int64_t xdate = cdiDate_get(datetime.date); + int64_t xdate = cdiDate_get(datetime.date); timeValue = xdate / 100 + copysign((double) (datetime.date.day != 0) * 0.5, (double) xdate); } else if (taxis->unit == TUNIT_SECOND) @@ -1395,7 +1293,7 @@ cdi_encode_timeval(CdiDateTime datetime, taxis_t *taxis) { int hour, minute, second, ms; cdiTime_decode(datetime.time, &hour, &minute, &second, &ms); - const int64_t xdate = cdiDate_get(datetime.date); + int64_t xdate = cdiDate_get(datetime.date); timeValue = copysign(1.0, (double) xdate) * (fabs((double) xdate) + (hour * 3600 + minute * 60 + second) / 86400.0); } } @@ -1405,34 +1303,25 @@ cdi_encode_timeval(CdiDateTime datetime, taxis_t *taxis) return timeValue; } -void -ptaxisInit(taxis_t *taxisptr) -{ - taxisDefaultValue(taxisptr); -} - void ptaxisCopy(taxis_t *dest, taxis_t *source) { reshLock(); // memcpy(dest, source, sizeof(taxis_t)); - dest->used = source->used; dest->datatype = source->datatype; dest->type = source->type; - dest->sdate = source->sdate; - dest->stime = source->stime; - dest->vdatetime = source->vdatetime; - dest->rdatetime = source->rdatetime; - dest->fdate = source->fdate; - dest->ftime = source->ftime; dest->calendar = source->calendar; dest->unit = source->unit; dest->numavg = source->numavg; dest->climatology = source->climatology; - dest->has_bounds = source->has_bounds; - dest->vdatetime_lb = source->vdatetime_lb; - dest->vdatetime_ub = source->vdatetime_ub; + dest->hasBounds = source->hasBounds; + dest->sDateTime = source->sDateTime; + dest->vDateTime = source->vDateTime; + dest->rDateTime = source->rDateTime; + dest->fDateTime = source->fDateTime; + dest->vDateTime_lb = source->vDateTime_lb; + dest->vDateTime_ub = source->vDateTime_ub; dest->fc_unit = source->fc_unit; dest->fc_period = source->fc_period; @@ -1462,7 +1351,6 @@ taxisPrintKernel(taxis_t *taxisptr, FILE *fp) "# taxisID %d\n" "#\n" "self = %d\n" - "used = %d\n" "type = %d\n" "vdate = %d\n" "vtime = %d\n" @@ -1474,7 +1362,7 @@ taxisPrintKernel(taxis_t *taxisptr, FILE *fp) "unit = %d\n" "numavg = %d\n" "climatology = %d\n" - "has_bounds = %d\n" + "hasBounds = %d\n" "vdate_lb = %d\n" "vtime_lb = %d\n" "vdate_ub = %d\n" @@ -1482,10 +1370,11 @@ taxisPrintKernel(taxis_t *taxisptr, FILE *fp) "fc_unit = %d\n" "fc_period = %g\n" "\n", - taxisptr->self, taxisptr->self, (int) taxisptr->used, taxisptr->type, (int) cdiDate_get(taxisptr->vdatetime.date), - cdiTime_get(taxisptr->vdatetime.time), (int) cdiDate_get(taxisptr->rdatetime.date), cdiTime_get(taxisptr->rdatetime.time), - taxisptr->fdate, taxisptr->ftime, taxisptr->calendar, taxisptr->unit, taxisptr->numavg, (int) taxisptr->climatology, - (int) taxisptr->has_bounds, vdate_lb, vtime_lb, vdate_ub, vtime_ub, taxisptr->fc_unit, taxisptr->fc_period); + taxisptr->self, taxisptr->self, taxisptr->type, (int) cdiDate_get(taxisptr->vDateTime.date), + cdiTime_get(taxisptr->vDateTime.time), (int) cdiDate_get(taxisptr->rDateTime.date), cdiTime_get(taxisptr->rDateTime.time), + (int) cdiDate_get(taxisptr->fDateTime.date), cdiTime_get(taxisptr->fDateTime.time), taxisptr->calendar, taxisptr->unit, + taxisptr->numavg, (int) taxisptr->climatology, (int) taxisptr->hasBounds, vdate_lb, vtime_lb, vdate_ub, vtime_ub, + taxisptr->fc_unit, taxisptr->fc_period); } static int @@ -1495,94 +1384,122 @@ taxisCompareP(void *taxisptr1, void *taxisptr2) xassert(t1 && t2); - return !(t1->used == t2->used && t1->type == t2->type && cdiDateTime_isEQ(t1->vdatetime, t2->vdatetime) - && cdiDateTime_isEQ(t1->rdatetime, t2->rdatetime) && t1->fdate == t2->fdate && t1->ftime == t2->ftime - && t1->calendar == t2->calendar && t1->unit == t2->unit && t1->fc_unit == t2->fc_unit && t1->numavg == t2->numavg - && t1->climatology == t2->climatology && t1->has_bounds == t2->has_bounds - && cdiDateTime_isEQ(t1->vdatetime_lb, t2->vdatetime_lb) && cdiDateTime_isEQ(t1->vdatetime_ub, t2->vdatetime_ub)); + return !(t1->type == t2->type && cdiDateTime_isEQ(t1->vDateTime, t2->vDateTime) && cdiDateTime_isEQ(t1->rDateTime, t2->rDateTime) + && cdiDateTime_isEQ(t1->fDateTime, t2->fDateTime) && t1->calendar == t2->calendar && t1->unit == t2->unit + && t1->fc_unit == t2->fc_unit && t1->fc_period == t2->fc_period && t1->numavg == t2->numavg + && t1->climatology == t2->climatology && t1->hasBounds == t2->hasBounds + && cdiDateTime_isEQ(t1->vDateTime_lb, t2->vDateTime_lb) && cdiDateTime_isEQ(t1->vDateTime_ub, t2->vDateTime_ub)); } static int -taxisTxCode(void) +taxisTxCode(void *taxisptr) { + (void) taxisptr; return TAXIS; } enum { - taxisNint = 22 + TAXIS_PACK_INT_SELF, + TAXIS_PACK_INT_TYPE, + TAXIS_PACK_INT_VDATE, + TAXIS_PACK_INT_VTIME, + TAXIS_PACK_INT_RDATE, + TAXIS_PACK_INT_RTIME, + TAXIS_PACK_INT_FDATE, + TAXIS_PACK_INT_FTIME, + TAXIS_PACK_INT_CALENDAR, + TAXIS_PACK_INT_UNIT, + TAXIS_PACK_INT_FC_UNIT, + TAXIS_PACK_INT_NUMAVG, + TAXIS_PACK_INT_CLIMATOLOGY, + TAXIS_PACK_INT_HAS_BOUNDS, + TAXIS_PACK_INT_VDATE_LB, + TAXIS_PACK_INT_VDATE_UB, + TAXIS_PACK_INT_VTIME_LB, + TAXIS_PACK_INT_VTIME_UB, + TAXIS_PACK_INT_NAMELEN, + TAXIS_PACK_INT_LNAMELEN, + TAXIS_PACK_INT_UNITSLEN, + taxisNint +}; + +enum +{ + TAXIS_PACK_FC_PERIOD, + taxisNdouble }; static int taxisGetPackSize(void *p, void *context) { taxis_t *taxisptr = (taxis_t *) p; - int packBufferSize = serializeGetSize(taxisNint, CDI_DATATYPE_INT, context) + serializeGetSize(1, CDI_DATATYPE_UINT32, context) + int packBufferSize = serializeGetSize(taxisNint, CDI_DATATYPE_INT, context) + + serializeGetSize(taxisNdouble, CDI_DATATYPE_FLT64, context) + (taxisptr->name ? serializeGetSize((int) strlen(taxisptr->name), CDI_DATATYPE_TXT, context) : 0) + (taxisptr->longname ? serializeGetSize((int) strlen(taxisptr->longname), CDI_DATATYPE_TXT, context) : 0) - + (taxisptr->units ? serializeGetSize((int) strlen(taxisptr->units), CDI_DATATYPE_TXT, context) : 0); + + (taxisptr->units ? serializeGetSize((int) strlen(taxisptr->units), CDI_DATATYPE_TXT, context) : 0) + + serializeGetSize(1, CDI_DATATYPE_UINT32, context); return packBufferSize; } int taxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id) { +#define adaptKey(key) (namespaceAdaptKey((key), originNamespace)) taxis_t *taxisP; int intBuffer[taxisNint]; + double dblBuffer[taxisNdouble]; uint32_t d; - int idx = 0; serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, intBuffer, taxisNint, CDI_DATATYPE_INT, context); + serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, dblBuffer, taxisNdouble, CDI_DATATYPE_FLT64, context); serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &d, 1, CDI_DATATYPE_UINT32, context); xassert(cdiCheckSum(CDI_DATATYPE_INT, taxisNint, intBuffer) == d); - taxisInit(); - - cdiResH targetID = namespaceAdaptKey(intBuffer[idx++], originNamespace); - taxisP = taxisNewEntry(force_id ? targetID : CDI_UNDEFID); + cdiResH targetID = force_id ? adaptKey(intBuffer[TAXIS_PACK_INT_SELF]) : CDI_UNDEFID; + taxisP = taxisNewEntry(targetID); xassert(!force_id || targetID == taxisP->self); - taxisP->used = (short) intBuffer[idx++]; - taxisP->type = intBuffer[idx++]; - taxisP->vdatetime.date = cdiDate_set(intBuffer[idx++]); - taxisP->vdatetime.time = cdiTime_set(intBuffer[idx++]); - taxisP->rdatetime.date = cdiDate_set(intBuffer[idx++]); - taxisP->rdatetime.time = cdiTime_set(intBuffer[idx++]); - taxisP->fdate = intBuffer[idx++]; - taxisP->ftime = intBuffer[idx++]; - taxisP->calendar = intBuffer[idx++]; - taxisP->unit = intBuffer[idx++]; - taxisP->fc_unit = intBuffer[idx++]; - taxisP->numavg = intBuffer[idx++]; - taxisP->climatology = intBuffer[idx++]; - taxisP->has_bounds = (short) intBuffer[idx++]; - taxisP->vdatetime_lb.date = cdiDate_set(intBuffer[idx++]); - taxisP->vdatetime_lb.time = cdiTime_set(intBuffer[idx++]); - taxisP->vdatetime_ub.date = cdiDate_set(intBuffer[idx++]); - taxisP->vdatetime_ub.time = cdiTime_set(intBuffer[idx++]); - - if (intBuffer[idx]) + taxisP->type = intBuffer[TAXIS_PACK_INT_TYPE]; + taxisP->vDateTime.date = cdiDate_set(intBuffer[TAXIS_PACK_INT_VDATE]); + taxisP->vDateTime.time = cdiTime_set(intBuffer[TAXIS_PACK_INT_VTIME]); + taxisP->rDateTime.date = cdiDate_set(intBuffer[TAXIS_PACK_INT_RDATE]); + taxisP->rDateTime.time = cdiTime_set(intBuffer[TAXIS_PACK_INT_RTIME]); + taxisP->fDateTime.date = cdiDate_set(intBuffer[TAXIS_PACK_INT_FDATE]); + taxisP->fDateTime.time = cdiTime_set(intBuffer[TAXIS_PACK_INT_FTIME]); + taxisP->calendar = intBuffer[TAXIS_PACK_INT_CALENDAR]; + taxisP->unit = intBuffer[TAXIS_PACK_INT_UNIT]; + taxisP->fc_unit = intBuffer[TAXIS_PACK_INT_FC_UNIT]; + taxisP->numavg = intBuffer[TAXIS_PACK_INT_NUMAVG]; + taxisP->climatology = intBuffer[TAXIS_PACK_INT_CLIMATOLOGY]; + taxisP->hasBounds = (bool) intBuffer[TAXIS_PACK_INT_HAS_BOUNDS]; + taxisP->vDateTime_lb.date = cdiDate_set(intBuffer[TAXIS_PACK_INT_VDATE_LB]); + taxisP->vDateTime_lb.time = cdiTime_set(intBuffer[TAXIS_PACK_INT_VDATE_UB]); + taxisP->vDateTime_ub.date = cdiDate_set(intBuffer[TAXIS_PACK_INT_VTIME_LB]); + taxisP->vDateTime_ub.time = cdiTime_set(intBuffer[TAXIS_PACK_INT_VTIME_UB]); + taxisP->fc_period = dblBuffer[TAXIS_PACK_FC_PERIOD]; + if (intBuffer[TAXIS_PACK_INT_NAMELEN]) { - int len = intBuffer[idx]; + int len = intBuffer[TAXIS_PACK_INT_NAMELEN]; char *name = new_refcount_string((size_t) len); serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, name, len, CDI_DATATYPE_TXT, context); name[len] = '\0'; taxisP->name = name; } - idx++; - if (intBuffer[idx]) + if (intBuffer[TAXIS_PACK_INT_LNAMELEN]) { - int len = intBuffer[idx]; + int len = intBuffer[TAXIS_PACK_INT_LNAMELEN]; char *longname = new_refcount_string((size_t) len); serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, longname, len, CDI_DATATYPE_TXT, context); longname[len] = '\0'; taxisP->longname = longname; } - if (intBuffer[idx]) + if (intBuffer[TAXIS_PACK_INT_UNITSLEN]) { - int len = intBuffer[idx]; + int len = intBuffer[TAXIS_PACK_INT_UNITSLEN]; char *units = new_refcount_string((size_t) len); serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, units, len, CDI_DATATYPE_TXT, context); units[len] = '\0'; @@ -1590,6 +1507,7 @@ taxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int } reshSetStatus(taxisP->self, &taxisOps, reshGetStatus(taxisP->self, &taxisOps) & ~RESH_SYNC_BIT); +#undef adaptKey return taxisP->self; } @@ -1598,41 +1516,46 @@ static void taxisPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos, void *context) { taxis_t *taxisP = (taxis_t *) voidP; - int intBuffer[taxisNint]; + int nameLen, lnameLen, unitsLen; + uint32_t d; - int idx = 0; - intBuffer[idx++] = taxisP->self; - intBuffer[idx++] = taxisP->used; - intBuffer[idx++] = taxisP->type; - intBuffer[idx++] = (int) cdiDate_get(taxisP->vdatetime.date); - intBuffer[idx++] = cdiTime_get(taxisP->vdatetime.time); - intBuffer[idx++] = (int) cdiDate_get(taxisP->rdatetime.date); - intBuffer[idx++] = cdiTime_get(taxisP->rdatetime.time); - intBuffer[idx++] = taxisP->fdate; - intBuffer[idx++] = taxisP->ftime; - intBuffer[idx++] = taxisP->calendar; - intBuffer[idx++] = taxisP->unit; - intBuffer[idx++] = taxisP->fc_unit; - intBuffer[idx++] = taxisP->numavg; - intBuffer[idx++] = taxisP->climatology; - intBuffer[idx++] = taxisP->has_bounds; - intBuffer[idx++] = (int) cdiDate_get(taxisP->vdatetime_lb.date); - intBuffer[idx++] = cdiTime_get(taxisP->vdatetime_lb.time); - intBuffer[idx++] = (int) cdiDate_get(taxisP->vdatetime_ub.date); - intBuffer[idx++] = cdiTime_get(taxisP->vdatetime_ub.time); - intBuffer[idx++] = taxisP->name ? (int) strlen(taxisP->name) : 0; - intBuffer[idx++] = taxisP->longname ? (int) strlen(taxisP->longname) : 0; - intBuffer[idx++] = taxisP->units ? (int) strlen(taxisP->units) : 0; - - serializePack(intBuffer, taxisNint, CDI_DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context); - uint32_t d = cdiCheckSum(CDI_DATATYPE_INT, taxisNint, intBuffer); + { + int intBuffer[taxisNint]; + intBuffer[TAXIS_PACK_INT_SELF] = taxisP->self; + intBuffer[TAXIS_PACK_INT_TYPE] = taxisP->type; + intBuffer[TAXIS_PACK_INT_VDATE] = (int) cdiDate_get(taxisP->vDateTime.date); + intBuffer[TAXIS_PACK_INT_VTIME] = cdiTime_get(taxisP->vDateTime.time); + intBuffer[TAXIS_PACK_INT_RDATE] = (int) cdiDate_get(taxisP->rDateTime.date); + intBuffer[TAXIS_PACK_INT_RTIME] = cdiTime_get(taxisP->rDateTime.time); + intBuffer[TAXIS_PACK_INT_FDATE] = (int) cdiDate_get(taxisP->fDateTime.date); + intBuffer[TAXIS_PACK_INT_FTIME] = cdiTime_get(taxisP->fDateTime.time); + intBuffer[TAXIS_PACK_INT_CALENDAR] = taxisP->calendar; + intBuffer[TAXIS_PACK_INT_UNIT] = taxisP->unit; + intBuffer[TAXIS_PACK_INT_FC_UNIT] = taxisP->fc_unit; + intBuffer[TAXIS_PACK_INT_NUMAVG] = taxisP->numavg; + intBuffer[TAXIS_PACK_INT_CLIMATOLOGY] = taxisP->climatology; + intBuffer[TAXIS_PACK_INT_HAS_BOUNDS] = taxisP->hasBounds; + intBuffer[TAXIS_PACK_INT_VDATE_LB] = (int) cdiDate_get(taxisP->vDateTime_lb.date); + intBuffer[TAXIS_PACK_INT_VDATE_UB] = cdiTime_get(taxisP->vDateTime_lb.time); + intBuffer[TAXIS_PACK_INT_VTIME_LB] = (int) cdiDate_get(taxisP->vDateTime_ub.date); + intBuffer[TAXIS_PACK_INT_VTIME_UB] = cdiTime_get(taxisP->vDateTime_ub.time); + intBuffer[TAXIS_PACK_INT_NAMELEN] = nameLen = taxisP->name ? (int) strlen(taxisP->name) : 0; + intBuffer[TAXIS_PACK_INT_LNAMELEN] = lnameLen = taxisP->longname ? (int) strlen(taxisP->longname) : 0; + intBuffer[TAXIS_PACK_INT_UNITSLEN] = unitsLen = taxisP->units ? (int) strlen(taxisP->units) : 0; + serializePack(intBuffer, taxisNint, CDI_DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context); + d = cdiCheckSum(CDI_DATATYPE_INT, taxisNint, intBuffer); + } + + { + double dblBuffer[taxisNdouble]; + dblBuffer[TAXIS_PACK_FC_PERIOD] = taxisP->fc_period; + serializePack(dblBuffer, taxisNdouble, CDI_DATATYPE_FLT64, packBuffer, packBufferSize, packBufferPos, context); + } serializePack(&d, 1, CDI_DATATYPE_UINT32, packBuffer, packBufferSize, packBufferPos, context); - if (taxisP->name) - serializePack(taxisP->name, intBuffer[15], CDI_DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context); + if (taxisP->name) serializePack(taxisP->name, nameLen, CDI_DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context); if (taxisP->longname) - serializePack(taxisP->longname, intBuffer[16], CDI_DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context); - if (taxisP->units) - serializePack(taxisP->units, intBuffer[16], CDI_DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context); + serializePack(taxisP->longname, lnameLen, CDI_DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context); + if (taxisP->units) serializePack(taxisP->units, unitsLen, CDI_DATATYPE_TXT, packBuffer, packBufferSize, packBufferPos, context); } /* diff --git a/src/taxis.h b/src/taxis.h index c9f3526bf9f4aa9f96cfc596ae99363be5ba9dec..b7eac28932fc67368597f4fc030714c3782325e6 100644 --- a/src/taxis.h +++ b/src/taxis.h @@ -10,49 +10,42 @@ typedef struct { - // Date format YYYYMMDD - // Time format hhmmss int self; - bool used; - short has_bounds; - int datatype; // datatype - int type; // time type - int sdate; // start date - int stime; // start time - CdiDateTime vdatetime; // verification date/time - CdiDateTime rdatetime; // reference date/time - int fdate; // forecast reference date - int ftime; // forecast reference time + int datatype; // datatype + int type; // time type int calendar; - int unit; // time unit + int unit; // time units int numavg; - bool climatology; - CdiDateTime vdatetime_lb; // lower bounds of verification date/time - CdiDateTime vdatetime_ub; // upper bounds of verification date/time - int fc_unit; // forecast time unit + CdiDateTime sDateTime; // start date/time + CdiDateTime vDateTime; // verification date/time + CdiDateTime rDateTime; // reference date/time + CdiDateTime fDateTime; // forecast reference date/time + CdiDateTime vDateTime_lb; // lower bounds of verification date/time + CdiDateTime vDateTime_ub; // upper bounds of verification date/time double fc_period; // forecast time period + int fc_unit; // forecast time unit char *name; char *longname; char *units; + bool climatology; + bool hasBounds; } taxis_t; -// taxisInqSdate: Get the start date -int taxisInqSdate(int taxisID); - -// taxisInqStime: Get the start time -int taxisInqStime(int taxisID); +// taxisInqSdatetime: Get the start date/time +CdiDateTime taxisInqSdatetime(int taxisID); void ptaxisInit(taxis_t *taxis); void ptaxisCopy(taxis_t *dest, taxis_t *source); taxis_t *taxisPtr(int taxisID); -void cdiSetForecastPeriod(double timevalue, taxis_t *taxis); -CdiDateTime cdi_decode_timeval(double timevalue, taxis_t *taxis); +void cdi_set_forecast_period(double timevalue, taxis_t *taxis); +CdiDateTime cdi_decode_timeval(double timevalue, const taxis_t *taxis); double cdi_encode_timeval(CdiDateTime datetime, taxis_t *taxis); void ptaxisDefDatatype(taxis_t *taxisptr, int datatype); void ptaxisDefName(taxis_t *taxisptr, const char *name); void ptaxisDefLongname(taxis_t *taxisptr, const char *longname); void ptaxisDefUnits(taxis_t *taxisptr, const char *units); +char *ptaxisAllocUnits(taxis_t *taxisptr, size_t len); void taxisDestroyKernel(taxis_t *taxisptr); #ifndef SX extern const resOps taxisOps; @@ -61,6 +54,11 @@ extern const resOps taxisOps; int taxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int checkForSameID); +enum +{ + TAXIS_MAX_UNIT_STR_LEN = 9 +}; + #endif /* TAXIS_H */ /* * Local Variables: diff --git a/src/tsteps.c b/src/tsteps.c index a2808324e8108bcfed24cacef3363b8575c1a0e7..e3d102a35cc7c2772c19e618725aee880ded77e7 100644 --- a/src/tsteps.c +++ b/src/tsteps.c @@ -7,13 +7,14 @@ static void tstepsInitEntry(tsteps_t *tstep) { - tstep->curRecID = CDI_UNDEFID; - tstep->position = 0; + tstep->recIDs = NULL; tstep->records = NULL; tstep->recordSize = 0; - tstep->nallrecs = 0; - tstep->recIDs = NULL; tstep->nrecs = 0; + tstep->curRecID = CDI_UNDEFID; + tstep->ncStepIndex = 0; + tstep->position = 0; + tstep->nallrecs = 0; tstep->next = 0; ptaxisInit(&(tstep->taxis)); @@ -46,17 +47,16 @@ tstepsNewEntry(stream_t *streamptr) tsteps_t *curTstep = &streamptr->tsteps[tsID]; tstepsInitEntry(curTstep); - curTstep->taxis.used = true; - return tsID; } void -cdiCreateTimesteps(stream_t *streamptr) +cdi_create_timesteps(int numTimesteps, stream_t *streamptr) { - if (streamptr->ntsteps < 0 || streamptr->tstepsTableSize > 0) return; + streamptr->ntsteps = (long) numTimesteps; + if (numTimesteps < 0 || streamptr->tstepsTableSize > 0) return; - const int ntsteps = (streamptr->ntsteps == 0) ? 1 : (int) streamptr->ntsteps; + int ntsteps = (numTimesteps == 0) ? 1 : numTimesteps; streamptr->tsteps = (tsteps_t *) Malloc((size_t) ntsteps * sizeof(tsteps_t)); @@ -65,9 +65,7 @@ cdiCreateTimesteps(stream_t *streamptr) for (int tsID = 0; tsID < ntsteps; tsID++) { - tsteps_t *curTstep = &streamptr->tsteps[tsID]; - tstepsInitEntry(curTstep); - curTstep->taxis.used = true; + tstepsInitEntry(&streamptr->tsteps[tsID]); } } /* diff --git a/src/util.c b/src/util.c index d2ac0b0d854fed511a4df41a5e1b8b023ff7ad18..3e6a65d3f01308f5c9cd953bc668964035715563 100644 --- a/src/util.c +++ b/src/util.c @@ -106,7 +106,7 @@ cdiUnescapeSpaces(const char *string, const char **outStringEnd) #endif #include <uuid/uuid.h> void -cdiCreateUUID(unsigned char *uuid) +cdiCreateUUID(unsigned char uuid[CDI_UUID_SIZE]) { static int uuid_seeded = 0; static char uuid_rand_state[31 * sizeof(long)]; diff --git a/src/varscan.c b/src/varscan.c index ab32359b8bbaf02f1df596dd262ba06d1e16a8ea..b00cda6f78178fb080a7adba32ed8faf6967c0cc 100644 --- a/src/varscan.c +++ b/src/varscan.c @@ -129,7 +129,7 @@ varGetEntry(int param, int gridID, int zaxistype, int ltype1, int tsteptype, con { if (name && name[0] && vartable[varID].name && vartable[varID].name[0]) { - if (strcmp(name, vartable[varID].name) == 0) return varID; + if (str_is_equal(name, vartable[varID].name)) return varID; } else { @@ -364,8 +364,6 @@ varInsertTileSubtype(vartable_t *vptr, const var_tile_t *tiles) subtypeDestroyPtr(subtype_ptr); return vptr->tiles->nentries - 1; } - - return CDI_UNDEFID; } void @@ -490,12 +488,14 @@ struct cdi_generate_varinfo const char *name; }; +/* static int cdi_generate_cmp_varname(const void *s1, const void *s2) { const struct cdi_generate_varinfo *x = (const struct cdi_generate_varinfo *) s1, *y = (const struct cdi_generate_varinfo *) s2; return strcmp(x->name, y->name); } +*/ void cdi_generate_vars(stream_t *streamptr) @@ -806,7 +806,7 @@ zaxis_compare(int zaxisID, int zaxistype, int nlevels, const double *levels, con if (!differ && hasBounds) { - double *bounds = malloc(2 * nlevels * sizeof(double)); + double *bounds = (double *) malloc(2 * nlevels * sizeof(double)); zaxisInqLbounds(zaxisID, bounds); zaxisInqUbounds(zaxisID, bounds + nlevels); for (int levelID = 0; levelID < nlevels; levelID++) @@ -828,14 +828,14 @@ zaxis_compare(int zaxisID, int zaxistype, int nlevels, const double *levels, con char zlongname[CDI_MAX_NAME]; int length = CDI_MAX_NAME; cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_LONGNAME, zlongname, &length); - if (zlongname[0] && (strcmp(longname, zlongname) != 0)) differ = true; + if (zlongname[0] && !str_is_equal(longname, zlongname)) differ = true; } if (units && units[0]) { char zunits[CDI_MAX_NAME]; int length = CDI_MAX_NAME; cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, zunits, &length); - if (zunits[0] && (strcmp(units, zunits) != 0)) differ = true; + if (zunits[0] && !str_is_equal(units, zunits)) differ = true; } } } @@ -1073,7 +1073,7 @@ varDefOptGribInt(int varID, int tile_index, long lval, const char *keyword) int idx = -1; for (int i = 0; i < vartable[varID].opt_grib_nentries; i++) { - if ((strcmp(keyword, vartable[varID].opt_grib_kvpair[i].keyword) == 0) + if (str_is_equal(keyword, vartable[varID].opt_grib_kvpair[i].keyword) && (vartable[varID].opt_grib_kvpair[i].data_type == t_int) && (vartable[varID].opt_grib_kvpair[i].subtype_index == tile_index)) idx = i; @@ -1103,7 +1103,7 @@ varDefOptGribDbl(int varID, int tile_index, double dval, const char *keyword) int idx = -1; for (int i = 0; i < vartable[varID].opt_grib_nentries; i++) { - if ((strcmp(keyword, vartable[varID].opt_grib_kvpair[i].keyword) == 0) + if (str_is_equal(keyword, vartable[varID].opt_grib_kvpair[i].keyword) && (vartable[varID].opt_grib_kvpair[i].data_type == t_double) && (vartable[varID].opt_grib_kvpair[i].subtype_index == tile_index)) idx = i; diff --git a/src/vlist.c b/src/vlist.c index 68f13bd8b4ed5115b51de096431e53cbbddb1da6..6ca6ce8fd0720f7310b028a539bf85b3dac580aa 100644 --- a/src/vlist.c +++ b/src/vlist.c @@ -2,6 +2,8 @@ #include "config.h" #endif +#include <stdbool.h> + #include "dmemory.h" #include "cdi.h" #include "cdi_int.h" @@ -63,7 +65,7 @@ static void vlist_delete(vlist_t *vlistptr); static int vlistGetSizeP(void *vlistptr, void *context); static void vlistPackP(void *vlistptr, void *buff, int size, int *position, void *context); -static int vlistTxCode(void); +static int vlistTxCode(void *vlistptr); #if !defined(__cplusplus) const @@ -124,15 +126,11 @@ vlist_new_entry(cdiResH resH) } static void -vlist_delete_entry(vlist_t *vlistptr) +vlist_delete_entry(int vlistID) { - int idx = vlistptr->self; - - reshRemove(idx, &vlistOps); - - Free(vlistptr); + reshRemove(vlistID, &vlistOps); - if (VLIST_Debug) Message("Removed idx %d from vlist list", idx); + if (VLIST_Debug) Message("Removed idx %d from vlist list", vlistID); } static void @@ -242,7 +240,28 @@ vlist_delete(vlist_t *vlistptr) if (vars) Free(vars); - vlist_delete_entry(vlistptr); + Free(vlistptr); +} + +// destroy a vlist object, should always be called through namespace lookup +void +cdiVlistDestroy_(int vlistID, bool assertInternal) +{ + vlist_t *vlistptr = vlist_to_pointer(vlistID); + + static const char warningTextUserByInternal[] + = "Destroying a vlist object that is owned by the user (vlistID=%d).\n" + "This is most likely because of a missing vlistDestroy() in the application code.\n" + "If that's not the case, and you are absolutely certain about it, please report the bug.", + warningTextInternalByUser[] = "Attempt to destroy an internal vlist object by the user (vlistID=%d)."; + static const char *const wText[2] = { warningTextUserByInternal, warningTextInternalByUser }; + if (vlistptr->internal == assertInternal) + { + vlist_delete(vlistptr); + vlist_delete_entry(vlistID); + } + else + Warning(wText[!assertInternal], vlistID); } /* @@ -258,26 +277,8 @@ vlist_delete(vlist_t *vlistptr) void vlistDestroy(int vlistID) { - vlist_t *vlistptr = vlist_to_pointer(vlistID); - - if (vlistptr->internal) - Warning("Attempt to destroy an internal vlist object by the user (vlistID=%d).", vlistID); - else - vlist_delete(vlistptr); -} - -// destroy an internal vlist object -void -cdiVlistDestroy_(int vlistID) -{ - vlist_t *vlistptr = vlist_to_pointer(vlistID); - - if (!vlistptr->internal) - Warning("Destroying a vlist object that is owned by the user.\n" - "This is most likely because of a missing vlistDestroy() in the application code.\n" - "If that's not the case, and you are absolutely certain about it, please report the bug."); - - vlist_delete(vlistptr); + void (*mycdiVlistDestroy_)(int, bool) = (void (*)(int, bool)) namespaceSwitchGet(NSSWITCH_VLIST_DESTROY_).func; + mycdiVlistDestroy_(vlistID, false); } static void @@ -834,7 +835,7 @@ vlistMerge(int vlistID2, int vlistID1) if (*name1 && *name2) { - if (strcmp(name1, name2) != 0) break; + if (!str_is_equal(name1, name2)) break; } else { @@ -1088,7 +1089,7 @@ vlistPrintKernel(vlist_t *vlistptr, FILE *fp) if (nvars > 0) { - fprintf(fp, " varID param gridID zaxisID stypeID tsteptype flag iorank name longname units\n"); + fprintf(fp, " varID param gridID zaxisID stypeID tsteptype flag name longname units\n"); for (int varID = 0; varID < nvars; varID++) { int param = vlistptr->vars[varID].param; @@ -1104,12 +1105,11 @@ vlistPrintKernel(vlist_t *vlistptr, FILE *fp) length = CDI_MAX_NAME; (void) cdiInqKeyString(vlistID, varID, CDI_KEY_UNITS, units, &length); int flag = vlistptr->vars[varID].flag; - int iorank = vlistptr->vars[varID].iorank; char paramstr[32]; cdiParamToString(param, paramstr, sizeof(paramstr)); - fprintf(fp, "%6d %-8s %6d %6d %6d %6d %5d %6d %-8s %s [%s]\n", varID, paramstr, gridID, zaxisID, subtypeID, tsteptype, - flag, iorank, name, longname, units); + fprintf(fp, "%6d %-8s %6d %6d %6d %6d %5d %-8s %s [%s]\n", varID, paramstr, gridID, zaxisID, subtypeID, tsteptype, + flag, name, longname, units); } fputs("\n" @@ -1142,12 +1142,11 @@ vlistPrintKernel(vlist_t *vlistptr, FILE *fp) } fputs("\n" - " varID size iorank\n", + " varID size\n", fp); for (int varID = 0; varID < nvars; varID++) - fprintf(fp, "%3d %8zu %6d\n", varID, - (size_t) zaxisInqSize(vlistptr->vars[varID].zaxisID) * gridInqSize(vlistptr->vars[varID].gridID), - vlistptr->vars[varID].iorank); + fprintf(fp, "%3d %8zu\n", varID, + (size_t) zaxisInqSize(vlistptr->vars[varID].zaxisID) * gridInqSize(vlistptr->vars[varID].gridID)); } } @@ -1497,8 +1496,10 @@ vlistHasTime(int vlistID) if (!(CDI_Reduce_Dim && vlistptr->ntsteps == 1)) { - for (int varID = 0; varID < vlistptr->nvars; varID++) - if (vlistptr->vars[varID].timetype != TIME_CONSTANT) + size_t nvars = vlistptr->nvars > 0 ? (size_t) vlistptr->nvars : (size_t) 0; + var_t *restrict vars = vlistptr->vars; + for (size_t varID = 0; varID < nvars; varID++) + if (vars[varID].timetype != TIME_CONSTANT) { hastime = true; break; @@ -1510,12 +1511,19 @@ vlistHasTime(int vlistID) enum { - vlist_nints = 6, + VLIST_PACK_INT_SELF, + VLIST_PACK_INT_NVARS, + VLIST_PACK_INT_TAXISID, + VLIST_PACK_INT_TABLEID, + VLIST_PACK_INT_INSTID, + VLIST_PACK_INT_MODELID, + vlistNints, }; static int -vlistTxCode(void) +vlistTxCode(void *vlistptr) { + (void) vlistptr; return VLIST; } @@ -1523,7 +1531,7 @@ static int vlistGetSizeP(void *vlistptr, void *context) { vlist_t *p = (vlist_t *) vlistptr; - int txsize = serializeGetSize(vlist_nints, CDI_DATATYPE_INT, context); + int txsize = serializeGetSize(vlistNints, CDI_DATATYPE_INT, context); txsize += serializeGetSize(1, CDI_DATATYPE_LONG, context); txsize += cdiAttsGetSize(p, CDI_GLOBAL, context); for (int varID = 0; varID < p->nvars; varID++) txsize += vlistVarGetPackSize(p, varID, context); @@ -1533,15 +1541,15 @@ vlistGetSizeP(void *vlistptr, void *context) static void vlistPackP(void *vlistptr, void *buf, int size, int *position, void *context) { - int tempbuf[vlist_nints]; + int tempbuf[vlistNints]; vlist_t *p = (vlist_t *) vlistptr; - tempbuf[0] = p->self; - tempbuf[1] = p->nvars; - tempbuf[2] = p->taxisID; - tempbuf[3] = p->tableID; - tempbuf[4] = p->instID; - tempbuf[5] = p->modelID; - serializePack(tempbuf, vlist_nints, CDI_DATATYPE_INT, buf, size, position, context); + tempbuf[VLIST_PACK_INT_SELF] = p->self; + tempbuf[VLIST_PACK_INT_NVARS] = p->nvars; + tempbuf[VLIST_PACK_INT_TAXISID] = p->taxisID; + tempbuf[VLIST_PACK_INT_TABLEID] = p->tableID; + tempbuf[VLIST_PACK_INT_INSTID] = p->instID; + tempbuf[VLIST_PACK_INT_MODELID] = p->modelID; + serializePack(tempbuf, vlistNints, CDI_DATATYPE_INT, buf, size, position, context); serializePack(&p->ntsteps, 1, CDI_DATATYPE_LONG, buf, size, position, context); cdiAttsPack(p, CDI_GLOBAL, buf, size, position, context); @@ -1551,25 +1559,28 @@ vlistPackP(void *vlistptr, void *buf, int size, int *position, void *context) } } -void +int vlistUnpack(char *buf, int size, int *position, int originNamespace, void *context, int force_id) { - int tempbuf[vlist_nints]; - serializeUnpack(buf, size, position, tempbuf, vlist_nints, CDI_DATATYPE_INT, context); - int nvars = tempbuf[1]; - int targetID = namespaceAdaptKey(tempbuf[0], originNamespace); - vlist_t *p = vlist_new_entry(force_id ? targetID : CDI_UNDEFID); +#define adaptKey(key) (namespaceAdaptKey((key), originNamespace)) + int tempbuf[vlistNints]; + serializeUnpack(buf, size, position, tempbuf, vlistNints, CDI_DATATYPE_INT, context); + int nvars = tempbuf[VLIST_PACK_INT_NVARS]; + int targetID = force_id ? adaptKey(tempbuf[VLIST_PACK_INT_SELF]) : CDI_UNDEFID; + vlist_t *p = vlist_new_entry(targetID); xassert(!force_id || p->self == targetID); if (!force_id) targetID = p->self; cdiVlistMakeInternal(p->self); - p->taxisID = namespaceAdaptKey(tempbuf[2], originNamespace); - p->tableID = tempbuf[3]; - p->instID = namespaceAdaptKey(tempbuf[4], originNamespace); - p->modelID = namespaceAdaptKey(tempbuf[5], originNamespace); + p->taxisID = adaptKey(tempbuf[VLIST_PACK_INT_TAXISID]); + p->tableID = tempbuf[VLIST_PACK_INT_TABLEID]; + p->instID = adaptKey(tempbuf[VLIST_PACK_INT_INSTID]); + p->modelID = adaptKey(tempbuf[VLIST_PACK_INT_MODELID]); serializeUnpack(buf, size, position, &p->ntsteps, 1, CDI_DATATYPE_LONG, context); cdiAttsUnpack(targetID, CDI_GLOBAL, buf, size, position, context); for (int varID = 0; varID < nvars; varID++) vlistVarUnpack(targetID, buf, size, position, originNamespace, context); reshSetStatus(targetID, &vlistOps, reshGetStatus(targetID, &vlistOps) & ~RESH_SYNC_BIT); +#undef adaptKey + return targetID; } void diff --git a/src/vlist.h b/src/vlist.h index fd842b5191fcc96ce1b2c587c61f126580c022cc..0d220d1eae588a9f5d509cbf1aa7e10b92892e2f 100644 --- a/src/vlist.h +++ b/src/vlist.h @@ -9,6 +9,7 @@ #include "error.h" #endif +#include <stdbool.h> #include <stddef.h> /* size_t */ #ifndef CDI_LIMITS_H @@ -46,6 +47,10 @@ typedef struct { bool isUsed; bool flag; + bool lvalidrange; + signed char xyz; /* order of spatial dimensions, + * a permutation of 123 */ + bool missvalused; // true if missval is defined int mvarID; int fvarID; int param; @@ -59,21 +64,13 @@ typedef struct int tableID; int timave; int nsb; // Number of significant bits - int xyz; - bool missvalused; // true if missval is defined - bool lvalidrange; - char *extra; double missval; - double scalefactor; - double addoffset; double validrange[2]; levinfo_t *levinfo; int comptype; // compression type int complevel; // compression level cdi_keys_t keys; cdi_atts_t atts; - int iorank; - int subtypeID; // subtype ID for tile-related meta-data, currently for GRIB-API only. int opt_grib_nentries; // current no. key-value pairs @@ -109,12 +106,11 @@ typedef struct vlist_t *vlist_to_pointer(int vlistID); void cdiVlistMakeInternal(int vlistID); void cdiVlistMakeImmutable(int vlistID); -void vlistCheckVarID(const char *caller, int vlistID, int varID); -void cdiVlistDestroy_(int vlistID); +void cdiVlistDestroy_(int vlistID, bool assertInternal); int vlistInqVarMissvalUsed(int vlistID, int varID); int vlistHasTime(int vlistID); -void vlistUnpack(char *buffer, int bufferSize, int *pos, int originNamespace, void *context, int force_id); +int vlistUnpack(char *buffer, int bufferSize, int *pos, int originNamespace, void *context, int force_id); /* vlistDefVarValidrange: Define the valid range of a Variable */ void vlistDefVarValidrange(int vlistID, int varID, const double *validrange); @@ -122,7 +118,7 @@ void vlistDefVarValidrange(int vlistID, int varID, const double *validrange); /* vlistInqVarValidrange: Get the valid range of a Variable */ int vlistInqVarValidrange(int vlistID, int varID, double *validrange); -void vlistInqVarDimorder(int vlistID, int varID, int (*outDimorder)[3]); +void vlistInqVarDimorder(int vlistID, int varID, int outDimorder[3]); void resize_opt_grib_entries(var_t *var, int nentries); diff --git a/src/vlist_var.c b/src/vlist_var.c index d7826e8c83ab52c99f710b3d73502978d3a5f262..d8785445a50bf58a30ac3d2b3634bd02bd52948b 100644 --- a/src/vlist_var.c +++ b/src/vlist_var.c @@ -1,3 +1,4 @@ +#include <float.h> /* FLT_MAX */ #include "dmemory.h" #include "cdi.h" #include "cdi_int.h" @@ -10,45 +11,41 @@ #include "error.h" static void -vlistvarInitEntry(int vlistID, int varID) -{ - vlist_t *vlistptr = vlist_to_pointer(vlistID); - - vlistptr->vars[varID].fvarID = varID; - vlistptr->vars[varID].mvarID = varID; - vlistptr->vars[varID].flag = 0; - vlistptr->vars[varID].param = 0; - vlistptr->vars[varID].datatype = CDI_UNDEFID; - vlistptr->vars[varID].timetype = CDI_UNDEFID; - vlistptr->vars[varID].tsteptype = TSTEP_INSTANT; - vlistptr->vars[varID].nsb = 0; - vlistptr->vars[varID].xyz = 321; - vlistptr->vars[varID].gridID = CDI_UNDEFID; - vlistptr->vars[varID].zaxisID = CDI_UNDEFID; - vlistptr->vars[varID].subtypeID = CDI_UNDEFID; - vlistptr->vars[varID].instID = CDI_UNDEFID; - vlistptr->vars[varID].modelID = CDI_UNDEFID; - vlistptr->vars[varID].tableID = CDI_UNDEFID; - vlistptr->vars[varID].missvalused = false; - vlistptr->vars[varID].missval = CDI_Default_Missval; - vlistptr->vars[varID].addoffset = 0.0; - vlistptr->vars[varID].scalefactor = 1.0; - vlistptr->vars[varID].extra = NULL; - vlistptr->vars[varID].levinfo = NULL; - vlistptr->vars[varID].comptype = CDI_COMPRESS_NONE; - vlistptr->vars[varID].complevel = 1; - vlistptr->vars[varID].keys.nalloc = MAX_KEYS; - vlistptr->vars[varID].keys.nelems = 0; - for (int i = 0; i < MAX_KEYS; ++i) vlistptr->vars[varID].keys.value[i].length = 0; - vlistptr->vars[varID].atts.nalloc = MAX_ATTRIBUTES; - vlistptr->vars[varID].atts.nelems = 0; - vlistptr->vars[varID].lvalidrange = false; - vlistptr->vars[varID].validrange[0] = VALIDMISS; - vlistptr->vars[varID].validrange[1] = VALIDMISS; - vlistptr->vars[varID].iorank = CDI_UNDEFID; - vlistptr->vars[varID].opt_grib_kvpair_size = 0; - vlistptr->vars[varID].opt_grib_kvpair = NULL; - vlistptr->vars[varID].opt_grib_nentries = 0; +vlistvar_init_entry(var_t *vlistvars, int varID) +{ + var_t *varptr = &vlistvars[varID]; + varptr->flag = false; + varptr->lvalidrange = false; + varptr->xyz = 5; // xyzStorVals[5] == 321 + varptr->missvalused = false; + varptr->mvarID = varID; + varptr->fvarID = varID; + varptr->param = 0; + varptr->gridID = CDI_UNDEFID; + varptr->zaxisID = CDI_UNDEFID; + varptr->timetype = CDI_UNDEFID; + varptr->tsteptype = TSTEP_INSTANT; + varptr->datatype = CDI_UNDEFID; + varptr->instID = CDI_UNDEFID; + varptr->modelID = CDI_UNDEFID; + varptr->tableID = CDI_UNDEFID; + varptr->timave = 0; + varptr->nsb = 0; + varptr->missval = CDI_Default_Missval; + varptr->validrange[0] = VALIDMISS; + varptr->validrange[1] = VALIDMISS; + varptr->levinfo = NULL; + varptr->comptype = CDI_COMPRESS_NONE; + varptr->complevel = 1; + varptr->keys.nalloc = MAX_KEYS; + varptr->keys.nelems = 0; + for (int i = 0; i < MAX_KEYS; ++i) varptr->keys.value[i].length = 0; + varptr->atts.nalloc = MAX_ATTRIBUTES; + varptr->atts.nelems = 0; + varptr->subtypeID = CDI_UNDEFID; + varptr->opt_grib_nentries = 0; + varptr->opt_grib_kvpair_size = 0; + varptr->opt_grib_kvpair = NULL; } static int @@ -57,44 +54,39 @@ vlistvarNewEntry(int vlistID) int varID = 0; vlist_t *vlistptr = vlist_to_pointer(vlistID); int vlistvarSize = vlistptr->varsAllocated; - var_t *vlistvar = vlistptr->vars; + var_t *vlistvars = vlistptr->vars; // Look for a free slot in vlistvar. (Create the table the first time through). if (!vlistvarSize) { vlistvarSize = 2; - vlistvar = (var_t *) Malloc((size_t) vlistvarSize * sizeof(var_t)); - for (int i = 0; i < vlistvarSize; ++i) vlistvar[i].isUsed = false; + vlistvars = (var_t *) Malloc((size_t) vlistvarSize * sizeof(var_t)); + for (int i = 0; i < vlistvarSize; ++i) vlistvars[i].isUsed = false; } else { - while (varID < vlistvarSize && vlistvar[varID].isUsed) ++varID; + while (varID < vlistvarSize && vlistvars[varID].isUsed) ++varID; } // If the table overflows, double its size. if (varID == vlistvarSize) { - vlistvar = (var_t *) Realloc(vlistvar, (size_t) (vlistvarSize *= 2) * sizeof(var_t)); - for (int i = varID; i < vlistvarSize; ++i) vlistvar[i].isUsed = false; + vlistvars = (var_t *) Realloc(vlistvars, (size_t) (vlistvarSize *= 2) * sizeof(var_t)); + for (int i = varID; i < vlistvarSize; ++i) vlistvars[i].isUsed = false; } vlistptr->varsAllocated = vlistvarSize; - vlistptr->vars = vlistvar; + vlistptr->vars = vlistvars; - vlistvarInitEntry(vlistID, varID); - - vlistptr->vars[varID].isUsed = true; + vlistvar_init_entry(vlistvars, varID); + vlistvars[varID].isUsed = true; return varID; } -void -vlistCheckVarID(const char *caller, int vlistID, int varID) +static var_t * +vlistptr_get_varptr(const char *caller, vlist_t *vlistptr, int varID) { - vlist_t *vlistptr = vlist_to_pointer(vlistID); - if (vlistptr == NULL) Errorc("vlist undefined!"); - - if (varID < 0 || varID >= vlistptr->nvars) Errorc("varID %d undefined!", varID); - - if (!vlistptr->vars[varID].isUsed) Errorc("varID %d undefined!", varID); + if (varID < 0 || varID >= vlistptr->nvars || !vlistptr->vars[varID].isUsed) Errorc("varID %d undefined!", varID); + return &vlistptr->vars[varID]; } int @@ -102,26 +94,27 @@ vlistDefVarTiles(int vlistID, int gridID, int zaxisID, int timetype, int tileset { if (CDI_Debug) Message("gridID = %d zaxisID = %d timetype = %d", gridID, zaxisID, timetype); - const int varID = vlistvarNewEntry(vlistID); + int varID = vlistvarNewEntry(vlistID); vlist_t *vlistptr = vlist_to_pointer(vlistID); vlistptr->nvars++; - vlistptr->vars[varID].gridID = gridID; - vlistptr->vars[varID].zaxisID = zaxisID; - vlistptr->vars[varID].timetype = timetype; - vlistptr->vars[varID].subtypeID = tilesetID; + var_t *varptr = &vlistptr->vars[varID]; + varptr->gridID = gridID; + varptr->zaxisID = zaxisID; + varptr->timetype = timetype; + varptr->subtypeID = tilesetID; if (timetype < 0) { - Message("Unexpected time type %d, set to TIME_VARYING!", timetype); - vlistptr->vars[varID].timetype = TIME_VARYING; + Warning("Unexpected time type %d, set to TIME_VARYING!", timetype); + varptr->timetype = TIME_VARYING; } // Compatibility for release 1.8.3 if (timetype > 1 && timetype < 15) { - vlistptr->vars[varID].timetype = TIME_VARYING; - vlistptr->vars[varID].tsteptype = timetype; + varptr->timetype = TIME_VARYING; + varptr->tsteptype = timetype; static bool printInfo = true; if (printInfo) { @@ -140,7 +133,7 @@ vlistDefVarTiles(int vlistID, int gridID, int zaxisID, int timetype, int tileset vlistAdd2ZaxisIDs(vlistptr, zaxisID); vlistAdd2SubtypeIDs(vlistptr, tilesetID); - vlistptr->vars[varID].param = cdiEncodeParam(-(varID + 1), 255, 255); + varptr->param = cdiEncodeParam(-(varID + 1), 255, 255); reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); return varID; @@ -193,14 +186,15 @@ vlistDefVar(int vlistID, int gridID, int zaxisID, int timetype) void cdiVlistCreateVarLevInfo(vlist_t *vlistptr, int varID) { - xassert(varID >= 0 && varID < vlistptr->nvars && vlistptr->vars[varID].levinfo == NULL); + var_t *varptr = vlistptr_get_varptr(__func__, vlistptr, varID); + xassert(varID >= 0 && varID < vlistptr->nvars && varptr->levinfo == NULL); - const int zaxisID = vlistptr->vars[varID].zaxisID; - const size_t nlevs = (size_t) zaxisInqSize(zaxisID); + int zaxisID = varptr->zaxisID; + size_t nlevs = (size_t) zaxisInqSize(zaxisID); - vlistptr->vars[varID].levinfo = (levinfo_t *) Malloc(nlevs * sizeof(levinfo_t)); + varptr->levinfo = (levinfo_t *) Malloc(nlevs * sizeof(levinfo_t)); - for (size_t levID = 0; levID < nlevs; ++levID) vlistptr->vars[varID].levinfo[levID] = DEFAULT_LEVINFO((int) levID); + for (size_t levID = 0; levID < nlevs; ++levID) varptr->levinfo[levID] = DEFAULT_LEVINFO((int) levID); } /* @@ -221,12 +215,11 @@ The function @func{vlistDefVarParam} defines the parameter number of a variable. void vlistDefVarParam(int vlistID, int varID, int param) { - vlistCheckVarID(__func__, vlistID, varID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); - vlist_t *vlistptr = vlist_to_pointer(vlistID); - if (vlistptr->vars[varID].param != param) + if (varptr->param != param) { - vlistptr->vars[varID].param = param; + varptr->param = param; reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } } @@ -249,16 +242,14 @@ The function @func{vlistDefVarCode} defines the code number of a variable. void vlistDefVarCode(int vlistID, int varID, int code) { - vlistCheckVarID(__func__, vlistID, varID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); - vlist_t *vlistptr = vlist_to_pointer(vlistID); - const int param = vlistptr->vars[varID].param; int pnum, pcat, pdis; - cdiDecodeParam(param, &pnum, &pcat, &pdis); - const int newParam = cdiEncodeParam(code, pcat, pdis); - if (vlistptr->vars[varID].param != newParam) + cdiDecodeParam(varptr->param, &pnum, &pcat, &pdis); + int newParam = cdiEncodeParam(code, pcat, pdis); + if (varptr->param != newParam) { - vlistptr->vars[varID].param = newParam; + varptr->param = newParam; reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } } @@ -266,12 +257,11 @@ vlistDefVarCode(int vlistID, int varID, int code) void vlistInqVar(int vlistID, int varID, int *gridID, int *zaxisID, int *timetype) { - vlistCheckVarID(__func__, vlistID, varID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - *gridID = vlistptr->vars[varID].gridID; - *zaxisID = vlistptr->vars[varID].zaxisID; - *timetype = vlistptr->vars[varID].timetype; + *gridID = varptr->gridID; + *zaxisID = varptr->zaxisID; + *timetype = varptr->timetype; } /* @@ -294,10 +284,8 @@ The function @func{vlistInqVarGrid} returns the grid ID of a Variable. int vlistInqVarGrid(int vlistID, int varID) { - vlistCheckVarID(__func__, vlistID, varID); - - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].gridID; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->gridID; } /* @@ -320,10 +308,8 @@ The function @func{vlistInqVarZaxis} returns the zaxis ID of a variable. int vlistInqVarZaxis(int vlistID, int varID) { - vlistCheckVarID(__func__, vlistID, varID); - - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].zaxisID; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->zaxisID; } /* @@ -341,10 +327,8 @@ The function @func{vlistInqVarSubtype} returns the subtype ID of a variable. int vlistInqVarSubtype(int vlistID, int varID) { - vlistCheckVarID(__func__, vlistID, varID); - - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].subtypeID; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->subtypeID; } /* @@ -367,10 +351,8 @@ The function @func{vlistInqVarParam} returns the parameter number of a variable. int vlistInqVarParam(int vlistID, int varID) { - vlistCheckVarID(__func__, vlistID, varID); - - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].param; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->param; } /* @@ -393,17 +375,14 @@ The function @func{vlistInqVarCode} returns the code number of a variable. int vlistInqVarCode(int vlistID, int varID) { - vlistCheckVarID(__func__, vlistID, varID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - - const int param = vlistptr->vars[varID].param; int pdis, pcat, pnum; - cdiDecodeParam(param, &pnum, &pcat, &pdis); + cdiDecodeParam(varptr->param, &pnum, &pcat, &pdis); int code = pnum; if (pdis != 255) code = -varID - 1; // GRIB2 Parameter - int tableID = vlistptr->vars[varID].tableID; + int tableID = varptr->tableID; if (code < 0 && tableID != -1) { char name[CDI_MAX_NAME]; @@ -441,21 +420,16 @@ void vlistInqVarName(int vlistID, int varID, char *name) { int length = CDI_MAX_NAME; - (void) cdiInqKeyString(vlistID, varID, CDI_KEY_NAME, name, &length); - - if (!name[0]) + if (CDI_NOERR != cdiInqKeyString(vlistID, varID, CDI_KEY_NAME, name, &length)) { - vlistCheckVarID(__func__, vlistID, varID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); - vlist_t *vlistptr = vlist_to_pointer(vlistID); - - int param = vlistptr->vars[varID].param; int pdis, pcat, pnum; - cdiDecodeParam(param, &pnum, &pcat, &pdis); + cdiDecodeParam(varptr->param, &pnum, &pcat, &pdis); if (pdis == 255) { int code = pnum; - int tableID = vlistptr->vars[varID].tableID; + int tableID = varptr->tableID; tableInqEntry(tableID, code, -1, name, NULL, NULL); if (!name[0]) sprintf(name, "var%d", code); } @@ -492,18 +466,15 @@ vlistCopyVarName(int vlistID, int varID) (void) cdiInqKeyString(vlistID, varID, CDI_KEY_NAME, name, &length); if (name[0]) return strdup(name); - vlistCheckVarID(__func__, vlistID, varID); - vlist_t *vlistptr = vlist_to_pointer(vlistID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); // Otherwise we check if we should use the table of parameter descriptions. - int param = vlistptr->vars[varID].param; int discipline, category, number; - cdiDecodeParam(param, &number, &category, &discipline); + cdiDecodeParam(varptr->param, &number, &category, &discipline); char *result = NULL; if (discipline == 255) { - int tableID = vlistptr->vars[varID].tableID; - tableInqEntry(tableID, number, -1, name, NULL, NULL); + tableInqEntry(varptr->tableID, number, -1, name, NULL, NULL); if (name[0]) result = strdup(name); else @@ -547,23 +518,13 @@ void vlistInqVarLongname(int vlistID, int varID, char *longname) { int length = CDI_MAX_NAME; - (void) cdiInqKeyString(vlistID, varID, CDI_KEY_LONGNAME, longname, &length); - - if (!longname[0]) + if (CDI_NOERR != cdiInqKeyString(vlistID, varID, CDI_KEY_LONGNAME, longname, &length)) { - vlistCheckVarID(__func__, vlistID, varID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); - vlist_t *vlistptr = vlist_to_pointer(vlistID); - - int param = vlistptr->vars[varID].param; int pdis, pcat, pnum; - cdiDecodeParam(param, &pnum, &pcat, &pdis); - if (pdis == 255) - { - int code = pnum; - int tableID = vlistptr->vars[varID].tableID; - tableInqEntry(tableID, code, -1, NULL, longname, NULL); - } + cdiDecodeParam(varptr->param, &pnum, &pcat, &pdis); + if (pdis == 255) tableInqEntry(varptr->tableID, pnum, -1, NULL, longname, NULL); } } @@ -649,23 +610,13 @@ void vlistInqVarUnits(int vlistID, int varID, char *units) { int length = CDI_MAX_NAME; - (void) cdiInqKeyString(vlistID, varID, CDI_KEY_UNITS, units, &length); - - if (!units[0]) + if (CDI_NOERR != cdiInqKeyString(vlistID, varID, CDI_KEY_UNITS, units, &length)) { - vlistCheckVarID(__func__, vlistID, varID); - - vlist_t *vlistptr = vlist_to_pointer(vlistID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); - int param = vlistptr->vars[varID].param; int pdis, pcat, pnum; - cdiDecodeParam(param, &pnum, &pcat, &pdis); - if (pdis == 255) - { - int code = pnum; - int tableID = vlistptr->vars[varID].tableID; - tableInqEntry(tableID, code, -1, NULL, NULL, units); - } + cdiDecodeParam(varptr->param, &pnum, &pcat, &pdis); + if (pdis == 255) tableInqEntry(varptr->tableID, pnum, -1, NULL, NULL, units); } } @@ -673,11 +624,11 @@ vlistInqVarUnits(int vlistID, int varID, char *units) int vlistInqVarID(int vlistID, int code) { - const vlist_t *vlistptr = vlist_to_pointer(vlistID); + vlist_t *vlistptr = vlist_to_pointer(vlistID); for (int varID = 0; varID < vlistptr->nvars; ++varID) { - const int param = vlistptr->vars[varID].param; + int param = vlistptr->vars[varID].param; int pdis, pcat, pnum; cdiDecodeParam(param, &pnum, &pcat, &pdis); if (pnum == code) return varID; @@ -689,13 +640,11 @@ vlistInqVarID(int vlistID, int code) SizeType vlistInqVarSize(int vlistID, int varID) { - vlistCheckVarID(__func__, vlistID, varID); - int zaxisID, gridID, timetype; vlistInqVar(vlistID, varID, &gridID, &zaxisID, &timetype); - const SizeType nlevs = (SizeType) zaxisInqSize(zaxisID); - const SizeType gridsize = gridInqSize(gridID); + SizeType nlevs = (SizeType) zaxisInqSize(zaxisID); + SizeType gridsize = gridInqSize(gridID); return gridsize * nlevs; } @@ -723,24 +672,21 @@ The valid CDI data types are @func{CDI_DATATYPE_PACK8}, @func{CDI_DATATYPE_PACK1 int vlistInqVarDatatype(int vlistID, int varID) { - vlistCheckVarID(__func__, vlistID, varID); - - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].datatype; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->datatype; } int vlistInqVarNumber(int vlistID, int varID) { - vlistCheckVarID(__func__, vlistID, varID); - - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - - int number = CDI_REAL; - if (vlistptr->vars[varID].datatype == CDI_DATATYPE_CPX32 || vlistptr->vars[varID].datatype == CDI_DATATYPE_CPX64) - number = CDI_COMP; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return (varptr->datatype == CDI_DATATYPE_CPX32 || varptr->datatype == CDI_DATATYPE_CPX64) ? CDI_COMP : CDI_REAL; +} - return number; +static bool +check_range(double value, double lowerBound, double upperBound) +{ + return (value >= lowerBound && value <= upperBound); } /* @@ -764,27 +710,47 @@ The function @func{vlistDefVarDatatype} defines the data type of a variable. void vlistDefVarDatatype(int vlistID, int varID, int datatype) { - vlistCheckVarID(__func__, vlistID, varID); - - vlist_t *vlistptr = vlist_to_pointer(vlistID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); - if (vlistptr->vars[varID].datatype != datatype) + if (varptr->datatype != datatype) { - vlistptr->vars[varID].datatype = datatype; + varptr->datatype = datatype; - if (!vlistptr->vars[varID].missvalused) - // clang-format off - switch (datatype) - { - case CDI_DATATYPE_INT8: vlistptr->vars[varID].missval = -SCHAR_MAX; break; - case CDI_DATATYPE_UINT8: vlistptr->vars[varID].missval = UCHAR_MAX; break; - case CDI_DATATYPE_INT16: vlistptr->vars[varID].missval = -SHRT_MAX; break; - case CDI_DATATYPE_UINT16: vlistptr->vars[varID].missval = USHRT_MAX; break; - case CDI_DATATYPE_INT32: vlistptr->vars[varID].missval = -INT_MAX; break; - case CDI_DATATYPE_UINT32: vlistptr->vars[varID].missval = UINT_MAX; break; - case CDI_DATATYPE_FLT32: vlistptr->vars[varID].missval = (float) CDI_Default_Missval; break; - } - // clang-format on + if (!varptr->missvalused) + { + double missval = varptr->missval; + bool missvalIsDefault = DBL_IS_EQUAL(missval, CDI_Default_Missval); + if (missvalIsDefault) + { + // clang-format off + switch (datatype) + { + case CDI_DATATYPE_INT8: varptr->missval = -SCHAR_MAX; break; + case CDI_DATATYPE_UINT8: varptr->missval = UCHAR_MAX; break; + case CDI_DATATYPE_INT16: varptr->missval = -SHRT_MAX; break; + case CDI_DATATYPE_UINT16: varptr->missval = USHRT_MAX; break; + case CDI_DATATYPE_INT32: varptr->missval = -INT_MAX; break; + case CDI_DATATYPE_UINT32: varptr->missval = UINT_MAX; break; + case CDI_DATATYPE_FLT32: varptr->missval = (float) CDI_Default_Missval; break; + } + // clang-format on + } + else + { + // clang-format off + switch (datatype) + { + case CDI_DATATYPE_INT8: varptr->missval = check_range(missval, -SCHAR_MAX, SCHAR_MAX) ? missval : -SCHAR_MAX; break; + case CDI_DATATYPE_UINT8: varptr->missval = check_range(missval, 0, UCHAR_MAX) ? missval : UCHAR_MAX; break; + case CDI_DATATYPE_INT16: varptr->missval = check_range(missval, -SHRT_MAX, SHRT_MAX) ? missval : -SHRT_MAX; break; + case CDI_DATATYPE_UINT16: varptr->missval = check_range(missval, 0, USHRT_MAX) ? missval : USHRT_MAX; break; + case CDI_DATATYPE_INT32: varptr->missval = check_range(missval, -INT_MAX, INT_MAX) ? missval : -INT_MAX; break; + case CDI_DATATYPE_UINT32: varptr->missval = check_range(missval, 0, UINT_MAX) ? missval : UINT_MAX; break; + case CDI_DATATYPE_FLT32: varptr->missval = check_range(missval, -FLT_MAX, FLT_MAX) ? missval : CDI_Default_Missval; break; + } + // clang-format on + } + } reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } } @@ -792,10 +758,10 @@ vlistDefVarDatatype(int vlistID, int varID, int datatype) void vlistDefVarInstitut(int vlistID, int varID, int instID) { - vlist_t *vlistptr = vlist_to_pointer(vlistID); - if (vlistptr->vars[varID].instID != instID) + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + if (varptr->instID != instID) { - vlistptr->vars[varID].instID = instID; + varptr->instID = instID; reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } } @@ -803,17 +769,17 @@ vlistDefVarInstitut(int vlistID, int varID, int instID) int vlistInqVarInstitut(int vlistID, int varID) { - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].instID; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->instID; } void vlistDefVarModel(int vlistID, int varID, int modelID) { - vlist_t *vlistptr = vlist_to_pointer(vlistID); - if (vlistptr->vars[varID].modelID != modelID) + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + if (varptr->modelID != modelID) { - vlistptr->vars[varID].modelID = modelID; + varptr->modelID = modelID; reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } } @@ -821,24 +787,22 @@ vlistDefVarModel(int vlistID, int varID, int modelID) int vlistInqVarModel(int vlistID, int varID) { - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].modelID; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->modelID; } void vlistDefVarTable(int vlistID, int varID, int tableID) { - vlist_t *vlistptr = vlist_to_pointer(vlistID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); - if (vlistptr->vars[varID].tableID != tableID) + if (varptr->tableID != tableID) { - vlistptr->vars[varID].tableID = tableID; - const int tablenum = tableInqNum(tableID); - - const int param = vlistptr->vars[varID].param; + varptr->tableID = tableID; + int tablenum = tableInqNum(tableID); int pnum, pcat, pdis; - cdiDecodeParam(param, &pnum, &pcat, &pdis); - vlistptr->vars[varID].param = cdiEncodeParam(pnum, tablenum, pdis); + cdiDecodeParam(varptr->param, &pnum, &pcat, &pdis); + varptr->param = cdiEncodeParam(pnum, tablenum, pdis); reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } } @@ -846,8 +810,8 @@ vlistDefVarTable(int vlistID, int varID, int tableID) int vlistInqVarTable(int vlistID, int varID) { - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].tableID; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->tableID; } /* @@ -954,10 +918,8 @@ The function @func{vlistInqVarMissval} returns the missing value of a variable. double vlistInqVarMissval(int vlistID, int varID) { - vlistCheckVarID(__func__, vlistID, varID); - - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].missval; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->missval; } /* @@ -978,161 +940,42 @@ The function @func{vlistDefVarMissval} defines the missing value of a variable. void vlistDefVarMissval(int vlistID, int varID, double missval) { - vlistCheckVarID(__func__, vlistID, varID); - - vlist_t *vlistptr = vlist_to_pointer(vlistID); - vlistptr->vars[varID].missval = missval; - vlistptr->vars[varID].missvalused = true; -} - -/* -@Function vlistDefVarExtra -@Title Define extra information of a Variable - -@Prototype void vlistDefVarExtra(int vlistID, int varID, const char *extra) -@Parameter - @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate}. - @Item varID Variable identifier. - @Item extra Extra information. - -@Description -The function @func{vlistDefVarExtra} defines the extra information of a variable. - -@EndFunction -*/ -void -vlistDefVarExtra(int vlistID, int varID, const char *extra) -{ - vlistCheckVarID(__func__, vlistID, varID); - - vlist_t *vlistptr = vlist_to_pointer(vlistID); - - if (extra) - { - if (vlistptr->vars[varID].extra) - { - Free(vlistptr->vars[varID].extra); - vlistptr->vars[varID].extra = NULL; - } - - vlistptr->vars[varID].extra = strdupx(extra); - reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); - } -} - -/* -@Function vlistInqVarExtra -@Title Get extra information of a Variable - -@Prototype void vlistInqVarExtra(int vlistID, int varID, char *extra) -@Parameter - @Item vlistID Variable list ID, from a previous call to @fref{vlistCreate} or @fref{streamInqVlist}. - @Item varID Variable identifier. - @Item extra Returned variable extra information. The caller must allocate space for the - returned string. The maximum possible length, in characters, of - the string is given by the predefined constant @func{CDI_MAX_NAME}. - -@Description -The function @func{vlistInqVarExtra} returns the extra information of a variable. - -@Result -@func{vlistInqVarExtra} returns the extra information of the variable to the parameter extra if available, -otherwise the result is an empty string. - -@EndFunction -*/ -void -vlistInqVarExtra(int vlistID, int varID, char *extra) -{ - vlistCheckVarID(__func__, vlistID, varID); - - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - if (vlistptr->vars[varID].extra == NULL) - sprintf(extra, "-"); - else - strcpy(extra, vlistptr->vars[varID].extra); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + varptr->missval = missval; + varptr->missvalused = true; } int vlistInqVarValidrange(int vlistID, int varID, double *validrange) { - vlistCheckVarID(__func__, vlistID, varID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - - if (validrange != NULL && vlistptr->vars[varID].lvalidrange) + if (validrange != NULL && varptr->lvalidrange) { - validrange[0] = vlistptr->vars[varID].validrange[0]; - validrange[1] = vlistptr->vars[varID].validrange[1]; + validrange[0] = varptr->validrange[0]; + validrange[1] = varptr->validrange[1]; } - return (int) vlistptr->vars[varID].lvalidrange; + return (int) varptr->lvalidrange; } void vlistDefVarValidrange(int vlistID, int varID, const double *validrange) { - vlistCheckVarID(__func__, vlistID, varID); - - vlist_t *vlistptr = vlist_to_pointer(vlistID); - - vlistptr->vars[varID].validrange[0] = validrange[0]; - vlistptr->vars[varID].validrange[1] = validrange[1]; - vlistptr->vars[varID].lvalidrange = true; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + varptr->validrange[0] = validrange[0]; + varptr->validrange[1] = validrange[1]; + varptr->lvalidrange = true; reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } -double -vlistInqVarScalefactor(int vlistID, int varID) -{ - vlistCheckVarID(__func__, vlistID, varID); - - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].scalefactor; -} - -double -vlistInqVarAddoffset(int vlistID, int varID) -{ - vlistCheckVarID(__func__, vlistID, varID); - - vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].addoffset; -} - -void -vlistDefVarScalefactor(int vlistID, int varID, double scalefactor) -{ - vlistCheckVarID(__func__, vlistID, varID); - - vlist_t *vlistptr = vlist_to_pointer(vlistID); - if (IS_NOT_EQUAL(vlistptr->vars[varID].scalefactor, scalefactor)) - { - vlistptr->vars[varID].scalefactor = scalefactor; - reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); - } -} - -void -vlistDefVarAddoffset(int vlistID, int varID, double addoffset) -{ - vlistCheckVarID(__func__, vlistID, varID); - - vlist_t *vlistptr = vlist_to_pointer(vlistID); - if (IS_NOT_EQUAL(vlistptr->vars[varID].addoffset, addoffset)) - { - vlistptr->vars[varID].addoffset = addoffset; - reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); - } -} - void vlistDefVarTimetype(int vlistID, int varID, int timetype) { - vlist_t *vlistptr = vlist_to_pointer(vlistID); - if (vlistptr->vars[varID].timetype != timetype) + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + if (varptr->timetype != timetype) { - vlistptr->vars[varID].timetype = timetype; + varptr->timetype = timetype; reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } } @@ -1140,17 +983,17 @@ vlistDefVarTimetype(int vlistID, int varID, int timetype) int vlistInqVarTimetype(int vlistID, int varID) { - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].timetype; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->timetype; } void vlistDefVarTsteptype(int vlistID, int varID, int tsteptype) { - vlist_t *vlistptr = vlist_to_pointer(vlistID); - if (vlistptr->vars[varID].tsteptype != tsteptype) + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + if (varptr->tsteptype != tsteptype) { - vlistptr->vars[varID].tsteptype = tsteptype; + varptr->tsteptype = tsteptype; reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } } @@ -1178,40 +1021,40 @@ The valid CDI timestep types are @func{TSTEP_INSTANT}, int vlistInqVarTsteptype(int vlistID, int varID) { - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].tsteptype; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->tsteptype; } int vlistInqVarMissvalUsed(int vlistID, int varID) { - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return (int) vlistptr->vars[varID].missvalused; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return (int) varptr->missvalused; } void vlistDefFlag(int vlistID, int varID, int levID, int flag) { vlist_t *vlistptr = vlist_to_pointer(vlistID); + var_t *varptr = vlistptr_get_varptr(__func__, vlistptr, varID); levinfo_t li = DEFAULT_LEVINFO(levID); - if (vlistptr->vars[varID].levinfo) + if (varptr->levinfo) ; else if (flag != li.flag) cdiVlistCreateVarLevInfo(vlistptr, varID); else return; - vlistptr->vars[varID].levinfo[levID].flag = flag; + varptr->levinfo[levID].flag = flag; + varptr->flag = 0; - vlistptr->vars[varID].flag = 0; - - int nlevs = zaxisInqSize(vlistptr->vars[varID].zaxisID); + int nlevs = zaxisInqSize(varptr->zaxisID); for (int levelID = 0; levelID < nlevs; ++levelID) { - if (vlistptr->vars[varID].levinfo[levelID].flag) + if (varptr->levinfo[levelID].flag) { - vlistptr->vars[varID].flag = 1; + varptr->flag = 1; break; } } @@ -1222,10 +1065,10 @@ vlistDefFlag(int vlistID, int varID, int levID, int flag) int vlistInqFlag(int vlistID, int varID, int levID) { - const vlist_t *vlistptr = vlist_to_pointer(vlistID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); - if (vlistptr->vars[varID].levinfo) - return vlistptr->vars[varID].levinfo[levID].flag; + if (varptr->levinfo) + return varptr->levinfo[levID].flag; else { levinfo_t li = DEFAULT_LEVINFO(levID); @@ -1237,7 +1080,7 @@ int vlistFindVar(int vlistID, int fvarID) { int varID; - const vlist_t *vlistptr = vlist_to_pointer(vlistID); + vlist_t *vlistptr = vlist_to_pointer(vlistID); for (varID = 0; varID < vlistptr->nvars; ++varID) { @@ -1247,7 +1090,7 @@ vlistFindVar(int vlistID, int fvarID) if (varID == vlistptr->nvars) { varID = -1; - Message("varID not found for fvarID %d in vlistID %d!", fvarID, vlistID); + Warning("varID not found for fvarID %d in vlistID %d!", fvarID, vlistID); } return varID; @@ -1257,22 +1100,21 @@ int vlistFindLevel(int vlistID, int fvarID, int flevelID) { int levelID = -1; - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - - const int varID = vlistFindVar(vlistID, fvarID); + int varID = vlistFindVar(vlistID, fvarID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); if (varID != -1) { - const int nlevs = zaxisInqSize(vlistptr->vars[varID].zaxisID); + int nlevs = zaxisInqSize(varptr->zaxisID); for (levelID = 0; levelID < nlevs; ++levelID) { - if (vlistptr->vars[varID].levinfo[levelID].flevelID == flevelID) break; + if (varptr->levinfo[levelID].flevelID == flevelID) break; } if (levelID == nlevs) { levelID = -1; - Message("levelID not found for fvarID %d and levelID %d in vlistID %d!", fvarID, flevelID, vlistID); + Warning("levelID not found for fvarID %d and levelID %d in vlistID %d!", fvarID, flevelID, vlistID); } } @@ -1282,17 +1124,17 @@ vlistFindLevel(int vlistID, int fvarID, int flevelID) int vlistMergedVar(int vlistID, int varID) { - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].mvarID; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->mvarID; } int vlistMergedLevel(int vlistID, int varID, int levelID) { - const vlist_t *vlistptr = vlist_to_pointer(vlistID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); - if (vlistptr->vars[varID].levinfo) - return vlistptr->vars[varID].levinfo[levelID].mlevelID; + if (varptr->levinfo) + return varptr->levinfo[levelID].mlevelID; else { levinfo_t li = DEFAULT_LEVINFO(levelID); @@ -1304,26 +1146,27 @@ void vlistDefIndex(int vlistID, int varID, int levelID, int index) { vlist_t *vlistptr = vlist_to_pointer(vlistID); + var_t *varptr = vlistptr_get_varptr(__func__, vlistptr, varID); levinfo_t li = DEFAULT_LEVINFO(levelID); - if (vlistptr->vars[varID].levinfo) + if (varptr->levinfo) ; else if (index != li.index) cdiVlistCreateVarLevInfo(vlistptr, varID); else return; - vlistptr->vars[varID].levinfo[levelID].index = index; + varptr->levinfo[levelID].index = index; reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } int vlistInqIndex(int vlistID, int varID, int levelID) { - const vlist_t *vlistptr = vlist_to_pointer(vlistID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); - if (vlistptr->vars[varID].levinfo) - return vlistptr->vars[varID].levinfo[levelID].index; + if (varptr->levinfo) + return varptr->levinfo[levelID].index; else { levinfo_t li = DEFAULT_LEVINFO(levelID); @@ -1335,30 +1178,29 @@ void vlistChangeVarZaxis(int vlistID, int varID, int zaxisID) { vlist_t *vlistptr = vlist_to_pointer(vlistID); + var_t *varptr = vlistptr_get_varptr(__func__, vlistptr, varID); - vlistCheckVarID(__func__, vlistID, varID); - - const int nlevs1 = zaxisInqSize(vlistptr->vars[varID].zaxisID); - const int nlevs2 = zaxisInqSize(zaxisID); + int nlevs1 = zaxisInqSize(varptr->zaxisID); + int nlevs2 = zaxisInqSize(zaxisID); if (nlevs1 != nlevs2) Error("Number of levels must not change!"); - const int nvars = vlistptr->nvars; + int nvars = vlistptr->nvars; int found = 0; - const int oldZaxisID = vlistptr->vars[varID].zaxisID; + int oldZaxisID = varptr->zaxisID; for (int i = 0; i < varID; ++i) found |= (vlistptr->vars[i].zaxisID == oldZaxisID); for (int i = varID + 1; i < nvars; ++i) found |= (vlistptr->vars[i].zaxisID == oldZaxisID); if (found) { - const int nzaxis = vlistptr->nzaxis; + int nzaxis = vlistptr->nzaxis; for (int i = 0; i < nzaxis; ++i) if (vlistptr->zaxisIDs[i] == oldZaxisID) vlistptr->zaxisIDs[i] = zaxisID; } else vlistAdd2ZaxisIDs(vlistptr, zaxisID); - vlistptr->vars[varID].zaxisID = zaxisID; + varptr->zaxisID = zaxisID; reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } @@ -1366,10 +1208,9 @@ void vlistChangeVarGrid(int vlistID, int varID, int gridID) { vlist_t *vlistptr = vlist_to_pointer(vlistID); + var_t *varptr = vlistptr_get_varptr(__func__, vlistptr, varID); - vlistCheckVarID(__func__, vlistID, varID); - - const int nvars = vlistptr->nvars; + int nvars = vlistptr->nvars; int index; for (index = 0; index < nvars; index++) if (index != varID) @@ -1383,19 +1224,18 @@ vlistChangeVarGrid(int vlistID, int varID, int gridID) else vlistAdd2GridIDs(vlistptr, gridID); - vlistptr->vars[varID].gridID = gridID; + varptr->gridID = gridID; reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } void vlistDefVarCompType(int vlistID, int varID, int comptype) { - vlistCheckVarID(__func__, vlistID, varID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); - vlist_t *vlistptr = vlist_to_pointer(vlistID); - if (vlistptr->vars[varID].comptype != comptype) + if (varptr->comptype != comptype) { - vlistptr->vars[varID].comptype = comptype; + varptr->comptype = comptype; reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } } @@ -1403,21 +1243,18 @@ vlistDefVarCompType(int vlistID, int varID, int comptype) int vlistInqVarCompType(int vlistID, int varID) { - vlistCheckVarID(__func__, vlistID, varID); - - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].comptype; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->comptype; } void vlistDefVarCompLevel(int vlistID, int varID, int complevel) { - vlistCheckVarID(__func__, vlistID, varID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); - vlist_t *vlistptr = vlist_to_pointer(vlistID); - if (vlistptr->vars[varID].complevel != complevel) + if (varptr->complevel != complevel) { - vlistptr->vars[varID].complevel = complevel; + varptr->complevel = complevel; reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } } @@ -1425,21 +1262,17 @@ vlistDefVarCompLevel(int vlistID, int varID, int complevel) int vlistInqVarCompLevel(int vlistID, int varID) { - vlistCheckVarID(__func__, vlistID, varID); - - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].complevel; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->complevel; } void vlistDefVarNSB(int vlistID, int varID, int nsb) { - vlistCheckVarID(__func__, vlistID, varID); - - vlist_t *vlistptr = vlist_to_pointer(vlistID); - if (vlistptr->vars[varID].nsb != nsb) + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + if (varptr->nsb != nsb) { - vlistptr->vars[varID].nsb = nsb; + varptr->nsb = nsb; reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } } @@ -1447,37 +1280,41 @@ vlistDefVarNSB(int vlistID, int varID, int nsb) int vlistInqVarNSB(int vlistID, int varID) { - vlistCheckVarID(__func__, vlistID, varID); - - vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].nsb; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return varptr->nsb; } static int -vlistEncodeXyz(int (*dimorder)[3]) +vlistEncodeXyz(const int dimorder[3]) { - return (*dimorder)[0] * 100 + (*dimorder)[1] * 10 + (*dimorder)[2]; + return (short) (dimorder[0] * 100 + dimorder[1] * 10 + dimorder[2]); } static void -vlistDecodeXyz(int xyz, int (*outDimorder)[3]) +vlistDecodeXyz(int xyz, int outDimorder[3]) { - (*outDimorder)[0] = xyz / 100, xyz -= (*outDimorder)[0] * 100; - (*outDimorder)[1] = xyz / 10, xyz -= (*outDimorder)[1] * 10; - (*outDimorder)[2] = xyz; + outDimorder[0] = xyz / 100, xyz = xyz % 100; + outDimorder[1] = xyz / 10; + outDimorder[2] = xyz % 10; } +static const short xyzStorVals[] = { 123, 132, 213, 231, 312, 321 }; +enum +{ + numXYZStorVals = sizeof(xyzStorVals) / sizeof(xyzStorVals[0]) +}; + void vlistDefVarXYZ(int vlistID, int varID, int xyz) { - vlistCheckVarID(__func__, vlistID, varID); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); if (xyz == 3) xyz = 321; // check xyz dimension order { int dimorder[3]; - vlistDecodeXyz(xyz, &dimorder); + vlistDecodeXyz(xyz, dimorder); int dimx = 0, dimy = 0, dimz = 0; for (int id = 0; id < 3; ++id) { @@ -1498,55 +1335,34 @@ vlistDefVarXYZ(int vlistID, int varID, int xyz) if (dimy == 0) for (int id = 0; id < 3; ++id) if (dimorder[id] == 0) { dimorder[id] = 2; break; } if (dimx == 0) for (int id = 0; id < 3; ++id) if (dimorder[id] == 0) { dimorder[id] = 1; break; } // clang-format on - xyz = vlistEncodeXyz(&dimorder); + xyz = vlistEncodeXyz(dimorder); } } assert(xyz == 123 || xyz == 312 || xyz == 231 || xyz == 321 || xyz == 132 || xyz == 213); - vlist_t *vlistptr = vlist_to_pointer(vlistID); - vlistptr->vars[varID].xyz = xyz; + for (size_t i = 0; i < numXYZStorVals; ++i) + if (xyz == xyzStorVals[i]) + { + xyz = (int) i; + break; + } + varptr->xyz = (signed char) xyz; reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); } void -vlistInqVarDimorder(int vlistID, int varID, int (*outDimorder)[3]) +vlistInqVarDimorder(int vlistID, int varID, int outDimorder[3]) { - vlistCheckVarID(__func__, vlistID, varID); - - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - vlistDecodeXyz(vlistptr->vars[varID].xyz, outDimorder); + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + vlistDecodeXyz(xyzStorVals[varptr->xyz], outDimorder); } int vlistInqVarXYZ(int vlistID, int varID) { - vlistCheckVarID(__func__, vlistID, varID); - - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].xyz; -} - -void -vlistDefVarIOrank(int vlistID, int varID, int iorank) -{ - vlistCheckVarID(__func__, vlistID, varID); - - vlist_t *vlistptr = vlist_to_pointer(vlistID); - if (vlistptr->vars[varID].iorank != iorank) - { - vlistptr->vars[varID].iorank = iorank; - reshSetStatus(vlistID, &vlistOps, RESH_DESYNC_IN_USE); - } -} - -int -vlistInqVarIOrank(int vlistID, int varID) -{ - vlistCheckVarID(__func__, vlistID, varID); - - const vlist_t *vlistptr = vlist_to_pointer(vlistID); - return vlistptr->vars[varID].iorank; + var_t *varptr = vlistptr_get_varptr(__func__, vlist_to_pointer(vlistID), varID); + return xyzStorVals[varptr->xyz]; } int @@ -1560,8 +1376,8 @@ vlistVarCompare(vlist_t *a, int varIDA, vlist_t *b, int varIDB) #define FCMP2(f) (namespaceResHDecode(pva->f).idx != namespaceResHDecode(pvb->f).idx) int diff = (int) FCMP(fvarID) | FCMP(mvarID) | FCMP(flag) | FCMP(param) | FCMP(datatype) | FCMP(timetype) | FCMP(tsteptype) | FCMP(xyz) | FCMP2(gridID) | FCMP2(zaxisID) | FCMP2(instID) | FCMP2(modelID) | FCMP2(tableID) | FCMP(missvalused) - | FCMPFLT(missval) | FCMPFLT(addoffset) | FCMPFLT(scalefactor) | FCMPSTR(extra) | FCMP(comptype) | FCMP(complevel) - | FCMP(lvalidrange) | FCMPFLT(validrange[0]) | FCMPFLT(validrange[1]); + | FCMPFLT(missval) | FCMP(comptype) | FCMP(complevel) | FCMP(lvalidrange) | FCMPFLT(validrange[0]) + | FCMPFLT(validrange[1]); #undef FCMP #undef FCMPFLT #undef FCMPSTR @@ -1570,17 +1386,17 @@ vlistVarCompare(vlist_t *a, int varIDA, vlist_t *b, int varIDB) if (pva->levinfo) { - const int zaxisID = pva->zaxisID; - const size_t nlevs = (size_t) zaxisInqSize(zaxisID); + int zaxisID = pva->zaxisID; + size_t nlevs = (size_t) zaxisInqSize(zaxisID); diff |= (memcmp(pva->levinfo, pvb->levinfo, sizeof(levinfo_t) * nlevs) != 0); if (diff) return 1; } - const size_t natts = a->vars[varIDA].atts.nelems; + size_t natts = a->vars[varIDA].atts.nelems; if (natts != b->vars[varIDB].atts.nelems) return 1; for (size_t attID = 0; attID < natts; ++attID) diff |= cdi_att_compare(&a->vars[varIDA].atts, &b->vars[varIDB].atts, (int) attID); - const size_t nkeys = a->vars[varIDA].keys.nelems; + size_t nkeys = a->vars[varIDA].keys.nelems; if (nkeys != b->vars[varIDB].keys.nelems) return 1; for (size_t keyID = 0; keyID < nkeys; ++keyID) diff |= cdi_key_compare(&a->vars[varIDA].keys, &b->vars[varIDB].keys, (int) keyID); diff --git a/src/vlist_var_key.c b/src/vlist_var_key.c index dd38e69751bc62dd10eae95d0185385bf5364e8a..161033044c9242566e40486b0dbc63f460116f4d 100644 --- a/src/vlist_var_key.c +++ b/src/vlist_var_key.c @@ -22,7 +22,7 @@ vlistDefVarIntKey(int vlistID, int varID, const char *name, int value) vlistID); for (idx = 0; idx < vlistptr->vars[varID].opt_grib_nentries; idx++) - if ((strcmp(name, vlistptr->vars[varID].opt_grib_kvpair[idx].keyword) == 0) + if (str_is_equal(name, vlistptr->vars[varID].opt_grib_kvpair[idx].keyword) && (vlistptr->vars[varID].opt_grib_kvpair[idx].data_type == t_int)) break; @@ -85,7 +85,7 @@ vlistDefVarDblKey(int vlistID, int varID, const char *name, double value) vlistID); for (idx = 0; idx < vlistptr->vars[varID].opt_grib_nentries; idx++) - if ((strcmp(name, vlistptr->vars[varID].opt_grib_kvpair[idx].keyword) == 0) + if (str_is_equal(name, vlistptr->vars[varID].opt_grib_kvpair[idx].keyword) && (vlistptr->vars[varID].opt_grib_kvpair[idx].data_type == t_double)) break; @@ -169,7 +169,7 @@ vlistHasVarKey(int vlistID, int varID, const char *name) for (int i = 0; i < vlistptr->vars[varID].opt_grib_nentries; ++i) { - if (strcmp(name, vlistptr->vars[varID].opt_grib_kvpair[i].keyword) == 0) return 1; + if (str_is_equal(name, vlistptr->vars[varID].opt_grib_kvpair[i].keyword)) return 1; } #else (void) vlistID; @@ -191,7 +191,7 @@ vlistInqVarDblKey(int vlistID, int varID, const char *name) for (int i = 0; i < vlistptr->vars[varID].opt_grib_nentries; ++i) { int isub = subtypeInqActiveIndex(vlistptr->vars[varID].subtypeID); - if ((strcmp(name, vlistptr->vars[varID].opt_grib_kvpair[i].keyword) == 0) + if (str_is_equal(name, vlistptr->vars[varID].opt_grib_kvpair[i].keyword) && (vlistptr->vars[varID].opt_grib_kvpair[i].data_type == t_double) && (vlistptr->vars[varID].opt_grib_kvpair[i].subtype_index == isub)) return vlistptr->vars[varID].opt_grib_kvpair[i].dbl_val; @@ -216,7 +216,7 @@ vlistInqVarIntKey(int vlistID, int varID, const char *name) for (int i = 0; i < vlistptr->vars[varID].opt_grib_nentries; ++i) { int isub = subtypeInqActiveIndex(vlistptr->vars[varID].subtypeID); - if ((strcmp(name, vlistptr->vars[varID].opt_grib_kvpair[i].keyword) == 0) + if (str_is_equal(name, vlistptr->vars[varID].opt_grib_kvpair[i].keyword) && (vlistptr->vars[varID].opt_grib_kvpair[i].data_type == t_int) && (vlistptr->vars[varID].opt_grib_kvpair[i].subtype_index == isub)) return vlistptr->vars[varID].opt_grib_kvpair[i].int_val; diff --git a/src/vlist_var_pack.c b/src/vlist_var_pack.c index a3e4d550e2799ce5ec59945f1a6e93177b757f7f..5a877401d9ed8508f9a6127d90c08d26385fc8ef 100644 --- a/src/vlist_var_pack.c +++ b/src/vlist_var_pack.c @@ -21,14 +21,13 @@ enum VLISTVAR_PACK_INT_IDX_COMPTYPE, VLISTVAR_PACK_INT_IDX_COMPLEVEL, VLISTVAR_PACK_INT_IDX_NLEVS, - VLISTVAR_PACK_INT_IDX_IORANK, - VLISTVAR_PACK_INT_IDX_EXTRALEN, vlistvarNint }; enum { - vlistvar_ndbls = 3, + VLIST_VAR_PACK_DBL_MISSVAL, + vlistvar_ndbls, }; int @@ -37,11 +36,9 @@ vlistVarGetPackSize(vlist_t *p, int varID, void *context) var_t *var = p->vars + varID; int varsize = serializeGetSize(vlistvarNint, CDI_DATATYPE_INT, context) + serializeGetSize(vlistvar_ndbls, CDI_DATATYPE_FLT64, context); - if (var->extra) varsize += serializeGetSize((int) strlen(var->extra), CDI_DATATYPE_TXT, context); - varsize += serializeGetSize(4 * zaxisInqSize(var->zaxisID), CDI_DATATYPE_INT, context); + if (var->levinfo) varsize += serializeGetSize(4 * zaxisInqSize(var->zaxisID), CDI_DATATYPE_INT, context); varsize += serializeKeysGetPackSize(&var->keys, context); - varsize += cdiAttsGetSize(p, varID, context); return varsize; @@ -50,32 +47,31 @@ vlistVarGetPackSize(vlist_t *p, int varID, void *context) void vlistVarPack(vlist_t *p, int varID, char *buf, int size, int *position, void *context) { - double dtempbuf[vlistvar_ndbls]; var_t *var = p->vars + varID; - int tempbuf[vlistvarNint], extralen; - - tempbuf[VLISTVAR_PACK_INT_IDX_FLAG] = var->flag; - tempbuf[VLISTVAR_PACK_INT_IDX_GRIDID] = var->gridID; - tempbuf[VLISTVAR_PACK_INT_IDX_ZAXISID] = var->zaxisID; - tempbuf[VLISTVAR_PACK_INT_IDX_TIMETYPE] = var->timetype; - tempbuf[VLISTVAR_PACK_INT_IDX_DATATYPE] = var->datatype; - tempbuf[VLISTVAR_PACK_INT_IDX_PARAM] = var->param; - tempbuf[VLISTVAR_PACK_INT_IDX_INSTID] = var->instID; - tempbuf[VLISTVAR_PACK_INT_IDX_MODELID] = var->modelID; - tempbuf[VLISTVAR_PACK_INT_IDX_TABLEID] = var->tableID; - tempbuf[VLISTVAR_PACK_INT_IDX_MISSVALUSED] = (int) var->missvalused; - tempbuf[VLISTVAR_PACK_INT_IDX_COMPTYPE] = var->comptype; - tempbuf[VLISTVAR_PACK_INT_IDX_COMPLEVEL] = var->complevel; - int nlevs = var->levinfo ? zaxisInqSize(var->zaxisID) : 0; - tempbuf[VLISTVAR_PACK_INT_IDX_NLEVS] = nlevs; - tempbuf[VLISTVAR_PACK_INT_IDX_IORANK] = var->iorank; - tempbuf[VLISTVAR_PACK_INT_IDX_EXTRALEN] = extralen = var->extra ? (int) strlen(var->extra) : 0; - dtempbuf[0] = var->missval; - dtempbuf[1] = var->scalefactor; - dtempbuf[2] = var->addoffset; - serializePack(tempbuf, vlistvarNint, CDI_DATATYPE_INT, buf, size, position, context); - serializePack(dtempbuf, vlistvar_ndbls, CDI_DATATYPE_FLT64, buf, size, position, context); - if (extralen) serializePack(var->extra, extralen, CDI_DATATYPE_TXT, buf, size, position, context); + int nlevs; + { + int tempbuf[vlistvarNint]; + tempbuf[VLISTVAR_PACK_INT_IDX_FLAG] = var->flag; + tempbuf[VLISTVAR_PACK_INT_IDX_GRIDID] = var->gridID; + tempbuf[VLISTVAR_PACK_INT_IDX_ZAXISID] = var->zaxisID; + tempbuf[VLISTVAR_PACK_INT_IDX_TIMETYPE] = var->timetype; + tempbuf[VLISTVAR_PACK_INT_IDX_DATATYPE] = var->datatype; + tempbuf[VLISTVAR_PACK_INT_IDX_PARAM] = var->param; + tempbuf[VLISTVAR_PACK_INT_IDX_INSTID] = var->instID; + tempbuf[VLISTVAR_PACK_INT_IDX_MODELID] = var->modelID; + tempbuf[VLISTVAR_PACK_INT_IDX_TABLEID] = var->tableID; + tempbuf[VLISTVAR_PACK_INT_IDX_MISSVALUSED] = (int) var->missvalused; + tempbuf[VLISTVAR_PACK_INT_IDX_COMPTYPE] = var->comptype; + tempbuf[VLISTVAR_PACK_INT_IDX_COMPLEVEL] = var->complevel; + nlevs = var->levinfo ? zaxisInqSize(var->zaxisID) : 0; + tempbuf[VLISTVAR_PACK_INT_IDX_NLEVS] = nlevs; + serializePack(tempbuf, vlistvarNint, CDI_DATATYPE_INT, buf, size, position, context); + } + { + double dtempbuf[vlistvar_ndbls]; + dtempbuf[VLIST_VAR_PACK_DBL_MISSVAL] = var->missval; + serializePack(dtempbuf, vlistvar_ndbls, CDI_DATATYPE_FLT64, buf, size, position, context); + } if (nlevs) { int *levbuf = (int *) malloc(nlevs * sizeof(int)); @@ -97,9 +93,9 @@ vlistVarPack(vlist_t *p, int varID, char *buf, int size, int *position, void *co void vlistVarUnpack(int vlistID, char *buf, int size, int *position, int originNamespace, void *context) { +#define adaptKey(key) (namespaceAdaptKey((key), originNamespace)) double dtempbuf[vlistvar_ndbls]; int tempbuf[vlistvarNint]; - char *varname = NULL; vlist_t *vlistptr = vlist_to_pointer(vlistID); serializeUnpack(buf, size, position, tempbuf, vlistvarNint, CDI_DATATYPE_INT, context); serializeUnpack(buf, size, position, dtempbuf, vlistvar_ndbls, CDI_DATATYPE_FLT64, context); @@ -108,26 +104,15 @@ vlistVarUnpack(int vlistID, char *buf, int size, int *position, int originNamesp /* NOTE: Tile sets currently not supported!!! */ /* ------------------------------------------- */ - int newvar = vlistDefVar(vlistID, namespaceAdaptKey(tempbuf[VLISTVAR_PACK_INT_IDX_GRIDID], originNamespace), - namespaceAdaptKey(tempbuf[VLISTVAR_PACK_INT_IDX_ZAXISID], originNamespace), - tempbuf[VLISTVAR_PACK_INT_IDX_TIMETYPE]); - if (tempbuf[VLISTVAR_PACK_INT_IDX_EXTRALEN]) varname = (char *) Malloc((size_t) tempbuf[VLISTVAR_PACK_INT_IDX_EXTRALEN] + 1); - if (tempbuf[VLISTVAR_PACK_INT_IDX_EXTRALEN]) - { - serializeUnpack(buf, size, position, varname, tempbuf[VLISTVAR_PACK_INT_IDX_EXTRALEN], CDI_DATATYPE_TXT, context); - varname[tempbuf[VLISTVAR_PACK_INT_IDX_EXTRALEN]] = '\0'; - vlistDefVarExtra(vlistID, newvar, varname); - } - Free(varname); + int newvar = vlistDefVar(vlistID, adaptKey(tempbuf[VLISTVAR_PACK_INT_IDX_GRIDID]), + adaptKey(tempbuf[VLISTVAR_PACK_INT_IDX_ZAXISID]), tempbuf[VLISTVAR_PACK_INT_IDX_TIMETYPE]); vlistDefVarDatatype(vlistID, newvar, tempbuf[VLISTVAR_PACK_INT_IDX_DATATYPE]); - vlistDefVarInstitut(vlistID, newvar, namespaceAdaptKey(tempbuf[VLISTVAR_PACK_INT_IDX_INSTID], originNamespace)); - vlistDefVarModel(vlistID, newvar, namespaceAdaptKey(tempbuf[VLISTVAR_PACK_INT_IDX_MODELID], originNamespace)); + vlistDefVarInstitut(vlistID, newvar, adaptKey(tempbuf[VLISTVAR_PACK_INT_IDX_INSTID])); + vlistDefVarModel(vlistID, newvar, adaptKey(tempbuf[VLISTVAR_PACK_INT_IDX_MODELID])); vlistDefVarTable(vlistID, newvar, tempbuf[VLISTVAR_PACK_INT_IDX_TABLEID]); // FIXME: changing the table might change the param code vlistDefVarParam(vlistID, newvar, tempbuf[VLISTVAR_PACK_INT_IDX_PARAM]); - if (tempbuf[VLISTVAR_PACK_INT_IDX_MISSVALUSED]) vlistDefVarMissval(vlistID, newvar, dtempbuf[0]); - vlistDefVarScalefactor(vlistID, newvar, dtempbuf[1]); - vlistDefVarAddoffset(vlistID, newvar, dtempbuf[2]); + if (tempbuf[VLISTVAR_PACK_INT_IDX_MISSVALUSED]) vlistDefVarMissval(vlistID, newvar, dtempbuf[VLIST_VAR_PACK_DBL_MISSVAL]); vlistDefVarCompType(vlistID, newvar, tempbuf[VLISTVAR_PACK_INT_IDX_COMPTYPE]); vlistDefVarCompLevel(vlistID, newvar, tempbuf[VLISTVAR_PACK_INT_IDX_COMPLEVEL]); const int nlevs = tempbuf[VLISTVAR_PACK_INT_IDX_NLEVS]; @@ -151,11 +136,11 @@ vlistVarUnpack(int vlistID, char *buf, int size, int *position, int originNamesp for (i = 0; i < nlevs; ++i) var->levinfo[i].flevelID = levbuf[i]; free(levbuf); } - vlistDefVarIOrank(vlistID, newvar, tempbuf[VLISTVAR_PACK_INT_IDX_IORANK]); serializeKeysUnpack(buf, size, position, &var->keys, context); cdiAttsUnpack(vlistID, newvar, buf, size, position, context); +#undef adaptKey } /* diff --git a/src/zaxis.c b/src/zaxis.c index 75661a92ba5ceb6fba43be3241e96630400c72b2..d3bc4ec309d0c53b72840c2aca8f43d30ba1a44d 100644 --- a/src/zaxis.c +++ b/src/zaxis.c @@ -27,34 +27,34 @@ static const struct const char *units; } ZaxistypeEntry[] = { - { /* 0 */ 0, "sfc", "surface", "", ""}, - { /* 1 */ 0, "lev", "generic", "", ""}, - { /* 2 */ 2, "lev", "hybrid", "", "level"}, - { /* 3 */ 2, "lev", "hybrid_half", "", "level"}, - { /* 4 */ 2, "plev", "pressure", "air_pressure", "Pa"}, - { /* 5 */ 1, "height", "height", "height", "m"}, - { /* 6 */ 2, "depth", "depth_below_sea", "depth", "m"}, - { /* 7 */ 2, "depth", "depth_below_land", "", "cm"}, - { /* 8 */ 0, "lev", "isentropic", "", "K"}, - { /* 9 */ 0, "lev", "trajectory", "", ""}, - { /* 10 */ 1, "alt", "altitude", "", "m"}, - { /* 11 */ 0, "lev", "sigma", "", "level"}, - { /* 12 */ 0, "lev", "meansea", "", "level"}, - { /* 13 */ 0, "toa", "top_of_atmosphere", "", ""}, - { /* 14 */ 0, "seabottom", "sea_bottom", "", ""}, - { /* 15 */ 0, "atmosphere", "atmosphere", "", ""}, - { /* 16 */ 0, "cloudbase", "cloud_base", "", ""}, - { /* 17 */ 0, "cloudtop", "cloud_top", "", ""}, - { /* 18 */ 0, "isotherm0", "isotherm_zero", "", ""}, - { /* 19 */ 0, "snow", "snow", "", ""}, - { /* 20 */ 0, "lakebottom", "lake_bottom", "", ""}, - { /* 21 */ 0, "sedimentbottom", "sediment_bottom", "", ""}, - { /* 22 */ 0, "sedimentbottomta", "sediment_bottom_ta", "", ""}, - { /* 23 */ 0, "sedimentbottomtw", "sediment_bottom_tw", "", ""}, - { /* 24 */ 0, "mixlayer", "mix_layer", "", ""}, - { /* 25 */ 0, "height", "generalized_height", "height", ""}, - { /* 26 */ 0, "character", "area_type", "", ""}, - { /* 27 */ 0, "tropopause", "tropopause", "", ""}, + { /* 0 */ 0, "sfc", "surface", "", ""}, + { /* 1 */ 0, "lev", "generic", "", ""}, + { /* 2 */ 2, "lev", "hybrid", "", "level"}, + { /* 3 */ 2, "lev", "hybrid_half", "", "level"}, + { /* 4 */ 2, "plev", "pressure", "air_pressure", "Pa"}, + { /* 5 */ 1, "height", "height", "height", "m"}, + { /* 6 */ 2, "depth", "depth_below_sea", "depth", "m"}, + { /* 7 */ 2, "depth", "depth_below_land", "", "cm"}, + { /* 8 */ 0, "lev", "isentropic", "", "K"}, + { /* 9 */ 0, "lev", "trajectory", "", ""}, + { /* 10 */ 1, "alt", "height above mean sea level", "altitude", "m"}, + { /* 11 */ 0, "lev", "sigma", "", "level"}, + { /* 12 */ 0, "lev", "meansea", "", "level"}, + { /* 13 */ 0, "toa", "top_of_atmosphere", "", ""}, + { /* 14 */ 0, "seabottom", "sea_bottom", "", ""}, + { /* 15 */ 0, "atmosphere", "atmosphere", "", ""}, + { /* 16 */ 0, "cloudbase", "cloud_base", "", ""}, + { /* 17 */ 0, "cloudtop", "cloud_top", "", ""}, + { /* 18 */ 0, "isotherm0", "isotherm_zero", "", ""}, + { /* 19 */ 0, "snow", "snow", "", ""}, + { /* 20 */ 0, "lakebottom", "lake_bottom", "", ""}, + { /* 21 */ 0, "sedimentbottom", "sediment_bottom", "", ""}, + { /* 22 */ 0, "sedimentbottomta", "sediment_bottom_ta", "", ""}, + { /* 23 */ 0, "sedimentbottomtw", "sediment_bottom_tw", "", ""}, + { /* 24 */ 0, "mixlayer", "mix_layer", "", ""}, + { /* 25 */ 0, "height", "generalized_height", "height", ""}, + { /* 26 */ 0, "character", "area_type", "", ""}, + { /* 27 */ 0, "tropopause", "tropopause", "", ""}, }; // clang-format on @@ -68,7 +68,7 @@ static void zaxisDestroyP(void *zaxisptr); static void zaxisPrintP(void *zaxisptr, FILE *fp); static int zaxisGetPackSize(void *zaxisptr, void *context); static void zaxisPack(void *zaxisptr, void *buffer, int size, int *pos, void *context); -static int zaxisTxCode(void); +static int zaxisTxCode(void *zaxisptr); static const resOps zaxisOps = { (int (*)(void *, void *)) zaxisCompareP, zaxisDestroyP, zaxisPrintP, zaxisGetPackSize, zaxisPack, zaxisTxCode }; @@ -79,8 +79,6 @@ getZaxisOps(void) return &zaxisOps; } -static int ZAXIS_Debug = 0; /* If set to 1, debugging */ - void zaxisGetTypeDescription(int zaxisType, int *outPositive, const char **outName, const char **outLongName, const char **outStdName, const char **outUnit) @@ -159,15 +157,12 @@ zaxisInit(void) static bool zaxisInitialized = false; if (zaxisInitialized) return; zaxisInitialized = true; - - const char *env = getenv("ZAXIS_DEBUG"); - if (env) ZAXIS_Debug = atoi(env); } static void zaxis_copy(zaxis_t *zaxisptr2, zaxis_t *zaxisptr1) { - const int zaxisID2 = zaxisptr2->self; + int zaxisID2 = zaxisptr2->self; memcpy(zaxisptr2, zaxisptr1, sizeof(zaxis_t)); zaxisptr2->self = zaxisID2; cdiInitKeys(&zaxisptr2->keys); @@ -192,7 +187,7 @@ zaxisCreate_(int zaxistype, int size, int id) if (zaxistype >= CDI_NumZaxistype || zaxistype < 0) Error("Internal problem! zaxistype=%d out of range (min=0/max=%d)!", zaxistype, CDI_NumZaxistype - 1); - const int zaxisID = zaxisptr->self; + int zaxisID = zaxisptr->self; cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, ZaxistypeEntry[zaxistype].name); if (zaxistype != ZAXIS_GENERIC) zaxisDefLongname(zaxisID, ZaxistypeEntry[zaxistype].longname); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, ZaxistypeEntry[zaxistype].units); @@ -261,8 +256,6 @@ zaxisDestroyKernel(zaxis_t *zaxisptr) { xassert(zaxisptr); - const int id = zaxisptr->self; - if (zaxisptr->vals) Free(zaxisptr->vals); #ifndef USE_MPI if (zaxisptr->cvals) @@ -276,12 +269,11 @@ zaxisDestroyKernel(zaxis_t *zaxisptr) if (zaxisptr->weights) Free(zaxisptr->weights); if (zaxisptr->vct) Free(zaxisptr->vct); - cdiDeleteKeys(id, CDI_GLOBAL); - cdiDeleteAtts(id, CDI_GLOBAL); + int zaxisID = zaxisptr->self; + cdiDeleteKeys(zaxisID, CDI_GLOBAL); + cdiDeleteAtts(zaxisID, CDI_GLOBAL); Free(zaxisptr); - - reshRemove(id, &zaxisOps); } /* @@ -299,6 +291,7 @@ zaxisDestroy(int zaxisID) { zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); zaxisDestroyKernel(zaxisptr); + reshRemove(zaxisID, &zaxisOps); } static void @@ -609,7 +602,7 @@ void zaxisDefLevel(int zaxisID, int levelID, double level) { zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); - const int size = zaxisptr->size; + int size = zaxisptr->size; xassert(size); xassert(levelID >= 0 && levelID < size); @@ -911,7 +904,7 @@ zaxisInqLevelID(int zaxisID, double level) zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); if (zaxisptr->vals) { - const int size = zaxisptr->size; + int size = zaxisptr->size; for (int i = 0; i < size; i++) if (fabs(level - zaxisptr->vals[i]) < DBL_EPSILON) { @@ -985,7 +978,7 @@ cdiCheckZaxis(int zaxisID) if (zaxisInqType(zaxisID) == ZAXIS_GENERIC && zaxisptr->vals) { - const int size = zaxisptr->size; + int size = zaxisptr->size; if (size > 1) { /* check direction */ @@ -1130,10 +1123,10 @@ zaxisDuplicate(int zaxisID) { zaxis_t *zaxisptr = zaxis_to_pointer(zaxisID); - const int zaxistype = zaxisInqType(zaxisID); - const int zaxissize = zaxisInqSize(zaxisID); + int zaxistype = zaxisInqType(zaxisID); + int zaxissize = zaxisInqSize(zaxisID); - const int zaxisIDnew = zaxisCreate(zaxistype, zaxissize); + int zaxisIDnew = zaxisCreate(zaxistype, zaxissize); zaxis_t *zaxisptrnew = zaxis_to_pointer(zaxisIDnew); zaxis_copy(zaxisptrnew, zaxisptr); @@ -1189,10 +1182,10 @@ zaxisPrintKernel(zaxis_t *zaxisptr, FILE *fp) int datatype = CDI_UNDEFID; cdiInqKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_DATATYPE, &datatype); - const int type = zaxisptr->type; - const int nlevels = zaxisptr->size; + int type = zaxisptr->type; + int nlevels = zaxisptr->size; - const int dig = (datatype == CDI_DATATYPE_FLT64) ? 15 : 7; + int dig = (datatype == CDI_DATATYPE_FLT64) ? 15 : 7; fprintf(fp, "zaxistype = %s\n", zaxisNamePtr(type)); fprintf(fp, "size = %d\n", nlevels); @@ -1259,7 +1252,7 @@ zaxisPrintKernel(zaxis_t *zaxisptr, FILE *fp) if (type == ZAXIS_HYBRID || type == ZAXIS_HYBRID_HALF) { - const int vctsize = zaxisptr->vctsize; + int vctsize = zaxisptr->vctsize; const double *vct = zaxisptr->vct; fprintf(fp, "vctsize = %d\n", vctsize); if (vctsize) @@ -1368,14 +1361,25 @@ zaxisCompareP(zaxis_t *z1, zaxis_t *z2) } static int -zaxisTxCode(void) +zaxisTxCode(void *zaxisPtr) { + (void) zaxisPtr; return ZAXIS; } enum { - zaxisNint = 6, + ZAXIS_PACK_INT_SELF, + ZAXIS_PACK_INT_TYPE, + ZAXIS_PACK_INT_SIZE, + ZAXIS_PACK_INT_DIRECTION, + ZAXIS_PACK_INT_VCTSIZE, + ZAXIS_PACK_INT_MEMBERMASK, + zaxisNint +}; + +enum +{ vals = 1 << 0, lbounds = 1 << 1, ubounds = 1 << 2, @@ -1430,12 +1434,12 @@ zaxisGetPackSize(void *voidP, void *context) packBufferSize += serializeKeysGetPackSize(&zaxisP->keys, context); - packBufferSize += serializeGetSize(1, CDI_DATATYPE_UCHAR, context); + packBufferSize += serializeGetSize(1, CDI_DATATYPE_UINT, context); return packBufferSize; } -void +int zaxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id) { int intBuffer[zaxisNint], memberMask; @@ -1448,13 +1452,13 @@ zaxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int zaxisInit(); - zaxis_t *zaxisP = zaxisNewEntry(force_id ? namespaceAdaptKey(intBuffer[0], originNamespace) : CDI_UNDEFID); + zaxis_t *zaxisP = zaxisNewEntry(force_id ? namespaceAdaptKey(intBuffer[ZAXIS_PACK_INT_SELF], originNamespace) : CDI_UNDEFID); - zaxisP->type = intBuffer[1]; - zaxisP->size = intBuffer[2]; - zaxisP->direction = intBuffer[3]; - zaxisP->vctsize = intBuffer[4]; - memberMask = intBuffer[5]; + zaxisP->type = intBuffer[ZAXIS_PACK_INT_TYPE]; + zaxisP->size = intBuffer[ZAXIS_PACK_INT_SIZE]; + zaxisP->direction = intBuffer[ZAXIS_PACK_INT_DIRECTION]; + zaxisP->vctsize = intBuffer[ZAXIS_PACK_INT_VCTSIZE]; + memberMask = intBuffer[ZAXIS_PACK_INT_MEMBERMASK]; if (memberMask & vals) { @@ -1516,6 +1520,7 @@ zaxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int serializeUnpack(unpackBuffer, unpackBufferSize, unpackBufferPos, &zaxisP->positive, 1, CDI_DATATYPE_UINT, context); reshSetStatus(zaxisP->self, &zaxisOps, reshGetStatus(zaxisP->self, &zaxisOps) & ~RESH_SYNC_BIT); + return zaxisP->self; } static void @@ -1526,12 +1531,12 @@ zaxisPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos, int memberMask; uint32_t d; - intBuffer[0] = zaxisP->self; - intBuffer[1] = zaxisP->type; - intBuffer[2] = zaxisP->size; - intBuffer[3] = zaxisP->direction; - intBuffer[4] = zaxisP->vctsize; - intBuffer[5] = memberMask = zaxisGetMemberMask(zaxisP); + intBuffer[ZAXIS_PACK_INT_SELF] = zaxisP->self; + intBuffer[ZAXIS_PACK_INT_TYPE] = zaxisP->type; + intBuffer[ZAXIS_PACK_INT_SIZE] = zaxisP->size; + intBuffer[ZAXIS_PACK_INT_DIRECTION] = zaxisP->direction; + intBuffer[ZAXIS_PACK_INT_VCTSIZE] = zaxisP->vctsize; + intBuffer[ZAXIS_PACK_INT_MEMBERMASK] = memberMask = zaxisGetMemberMask(zaxisP); serializePack(intBuffer, zaxisNint, CDI_DATATYPE_INT, packBuffer, packBufferSize, packBufferPos, context); d = cdiCheckSum(CDI_DATATYPE_INT, zaxisNint, intBuffer); diff --git a/src/zaxis.h b/src/zaxis.h index de3f91ca974810f1bacbacfd9c44f12608c489e7..17d4e44da59dfe193d2b8f91b929336893bccf09 100644 --- a/src/zaxis.h +++ b/src/zaxis.h @@ -43,7 +43,7 @@ zaxis_t *zaxis_to_pointer(int zaxisID); void cdiZaxisGetIndexList(unsigned numIDs, int *IDs); -void zaxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id); +int zaxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int originNamespace, void *context, int force_id); const resOps *getZaxisOps(void); diff --git a/tests/Makefile.am b/tests/Makefile.am index bdcc8138ba45edf110a4e60f62b9e657a7340051..d530636e10f01568e32e65549577637f058d3f70 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,75 +1,240 @@ -## Process this file with automake to produce Makefile.in -# -#TESTS = test_grib.sh -TESTS = cksum_verify \ - test_cksum_grib test_cksum_nc test_cksum_extra \ - test_cksum_service test_cksum_nc2 test_cksum_nc4 test_cksum_ieg \ - test_chunk_cksum \ - pio_write_run pio_cksum_mpinonb pio_cksum_fpguard \ - pio_cksum_asynch pio_cksum_writer pio_cksum_cdf \ - pio_cksum_mpi_fw_ordered \ - pio_cksum_mpi_fw_at_all \ - pio_cksum_mpi_fw_at_reblock \ - test_resource_copy_run pio_write_deco2d_run \ - test_f2003 test_cdf_transformation \ - test_table_run test_byteswap_run - -#test_cdf_const: deactivated (depends on app/cdi) - -check_PROGRAMS = cksum_verify test_grib cksum_write cksum_read pio_write \ - test_resource_copy cksum_write_chunk pio_write_deco2d test_table \ - test_byteswap +TEST_EXTENSIONS = @EXEEXT@ .run + +# Serial tests: +TESTS = \ + calendar_test1 \ + cksum_verify \ + pio_write.run \ + pio_write_deco2d.run \ + test_byteswap.run \ + test_cdf_const.run \ + test_cdf_transformation.run \ + test_cksum_ext.run \ + test_cksum_grb.run \ + test_cksum_grb2.run \ + test_cksum_ieg.run \ + test_cksum_nc.run \ + test_cksum_nc2.run \ + test_cksum_nc4.run \ + test_cksum_nc_chunk.run \ + test_cksum_srv.run \ + test_f2003.run \ + test_grib.run \ + test_month_adjust \ + test_resource_copy.run \ + test_table.run + +# Update test_cksum_base before running tests that source it: +test_cksum_TEST_LOGS_ = \ + test_cksum_ext.log \ + test_cksum_grb.log \ + test_cksum_grb2.log \ + test_cksum_ieg.log \ + test_cksum_nc.log \ + test_cksum_nc2.log \ + test_cksum_nc4.log \ + test_cksum_srv.log +$(test_cksum_TEST_LOGS_): test_cksum_base + +# Parallel tests: +TESTS += \ + pio_cksum_asynch.run \ + pio_cksum_fpguard.run \ + pio_cksum_grb2.run \ + pio_cksum_mpi_fw_at_all.run \ + pio_cksum_mpi_fw_at_reblock.run \ + pio_cksum_mpi_fw_ordered.run \ + pio_cksum_mpinonb.run \ + pio_cksum_nc.run \ + pio_cksum_nc2.run \ + pio_cksum_nc4.run \ + pio_cksum_writer.run \ + pio_write.parallel.run \ + pio_write_deco2d.parallel.run \ + pio_write_dist_array.run \ + test_resource_copy.parallel.run + +# Update pio_write_dist_array.run before running tests that source it: +pio_write_dist_array_TEST_LOGS_ = \ + pio_cksum_asynch.log \ + pio_cksum_fpguard.log \ + pio_cksum_grb2.log \ + pio_cksum_mpi_fw_at_all.log \ + pio_cksum_mpi_fw_at_reblock.log \ + pio_cksum_mpi_fw_ordered.log \ + pio_cksum_mpinonb.log \ + pio_cksum_nc.log \ + pio_cksum_nc2.log \ + pio_cksum_nc4.log \ + pio_cksum_writer.log +$(pio_write_dist_array_TEST_LOGS_): pio_write_dist_array.run + +# Update pio_write.run before running tests that source it: +pio_write_TEST_LOGS_ = \ + $(pio_write_dist_array_TEST_LOGS_) \ + pio_write.parallel.log \ + pio_write_deco2d.log \ + pio_write_deco2d.parallel.log \ + pio_write_dist_array.log +$(pio_write_TEST_LOGS_): pio_write.run + +if !with_concurrent_mpi_checks +pio_cksum_fpguard.log: pio_cksum_asynch.log +pio_cksum_grb2.log: pio_cksum_fpguard.log +pio_cksum_mpi_fw_at_all.log: pio_cksum_grb2.log +pio_cksum_mpi_fw_at_reblock.log: pio_cksum_mpi_fw_at_all.log +pio_cksum_mpi_fw_ordered.log: pio_cksum_mpi_fw_at_reblock.log +pio_cksum_mpinonb.log: pio_cksum_mpi_fw_ordered.log +pio_cksum_nc.log: pio_cksum_mpinonb.log +pio_cksum_nc2.log: pio_cksum_nc.log +pio_cksum_nc4.log: pio_cksum_nc2.log +pio_cksum_writer.log: pio_cksum_nc4.log +pio_write.parallel.log: pio_cksum_writer.log +pio_write_deco2d.parallel.log: pio_write.parallel.log +pio_write_dist_array.log: pio_write_deco2d.parallel.log +test_resource_copy.parallel.log: pio_write_dist_array.log +endif !with_concurrent_mpi_checks + +test_PROGRAMS_ = \ + calendar_test1 \ + cksum_read \ + cksum_verify \ + cksum_write \ + cksum_write_chunk \ + pio_write \ + pio_write_deco2d \ + test_byteswap \ + test_grib \ + test_month_adjust \ + test_resource_copy \ + test_table if ENABLE_NETCDF -check_PROGRAMS += test_cdf_write test_cdf_read +test_PROGRAMS_ += \ + test_cdf_read \ + test_cdf_write endif -# -test_grib_SOURCES = test_grib.c +if ENABLE_MPI +test_PROGRAMS_ += \ + pio_write.parallel \ + pio_write_deco2d.parallel \ + test_resource_copy.parallel +endif ENABLE_MPI + +if with_on_demand_check_programs +check_PROGRAMS = $(test_PROGRAMS_) +else !with_on_demand_check_programs +noinst_PROGRAMS = $(test_PROGRAMS_) +endif !with_on_demand_check_programs + +AM_CPPFLAGS = -I$(top_srcdir)/src +AM_CFLAGS = $(PPM_CORE_C_INCLUDE) $(YAXT_C_INCLUDE) $(MPI_C_INCLUDE) + +AM_LDFLAGS = +if ENABLE_ALL_STATIC +AM_LDFLAGS += -all-static +endif + +LDADD = $(top_builddir)/src/libcdi.la + +calendar_test1_SOURCES = calendar_test1.c + +cksum_read_SOURCES = \ + cksum_read.c \ + ensure_array_size.c \ + ensure_array_size.h \ + stream_cksum.c \ + stream_cksum.h \ + var_cksum.c \ + var_cksum.h + cksum_verify_SOURCES = cksum_verify.c -cksum_write_SOURCES = cksum_write.c simple_model_helper.h simple_model_helper.c -cksum_write_chunk_SOURCES = cksum_write_chunk.c simple_model_helper.h simple_model_helper.c -cksum_read_SOURCES = cksum_read.c \ - var_cksum.c var_cksum.h \ - stream_cksum.c stream_cksum.h \ - ensure_array_size.h ensure_array_size.c -pio_write_SOURCES = pio_write.c pio_write.h simple_model.c \ - simple_model_helper.h simple_model_helper.c -pio_write_deco2d_SOURCES = pio_write.c pio_write.h deco2d_model.c \ - simple_model_helper.h simple_model_helper.c + +cksum_write_SOURCES = \ + cksum_write.c \ + simple_model_helper.c \ + simple_model_helper.h + +cksum_write_chunk_SOURCES = \ + cksum_write_chunk.c \ + simple_model_helper.c \ + simple_model_helper.h + +pio_write_SOURCES = \ + pio_write.c \ + pio_write.h \ + pio_write_setup_grid.c \ + pio_write_setup_grid.h \ + simple_model.c \ + simple_model_helper.c \ + simple_model_helper.h +nodist_pio_write_parallel_SOURCES = $(pio_write_SOURCES:.c=.parallel.c) +pio_write_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(PPM_CORE_C_LIB) $(YAXT_C_LIB) $(LDADD) + +pio_write_deco2d_SOURCES = \ + deco2d_model.c \ + pio_write.c \ + pio_write.h \ + pio_write_setup_grid.c \ + pio_write_setup_grid.h \ + simple_model_helper.c \ + simple_model_helper.h +nodist_pio_write_deco2d_parallel_SOURCES = $(pio_write_deco2d_SOURCES:.c=.parallel.c) +pio_write_deco2d_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(PPM_CORE_C_LIB) $(YAXT_C_LIB) $(LDADD) + +test_byteswap_SOURCES = test_byteswap.c + +test_grib_SOURCES = test_grib.c + +test_month_adjust_SOURCES = test_month_adjust.c + test_resource_copy_SOURCES = test_resource_copy.c -test_resource_copy_LDADD = ../src/libcdiresunpack.la $(LDADD) -test_resource_copy_mpi_SOURCES = test_resource_copy.c -test_cdf_write_SOURCES = test_cdf_write.c -test_cdf_read_SOURCES = test_cdf_read.c +test_resource_copy_LDADD = $(top_builddir)/src/libcdiresunpack.la +nodist_test_resource_copy_parallel_SOURCES = $(test_resource_copy_SOURCES:.c=.parallel.c) +test_resource_copy_parallel_LDADD = $(top_builddir)/src/libcdipio.la $(LDADD) + test_table_SOURCES = test_table.c -test_byteswap_SOURCES = test_byteswap.c -# -AM_CFLAGS = $(PPM_CORE_CFLAGS) $(YAXT_CFLAGS) $(MPI_C_INCLUDE) -if USE_MPI -pio_write_LDADD = ../src/libcdipio.la ../src/libcdi.la $(PPM_CORE_LIBS) $(YAXT_LIBS) $(MPI_C_LIB) -pio_write_deco2d_LDADD = ../src/libcdipio.la ../src/libcdi.la $(PPM_CORE_LIBS) $(YAXT_LIBS) $(MPI_C_LIB) -TESTS += test_resource_copy_mpi_run -check_PROGRAMS += test_resource_copy_mpi -test_resource_copy_mpi_LDADD = ../src/libcdipio.la ../src/libcdi.la -test_resource_copy_mpi_CFLAGS = $(AM_CFLAGS) $(CFLAGS) \ - -DMPI_MARSHALLING -else -pio_write_LDADD = $(LDADD) -pio_write_deco2d_LDADD = $(LDADD) -test_resource_copy_mpi_LDADD = $(LDADD) -endif -LDADD = ../src/libcdi.la -AM_CPPFLAGS = -I$(top_srcdir)/src -# -EXTRA_DIST = test_cdf_write.c test_cdf_read.c test_cksum_base -# +test_cdf_read_SOURCES = test_cdf_read.c + +test_cdf_write_SOURCES = \ + simple_model_helper.c \ + simple_model_helper.h \ + test_cdf_write.c + +clean-local: + -rm -f *.parallel.c + -rm -f *.grb *.grb2 *.nc *.nc2 *.nc4 *.srv *.ext *.cksum *.ieg *.stderr *.stdout + -rm -rf *.dSYM + AUTOMAKE_OPTIONS = color-tests -# -clean-local: clean-local-dirs - -rm -f *~ *.grb *.nc *.nc2 *.nc4 *.srv *.ext *.cksum *.ieg *.log -.PHONY: clean-local-dirs -clean-local-dirs: - -rm -rf test_cdf_const.d *.dSYM +# Compile programs using Libtool: +COMPILE = $(LTCOMPILE) +FCCOMPILE = $(LTFCCOMPILE) +PPFCCOMPILE = $(LTPPFCCOMPILE) +CXXCOMPILE = $(LTCXXCOMPILE) + +# Compile *.F90 without CPPFLAGS, which are normally meant for the C compiler +# and might not be compatible with the Fortran compiler: +LTPPFCCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=FC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) + +# Avoid compiling twice by running Libtool with '-static' +# This is safe because all Libtool libraries in this directory are +# static-only and contain PIC objects: +AM_CFLAGS += -static +AM_FCFLAGS = -static +AM_CXXFLAGS = -static + +# Generate source files for parallel versions of the programs. We do this to +# avoid target-specific flags, which result into rules that do not use the +# compilation commands above. +SUFFIXES = .parallel.c + +.c.parallel.c: + $(AM_V_GEN):;{ \ + echo '#define USE_MPI 1'; \ + echo '#include "$<"'; \ + } >$@ diff --git a/tests/calendar_test1.c b/tests/calendar_test1.c new file mode 100644 index 0000000000000000000000000000000000000000..500a5c877456ef4b7be2053f80116f1a518847d1 --- /dev/null +++ b/tests/calendar_test1.c @@ -0,0 +1,107 @@ +#include <stdio.h> +#include <stdlib.h> + +#include "cdi.h" +#include "julian_date.h" + +int +main(void) +{ + int calendar = CALENDAR_STANDARD; + int j = 0; + + // 1 - Check valid range of years + { + int nmin = 11000; + int vdate0 = -80001201; + int vtime0 = 120500; + + // printf("start time: %8d %4d\n", vdate0, vtime0); + + CdiDateTime dt = cdiDateTime_set(vdate0, vtime0); + + for (int i = 0; i < nmin; i++) + { + JulianDate julianDate = julianDate_encode(calendar, dt); + + dt = julianDate_decode(calendar, julianDate); + int vdate = (int) cdiDate_get(dt.date); + int vtime = cdiTime_get(dt.time); + + if (vdate0 != vdate || vtime0 != vtime) + fprintf(stderr, "%4d %8d %4d %8d %4d %9d %g\n", ++j, vdate0, vtime0, vdate, vtime, (int) julianDate.julianDay, + julianDate.secondOfDay); + + dt.date.year++; + julianDate = julianDate_encode(calendar, dt); + + dt = julianDate_decode(calendar, julianDate); + vdate0 = (int) cdiDate_get(dt.date); + vtime0 = cdiTime_get(dt.time); + } + + // printf("stop time: %8d %4d\n", vdate0, vtime0); + } + // 2 - Check time increment of one minute + { + int nmin = 120000; + int ijulinc = 60; + int vdate0 = 20001201; + int vtime0 = 0; + + // printf("start time: %8d %4d\n", vdate0, vtime0); + + CdiDateTime dt = cdiDateTime_set(vdate0, vtime0); + JulianDate julianDate = julianDate_encode(calendar, dt); + + for (int i = 0; i < nmin; i++) + { + int year, mon, day, hour, minute, second; + cdiDecodeDate(vdate0, &year, &mon, &day); + cdiDecodeTime(vtime0, &hour, &minute, &second); + + if (++minute >= 60) + { + minute = 0; + if (++hour >= 24) + { + hour = 0; + if (++day >= 32) + { + day = 1; + if (++mon >= 13) + { + mon = 1; + year++; + } + } + } + } + + vdate0 = cdiEncodeDate(year, mon, day); + vtime0 = cdiEncodeTime(hour, minute, second); + + julianDate = julianDate_add_seconds(julianDate, ijulinc); + dt = julianDate_decode(calendar, julianDate); + int vdate = (int) cdiDate_get(dt.date); + int vtime = cdiTime_get(dt.time); + + if (vdate0 != vdate || vtime0 != vtime) + fprintf(stderr, "%4d %8d %4d %8d %4d %9d %g\n", ++j, vdate0, vtime0, vdate, vtime, (int) julianDate.julianDay, + julianDate.secondOfDay); + } + + // printf("stop time: %8d %4d\n", vdate0, vtime0); + } + return j == 0 ? EXIT_SUCCESS : EXIT_FAILURE; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ diff --git a/tests/cksum_read.c b/tests/cksum_read.c index 190b61009c950e7e3c32713ccdee01406e2dc82e..fe6a70717e81c39fd03fc09f8c7ba071180bb1aa 100644 --- a/tests/cksum_read.c +++ b/tests/cksum_read.c @@ -1,5 +1,5 @@ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #include <assert.h> @@ -27,10 +27,10 @@ read_table(const char *table_fname, size_t *table_len) if (!(tablefp = fopen(table_fname, "r"))) { perror("failed to open table file"); - *table_len = (size_t)-1; + *table_len = (size_t) -1; return NULL; } - while (fscanf(tablefp, "%08" PRIx32" %d\n", &cksum_temp, &code) == 2) + while (fscanf(tablefp, "%08" PRIx32 " %d\n", &cksum_temp, &code) == 2) { ENSURE_ARRAY_SIZE(table, table_size, table_used + 1); table[table_used].code = code; @@ -42,35 +42,29 @@ read_table(const char *table_fname, size_t *table_len) return table; } - -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { const char *fname = "example.grb", *table_fname = "example.cksum"; - if (argc > 1) - fname = argv[1]; - if (argc > 2) - table_fname = argv[2]; + if (argc > 1) fname = argv[1]; + if (argc > 2) table_fname = argv[2]; // compute checksums from data file size_t nvars; struct cksum_table *file_vars = cksum_stream(fname, &nvars); - if (!file_vars) - exit(EXIT_FAILURE); + if (!file_vars) exit(EXIT_FAILURE); // check checksums from table file int retcode; { size_t num_ref_entries; - struct cksum_table *ref_var_table - = read_table(table_fname, &num_ref_entries); - if (num_ref_entries == (size_t)-1) + struct cksum_table *ref_var_table = read_table(table_fname, &num_ref_entries); + if (num_ref_entries == (size_t) -1) { free(file_vars); exit(EXIT_FAILURE); } - retcode - = compare_checksums(file_vars, nvars, "file", - ref_var_table, num_ref_entries, "reference table"); + retcode = compare_checksums(file_vars, nvars, "file", ref_var_table, num_ref_entries, "reference table"); free(file_vars); free(ref_var_table); } diff --git a/tests/cksum_verify.c b/tests/cksum_verify.c index 7c71da6cfcaeb2e57db33aeae6da12daa7d09eee..eeae9fc57ef0f5d3de1b36e5338ab0488c68ed1e 100644 --- a/tests/cksum_verify.c +++ b/tests/cksum_verify.c @@ -13,7 +13,8 @@ #include "cksum.h" -enum { +enum +{ block_size = 16, }; @@ -23,8 +24,8 @@ main() unsigned char *test_data = NULL, *init_block = NULL; size_t num_blocks = 1000; - if (!(init_block = (unsigned char *)calloc(block_size * block_size, 1U)) - || !(test_data = (unsigned char *)calloc((size_t)block_size * num_blocks, 1U))) + if (!(init_block = (unsigned char *) calloc(block_size * block_size, 1U)) + || !(test_data = (unsigned char *) calloc((size_t) block_size * num_blocks, 1U))) return EXIT_FAILURE; /* this is supposed to be non-random */ @@ -34,23 +35,20 @@ main() /* repeat block and rotate */ for (size_t i = 1; i < block_size; ++i) { - memcpy(init_block + block_size * i, - init_block + block_size - i, i); - memcpy(init_block + block_size * i + i, init_block, - block_size - i); + memcpy(init_block + block_size * i, init_block + block_size - i, i); + memcpy(init_block + block_size * i + i, init_block, block_size - i); } for (size_t i = 0; i < num_blocks; ++i) { - size_t block_idx = ((size_t)lrand48()) % block_size; - memcpy(test_data + i, init_block + block_idx * block_size, - block_size); + size_t block_idx = ((size_t) lrand48()) % block_size; + memcpy(test_data + i, init_block + block_idx * block_size, block_size); } uint32_t cksum_result = memcrc(test_data, num_blocks * block_size); if (cksum_result != UINT32_C(0xc47779cd)) { - printf("unexpected crc result: 0x%8" PRIx32"\n", cksum_result); + printf("unexpected crc result: 0x%8" PRIx32 "\n", cksum_result); return EXIT_FAILURE; } diff --git a/tests/cksum_write.c b/tests/cksum_write.c index 39236a744082683a16a389d1f13a3280eed6cdd2..5a863e6d39c3b8fabfff7b4b87f75fbcdb0887b7 100644 --- a/tests/cksum_write.c +++ b/tests/cksum_write.c @@ -13,6 +13,7 @@ #include "cdi.h" #include "cdi_uuid.h" +#include "dmemory.h" #include "cksum.h" #include "simple_model_helper.h" @@ -22,46 +23,23 @@ parse_intarg(const char msg[]) { char *end; long temp = strtol(optarg, &end, 0); - if ((errno == ERANGE && (temp == LONG_MAX || temp == LONG_MIN)) - || (errno != 0 && temp == 0)) { - perror(msg); - exit(EXIT_FAILURE); - } + if ((errno == ERANGE && (temp == LONG_MAX || temp == LONG_MIN)) || (errno != 0 && temp == 0)) + { + perror(msg); + exit(EXIT_FAILURE); + } if (temp > INT_MAX || temp < INT_MIN) - { - fprintf(stderr, "range error: %ld\n", temp); - exit(EXIT_FAILURE); - } - return (int)temp; + { + fprintf(stderr, "range error: %ld\n", temp); + exit(EXIT_FAILURE); + } + return (int) temp; } /* If we're not using GNU C, elide __attribute__ */ -#if ! defined __GNUC__ && ! defined __attribute__ -# define __attribute__(x) /*NOTHING*/ +#if !defined __GNUC__ && !defined __attribute__ +#define __attribute__(x) /*NOTHING*/ #endif -static void -allocError(const char *msg) __attribute__((noreturn)); - -static void -allocError(const char *msg) -{ - perror(msg); - exit(EXIT_FAILURE); -} - -static char * -fname_create(const char *prefix, const char *suffix) -{ - size_t prefix_len, suffix_len; - char *fname; - if (!(fname = (char *)malloc((prefix_len = strlen(prefix)) + 1 - + (suffix_len = strlen(suffix)) + 1))) - allocError("cannot create string"); - strcpy(fname, prefix); - fname[prefix_len] = '.'; - strcpy(fname + prefix_len + 1, suffix); - return fname; -} static inline void check_positive(int v, const char *msg) @@ -75,40 +53,48 @@ check_positive(int v, const char *msg) #ifdef TEST_CHUNK_WRITE static void -get_chunk(double *chunkBuf, double *var, int varShape[3], - int chunk[3][2]) +get_chunk(double *chunkBuf, double *var, int varShape[3], int chunk[3][2]) { size_t ofs = 0; - unsigned start_k = (unsigned)chunk[2][0], start_j = (unsigned)chunk[1][0], - start_i = (unsigned)chunk[0][0]; - unsigned size_k = (unsigned)chunk[2][1] - (unsigned)chunk[2][0] + 1, - size_j = (unsigned)chunk[1][1] - (unsigned)chunk[1][0] + 1, - size_i = (unsigned)chunk[0][1] - (unsigned)chunk[0][0] + 1; - size_t stride_k = (size_t)varShape[0] * (size_t)varShape[1], - stride_j = (size_t)varShape[0]; - for (unsigned k = 0; k < size_k ; ++k) - for (unsigned j = 0; j < size_j; ++j) - for (unsigned i = 0; i < size_i; ++i) - chunkBuf[ofs++] = var[(k + start_k) * stride_k - + (j + start_j) * stride_j + (i + start_i)]; + size_t start_k = (size_t) chunk[2][0], start_j = (size_t) chunk[1][0], start_i = (size_t) chunk[0][0]; + size_t size_k = (size_t) chunk[2][1] - (size_t) chunk[2][0] + 1, size_j = (size_t) chunk[1][1] - (size_t) chunk[1][0] + 1, + size_i = (size_t) chunk[0][1] - (size_t) chunk[0][0] + 1; + size_t stride_k = (size_t) varShape[0] * (size_t) varShape[1], stride_j = (size_t) varShape[0]; + for (size_t k = 0; k < size_k; ++k) + for (size_t j = 0; j < size_j; ++j) + for (size_t i = 0; i < size_i; ++i) + chunkBuf[ofs++] = var[(k + start_k) * stride_k + (j + start_j) * stride_j + (i + start_i)]; } #endif #ifndef TEST_CHUNK_WRITE -static const struct { - char suffix[4]; +static const struct +{ + char suffix[5]; int type, defaultDT, defaultGrid; } suffix2type[] = { { "nc", CDI_FILETYPE_NC, CDI_DATATYPE_FLT64, GRID_LONLAT }, - { "grb", CDI_FILETYPE_GRB, CDI_DATATYPE_PACK24, GRID_LONLAT }, + { "grb", CDI_FILETYPE_GRB, CDI_DATATYPE_PACK24, GRID_LONLAT }, + { "grb2", CDI_FILETYPE_GRB2, CDI_DATATYPE_PACK24, GRID_LONLAT }, { "nc2", CDI_FILETYPE_NC2, CDI_DATATYPE_FLT64, GRID_LONLAT }, { "nc4", CDI_FILETYPE_NC4, CDI_DATATYPE_FLT64, GRID_LONLAT }, - { "ext", CDI_FILETYPE_EXT, CDI_DATATYPE_FLT64, GRID_GENERIC, }, - { "srv", CDI_FILETYPE_SRV, CDI_DATATYPE_FLT64, GRID_GENERIC, }, + { + "ext", + CDI_FILETYPE_EXT, + CDI_DATATYPE_FLT64, + GRID_GENERIC, + }, + { + "srv", + CDI_FILETYPE_SRV, + CDI_DATATYPE_FLT64, + GRID_GENERIC, + }, { "ieg", CDI_FILETYPE_IEG, CDI_DATATYPE_FLT64, GRID_LONLAT }, }; #endif -enum { +enum +{ nvars = 2, }; @@ -119,21 +105,22 @@ main(int argc, char *argv[]) { int gridID, zaxisID[nvars], taxisID; int vlistID, varID[nvars], streamID; - int nlon = 12, //!< Number of longitudes - nlat = 6, //!< Number of latitudes - nlev = 5, //!< Number of levels - nts = 3; //!< Number of time steps - enum { nmiss = 0 }; - double *lons, *lats, *restrict var[nvars], *levs, mscale, mrscale; + int nlon = 12, //!< Number of longitudes + nlat = 6, //!< Number of latitudes + nlev = 5, //!< Number of levels + nts = 3; //!< Number of time steps + enum + { + nmiss = 0 + }; + double *restrict var[nvars], mscale, mrscale; size_t varSize[nvars]; const char *varName[nvars] = { "varname1", "varname2" }; #ifndef TEST_CHUNK_WRITE const char *suffix = "grb", *prefix = "example"; - int grid = GRID_LONLAT; int filetype = CDI_FILETYPE_GRB, datatype = CDI_DATATYPE_PACK24; #else const char *suffix = "nc", *prefix = "example"; - int grid = GRID_LONLAT; int filetype = CDI_FILETYPE_NC, datatype = CDI_DATATYPE_FLT64; #endif { @@ -142,87 +129,67 @@ main(int argc, char *argv[]) #ifndef TEST_CHUNK_WRITE "f:" #endif - "m:n:o:t:")) != -1) - switch (opt) { -#ifndef TEST_CHUNK_WRITE - case 'f': + "b:m:n:o:t:")) + != -1) + switch (opt) { - int found = 0; - for (size_t i = 0; - i < sizeof (suffix2type) / sizeof (suffix2type[0]); - ++i) - if (!strcmp(optarg, suffix2type[i].suffix)) +#ifndef TEST_CHUNK_WRITE + case 'f': + { + int found = 0; + for (size_t i = 0; i < sizeof(suffix2type) / sizeof(suffix2type[0]); ++i) + if (!strcmp(optarg, suffix2type[i].suffix)) + { + found = 1; + filetype = suffix2type[i].type; + suffix = suffix2type[i].suffix; + datatype = suffix2type[i].defaultDT; + break; + } + if (!found) { - found = 1; - filetype = suffix2type[i].type; - suffix = suffix2type[i].suffix; - datatype = suffix2type[i].defaultDT; - break; + fprintf(stderr, "Unsupported format requested: %s\n", optarg); + exit(EXIT_FAILURE); } - if (!found) + } + break; +#endif + case 'b': prefix = optarg; break; + case 'm': nlon = parse_intarg("error parsing number of longitudes"); check_positive(nlon, "longitudes"); +#ifdef TEST_CHUNK_WRITE + if (nlon < 2) { - fprintf(stderr, "Unsupported format requested: %s\n", optarg); + fputs("number of longitudes must be larger 1 for " + "chunk write test\n", + stderr); exit(EXIT_FAILURE); } - } - break; -#endif - case 'm': - nlon = parse_intarg("error parsing number of longitudes"); - check_positive(nlon, "longitudes"); -#ifdef TEST_CHUNK_WRITE - if (nlon < 2) - { - fputs("number of longitudes must be larger 1 for " - "chunk write test\n", stderr); - exit(EXIT_FAILURE); - } #endif - break; - case 'n': - check_positive(nlat = parse_intarg("error parsing number of latitudes"), - "latitudes"); - break; - case 'o': - check_positive(nlev = parse_intarg("error parsing number of levels"), - "levels"); - break; - case 't': - check_positive(nts = parse_intarg("error parsing number of timesteps"), - "timesteps"); - break; - default: /* '?' */ - fprintf(stderr, "Usage: %s [-m nlon] [-n nlat] [-o nlev] [-t nts]\n", argv[0]); - exit(EXIT_FAILURE); - } + break; + case 'n': check_positive(nlat = parse_intarg("error parsing number of latitudes"), "latitudes"); break; + case 'o': check_positive(nlev = parse_intarg("error parsing number of levels"), "levels"); break; + case 't': check_positive(nts = parse_intarg("error parsing number of timesteps"), "timesteps"); break; + default: /* '?' */ fprintf(stderr, "Usage: %s [-m nlon] [-n nlat] [-o nlev] [-t nts]\n", argv[0]); exit(EXIT_FAILURE); + } } - lons = (double *)malloc((size_t)nlon * sizeof (lons[0])); - for (size_t i = 0; i < (size_t)nlon; ++i) - lons[i] = ((double)(i * 360))/nlon; - lats = (double *)malloc((size_t)nlat * sizeof (lats[0])); - for (size_t i = 0; i < (size_t)nlat; ++i) - lats[i] = ((double)(i * 180))/nlat - 90.0; - levs = (double *)malloc((size_t)nlev * sizeof (levs[0])); - for (size_t i = 0; i < (size_t)nlev; ++i) - levs[i] = 101300 - floor(3940.3 * (exp(2.3579 * (double)(i)/(nlev - 1)) - 1.0)); - - varSize[0] = (size_t)nlon * (size_t)nlat; - varSize[1] = (size_t)nlon * (size_t)nlat * (size_t)nlev; + varSize[0] = (size_t) nlon * (size_t) nlat; + varSize[1] = (size_t) nlon * (size_t) nlat * (size_t) nlev; // Create a regular lon/lat grid - gridID = gridCreate(grid, nlon*nlat); - gridDefXsize(gridID, nlon); - gridDefYsize(gridID, nlat); - gridDefXvals(gridID, lons); - gridDefYvals(gridID, lats); + gridID = createGlobalLatLonGrid(nlon, nlat); // Create a surface level Z-axis zaxisID[0] = zaxisCreate(ZAXIS_SURFACE, 1); // Create a pressure level Z-axis zaxisID[1] = zaxisCreate(ZAXIS_PRESSURE, nlev); - zaxisDefLevels(zaxisID[1], levs); + { + double *levs = (double *) Malloc((size_t) nlev * sizeof(levs[0])); + for (size_t i = 0; i < (size_t) nlev; ++i) levs[i] = 101300 - floor(3940.3 * expm1(2.3579 * (double) i / (nlev - 1))); + zaxisDefLevels(zaxisID[1], levs); + free(levs); + } /* add uuids to zaxis and grid */ { @@ -233,10 +200,7 @@ main(int argc, char *argv[]) cdiStr2UUID(gridUUIDTxt, uuid); gridDefUUID(gridID, uuid); - static char zaxisUUIDTxt[2][37] = { - { "d157f399-5496-4097-a3d8-437a6dda6311" }, - { "6f784a65-bce8-48c9-afa4-4c40130709c7" } - }; + static char zaxisUUIDTxt[2][37] = { { "d157f399-5496-4097-a3d8-437a6dda6311" }, { "6f784a65-bce8-48c9-afa4-4c40130709c7" } }; for (int i = 0; i < 2; ++i) { @@ -262,7 +226,7 @@ main(int argc, char *argv[]) // and set the data type vlistDefVarDatatype(vlistID, varID[i], datatype); // create memory for variables - var[i] = (double *)malloc(varSize[i] * sizeof (var[i][0])); + var[i] = (double *) Malloc(varSize[i] * sizeof(var[i][0])); } var_scale(datatype, &mscale, &mrscale); @@ -271,16 +235,7 @@ main(int argc, char *argv[]) vlistDefTaxis(vlistID, taxisID); // Create a dataset - { - char *fname = fname_create(prefix, suffix); - if ((streamID = streamOpenWrite(fname, filetype)) < 0) - { - fprintf(stderr, "error opening output file %s: %s\n", - fname, cdiStringError(streamID)); - exit(EXIT_FAILURE); - } - free(fname); - } + streamID = composeStream(NULL, prefix, -1, suffix, filetype); // Assign the variable list to the dataset streamDefVlist(streamID, vlistID); @@ -288,36 +243,26 @@ main(int argc, char *argv[]) { uint32_t checksum_state[nvars] = { 0, 0 }; // Loop over the number of time steps - for ( size_t tsID = 0; tsID < (size_t)nts; tsID++ ) + for (size_t tsID = 0; tsID < (size_t) nts; tsID++) { - int vdatetime[2] = { 120000, 19850101+(int)tsID }; + int vdatetime[2] = { 120000, 19850101 + (int) tsID }; // Set the verification date to 1985-01-01 + tsID taxisDefVdate(taxisID, vdatetime[1]); // Set the verification time to 12:00:00 taxisDefVtime(taxisID, vdatetime[0]); // Define the time step - streamDefTimestep(streamID, (int)tsID); + streamDefTimestep(streamID, (int) tsID); // Init var1 and var2 - for (size_t j = 0; j < (size_t)nlat; j++) - for (size_t i = 0; i < (size_t)nlon; i++) - var[0][i+j*(size_t)nlon] - = sign_flat(round( - (sin(2.0 * M_PI * (lons[(i + tsID)%(size_t)nlon] - lons[0]) - / (lons[nlon-1] - lons[0])) - * cos(2.0 * M_PI * (lats[j] - lats[0]) - / (lons[nlat-1] - lats[0])) - ) * mscale)) * mrscale; - for (size_t k = 0; k < (size_t)nlev; ++k) - for (size_t j = 0; j < (size_t)nlat; j++) - for (size_t i = 0; i < (size_t)nlon; i++) - var[1][i+j*(size_t)nlon+k*(size_t)nlon*(size_t)nlat] - = sign_flat(round( - (cos(2.0 * M_PI * (lons[(i + tsID)%(size_t)nlon] - lons[0]) - / (lons[nlon-1] - lons[0])) - * sin(2.0 * M_PI * (lats[j] - lats[0]) - / (lons[nlat-1] - lats[0])) - ) * mscale)) * mrscale; + for (size_t j = 0; j < (size_t) nlat; j++) + for (size_t i = 0; i < (size_t) nlon; i++) + var[0][i + j * (size_t) nlon] = dg_wobble((double) ((i + tsID) % (size_t) nlon) / (double) (nlon - 1), + (double) j / (double) (nlat - 1), mscale, mrscale); + for (size_t k = 0; k < (size_t) nlev; ++k) + for (size_t j = 0; j < (size_t) nlat; j++) + for (size_t i = 0; i < (size_t) nlon; i++) + var[1][i + j * (size_t) nlon + k * (size_t) nlon * (size_t) nlat] = dg_wobble( + (double) j / (double) (nlat - 1), (double) ((i + tsID) % (size_t) nlon) / (double) (nlon - 1), mscale, mrscale); if (filetype == CDI_FILETYPE_EXT) { @@ -327,39 +272,34 @@ main(int argc, char *argv[]) * return */ vdatetime[0] = 0; } - memcrc_r(&checksum_state[0], (const unsigned char *)vdatetime, sizeof (vdatetime)); - memcrc_r(&checksum_state[0], (const unsigned char *)var[0], varSize[0] * sizeof (var[0][0])); - memcrc_r(&checksum_state[1], (const unsigned char *)vdatetime, sizeof (vdatetime)); - memcrc_r(&checksum_state[1], (const unsigned char *)var[1], varSize[1] * sizeof (var[1][0])); + memcrc_r(&checksum_state[0], (const unsigned char *) vdatetime, sizeof(vdatetime)); + memcrc_r(&checksum_state[0], (const unsigned char *) var[0], varSize[0] * sizeof(var[0][0])); + memcrc_r(&checksum_state[1], (const unsigned char *) vdatetime, sizeof(vdatetime)); + memcrc_r(&checksum_state[1], (const unsigned char *) var[1], varSize[1] * sizeof(var[1][0])); // Write var1 and var2 #ifdef TEST_CHUNK_WRITE { - size_t maxChunkSize - = ((size_t)nlon + 1)/2 * (size_t)nlat * (size_t)nlev; - double *chunkBuf = (double *)malloc(maxChunkSize * sizeof (double)); + size_t maxChunkSize = ((size_t) nlon + 1) / 2 * (size_t) nlat * (size_t) nlev; + double *chunkBuf = (double *) Malloc(maxChunkSize * sizeof(double)); int varShape[2][3] = { { nlon, nlat, 1 }, { nlon, nlat, nlev } }, - chunk[3][2] = { { 0, nlon/2 - 1 }, { 0, nlat - 1 }, { 0, 0 } }; - if (!chunkBuf) - allocError("cannot create chunk buffer"); - chunk[0][0] = 0; chunk[0][1] = nlon/2 - 1; + chunk[3][2] = { { 0, nlon / 2 - 1 }, { 0, nlat - 1 }, { 0, 0 } }; + chunk[0][0] = 0; + chunk[0][1] = nlon / 2 - 1; chunk[2][1] = 0; get_chunk(chunkBuf, var[0], varShape[0], chunk); - streamWriteVarChunk(streamID, varID[0], (const int (*)[2])chunk, - chunkBuf, nmiss); + streamWriteVarChunk(streamID, varID[0], (const int(*)[2]) chunk, chunkBuf, nmiss); chunk[2][1] = nlev - 1; get_chunk(chunkBuf, var[1], varShape[1], chunk); - streamWriteVarChunk(streamID, varID[1], (const int (*)[2])chunk, - chunkBuf, nmiss); - chunk[0][0] = chunk[0][1] + 1; chunk[0][1] = nlon - 1; + streamWriteVarChunk(streamID, varID[1], (const int(*)[2]) chunk, chunkBuf, nmiss); + chunk[0][0] = chunk[0][1] + 1; + chunk[0][1] = nlon - 1; chunk[2][1] = 0; get_chunk(chunkBuf, var[0], varShape[0], chunk); - streamWriteVarChunk(streamID, varID[0], (const int (*)[2])chunk, - chunkBuf, nmiss); + streamWriteVarChunk(streamID, varID[0], (const int(*)[2]) chunk, chunkBuf, nmiss); chunk[2][1] = nlev - 1; get_chunk(chunkBuf, var[1], varShape[1], chunk); - streamWriteVarChunk(streamID, varID[1], (const int (*)[2])chunk, - chunkBuf, nmiss); + streamWriteVarChunk(streamID, varID[1], (const int(*)[2]) chunk, chunkBuf, nmiss); free(chunkBuf); } #else @@ -371,7 +311,8 @@ main(int argc, char *argv[]) { FILE *tablefp; { - char *fname = fname_create(prefix, "cksum"); + char *fname = NULL; + composeFilename(&fname, prefix, -1, "cksum"); if (!(tablefp = fopen(fname, "w"))) { perror("failed to open table file"); @@ -379,16 +320,13 @@ main(int argc, char *argv[]) } free(fname); } - for (size_t i = 0; i < (size_t)nvars; ++i) + for (size_t i = 0; i < (size_t) nvars; ++i) { uint32_t cksum; int code; - cksum - = memcrc_finish(&checksum_state[i], - (off_t)((varSize[i] * sizeof (var[i][0]) - + sizeof (int) * 2) * (size_t)nts)); + cksum = memcrc_finish(&checksum_state[i], (off_t) ((varSize[i] * sizeof(var[i][0]) + sizeof(int) * 2) * (size_t) nts)); code = vlistInqVarCode(vlistID, varID[i]); - if (fprintf(tablefp, "%08lx %d\n", (unsigned long)cksum, code) < 0) + if (fprintf(tablefp, "%08lx %d\n", (unsigned long) cksum, code) < 0) { perror("failed to write table file"); exit(EXIT_FAILURE); @@ -402,16 +340,12 @@ main(int argc, char *argv[]) streamClose(streamID); // Destroy the objects - for (size_t i = 0; i < nvars; ++i) - free(var[i]); + for (size_t i = 0; i < nvars; ++i) free(var[i]); vlistDestroy(vlistID); taxisDestroy(taxisID); zaxisDestroy(zaxisID[0]); zaxisDestroy(zaxisID[1]); gridDestroy(gridID); - free(levs); - free(lats); - free(lons); return 0; } diff --git a/tests/deco2d_model.c b/tests/deco2d_model.c index dd0dcd9bcf2e3b436617e8a51f96a4c4ad50beec..da865f673444b68b807673ca9148df0dd511eba5 100644 --- a/tests/deco2d_model.c +++ b/tests/deco2d_model.c @@ -1,9 +1,10 @@ -#if defined (HAVE_CONFIG_H) -# include "config.h" +#if defined(HAVE_CONFIG_H) +#include "config.h" #endif #include <inttypes.h> #include <math.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <time.h> @@ -11,8 +12,6 @@ #ifdef USE_MPI #include <mpi.h> #include <yaxt.h> -#else -typedef int MPI_Comm; #endif #include "cdi.h" @@ -29,53 +28,37 @@ typedef int MPI_Comm; #include "dmemory.h" #include "error.h" #include "pio_write.h" +#include "pio_write_setup_grid.h" #include "simple_model_helper.h" #include "cdi_uuid.h" -enum { - ntfiles = 2, +enum +{ + ntfiles = 2, nproma = 16, }; - static void -modelRegionCompute(double region[], int nlev, int nlat, int nlon, - const int chunkStart[3], const int chunkSize[3], - int tsID, const double lons[], const double lats[], +modelRegionCompute(double region[], int nlev, int nlat, int nlon, const int chunkStart[3], const int chunkSize[3], int tsID, double mscale, double mrscale) { - (void)nlev; - unsigned is = (unsigned)chunkStart[0], - js = (unsigned)chunkStart[1], - ks = (unsigned)chunkStart[2], - m = (unsigned)chunkSize[0], - n = (unsigned)chunkSize[1], - o = (unsigned)chunkSize[2], - jstride = (unsigned)chunkSize[0], - kstride = ((jstride * (unsigned)chunkSize[1] + nproma - 1)/nproma)*nproma; + (void) nlev; + int is = chunkStart[0], js = chunkStart[1], ks = chunkStart[2], m = chunkSize[0], n = chunkSize[1], o = chunkSize[2], + jstride = chunkSize[0], kstride = ((jstride * chunkSize[1] + nproma - 1) / nproma) * nproma; - for (unsigned k = 0; k < o; ++k) - for (unsigned j = 0; j < n; ++j) - for (unsigned i = 0; i < m; ++i) + tsID %= nlon; + for (int k = 0; k < o; ++k) + for (int j = 0; j < n; ++j) + for (int i = 0; i < m; ++i) region[k * kstride + j * jstride + i] - = dg_wobble((lons[(i + is + (unsigned)tsID)%(unsigned)nlon] - lons[0]) - / (lons[nlon-1] - lons[0]), - (lats[(j + js + k + ks)%(unsigned)nlat] - lats[0]) - / (lats[nlat-1] - lats[0]), - mscale, mrscale); + = dg_wobble((double) ((i + is + tsID) % nlon) / (double) (nlon - 1), + (double) ((j + js + k + ks) % nlat) / (double) (nlat - 1), mscale, mrscale); } -#ifdef USE_MPI -static void -findPartition2D(int npart[2], int num_parts); -#endif - void -modelRun(struct model_config setup, MPI_Comm comm) +modelRun(const struct model_config *setup, MPI_Comm comm) { - static const char * const fname_prefix = "example"; - struct varDesc_t { size_t size; @@ -86,19 +69,28 @@ modelRun(struct model_config setup, MPI_Comm comm) Xt_idxlist partDesc; Xt_redist redist4gather; #endif - } *varDesc; - int gridID, taxisID, vlistID, streamID, tsID, tfID = 0; - enum { nmiss = 0 }; - double *restrict lons, *restrict lats, *restrict levs; + bool useFloat; + } * varDesc; + int gridID, taxisID, vlistID, tsID, tfID = 0; + enum + { + nmiss = 0 + }; + double *levs; double *var = NULL, *varslice = NULL; + float *varsliceF = NULL; +#if !USE_MPI + float *varF = NULL; +#endif double mscale, mrscale; time_t current_time; int vdate = 19850101, vtime = 120000; int rank = 0; - char filename[1024]; - int nlon = setup.nlon, nlat = setup.nlat; - size_t nVars = setup.nvars > 0 ? (size_t)setup.nvars : 0; - size_t varslice_size = 0; + char *filename = NULL; + int nlon = setup->nlon, nlat = setup->nlat; + size_t nVars = setup->nvars > 0 ? (size_t) setup->nvars : 0; + size_t varslice_size = 0, varsliceF_size = 0; + ; #if USE_MPI int comm_size = 1; int npart[2], rank_coord[2]; @@ -106,16 +98,23 @@ modelRun(struct model_config setup, MPI_Comm comm) #endif #if USE_MPI - xmpi ( MPI_Comm_rank ( comm, &rank )); - xmpi ( MPI_Comm_size ( comm, &comm_size )); + xmpi(MPI_Comm_rank(comm, &rank)); + xmpi(MPI_Comm_size(comm, &comm_size)); #else - (void)comm; + (void) comm; #endif - if (rank == 0 && setup.compute_checksum) +#if USE_MPI + bool needsGather = setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG; +#else + bool needsGather = true; +#endif + if (rank == 0 && (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG)) { - var = (double *)Malloc((size_t)nlon * (size_t)nlat - * (size_t)setup.max_nlev * sizeof(var[0])); + var = (double *) Malloc((size_t) nlon * (size_t) nlat * (size_t) setup->max_nlev * sizeof(var[0])); +#if !USE_MPI + varF = (float *) Malloc((size_t) nlon * (size_t) nlat * (size_t) setup->max_nlev * sizeof(varF[0])); +#endif } #if USE_MPI @@ -129,63 +128,36 @@ modelRun(struct model_config setup, MPI_Comm comm) else { findPartition2D(npart, comm_size); - rank_coord[0] = rank % npart[0], - rank_coord[1] = rank / npart[0]; + rank_coord[0] = rank % npart[0], rank_coord[1] = rank / npart[0]; } - blk_displ = Malloc((size_t)setup.max_nlev * sizeof (blk_displ[0]) * 2); - blk_lens = blk_displ + setup.max_nlev; + blk_displ = Malloc((size_t) setup->max_nlev * sizeof(blk_displ[0]) * 2); + blk_lens = blk_displ + setup->max_nlev; #endif - var_scale(setup.datatype, &mscale, &mrscale); + var_scale(setup->datatype, &mscale, &mrscale); - gridID = gridCreate ( GRID_LONLAT, nlon*nlat ); - gridDefXsize ( gridID, nlon ); - gridDefYsize ( gridID, nlat ); - lons = (double *)Malloc((size_t)nlon * sizeof (lons[0])); - for (size_t i = 0; i < (size_t)nlon; ++i) - lons[i] = ((double)(i * 360))/nlon; - lats = (double *)Malloc((size_t)nlat * sizeof (lats[0])); - for (size_t i = 0; i < (size_t)nlat; ++i) - lats[i] = ((double)(i * 180))/nlat - 90.0; - gridDefXvals ( gridID, lons ); - gridDefYvals ( gridID, lats ); - if (setup.create_uuid) - { - unsigned char uuid[CDI_UUID_SIZE]; - if (rank == 0) - cdiCreateUUID(uuid); -#if USE_MPI - MPI_Bcast(uuid, CDI_UUID_SIZE, MPI_UNSIGNED_CHAR, 0, comm); -#endif - gridDefUUID(gridID, uuid); - } - levs = (double *)Malloc((size_t)setup.max_nlev * sizeof (levs[0])); + gridID = setupGrid(setup, comm); + + levs = (double *) Malloc((size_t) setup->max_nlev * sizeof(levs[0])); { - double lscale = 1.0/(double)(setup.max_nlev - 1); - for (size_t i = 0; i < (size_t)setup.max_nlev; ++i) - levs[i] = 101300.0 - 13000.0 * expm1(2.173 * (double)i * lscale); + double lscale = 1.0 / (double) (setup->max_nlev - 1); + for (size_t i = 0; i < (size_t) setup->max_nlev; ++i) levs[i] = 101300.0 - 13000.0 * expm1(2.173 * (double) i * lscale); } - vlistID = vlistCreate (); + vlistID = vlistCreate(); - varDesc = (struct varDesc_t *)Malloc(nVars * sizeof (varDesc[0])); - for (size_t varIdx = 0; varIdx < nVars; varIdx++ ) + varDesc = (struct varDesc_t *) Malloc(nVars * sizeof(varDesc[0])); + for (size_t varIdx = 0; varIdx < nVars; varIdx++) { - int varLevs = (int)random()%4; + int varLevs = (int) cdi_repeatable_random() % 4; switch (varLevs) { - case 1: - varLevs = setup.max_nlev / 3; - break; - case 2: - varLevs = setup.max_nlev >= 11 ? 11 : setup.max_nlev / 2; - break; - case 3: - varLevs = setup.max_nlev - 1; - break; + case 1: varLevs = setup->max_nlev / 3; break; + case 2: varLevs = setup->max_nlev >= 11 ? 11 : setup->max_nlev / 2; break; + case 3: varLevs = setup->max_nlev - 1; break; } ++varLevs; varDesc[varIdx].nlev = varLevs; - for (size_t i = 0; i < (size_t)varIdx; ++i) + for (size_t i = 0; i < (size_t) varIdx; ++i) if (varDesc[i].nlev == varLevs) { varDesc[varIdx].zaxisID = varDesc[i].zaxisID; @@ -195,25 +167,21 @@ modelRun(struct model_config setup, MPI_Comm comm) varDesc[varIdx].zaxisID = zaxisCreate(ZAXIS_SURFACE, 1); else { - varDesc[varIdx].zaxisID - = zaxisCreate(ZAXIS_PRESSURE, varDesc[varIdx].nlev); + varDesc[varIdx].zaxisID = zaxisCreate(ZAXIS_PRESSURE, varDesc[varIdx].nlev); zaxisDefLevels(varDesc[varIdx].zaxisID, levs); } - if (setup.create_uuid) - { - unsigned char uuid[CDI_UUID_SIZE]; - if (rank == 0) - cdiCreateUUID(uuid); + if (setup->flags & PIO_WRITE_CONFIG_CREATE_UUID_FLAG) + { + unsigned char uuid[CDI_UUID_SIZE]; + if (rank == 0) cdiCreateUUID(uuid); #if USE_MPI - MPI_Bcast(uuid, CDI_UUID_SIZE, MPI_UNSIGNED_CHAR, 0, comm); + MPI_Bcast(uuid, CDI_UUID_SIZE, MPI_UNSIGNED_CHAR, 0, comm); #endif - cdiDefKeyBytes(varDesc[varIdx].zaxisID, CDI_GLOBAL, CDI_KEY_UUID, uuid, CDI_UUID_SIZE); - } - zaxisIDset: - varDesc[varIdx].id - = vlistDefVar(vlistID, gridID, varDesc[varIdx].zaxisID, TIME_VARIABLE); - varDesc[varIdx].size - = (size_t)nlon * (size_t)nlat * (size_t)varDesc[varIdx].nlev; + cdiDefKeyBytes(varDesc[varIdx].zaxisID, CDI_GLOBAL, CDI_KEY_UUID, uuid, CDI_UUID_SIZE); + } + zaxisIDset: + varDesc[varIdx].id = vlistDefVar(vlistID, gridID, varDesc[varIdx].zaxisID, TIME_VARIABLE); + varDesc[varIdx].size = (size_t) nlon * (size_t) nlat * (size_t) varDesc[varIdx].nlev; #ifdef USE_MPI { for (size_t i = 0; i < varIdx; ++i) @@ -231,100 +199,69 @@ modelRun(struct model_config setup, MPI_Comm comm) int start[2], chunkSize[3], varSize[2] = { nlon, nlat }; for (size_t i = 0; i < 2; ++i) { - struct PPM_extent range - = PPM_uniform_partition((struct PPM_extent){ 0, varSize[i] }, - npart[i], rank_coord[i]); + struct PPM_extent range = PPM_uniform_partition((struct PPM_extent){ 0, varSize[i] }, npart[i], rank_coord[i]); start[i] = range.first; chunkSize[i] = range.size; - fprintf(stderr, "%d: start[%zu]=%d, chunkSize[%zu] = %d\n", rank, - i, start[i], i, chunkSize[i]); + fprintf(stderr, "%d: start[%zu]=%d, chunkSize[%zu] = %d\n", rank, i, start[i], i, chunkSize[i]); varDesc[varIdx].start[i] = range.first; varDesc[varIdx].chunkSize[i] = range.size; } - Xt_int varSizeXt[3] = { (Xt_int)nlon, (Xt_int)nlat, (Xt_int)varLevs }; + Xt_int varSizeXt[3] = { (Xt_int) nlon, (Xt_int) nlat, (Xt_int) varLevs }; chunkSize[2] = varLevs; Xt_int varStartXt[3] = { start[0], start[1], 0 }; - Xt_idxlist part_idxlist - = xt_idxsection_new(0, (varLevs > 1 ? 3 : 2), varSizeXt, - chunkSize, varStartXt), - gather_idxlist; + Xt_idxlist part_idxlist = xt_idxsection_new(0, (varLevs > 1 ? 3 : 2), varSizeXt, chunkSize, varStartXt), gather_idxlist; varDesc[varIdx].partDesc = part_idxlist; - if (setup.compute_checksum) + if (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG) { if (rank == 0) { gather_idxlist - = xt_idxstripes_new(&(struct Xt_stripe){.start = 0, - .stride = 1, .nstrides = (int)varDesc[varIdx].size }, 1); + = xt_idxstripes_new(&(struct Xt_stripe){ .start = 0, .stride = 1, .nstrides = (int) varDesc[varIdx].size }, 1); } else gather_idxlist = xt_idxempty_new(); - Xt_xmap xmap4gather - = xt_xmap_all2all_new(part_idxlist, gather_idxlist, comm); + Xt_xmap xmap4gather = xt_xmap_all2all_new(part_idxlist, gather_idxlist, comm); xt_idxlist_delete(gather_idxlist); - struct Xt_offset_ext *src_blocks = Malloc((size_t)varLevs - * sizeof (*src_blocks)); - struct Xt_offset_ext dst_block = { .start = 0, - .size = nlon * nlat * varLevs, - .stride = 1 }; - size_t levStride - = (((size_t)chunkSize[0] * (size_t)chunkSize[1] + nproma - 1) - / nproma) * nproma; - for (size_t i = 0; i < (size_t)varLevs; ++i) - src_blocks[i] = (struct Xt_offset_ext) - { .start = (int)(i * levStride), - .size = chunkSize[0] * chunkSize[1], - .stride = 1 }; - varDesc[varIdx].redist4gather - = xt_redist_p2p_ext_new(xmap4gather, - varLevs, src_blocks, 1, &dst_block, - MPI_DOUBLE); + struct Xt_offset_ext *src_blocks = Malloc((size_t) varLevs * sizeof(*src_blocks)); + struct Xt_offset_ext dst_block = { .start = 0, .size = nlon * nlat * varLevs, .stride = 1 }; + size_t levStride = (((size_t) chunkSize[0] * (size_t) chunkSize[1] + nproma - 1) / nproma) * nproma; + for (size_t i = 0; i < (size_t) varLevs; ++i) + src_blocks[i] + = (struct Xt_offset_ext){ .start = (int) (i * levStride), .size = chunkSize[0] * chunkSize[1], .stride = 1 }; + varDesc[varIdx].redist4gather = xt_redist_p2p_ext_new(xmap4gather, varLevs, src_blocks, 1, &dst_block, MPI_DOUBLE); Free(src_blocks); xt_xmap_delete(xmap4gather); } - partDescriptionSet: ; } + partDescriptionSet:; #endif - varDesc[varIdx].code = GRIB_USERDEF + (int)varIdx; + varDesc[varIdx].code = GRIB_USERDEF + (int) varIdx; vlistDefVarCode(vlistID, varDesc[varIdx].id, varDesc[varIdx].code); - vlistDefVarDatatype(vlistID, varDesc[varIdx].id, setup.datatype); + vlistDefVarDatatype(vlistID, varDesc[varIdx].id, setup->datatype); + varDesc[varIdx].useFloat = (bool) (cdi_repeatable_random() & 1); } - taxisID = taxisCreate ( TAXIS_ABSOLUTE ); - vlistDefTaxis ( vlistID, taxisID ); + taxisID = taxisCreate(setup->taxistype); + vlistDefTaxis(vlistID, taxisID); - sprintf ( &filename[0], "%s_%d.%s", fname_prefix, tfID, setup.suffix ); - streamID = streamOpenWrite ( filename, setup.filetype ); - xassert ( streamID >= 0 ); - streamDefVlist ( streamID, vlistID); + for (tfID = 0; tfID < ntfiles; tfID++) + { + for (size_t varIdx = 0; varIdx < nVars; ++varIdx) varDesc[varIdx].checksum_state = 0; -#ifdef USE_MPI - pioEndDef (); -#endif + int streamID = composeStream(&filename, setup->prefix, tfID, setup->suffix, setup->filetype); + streamDefVlist(streamID, vlistID); - for ( tfID = 0; tfID < ntfiles; tfID++ ) - { - for (size_t varIdx = 0; varIdx < nVars; ++varIdx) - varDesc[varIdx].checksum_state = 0; - if ( tfID > 0 ) - { - streamClose ( streamID ); - sprintf ( &filename[0], "%s_%d.%s", fname_prefix, tfID, setup.suffix ); - streamID = streamOpenWrite ( filename, setup.filetype ); - xassert ( streamID >= 0 ); - streamDefVlist ( streamID, vlistID ); - } vdate = 19850101; vtime = 120000; current_time = cditime2time_t(vdate, vtime); - for ( tsID = 0; tsID < setup.nts; tsID++ ) - { + for (tsID = 0; tsID < setup->nts; tsID++) + { int vdatetime[2]; time_t2cditime(current_time, &vdatetime[1], &vdatetime[0]); - taxisDefVdate(taxisID, vdatetime[1]); - taxisDefVtime(taxisID, vdatetime[0]); - streamDefTimestep ( streamID, tsID ); - if (setup.filetype == CDI_FILETYPE_EXT) + taxisDefVdate(taxisID, vdatetime[1]); + taxisDefVtime(taxisID, vdatetime[0]); + streamDefTimestep(streamID, tsID); + if (setup->filetype == CDI_FILETYPE_EXT) { /* EXTRA doesn't store time, only date * set the value to 0 before checksumming, because a @@ -332,122 +269,122 @@ modelRun(struct model_config setup, MPI_Comm comm) * return */ vdatetime[0] = 0; } - for (size_t varIdx = 0; varIdx < nVars; ++varIdx) - { - size_t varLevs = (size_t)varDesc[varIdx].nlev; + for (size_t varIdx = 0; varIdx < nVars; ++varIdx) + { + size_t varLevs = (size_t) varDesc[varIdx].nlev; #ifdef USE_MPI - int start[3] = { varDesc[varIdx].start[0], - varDesc[varIdx].start[1], - 0 }; - int chunk[3] = { varDesc[varIdx].chunkSize[0], - varDesc[varIdx].chunkSize[1], - (int)varLevs }; + int start[3] = { varDesc[varIdx].start[0], varDesc[varIdx].start[1], 0 }; + int chunk[3] = { varDesc[varIdx].chunkSize[0], varDesc[varIdx].chunkSize[1], (int) varLevs }; #else - int chunk[3] = { nlon, nlat, (int)varLevs }; + int chunk[3] = { nlon, nlat, (int) varLevs }; int start[3] = { 0, 0, 0 }; #endif size_t chunkSize - = (((size_t)chunk[0] * (size_t)chunk[1] + (size_t)(nproma - 1)) - / (size_t)nproma) * (size_t)nproma * varLevs; + = (((size_t) chunk[0] * (size_t) chunk[1] + (size_t) (nproma - 1)) / (size_t) nproma) * (size_t) nproma * varLevs; if (varslice_size < chunkSize) { - varslice = (double *)Realloc(varslice, chunkSize * sizeof (var[0])); + varslice = (double *) Realloc(varslice, chunkSize * sizeof(var[0])); varslice_size = chunkSize; } - modelRegionCompute(varslice, (int)varLevs, nlat, nlon, - start, chunk, tsID, lons, lats, - mscale, mrscale); - if (setup.compute_checksum) + modelRegionCompute(varslice, (int) varLevs, nlat, nlon, start, chunk, tsID, mscale, mrscale); + bool useFloat = varDesc[varIdx].useFloat; + if (useFloat) { -#if USE_MPI - xt_redist_s_exchange1(varDesc[varIdx].redist4gather, - varslice, var); - size_t layerSize = (size_t)(chunk[0] * chunk[1]); - size_t nblk = (layerSize + nproma - 1)/nproma - 1; - for (size_t k = 0; k < varLevs; ++k) + if (varsliceF_size < chunkSize) { - blk_displ[k] = (int)(k * (nblk + 1) * nproma); - blk_lens[k] = (int)layerSize; + varsliceF = (float *) Realloc(varsliceF, chunkSize * sizeof(varsliceF[0])); + varsliceF_size = chunkSize; } + for (size_t i = 0; i < chunkSize; ++i) varslice[i] = varsliceF[i] = (float) varslice[i]; + } + + if (needsGather) + { +#if USE_MPI + xt_redist_s_exchange1(varDesc[varIdx].redist4gather, varslice, var); #else - size_t layerSize = (size_t)(chunk[0] * chunk[1]); - size_t nblk = (layerSize + nproma - 1)/nproma - 1; + size_t layerSize = (size_t) (chunk[0] * chunk[1]); + size_t nblk = (layerSize + nproma - 1) / nproma - 1; size_t npromz = layerSize - nblk * nproma; for (size_t k = 0; k < varLevs; ++k) { for (size_t j = 0; j < nblk; ++j) for (size_t i = 0; i < nproma; ++i) - var[k * layerSize + j * nproma + i] = - varslice[k * (nblk + 1) * nproma + j * nproma + i]; + var[k * layerSize + j * nproma + i] = varslice[k * (nblk + 1) * nproma + j * nproma + i]; for (size_t i = 0; i < npromz; ++i) - var[k * layerSize + nblk * nproma + i] = - varslice[k * (nblk + 1) * nproma + nblk * nproma + i]; + var[k * layerSize + nblk * nproma + i] = varslice[k * (nblk + 1) * nproma + nblk * nproma + i]; } + if (useFloat) + for (size_t k = 0; k < varLevs; ++k) + for (size_t i = 0; i < layerSize; ++i) varF[k * layerSize + i] = (float) var[k * layerSize + i]; #endif } - if (rank == 0 && setup.compute_checksum) + if (rank == 0 && (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG)) { - memcrc_r(&varDesc[varIdx].checksum_state, - (const unsigned char *)vdatetime, - sizeof (vdatetime)); - memcrc_r(&varDesc[varIdx].checksum_state, - (const unsigned char *)var, - varDesc[varIdx].size * sizeof (var[0])); + memcrc_r(&varDesc[varIdx].checksum_state, (const unsigned char *) vdatetime, sizeof(vdatetime)); + memcrc_r(&varDesc[varIdx].checksum_state, (const unsigned char *) var, varDesc[varIdx].size * sizeof(var[0])); } #ifdef USE_MPI - streamWriteScatteredVarPart(streamID, varDesc[varIdx].id, - varslice, - (int)varLevs, blk_lens, blk_displ, - nmiss, varDesc[varIdx].partDesc); + size_t layerSize = (size_t) (chunk[0] * chunk[1]); + size_t nblk = (layerSize + nproma - 1) / nproma - 1; + for (size_t k = 0; k < varLevs; ++k) + { + blk_displ[k] = (int) (k * (nblk + 1) * nproma); + blk_lens[k] = (int) layerSize; + } + if (useFloat) + streamWriteScatteredVarPartF(streamID, varDesc[varIdx].id, varsliceF, (int) varLevs, blk_lens, blk_displ, nmiss, + varDesc[varIdx].partDesc); + else + streamWriteScatteredVarPart(streamID, varDesc[varIdx].id, varslice, (int) varLevs, blk_lens, blk_displ, nmiss, + varDesc[varIdx].partDesc); #else - streamWriteVar(streamID, varDesc[varIdx].id, var, nmiss); + if (useFloat) + streamWriteVarF(streamID, varDesc[varIdx].id, varF, nmiss); + else + streamWriteVar(streamID, varDesc[varIdx].id, var, nmiss); #endif - } + } current_time += 86400; #ifdef USE_MPI - pioWriteTimestep(); + pioWriteTimestep(); #endif - } - if (rank == 0 && setup.compute_checksum) + } + streamClose(streamID); + if (rank == 0 && (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG)) { FILE *tablefp; - { - sprintf(filename, "%s_%d.cksum", fname_prefix, tfID); - if (!(tablefp = fopen(filename, "w"))) - { - perror("failed to open table file"); - exit(EXIT_FAILURE); - } - for (size_t i = 0; i < nVars; ++i) - { - uint32_t cksum; - int code; - cksum = memcrc_finish(&varDesc[i].checksum_state, - (off_t)((varDesc[i].size - * sizeof (var[0]) - + sizeof (int) * 2) - * (size_t)setup.nts)); - code = vlistInqVarCode(vlistID, varDesc[i].id); - if (fprintf(tablefp, "%08lx %d\n", (unsigned long)cksum, - code) < 0) - { - perror("failed to write table file"); - exit(EXIT_FAILURE); - } - } - fclose(tablefp); - } + composeFilename(&filename, setup->prefix, tfID, "cksum"); + if (!(tablefp = fopen(filename, "w"))) + { + perror("failed to open table file"); + exit(EXIT_FAILURE); + } + for (size_t varIdx = 0; varIdx < nVars; ++varIdx) + { + uint32_t cksum; + int code; + cksum = memcrc_finish(&varDesc[varIdx].checksum_state, + (off_t) ((varDesc[varIdx].size * sizeof(var[0]) + sizeof(int) * 2) * (size_t) setup->nts)); + code = vlistInqVarCode(vlistID, varDesc[varIdx].id); + if (fprintf(tablefp, "%08lx %d\n", (unsigned long) cksum, code) < 0) + { + perror("failed to write table file"); + exit(EXIT_FAILURE); + } + } + fclose(tablefp); } } - Free(varslice); #ifdef USE_MPI - pioEndTimestepping (); + pioEndTimestepping(); #endif - streamClose ( streamID ); - vlistDestroy ( vlistID ); - taxisDestroy ( taxisID ); - for (size_t varIdx = 0; varIdx < nVars; varIdx++ ) + Free(varslice); + Free(varsliceF); + vlistDestroy(vlistID); + taxisDestroy(taxisID); + for (size_t varIdx = 0; varIdx < nVars; varIdx++) { int zID = varDesc[varIdx].zaxisID; if (zID != CDI_UNDEFID) @@ -455,83 +392,24 @@ modelRun(struct model_config setup, MPI_Comm comm) zaxisDestroy(zID); #if USE_MPI xt_idxlist_delete(varDesc[varIdx].partDesc); - xt_redist_delete(varDesc[varIdx].redist4gather); + if (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG) xt_redist_delete(varDesc[varIdx].redist4gather); #endif for (size_t j = varIdx + 1; j < nVars; ++j) - if (zID == varDesc[j].zaxisID) - varDesc[j].zaxisID = CDI_UNDEFID; + if (zID == varDesc[j].zaxisID) varDesc[j].zaxisID = CDI_UNDEFID; } } - gridDestroy ( gridID ); + gridDestroy(gridID); Free(var); #if USE_MPI Free(blk_displ); +#else + Free(varF); #endif Free(varDesc); Free(levs); - Free(lats); - Free(lons); + Free(filename); } -#ifdef USE_MPI -static void -findPartition2D(int npart[2], int num_parts) -{ - const uint64_t rscale = 256; - uint32_t *factors = NULL; - xassert(num_parts > 0); - int numFactors - = PPM_prime_factorization_32((uint32_t)num_parts, &factors); - /* try to distribute prime factors on dimensions to get - * approx. 2 times as many parts in x dim than y dim */ - const uint64_t optimumRatio = rscale * 2; - npart[0] = num_parts, npart[1] = 1; - uint_fast32_t npart_attempt[2]; - uint64_t bestRatio = (uint64_t)num_parts * rscale, - bestDiff = (uint64_t)llabs((long long)(bestRatio - optimumRatio)); - /* test all assignments of factors to dimensions, starting with - * only one assigned to x dim (omitting 0 because that would - * always give npart[1] > npart[0] */ - for (int assign2X = 1; assign2X <= numFactors; ++assign2X) - { - uint_fast32_t pattern = (UINT32_C(1) << assign2X) - 1, - lastPattern = pattern << (numFactors - assign2X); - do { - npart_attempt[0] = 1; - npart_attempt[1] = 1; - /* loop over all factors */ - for (uint_fast32_t i = 0; i < (uint_fast32_t)numFactors; ++i) - { - uint_fast32_t dim_idx = (pattern >> i) & 1; - npart_attempt[dim_idx] *= factors[i]; - } - uint64_t ratio = ((uint64_t)npart_attempt[0] * rscale) - / (uint64_t)npart_attempt[1]; - uint64_t diff = (uint64_t)llabs((long long)(ratio - optimumRatio)); - if (diff < bestDiff) - { - npart[0] = (int)npart_attempt[0]; - npart[1] = (int)npart_attempt[1]; - bestDiff = diff; - bestRatio = ratio; - } - { - uint_fast32_t t; -#if HAVE_DECL___BUILTIN_CTZ - t = pattern | (pattern - 1); - pattern = (t + 1) - | (((~t & -~t) - 1) >> (__builtin_ctz((unsigned)pattern) + 1)); -#else - t = (pattern | (pattern - 1)) + 1; - pattern = t | ((((t & -t) / (pattern & -pattern)) >> 1) - 1); -#endif - } - } while (pattern <= lastPattern); - } - Free(factors); -} -#endif - /* * Local Variables: * c-file-style: "Java" diff --git a/tests/ensure_array_size.c b/tests/ensure_array_size.c index f7e59aa95b2d609726f3febc39f296e33796c66b..9cdb5f8207c84a613e6e8827e992427de0540024 100644 --- a/tests/ensure_array_size.c +++ b/tests/ensure_array_size.c @@ -1,5 +1,5 @@ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #include <stdlib.h> @@ -8,13 +8,10 @@ #include "error.h" void -realloc_array(void **array, size_t elem_size, size_t *curr_array_size, - size_t requested_size) +realloc_array(void **array, size_t elem_size, size_t *curr_array_size, size_t requested_size) { - const size_t array_inc_size = (1024 + elem_size - 1)/ elem_size; - *curr_array_size = array_inc_size - * ((requested_size + array_inc_size) / array_inc_size); + const size_t array_inc_size = (1024 + elem_size - 1) / elem_size; + *curr_array_size = array_inc_size * ((requested_size + array_inc_size) / array_inc_size); *array = realloc(*array, *curr_array_size * elem_size); - if (!*array) - xabort("reallocation failed"); + if (!*array) xabort("reallocation failed"); } diff --git a/tests/ensure_array_size.h b/tests/ensure_array_size.h index 1452d414261f45a4ee48d7817e2b0accaffc6829..7160880668c9d69c52e50a52ef22d56cca91ea77 100644 --- a/tests/ensure_array_size.h +++ b/tests/ensure_array_size.h @@ -1,21 +1,19 @@ #ifndef ENSURE_ARRAY_SIZE_H #define ENSURE_ARRAY_SIZE_H -void -realloc_array(void **array, size_t elem_size, size_t *curr_array_size, - size_t requested_size); +void realloc_array(void **array, size_t elem_size, size_t *curr_array_size, size_t requested_size); -#define ENSURE_ARRAY_SIZE(arrayp, curr_array_size, req_size) \ - do { \ - if ((req_size) > (curr_array_size)) \ - { \ - size_t casize = (curr_array_size); \ - \ - realloc_array((void **)&(arrayp), sizeof(*(arrayp)), &casize, \ - (req_size)); \ - (curr_array_size) = casize; \ - } \ - } \ - while(0) +#define ENSURE_ARRAY_SIZE(arrayp, curr_array_size, req_size) \ + do \ + { \ + if ((req_size) > (curr_array_size)) \ + { \ + size_t casize = (curr_array_size); \ + \ + realloc_array((void **) &(arrayp), sizeof(*(arrayp)), &casize, (req_size)); \ + (curr_array_size) = casize; \ + } \ + } \ + while (0) #endif diff --git a/tests/pio_cksum_asynch.in b/tests/pio_cksum_asynch.in deleted file mode 100644 index 0f431e3b0270774f3134531d4a919ab8495e6294..0000000000000000000000000000000000000000 --- a/tests/pio_cksum_asynch.in +++ /dev/null @@ -1,14 +0,0 @@ -#! @SHELL@ -pio_write_args="-p PIO_ASYNCH -w 3" -mpi_task_num=7 -LOG=pio_cksum_asynch.log -if [ "@USE_MPI@" = yes ]; then - . ./pio_write_run -else - exit 77 -fi -# -# Local Variables: -# mode: sh -# End: -# diff --git a/tests/pio_cksum_asynch.run.in b/tests/pio_cksum_asynch.run.in new file mode 100644 index 0000000000000000000000000000000000000000..995acf60449275df8e8bc41d5b2606c5f9d269d1 --- /dev/null +++ b/tests/pio_cksum_asynch.run.in @@ -0,0 +1,12 @@ +#!@SHELL@ + +pio_write_args="-p PIO_ASYNCH -w 3" +mpi_task_num=7 + +. ./pio_write.run +( . ./pio_write_dist_array.run ) || test $? -eq 77 +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/pio_cksum_cdf.in b/tests/pio_cksum_cdf.in deleted file mode 100644 index 358091f84bd0219bac64a0d5ec1073a2cfaac093..0000000000000000000000000000000000000000 --- a/tests/pio_cksum_cdf.in +++ /dev/null @@ -1,15 +0,0 @@ -#! @SHELL@ -pio_write_args="-f nc4 -w 3" -mpi_task_num=7 -LOG=pio_cksum_cdf.log -suffix=nc4 -if [ "@USE_MPI@" = yes -a "@ENABLE_NETCDF@" = yes ]; then - . ./pio_write_run -else - exit 77 -fi -# -# Local Variables: -# mode: sh -# End: -# diff --git a/tests/pio_cksum_fpguard.in b/tests/pio_cksum_fpguard.in deleted file mode 100644 index 61366ef038181c8314fd86e2fcfda8d498b2eabd..0000000000000000000000000000000000000000 --- a/tests/pio_cksum_fpguard.in +++ /dev/null @@ -1,14 +0,0 @@ -#! @SHELL@ -pio_write_args="-p PIO_FPGUARD -w 3" -mpi_task_num=6 -LOG=pio_cksum_fpguard.log -if [ "@USE_MPI@" = yes ]; then - . ./pio_write_run -else - exit 77 -fi -# -# Local Variables: -# mode: sh -# End: -# diff --git a/tests/pio_cksum_fpguard.run.in b/tests/pio_cksum_fpguard.run.in new file mode 100644 index 0000000000000000000000000000000000000000..8a6bd3d071bd601c39d93ff7f7409fa6aa303f81 --- /dev/null +++ b/tests/pio_cksum_fpguard.run.in @@ -0,0 +1,12 @@ +#!@SHELL@ + +pio_write_args="-p PIO_FPGUARD -w 3" +mpi_task_num=6 + +. ./pio_write.run +( . ./pio_write_dist_array.run ) || test $? -eq 77 +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/pio_cksum_grb2.run.in b/tests/pio_cksum_grb2.run.in new file mode 100644 index 0000000000000000000000000000000000000000..09741ee26b7ef517881696f6e3a72ebe26aa62da --- /dev/null +++ b/tests/pio_cksum_grb2.run.in @@ -0,0 +1,13 @@ +#! @SHELL@ + +suffix=grb2 +pio_write_args="-w 3" +mpi_task_num=8 + +. ./pio_write.run +( . ./pio_write_dist_array.run ) || test $? -eq 77 +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/pio_cksum_mpi_fw_at_all.in b/tests/pio_cksum_mpi_fw_at_all.in deleted file mode 100644 index 3320d5f14a6c2dd682d9d04792072b790a1e262a..0000000000000000000000000000000000000000 --- a/tests/pio_cksum_mpi_fw_at_all.in +++ /dev/null @@ -1,9 +0,0 @@ -#! @SHELL@ -pio_write_args="-p PIO_MPI_FW_AT_ALL -w 2" -mpi_task_num=5 -LOG=pio_cksum_mpi_fw_at_all.log -if [ "@USE_MPI@" = yes ]; then - . ./pio_write_run -else - exit 77 -fi diff --git a/tests/pio_cksum_mpi_fw_at_all.run.in b/tests/pio_cksum_mpi_fw_at_all.run.in new file mode 100644 index 0000000000000000000000000000000000000000..21d9c75e02bcb5eaac36fbb0f20f621eb37544f7 --- /dev/null +++ b/tests/pio_cksum_mpi_fw_at_all.run.in @@ -0,0 +1,7 @@ +#!@SHELL@ + +pio_write_args="-p PIO_MPI_FW_AT_ALL -w 2" +mpi_task_num=5 + +. ./pio_write.run +( . ./pio_write_dist_array.run ) || test $? -eq 77 diff --git a/tests/pio_cksum_mpi_fw_at_reblock.in b/tests/pio_cksum_mpi_fw_at_reblock.in deleted file mode 100644 index 2aeb44d71caf8dea0993d153d6754a9511117818..0000000000000000000000000000000000000000 --- a/tests/pio_cksum_mpi_fw_at_reblock.in +++ /dev/null @@ -1,9 +0,0 @@ -#! @SHELL@ -pio_write_args="-p PIO_MPI_FW_AT_REBLOCK -w 2" -mpi_task_num=5 -LOG=pio_cksum_mpi_fw_at_reblock.log -if [ "@USE_MPI@" = yes ]; then - . ./pio_write_run -else - exit 77 -fi diff --git a/tests/pio_cksum_mpi_fw_at_reblock.run.in b/tests/pio_cksum_mpi_fw_at_reblock.run.in new file mode 100644 index 0000000000000000000000000000000000000000..c8b83b86c96dd59660b72e946a568308a6be897c --- /dev/null +++ b/tests/pio_cksum_mpi_fw_at_reblock.run.in @@ -0,0 +1,7 @@ +#!@SHELL@ + +pio_write_args="-p PIO_MPI_FW_AT_REBLOCK -w 2" +mpi_task_num=5 + +. ./pio_write.run +( . ./pio_write_dist_array.run ) || test $? -eq 77 diff --git a/tests/pio_cksum_mpi_fw_ordered.in b/tests/pio_cksum_mpi_fw_ordered.in deleted file mode 100644 index a5862f197302a1b3fe957fef183567afe5d52e8e..0000000000000000000000000000000000000000 --- a/tests/pio_cksum_mpi_fw_ordered.in +++ /dev/null @@ -1,9 +0,0 @@ -#! @SHELL@ -pio_write_args="-p PIO_MPI_FW_ORDERED -w 2" -mpi_task_num=5 -LOG=pio_cksum_mpi_fw_ordered.log -if [ "@USE_MPI@" = yes ]; then - . ./pio_write_run -else - exit 77 -fi diff --git a/tests/pio_cksum_mpi_fw_ordered.run.in b/tests/pio_cksum_mpi_fw_ordered.run.in new file mode 100644 index 0000000000000000000000000000000000000000..dd5221025a03ed9eb3754e8cdfac374df73b3acb --- /dev/null +++ b/tests/pio_cksum_mpi_fw_ordered.run.in @@ -0,0 +1,7 @@ +#!@SHELL@ + +pio_write_args="-p PIO_MPI_FW_ORDERED -w 2" +mpi_task_num=5 + +. ./pio_write.run +( . ./pio_write_dist_array.run ) || test $? -eq 77 diff --git a/tests/pio_cksum_mpinonb.in b/tests/pio_cksum_mpinonb.in deleted file mode 100644 index b6ea976b8af4f82425522d64e3ea989dbdcc42a1..0000000000000000000000000000000000000000 --- a/tests/pio_cksum_mpinonb.in +++ /dev/null @@ -1,14 +0,0 @@ -#! @SHELL@ -pio_write_args="-p PIO_MPI -w 2" -mpi_task_num=4 -LOG=pio_cksum_mpinonb.log -if [ "@USE_MPI@" = yes ]; then - . ./pio_write_run -else - exit 77 -fi -# -# Local Variables: -# mode: sh -# End: -# diff --git a/tests/pio_cksum_mpinonb.run.in b/tests/pio_cksum_mpinonb.run.in new file mode 100644 index 0000000000000000000000000000000000000000..7c59860c0ab982b35c3ed8a3f1106b40c0fa4bcc --- /dev/null +++ b/tests/pio_cksum_mpinonb.run.in @@ -0,0 +1,12 @@ +#!@SHELL@ + +pio_write_args="-p PIO_MPI -w 2" +mpi_task_num=4 + +. ./pio_write.run +( . ./pio_write_dist_array.run ) || test $? -eq 77 +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/pio_cksum_nc.run.in b/tests/pio_cksum_nc.run.in new file mode 100644 index 0000000000000000000000000000000000000000..3fd77980120aac7d210e7975c76020d62b1862b8 --- /dev/null +++ b/tests/pio_cksum_nc.run.in @@ -0,0 +1,13 @@ +#!@SHELL@ + +suffix=nc +pio_write_args="-w 2 -qtaxis-type=relative" +mpi_task_num=5 + +. ./pio_write.run +( . ./pio_write_dist_array.run ) || test $? -eq 77 +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/pio_cksum_nc2.run.in b/tests/pio_cksum_nc2.run.in new file mode 100644 index 0000000000000000000000000000000000000000..70159cd3351885574154fdca143b605c9d730385 --- /dev/null +++ b/tests/pio_cksum_nc2.run.in @@ -0,0 +1,13 @@ +#!@SHELL@ + +suffix=nc2 +pio_write_args="-w 3 -qtaxis-type=relative" +mpi_task_num=8 + +. ./pio_write.run +( . ./pio_write_dist_array.run ) || test $? -eq 77 +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/pio_cksum_nc4.run.in b/tests/pio_cksum_nc4.run.in new file mode 100644 index 0000000000000000000000000000000000000000..940b7dc352c61b4aace6cdfaecaa6a9f01804f44 --- /dev/null +++ b/tests/pio_cksum_nc4.run.in @@ -0,0 +1,13 @@ +#!@SHELL@ + +suffix=nc4 +pio_write_args="-w 3 -qtaxis-type=relative" +mpi_task_num=7 + +. ./pio_write.run +( . ./pio_write_dist_array.run ) || test $? -eq 77 +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/pio_cksum_writer.in b/tests/pio_cksum_writer.in deleted file mode 100644 index 02140d5211e13c505d5671099e812ddcb57ac693..0000000000000000000000000000000000000000 --- a/tests/pio_cksum_writer.in +++ /dev/null @@ -1,14 +0,0 @@ -#! @SHELL@ -pio_write_args="-p PIO_WRITER -w 4" -mpi_task_num=8 -LOG=pio_cksum_writer.log -if [ "@USE_MPI@" = yes ]; then - . ./pio_write_run -else - exit 77 -fi -# -# Local Variables: -# mode: sh -# End: -# diff --git a/tests/pio_cksum_writer.run.in b/tests/pio_cksum_writer.run.in new file mode 100644 index 0000000000000000000000000000000000000000..63dd4eae7f65c4957c35974f0438d28b2bdfc52b --- /dev/null +++ b/tests/pio_cksum_writer.run.in @@ -0,0 +1,12 @@ +#!@SHELL@ + +pio_write_args="-p PIO_WRITER -w 4" +mpi_task_num=8 + +. ./pio_write.run +( . ./pio_write_dist_array.run ) || test $? -eq 77 +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/pio_write.c b/tests/pio_write.c index a119ffff6c9c50f546221c788325090586927ece..8d65aa69ed12cf0462630b4434b5585248b76e5d 100644 --- a/tests/pio_write.c +++ b/tests/pio_write.c @@ -16,42 +16,81 @@ #ifdef USE_MPI #include <mpi.h> #include <yaxt.h> -#else -typedef int MPI_Comm; +#ifdef HAVE_PPM_CORE +#include <ppm/ppm.h> +#endif #endif #include "cdi.h" +#include "error.h" #include "dmemory.h" #include "pio_write.h" +#include "simple_model_helper.h" #ifdef USE_MPI #include "cdipio.h" #include "pio_util.h" #endif +static const char default_fname_prefix[] = "example"; + static const struct model_config default_setup #ifdef __cplusplus - = { 12, 6, 3, 5, 5, CDI_FILETYPE_GRB, CDI_DATATYPE_PACK24, 1, 0, "grb"}; + = { 12, + 6, + 3, + 5, + 5, + CDI_FILETYPE_GRB, + CDI_DATATYPE_PACK24, + PIO_WRITE_CONFIG_CHECKSUM_FLAG, + TAXIS_ABSOLUTE, + -1, + "grb", + default_fname_prefix }; #else - = { .nlon = 12, .nlat = 6, .nts = 3, .max_nlev = 5, .nvars = 5, - .filetype = CDI_FILETYPE_GRB, .datatype = CDI_DATATYPE_PACK24, - .compute_checksum = 1, .create_uuid = 0, - .suffix = "grb", -}; + = { + .nlon = 12, + .nlat = 6, + .nts = 3, + .max_nlev = 5, + .nvars = 5, + .filetype = CDI_FILETYPE_GRB, + .datatype = CDI_DATATYPE_PACK24, + .flags = PIO_WRITE_CONFIG_CHECKSUM_FLAG, + .taxistype = TAXIS_ABSOLUTE, + .taxisunit = -1, + .suffix = "grb", + .prefix = default_fname_prefix, + }; #endif -static const struct { - char suffix[4]; +static const struct +{ + char suffix[5]; int type, defaultDT, defaultGrid; } suffix2type[] = { - { "nc", CDI_FILETYPE_NC, CDI_DATATYPE_FLT64, GRID_LONLAT }, + { "nc", CDI_FILETYPE_NC, CDI_DATATYPE_FLT64, GRID_LONLAT }, { "grb", CDI_FILETYPE_GRB, CDI_DATATYPE_PACK24, GRID_LONLAT }, + { "grb2", CDI_FILETYPE_GRB2, CDI_DATATYPE_PACK24, GRID_LONLAT }, { "nc2", CDI_FILETYPE_NC2, CDI_DATATYPE_FLT64, GRID_LONLAT }, { "nc4", CDI_FILETYPE_NC4, CDI_DATATYPE_FLT64, GRID_LONLAT }, - { "ext", CDI_FILETYPE_EXT, CDI_DATATYPE_FLT64, GRID_GENERIC, }, - { "srv", CDI_FILETYPE_SRV, CDI_DATATYPE_FLT64, GRID_GENERIC, }, + { + "ext", + CDI_FILETYPE_EXT, + CDI_DATATYPE_FLT64, + GRID_GENERIC, + }, + { + "srv", + CDI_FILETYPE_SRV, + CDI_DATATYPE_FLT64, + GRID_GENERIC, + }, { "ieg", CDI_FILETYPE_IEG, CDI_DATATYPE_FLT64, GRID_LONLAT }, }; +static void invalidOptionDie(const char *format, ...) __attribute__((noreturn)); + static void invalidOptionDie(const char *format, ...) { @@ -66,14 +105,13 @@ parse_intarg(const char msg[]) { char *end; long temp = strtol(optarg, &end, 0); - if ((errno == ERANGE && (temp == LONG_MAX || temp == LONG_MIN)) - || (errno != 0 && temp == 0)) { - perror(msg); - exit(EXIT_FAILURE); - } - if (temp > INT_MAX || temp < INT_MIN) - invalidOptionDie("range error: %ld\n", temp); - return (int)temp; + if ((errno == ERANGE && (temp == LONG_MAX || temp == LONG_MIN)) || (errno != 0 && temp == 0)) + { + perror(msg); + exit(EXIT_FAILURE); + } + if (temp > INT_MAX || temp < INT_MIN) invalidOptionDie("range error: %ld\n", temp); + return (int) temp; } static unsigned @@ -81,88 +119,215 @@ parse_unsignedarg(const char msg[]) { char *end; unsigned long temp = strtoul(optarg, &end, 0); - if ((errno == ERANGE && (temp == ULONG_MAX)) - || (errno != 0 && temp == 0)) + if ((errno == ERANGE && (temp == ULONG_MAX)) || (errno != 0 && temp == 0)) { perror(msg); exit(EXIT_FAILURE); } - if (temp > UINT_MAX) - invalidOptionDie("range error: %ld\n", temp); - return (unsigned)temp; + if (temp > UINT_MAX) invalidOptionDie("range error: %ld\n", temp); + return (unsigned) temp; } typedef int (*pioRoleFunc)(MPI_Comm commSuper, int IOMode, int nProcsIO); +struct boolOptionParse +{ + bool matched, value, invert; +}; + +static struct boolOptionParse +parseBooleanLongOption(size_t optionStrSize, const char *optionStr, const char *argStr) +{ + bool invert; + struct boolOptionParse result; + if ((invert = !strncmp(argStr, optionStr, optionStrSize - 1)) || !strncmp(argStr, optionStr + 3, optionStrSize - 4)) + { + result.matched = true; + result.invert = invert; + size_t valOfs = optionStrSize - (invert ? 1 : 4); + if (argStr[valOfs] == '\0' || !strcmp(argStr + valOfs, "=true")) + result.value = !invert; + else if (!strcmp(argStr + valOfs, "=false")) + result.value = invert; + else + invalidOptionDie("invalid option argument to -q%s: %s\n", optionStr + (invert ? 0 : 3), argStr + valOfs); + } + else + result = (struct boolOptionParse){ .matched = false, .value = false }; + return result; +} + +struct string2int +{ + const char *key; + int val; +}; + +static bool +parseLongOptionArgStringToInt(const char *str, size_t optionStrLen, const char *optionStr, size_t mapSize, + const struct string2int *map, int argc, char *argv[], int *out) +{ + if (!strncmp(str, optionStr, optionStrLen)) + { + const char *optargArg; + if (str[optionStrLen] == '=') + optargArg = str + optionStrLen + 1; + else if (str[sizeof(optionStr) - 1] == 0 && optind < argc) + optargArg = argv[optind++]; + else + invalidOptionDie("missing argument to -q%s", optionStr); + for (size_t i = 0; i < mapSize; ++i) + if (!strcmp(optargArg, map[i].key)) + { + *out = map[i].val; + return true; + } + invalidOptionDie("unknown argument \"%s\" to -q%s", optargArg, optionStr); + } + return false; +} + static void -parse_long_option(struct model_config *restrict setup, - int pioConfHandle, pioRoleFunc *pioRoleAssign, - const char *str) +parse_long_option(struct model_config *restrict setup, int pioConfHandle, pioRoleFunc *pioRoleAssign, const char *str, int argc, + char *argv[]) { #ifndef USE_MPI - (void)pioConfHandle; - (void)pioRoleAssign; + (void) pioConfHandle; + (void) pioRoleAssign; #endif - static const char cacheRedistStr[] = "cache-redists", - pioRoleSchemeOptionStr[] = "pio-role-scheme", - uuidCreateOptionStr[] = "no-create-uuid"; - if (!strncmp(str, cacheRedistStr, sizeof (cacheRedistStr) - 1)) + static const char cacheRedistStr[] = "no-cache-redists", pioRoleSchemeOptionStr[] = "pio-role-scheme", + curvilinearGridOptionStr[] = "no-create-curvilinear-grid", uuidCreateOptionStr[] = "no-create-uuid", + useDistGridOptionStr[] = "no-use-dist-grid", batchedRmaOptionStr[] = "no-batch-rma", + presetDecoOptionStr[] = "no-preset-decomposition", datatypeOptionStr[] = "datatype", + prefixOptionStr[] = "prefix", taxistypeOptionStr[] = "taxis-type", taxisunitOptionStr[] = "taxis-unit"; + static const struct string2int datatypeArgMap[] = { + { "pack", CDI_DATATYPE_PACK }, { "pack1", CDI_DATATYPE_PACK1 }, { "pack2", CDI_DATATYPE_PACK2 }, + { "pack3", CDI_DATATYPE_PACK3 }, { "pack4", CDI_DATATYPE_PACK4 }, { "pack5", CDI_DATATYPE_PACK5 }, + { "pack6", CDI_DATATYPE_PACK6 }, { "pack7", CDI_DATATYPE_PACK7 }, { "pack8", CDI_DATATYPE_PACK8 }, + { "pack9", CDI_DATATYPE_PACK9 }, { "pack10", CDI_DATATYPE_PACK10 }, { "pack11", CDI_DATATYPE_PACK11 }, + { "pack12", CDI_DATATYPE_PACK12 }, { "pack13", CDI_DATATYPE_PACK13 }, { "pack14", CDI_DATATYPE_PACK14 }, + { "pack15", CDI_DATATYPE_PACK15 }, { "pack16", CDI_DATATYPE_PACK16 }, { "pack17", CDI_DATATYPE_PACK17 }, + { "pack18", CDI_DATATYPE_PACK18 }, { "pack19", CDI_DATATYPE_PACK19 }, { "pack20", CDI_DATATYPE_PACK20 }, + { "pack21", CDI_DATATYPE_PACK21 }, { "pack22", CDI_DATATYPE_PACK22 }, { "pack23", CDI_DATATYPE_PACK23 }, + { "pack24", CDI_DATATYPE_PACK24 }, { "pack25", CDI_DATATYPE_PACK25 }, { "pack26", CDI_DATATYPE_PACK26 }, + { "pack27", CDI_DATATYPE_PACK27 }, { "pack28", CDI_DATATYPE_PACK28 }, { "pack29", CDI_DATATYPE_PACK29 }, + { "pack30", CDI_DATATYPE_PACK30 }, { "pack31", CDI_DATATYPE_PACK31 }, { "pack32", CDI_DATATYPE_PACK32 }, + { "cpx32", CDI_DATATYPE_CPX32 }, { "cpx64", CDI_DATATYPE_CPX64 }, { "flt32", CDI_DATATYPE_FLT32 }, + { "flt64", CDI_DATATYPE_FLT64 }, { "int8", CDI_DATATYPE_INT8 }, { "int16", CDI_DATATYPE_INT16 }, + { "int32", CDI_DATATYPE_INT32 }, { "uint8", CDI_DATATYPE_UINT8 }, { "uint16", CDI_DATATYPE_UINT16 }, + { "uint32", CDI_DATATYPE_UINT32 }, + }; + static const struct string2int taxistypeArgMap[] = { + { "absolute", TAXIS_ABSOLUTE }, + { "relative", TAXIS_RELATIVE }, + { "forecast", TAXIS_FORECAST }, + }; + static const struct string2int taxisunitArgMap[] = { + { "second", TUNIT_SECOND }, { "minute", TUNIT_MINUTE }, { "quarter", TUNIT_QUARTER }, { "30minutes", TUNIT_30MINUTES }, + { "hour", TUNIT_HOUR }, { "3hours", TUNIT_3HOURS }, { "6hours", TUNIT_6HOURS }, { "12hours", TUNIT_12HOURS }, + { "day", TUNIT_DAY }, { "month", TUNIT_MONTH }, { "year", TUNIT_YEAR }, + }; + enum + { + datatypeArgMapSize = sizeof(datatypeArgMap) / sizeof(datatypeArgMap[0]), + taxistypeArgMapSize = sizeof(taxistypeArgMap) / sizeof(taxistypeArgMap[0]), + taxisunitArgMapSize = sizeof(taxisunitArgMap) / sizeof(taxisunitArgMap[0]), + }; + struct boolOptionParse bop; + if ((bop = parseBooleanLongOption(sizeof(cacheRedistStr), cacheRedistStr, str)).matched) { #ifdef USE_MPI - if (str[sizeof (cacheRedistStr) - 1] == '\0' - || !strcmp(str + sizeof (cacheRedistStr) - 1, "=true")) - cdiPioConfSetRedistCache(pioConfHandle, 1); - else if (!strcmp(str + sizeof (cacheRedistStr) - 1, "=false")) - cdiPioConfSetRedistCache(pioConfHandle, 0); - else - invalidOptionDie("invalid option argument to -qcache-redists: %s\n", - optarg + sizeof (cacheRedistStr) - 1); + cdiPioConfSetRedistCache(pioConfHandle, bop.value); #else - invalidOptionDie("CDI-PIO option -q%s ignored in non-MPI mode\n", - cacheRedistStr); + invalidOptionDie("CDI-PIO option -q%s unavailable in non-MPI mode\n", cacheRedistStr + (bop.invert ? 0 : 3)); #endif } - else if (!strncmp(str, pioRoleSchemeOptionStr, - sizeof (pioRoleSchemeOptionStr) - 1)) + else if (parseLongOptionArgStringToInt(str, sizeof(taxistypeOptionStr) - 1, taxistypeOptionStr, taxistypeArgMapSize, + taxistypeArgMap, argc, argv, &setup->taxistype)) + ; + else if (parseLongOptionArgStringToInt(str, sizeof(taxisunitOptionStr) - 1, taxisunitOptionStr, taxisunitArgMapSize, + taxisunitArgMap, argc, argv, &setup->taxisunit)) + ; + else if (parseLongOptionArgStringToInt(str, sizeof(datatypeOptionStr) - 1, datatypeOptionStr, datatypeArgMapSize, datatypeArgMap, + argc, argv, &setup->datatype)) + ; + else if (!strncmp(str, pioRoleSchemeOptionStr, sizeof(pioRoleSchemeOptionStr) - 1)) { #ifdef USE_MPI - static const char pioRoleSchemeLastN[]="last", - pioRoleSchemeFirstN[]="first", pioRoleSchemeBalanced[]="balanced"; - if (str[sizeof (pioRoleSchemeOptionStr) - 1] == '=') + static const char pioRoleSchemeLastN[] = "last", pioRoleSchemeFirstN[] = "first", pioRoleSchemeBalanced[] = "balanced"; + if (str[sizeof(pioRoleSchemeOptionStr) - 1] == '=') { - const char *optargarg = str + sizeof (pioRoleSchemeOptionStr); - if (!strcmp(optargarg, pioRoleSchemeLastN)) + const char *optargArg = str + sizeof(pioRoleSchemeOptionStr); + if (!strcmp(optargArg, pioRoleSchemeLastN)) *pioRoleAssign = cdiPioCSRLastN; - else if (!strcmp(optargarg, pioRoleSchemeFirstN)) + else if (!strcmp(optargArg, pioRoleSchemeFirstN)) *pioRoleAssign = cdiPioCSRFirstN; - else if (!strcmp(optargarg, pioRoleSchemeBalanced)) + else if (!strcmp(optargArg, pioRoleSchemeBalanced)) *pioRoleAssign = cdiPioCSRBalanced; else - invalidOptionDie("unknown scheme argument \"%s\" to -q%s", - optargarg, pioRoleSchemeOptionStr); + invalidOptionDie("unknown scheme argument \"%s\" to -q%s", optargArg, pioRoleSchemeOptionStr); } else - invalidOptionDie("long option %s needs argument\n", - pioRoleSchemeOptionStr); + invalidOptionDie("long option %s needs argument\n", pioRoleSchemeOptionStr); +#else + invalidOptionDie("CDI-PIO option -q%s ignored in non-MPI mode\n", pioRoleSchemeOptionStr); +#endif + } + else if (!strncmp(str, prefixOptionStr, sizeof(prefixOptionStr) - 1)) + { + if (str[sizeof(prefixOptionStr) - 1] == '=') + { + setup->prefix = str + sizeof(prefixOptionStr); + } + else + invalidOptionDie("long option %s needs argument\n", prefixOptionStr); + } + else if ((bop = parseBooleanLongOption(sizeof(useDistGridOptionStr), useDistGridOptionStr, str)).matched) + { +#if defined USE_MPI && defined HAVE_PPM_DIST_ARRAY_H + setup->flags = (setup->flags & ~PIO_WRITE_CONFIG_USE_DIST_GRID_FLAG) | (bop.value << PIO_WRITE_CONFIG_USE_DIST_GRID_BIT); +#else + invalidOptionDie("CDI-PIO option -q%s feature unavailable %s\n", useDistGridOptionStr + (bop.invert ? 0 : 3), +#ifndef USE_MPI + "in non-MPI mode" +#else + "without PPM feature distributed multi-array" +#endif + ); +#endif + } + else if ((bop = parseBooleanLongOption(sizeof(uuidCreateOptionStr), uuidCreateOptionStr, str)).matched) + { + setup->flags = (setup->flags & ~PIO_WRITE_CONFIG_CREATE_UUID_FLAG) | (bop.value << PIO_WRITE_CONFIG_CREATE_UUID_BIT); + } + else if ((bop = parseBooleanLongOption(sizeof(presetDecoOptionStr), presetDecoOptionStr, str)).matched) + { +#ifdef USE_MPI + setup->flags + = (setup->flags & ~PIO_WRITE_CONFIG_PRESET_DECOMPOSITION_FLAG) | (bop.value << PIO_WRITE_CONFIG_PRESET_DECOMPOSITION_BIT); #else - invalidOptionDie("CDI-PIO option -q%s ignored in non-MPI mode\n", - pioRoleSchemeOptionStr); + invalidOptionDie("CDI-PIO option -q%s unavailable in non-MPI mode\n", presetDecoOptionStr + (bop.invert ? 0 : 3)); #endif } - else if (!strcmp(str, uuidCreateOptionStr + 3)) + else if ((bop = parseBooleanLongOption(sizeof(batchedRmaOptionStr), batchedRmaOptionStr, str)).matched) { - setup->create_uuid = true; +#ifdef USE_MPI + cdiPioConfSetBatchedRMA(pioConfHandle, bop.value); +#else + invalidOptionDie("CDI-PIO option -q%s unavailable in non-MPI mode\n", batchedRmaOptionStr + (bop.invert ? 0 : 3)); +#endif } - else if (!strcmp(str, uuidCreateOptionStr)) + else if ((bop = parseBooleanLongOption(sizeof(curvilinearGridOptionStr), curvilinearGridOptionStr, str)).matched) { - setup->create_uuid = false; + setup->flags = (setup->flags & ~PIO_WRITE_CONFIG_CREATE_CURVILINEAR_GRID_FLAG) + | (bop.value << PIO_WRITE_CONFIG_CREATE_CURVILINEAR_GRID_BIT); } else invalidOptionDie("unknown long option: %s\n", str); } - -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { struct model_config setup = default_setup; @@ -176,12 +341,12 @@ int main(int argc, char *argv[]) int IOMode = PIO_MPI; int nProcsIO = 2; - xmpi ( MPI_Init ( &argc, &argv)); + xmpi(MPI_Init(&argc, &argv)); commGlob = MPI_COMM_WORLD; xt_initialize(commGlob); - xmpi ( MPI_Comm_set_errhandler ( commGlob, MPI_ERRORS_RETURN )); - xmpi ( MPI_Comm_size ( commGlob, &sizeGlob )); - xmpi ( MPI_Comm_rank ( commGlob, &rankGlob )); + xmpi(MPI_Comm_set_errhandler(commGlob, MPI_ERRORS_RETURN)); + xmpi(MPI_Comm_size(commGlob, &sizeGlob)); + xmpi(MPI_Comm_rank(commGlob, &rankGlob)); pioConfHandle = cdiPioConfCreate(); pioRoleAssign = cdiPioCSRLastN; @@ -201,118 +366,105 @@ int main(int argc, char *argv[]) perror("failed seed generation!"); exit(1); } - randSeed = (unsigned)(tv.tv_sec ^ tv.tv_usec); + randSeed = (unsigned) (tv.tv_sec ^ tv.tv_usec); } } { int opt; - while ((opt = getopt(argc, argv, "f:m:n:z:t:y:cs:q:" + while ((opt = getopt(argc, argv, + "f:m:n:z:t:y:cs:q:" #ifdef USE_MPI "p:w:" #endif - )) != -1) - switch (opt) { -#ifdef USE_MPI - case 'p': - IOMode = cdiPioStr2IOMode(optarg); - if (IOMode < 0) - { - fprintf(stderr, "Unsupported PIO mode requested: %s\n", optarg); - exit(EXIT_FAILURE); - } - break; - case 'w': + )) + != -1) + switch (opt) { - long temp = strtol(optarg, NULL, 0); - if (temp < 0 || temp > INT_MAX/2) +#ifdef USE_MPI + case 'p': + IOMode = cdiPioStr2IOMode(optarg); + if (IOMode < 0) { - fprintf(stderr, "Unsupported number of I/O servers: %ld\n", temp); + fprintf(stderr, "Unsupported PIO mode requested: %s\n", optarg); exit(EXIT_FAILURE); } - nProcsIO = (int)temp; - } - break; + break; + case 'w': + { + long temp = strtol(optarg, NULL, 0); + if (temp < 0 || temp > INT_MAX / 2) + { + fprintf(stderr, "Unsupported number of I/O servers: %ld\n", temp); + exit(EXIT_FAILURE); + } + nProcsIO = (int) temp; + } + break; #endif - case 'q': - parse_long_option(&setup, pioConfHandle, &pioRoleAssign, optarg); - break; - case 'f': - { - int found = 0; - for (size_t i = 0; - i < sizeof (suffix2type) / sizeof (suffix2type[0]); - ++i) - if (!strcmp(optarg, suffix2type[i].suffix)) + case 'q': parse_long_option(&setup, pioConfHandle, &pioRoleAssign, optarg, argc, argv); break; + case 'f': + { + int found = 0; + for (size_t i = 0; i < sizeof(suffix2type) / sizeof(suffix2type[0]); ++i) + if (!strcmp(optarg, suffix2type[i].suffix)) + { + found = 1; + setup.filetype = suffix2type[i].type; + setup.suffix = suffix2type[i].suffix; + setup.datatype = suffix2type[i].defaultDT; + break; + } + if (!found) { - found = 1; - setup.filetype = suffix2type[i].type; - setup.suffix = suffix2type[i].suffix; - setup.datatype = suffix2type[i].defaultDT; - break; + fprintf(stderr, "Unsupported format requested: %s\n", optarg); + exit(EXIT_FAILURE); } - if (!found) + } + break; + case 'm': setup.nlon = parse_intarg("error parsing number of longitudes"); break; + case 'n': setup.nlat = parse_intarg("error parsing number of latitudes"); break; + case 'y': + setup.nvars = parse_intarg("error parsing number of variables"); + if (setup.nvars < 1) { - fprintf(stderr, "Unsupported format requested: %s\n", optarg); + fputs("number of variables must be greater than zero!\n", stderr); exit(EXIT_FAILURE); } - } - break; - case 'm': - setup.nlon = parse_intarg("error parsing number of longitudes"); - break; - case 'n': - setup.nlat = parse_intarg("error parsing number of latitudes"); - break; - case 'y': - setup.nvars = parse_intarg("error parsing number of variables"); - if (setup.nvars < 1) - { - fputs("number of levels must be greater than zero!\n", - stderr); - exit(EXIT_FAILURE); - } - if (setup.nvars > 127) - { - fputs("number of variables must not exceed 127!\n", - stderr); - exit(EXIT_FAILURE); - } - break; - case 'z': - setup.max_nlev = parse_intarg("error parsing number of levels"); - if (setup.max_nlev < 1) - { - fputs("number of levels must be greater than zero!\n", - stderr); - exit(EXIT_FAILURE); - } - break; - case 't': - setup.nts = parse_intarg("error parsing number of timesteps"); - break; - case 'c': - setup.compute_checksum = 0; - break; - case 's': - randSeed = parse_unsignedarg("error parsing random seed"); - break; - default: /* '?' */ - fprintf(stderr, "Usage: %s " - "[-m nlon] [-n nlat] [-z nlev] [-t nts] [-y num_vars]" + if (setup.nvars > 127) + { + fputs("number of variables must not exceed 127!\n", stderr); + exit(EXIT_FAILURE); + } + break; + case 'z': + setup.max_nlev = parse_intarg("error parsing number of levels"); + if (setup.max_nlev < 1) + { + fputs("number of levels must be greater than zero!\n", stderr); + exit(EXIT_FAILURE); + } + break; + case 't': setup.nts = parse_intarg("error parsing number of timesteps"); break; + case 'c': setup.flags &= ~PIO_WRITE_CONFIG_CHECKSUM_FLAG; break; + case 's': randSeed = parse_unsignedarg("error parsing random seed"); break; + default: /* '?' */ + fprintf(stderr, + "Usage: %s " + "[-m nlon] [-n nlat] [-z nlev] [-t nts] [-y num_vars]" #ifdef USE_MPI - " [-p PIO_MODE] [-w NIOSERVERS] [-c]" + " [-p PIO_MODE] [-w NIOSERVERS] [-c]" #endif - "\n", argv[0]); - exit(EXIT_FAILURE); - } - + "\n", + argv[0]); + exit(EXIT_FAILURE); + } } #ifdef USE_MPI MPI_Bcast(&randSeed, 1, MPI_UNSIGNED, 0, MPI_COMM_WORLD); #endif - srandom(randSeed); + cdi_seed_repeatable_random(randSeed); #ifdef USE_MPI if (rankGlob == 0) #endif @@ -321,8 +473,7 @@ int main(int argc, char *argv[]) #ifdef USE_MPI int pioNamespace; cdiPioConfSetIOMode(pioConfHandle, IOMode); - cdiPioConfSetCSRole(pioConfHandle, pioRoleAssign(commGlob, IOMode, - nProcsIO)); + cdiPioConfSetCSRole(pioConfHandle, pioRoleAssign(commGlob, IOMode, nProcsIO)); cdiPioConfSetPartInflate(pioConfHandle, 1.0f); int initNamespace = namespaceGetActive(); commModel = cdiPioInit(commGlob, pioConfHandle, &pioNamespace); @@ -330,23 +481,23 @@ int main(int argc, char *argv[]) { namespaceSetActive(pioNamespace); #else - commModel = -1; + commModel = -1; #endif - modelRun (setup, commModel); + modelRun(&setup, commModel); #ifdef USE_MPI } + cdi_repeatable_finalize(); + pioFinalize(); namespaceSetActive(initNamespace); cdiPioConfDestroy(pioConfHandle); - pioFinalize (); xt_finalize(); - MPI_Finalize (); + MPI_Finalize(); #endif return 0; } - /* * Local Variables: * c-file-style: "Java" diff --git a/tests/pio_write.h b/tests/pio_write.h index dae4602e411eefcae19eb23b3928ef17751ff358..f140af18679df7ba474906515c7f230e87011ca2 100644 --- a/tests/pio_write.h +++ b/tests/pio_write.h @@ -5,17 +5,37 @@ #include "config.h" #endif +#ifdef USE_MPI +#include <mpi.h> +#else +typedef int MPI_Comm; +#endif + #include <stdbool.h> +enum +{ + PIO_WRITE_CONFIG_CHECKSUM_BIT = 0, + PIO_WRITE_CONFIG_CREATE_UUID_BIT, + PIO_WRITE_CONFIG_CREATE_CURVILINEAR_GRID_BIT, + PIO_WRITE_CONFIG_USE_DIST_GRID_BIT, + PIO_WRITE_CONFIG_PRESET_DECOMPOSITION_BIT, + PIO_WRITE_CONFIG_CHECKSUM_FLAG = 1 << PIO_WRITE_CONFIG_CHECKSUM_BIT, + PIO_WRITE_CONFIG_CREATE_UUID_FLAG = 1 << PIO_WRITE_CONFIG_CREATE_UUID_BIT, + PIO_WRITE_CONFIG_CREATE_CURVILINEAR_GRID_FLAG = 1 << PIO_WRITE_CONFIG_CREATE_CURVILINEAR_GRID_BIT, + PIO_WRITE_CONFIG_USE_DIST_GRID_FLAG = 1 << PIO_WRITE_CONFIG_USE_DIST_GRID_BIT, + PIO_WRITE_CONFIG_PRESET_DECOMPOSITION_FLAG = 1 << PIO_WRITE_CONFIG_PRESET_DECOMPOSITION_BIT, +}; + struct model_config { int nlon, nlat, nts, max_nlev, nvars; int filetype, datatype; - bool compute_checksum, create_uuid; - const char *suffix; + int flags; + int taxistype, taxisunit; + const char *suffix, *prefix; }; -void -modelRun(struct model_config setup, MPI_Comm comm); +void modelRun(const struct model_config *setup, MPI_Comm comm); #endif diff --git a/tests/pio_write.parallel.run.in b/tests/pio_write.parallel.run.in new file mode 100644 index 0000000000000000000000000000000000000000..1bf4561e3334a747273f556ee96c024a70c1f733 --- /dev/null +++ b/tests/pio_write.parallel.run.in @@ -0,0 +1,10 @@ +#!@SHELL@ + +mpi_task_num=4 + +. ./pio_write.run +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/pio_write.run.in b/tests/pio_write.run.in new file mode 100644 index 0000000000000000000000000000000000000000..a13330e3bb6e92a60a29cd5e4ea67ba5489b3bff --- /dev/null +++ b/tests/pio_write.run.in @@ -0,0 +1,88 @@ +#! @SHELL@ + +set -e +case "$0" in + */*) + prefix=`expr "$0" : '.*/\([^/]*\)$'` + ;; + *) + prefix=$0 + ;; +esac +case x"${CDI_PIO_TEST_DIR+${CDI_PIO_TEST_DIR}}" in + x) + : + ;; + *) + prefix="${CDI_PIO_TEST_DIR}/${prefix}" + ;; +esac +suffix=${suffix-grb} + +if ${mpi_task_num+:} false; then + @ENABLE_MPI_FALSE@exit 77 + test 'x@MPI_LAUNCH@' != xtrue || exit 77 + pio_write=${pio_write-'./pio_write.parallel'} + variations=${variations-"'' -qno-batch-rma -qcache-redists -qcreate-curvilinear-grid -qpreset-decomposition=true"} + launch="@MPI_LAUNCH@ -n ${mpi_task_num} ${tool_wrap_mpi}" +else + pio_write=${pio_write-'./pio_write'} + variations=${variations-"'' -qcreate-curvilinear-grid"} + launch=${tool_wrap} +fi + +case ${suffix} in + grb) + test 'x@ENABLE_GRIB@' = xyes || exit 77 + ;; + grb2) + @HAVE_LIBGRIB_API_FALSE@exit 77 + test 'x@ENABLE_GRIB@' = xyes || exit 77 + ;; + nc) + @ENABLE_NETCDF_FALSE@exit 77 + ;; + nc2) + test 'x@ENABLE_NC2@' = xyes || exit 77 + ;; + nc4) + test 'x@ENABLE_NC4@' = xyes || exit 77 + ;; + *) + echo "Unsupported suffix '${suffix}'" >&2 + exit 1 + ;; +esac + +test_variation () +{ + if prefix_dirname=`expr "$prefix" : '\(.*\)/'` ; then + mkdir -p "${prefix_dirname}" + fi + echo "creating data with $1" >&2 + variation=$1 + @top_builddir@/libtool --mode=execute \ + ${launch} \ + ${pio_write} "-qprefix=${prefix}" -f ${suffix} \ + ${pio_write_args} -s 7 ${variation} || exit 1 + tfile=0 + ntfiles=2 + while [ "$tfile" -lt "$ntfiles" ]; do + p="${prefix}_${tfile}" + echo "checking ${p}.${suffix}" >&2 + @top_builddir@/libtool --mode=execute \ + ${tool_wrap} ./cksum_read "${p}.${suffix}" "${p}.cksum" + rm "${p}.${suffix}" "${p}.cksum" + tfile=`expr "$tfile" + 1` + done +} + +eval "set dummy $variations"; shift +for variation in "$@"; do + test_variation "$variation" +done +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/pio_write_deco2d.parallel.run.in b/tests/pio_write_deco2d.parallel.run.in new file mode 100644 index 0000000000000000000000000000000000000000..e1f12dae0e4a26e1bdcef171d29ee98f1c47cc2b --- /dev/null +++ b/tests/pio_write_deco2d.parallel.run.in @@ -0,0 +1,11 @@ +#!@SHELL@ + +mpi_task_num=6 +pio_write='./pio_write_deco2d.parallel' + +. ./pio_write.run +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/pio_write_deco2d.run.in b/tests/pio_write_deco2d.run.in new file mode 100644 index 0000000000000000000000000000000000000000..d534643e2b7ad7fced5497ba385c8b7b5bbdad45 --- /dev/null +++ b/tests/pio_write_deco2d.run.in @@ -0,0 +1,10 @@ +#!@SHELL@ + +pio_write='./pio_write_deco2d' + +. ./pio_write.run +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/pio_write_deco2d_run.in b/tests/pio_write_deco2d_run.in deleted file mode 100644 index bb45949b156b0ff3ecd11ca0d9ec44324c2a4afd..0000000000000000000000000000000000000000 --- a/tests/pio_write_deco2d_run.in +++ /dev/null @@ -1,24 +0,0 @@ -#! @SHELL@ -set -e -LOG="${LOG-pio_write_deco2d.log}" -if [ @ENABLE_GRIB@ = yes ]; then - mpi_task_num="${mpi_task_num-6}" - suffix="${suffix-grb}" - exec 5>&1 6>&2 >"$LOG" 2>&1 - ../libtool --mode=execute @MPI_LAUNCH@ -n ${mpi_task_num} \ - ${tool_wrap_mpi} ./pio_write_deco2d ${pio_write_args} - exec 2>&6 1>&5 5>&- 6>&- - ../libtool --mode=execute \ - ${tool_wrap} ./cksum_read example_0.${suffix} example_0.cksum - ../libtool --mode=execute \ - ${tool_wrap} ./cksum_read example_1.${suffix} example_1.cksum - \rm "$LOG" -else - # skip tests for unsupported formats - exit 77 -fi -# -# Local Variables: -# mode: sh -# End: -# diff --git a/tests/pio_write_dist_array.run.in b/tests/pio_write_dist_array.run.in new file mode 100644 index 0000000000000000000000000000000000000000..25bf3bed97faf30e86ebcd117dc104c13694a68c --- /dev/null +++ b/tests/pio_write_dist_array.run.in @@ -0,0 +1,12 @@ +#! @SHELL@ +test 'x@HAVE_PPM_DIST_ARRAY@' = xyes || exit 77 + +mpi_task_num=${mpi_task_num-4} +variations="'-qcreate-curvilinear-grid -quse-dist-grid'" + +. ./pio_write.run +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/pio_write_run.in b/tests/pio_write_run.in deleted file mode 100644 index 247e75649fdc56a3167ded93dae3dcba4f278761..0000000000000000000000000000000000000000 --- a/tests/pio_write_run.in +++ /dev/null @@ -1,32 +0,0 @@ -#! @SHELL@ -set -e -LOG="${LOG-pio_write.log}" -if [ @ENABLE_GRIB@ != yes ]; then - # skip tests for unsupported formats - exit 77 -fi -mpi_task_num="${mpi_task_num-4}" -suffix="${suffix-grb}" -if [ "@USE_MPI@" = yes ]; then - variations="-qcache-redists" -else - unset variations -fi -for variation in "" $variations ; do - exec 5>&1 6>&2 >"$LOG" 2>&1 - ../libtool --mode=execute \ - @MPI_LAUNCH@ \ - -n ${mpi_task_num} ${tool_wrap_mpi} \ - ./pio_write ${pio_write_args} ${variation} - exec 2>&6 1>&5 5>&- 6>&- - ../libtool --mode=execute \ - ${tool_wrap} ./cksum_read example_0.${suffix} example_0.cksum - ../libtool --mode=execute \ - ${tool_wrap} ./cksum_read example_1.${suffix} example_1.cksum - \rm "$LOG" -done -# -# Local Variables: -# mode: sh -# End: -# diff --git a/tests/pio_write_setup_grid.c b/tests/pio_write_setup_grid.c new file mode 100644 index 0000000000000000000000000000000000000000..8b35dc07aad3591928a11ad764cab49b940e822d --- /dev/null +++ b/tests/pio_write_setup_grid.c @@ -0,0 +1,197 @@ +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include <stdio.h> +#include <stdlib.h> + +#ifdef USE_MPI +#include <mpi.h> +#include <yaxt.h> +#include "error.h" +#include "pio_util.h" +#endif +#include "dmemory.h" + +#if defined USE_MPI && defined HAVE_PPM_CORE +#include <ppm/ppm_uniform_partition.h> +#include <core/ppm_combinatorics.h> +#endif + +#include "cdi.h" +#ifdef USE_MPI +#include "cdipio.h" +#endif +#include "pio_write_setup_grid.h" +#include "cdi_uuid.h" +#include "simple_model_helper.h" + +#if USE_MPI +void +findPartition2D(int npart[2], int num_parts) +{ + const uint64_t rscale = 256; + uint32_t *factors = NULL; + xassert(num_parts > 0); + int numFactors = PPM_prime_factorization_32((uint32_t) num_parts, &factors); + /* try to distribute prime factors on dimensions to get + * approx. 2 times as many parts in x dim than y dim */ + const uint64_t optimumRatio = rscale * 2; + npart[0] = num_parts, npart[1] = 1; + uint_fast32_t npart_attempt[2]; + uint64_t bestRatio = (uint64_t) num_parts * rscale, bestDiff = (uint64_t) llabs((long long) (bestRatio - optimumRatio)); + /* test all assignments of factors to dimensions, starting with + * only one assigned to x dim (omitting 0 because that would + * always give npart[1] > npart[0] */ + for (int assign2X = 1; assign2X <= numFactors; ++assign2X) + { + uint_fast32_t pattern = (UINT32_C(1) << assign2X) - 1, lastPattern = pattern << (numFactors - assign2X); + do + { + npart_attempt[0] = 1; + npart_attempt[1] = 1; + /* loop over all factors */ + for (uint_fast32_t i = 0; i < (uint_fast32_t) numFactors; ++i) + { + uint_fast32_t dim_idx = (pattern >> i) & 1; + npart_attempt[dim_idx] *= factors[i]; + } + uint64_t ratio = ((uint64_t) npart_attempt[0] * rscale) / (uint64_t) npart_attempt[1]; + uint64_t diff = (uint64_t) llabs((long long) (ratio - optimumRatio)); + if (diff < bestDiff) + { + npart[0] = (int) npart_attempt[0]; + npart[1] = (int) npart_attempt[1]; + bestDiff = diff; + bestRatio = ratio; + } + { + uint_fast32_t t; +#if HAVE_DECL___BUILTIN_CTZ + t = pattern | (pattern - 1); + pattern = (t + 1) | (((~t & -~t) - 1) >> (__builtin_ctz((unsigned) pattern) + 1)); +#else + t = (pattern | (pattern - 1)) + 1; + pattern = t | ((((t & -t) / (pattern & -pattern)) >> 1) - 1); +#endif + } + } + while (pattern <= lastPattern); + } + Free(factors); +} +#endif + +int +setupGrid(const struct model_config *setup, MPI_Comm comm) +{ + int nlon = setup->nlon, nlat = setup->nlat; + int gridID; + int rank = 0; +#if USE_MPI + xmpi(MPI_Comm_rank(comm, &rank)); +#else + (void) comm; +#endif + if (setup->flags & PIO_WRITE_CONFIG_USE_DIST_GRID_FLAG) + { +#if USE_MPI + if (setup->flags & PIO_WRITE_CONFIG_CREATE_CURVILINEAR_GRID_FLAG) + { + size_t gridsize = (size_t) nlon * (size_t) nlat; + Xt_int grid_global_shape[2] = { (Xt_int) nlat, (Xt_int) nlon }, grid_local_chunk_start[2]; + int nprocs; + xmpi(MPI_Comm_size(comm, &nprocs)); + int nprocs2D[2], grid_local_chunk_shape[2]; + findPartition2D(nprocs2D, nprocs); + { + struct PPM_extent set_interval_y = { 0, nlat }, + part_interval_y = PPM_uniform_partition(set_interval_y, nprocs2D[1], rank / nprocs2D[0]); + grid_local_chunk_shape[0] = part_interval_y.size; + grid_local_chunk_start[0] = part_interval_y.first; + } + { + struct PPM_extent set_interval_x = { 0, nlon }, + part_interval_x = PPM_uniform_partition(set_interval_x, nprocs2D[0], rank % nprocs2D[0]); + grid_local_chunk_shape[1] = part_interval_x.size; + grid_local_chunk_start[1] = part_interval_x.first; + } + { + Xt_idxlist partDesc2D + = xt_idxsection_new((Xt_int) 0, 2, grid_global_shape, grid_local_chunk_shape, grid_local_chunk_start); + const int gridDecoChunks[2][2] = { [0] = { + [0] = (int)grid_local_chunk_start[0], + [1] = (int)grid_local_chunk_shape[0], + }, [1] = { + [0] = (int)grid_local_chunk_start[1], + [1] = (int)grid_local_chunk_shape[1], + } }; + gridID = cdiPioDistGridCreate(GRID_CURVILINEAR, (int) gridsize, nlon, nlat, 0, gridDecoChunks, partDesc2D, NULL, NULL); + xt_idxlist_delete(partDesc2D); + } + size_t grid_chunk_size = (size_t) grid_local_chunk_shape[0] * (size_t) grid_local_chunk_shape[1]; + { + double *grid_chunk = (double *) Malloc(2 * grid_chunk_size * sizeof(*grid_chunk)); + /* anti-clockwise coordinates around Amazonia */ + static const struct cart_coord region[4] +#ifdef __cplusplus + = { { DEG2RAD(-25.0), DEG2RAD(-85.0) }, + { DEG2RAD(-18.0), DEG2RAD(-44.0) }, + { DEG2RAD(-7.0), DEG2RAD(-50.0) }, + { DEG2RAD(10.0), DEG2RAD(-80.0) } }; +#else + = { { .lon = DEG2RAD(-85.0), .lat = DEG2RAD(-25.0) }, + { .lon = DEG2RAD(-44.0), .lat = DEG2RAD(-18.0) }, + { .lon = DEG2RAD(-50.0), .lat = DEG2RAD(7.0) }, + { .lon = DEG2RAD(-80.0), .lat = DEG2RAD(10.0) } }; +#endif + const size_t xyRange[2][2] = { { (size_t) grid_local_chunk_start[1], (size_t) grid_local_chunk_start[0] }, + { (size_t) grid_local_chunk_shape[1], (size_t) grid_local_chunk_shape[0] } }; + computeCurvilinearChunk(grid_chunk, region, (size_t) nlon, (size_t) nlat, xyRange); + gridDefXvals(gridID, grid_chunk + grid_chunk_size); + gridDefYvals(gridID, grid_chunk); + Free(grid_chunk); + } + } + else + { + fputs("Error: distributed lat-lon grids are unsupported" + " at this moment.\n", + stderr); + abort(); + } +#else + fputs("Error: distributed grids are unsupported for" + " non-MPI configurations.\n", + stderr); + abort(); +#endif + } + else + { + if (setup->flags & PIO_WRITE_CONFIG_CREATE_CURVILINEAR_GRID_FLAG) + gridID = createLocalCurvilinearGrid(nlon, nlat); + else + gridID = createGlobalLatLonGrid(nlon, nlat); + } + if (setup->flags & PIO_WRITE_CONFIG_CREATE_UUID_FLAG) + { + unsigned char uuid[CDI_UUID_SIZE]; + if (rank == 0) cdiCreateUUID(uuid); +#if USE_MPI + MPI_Bcast(uuid, CDI_UUID_SIZE, MPI_UNSIGNED_CHAR, 0, comm); +#endif + gridDefUUID(gridID, uuid); + } + return gridID; +} + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ diff --git a/tests/pio_write_setup_grid.h b/tests/pio_write_setup_grid.h new file mode 100644 index 0000000000000000000000000000000000000000..52658eb7cd43baa66f5934f357f6419dab796065 --- /dev/null +++ b/tests/pio_write_setup_grid.h @@ -0,0 +1,29 @@ +#ifndef PIO_WRITE_SETUP_GRID_H +#define PIO_WRITE_SETUP_GRID_H + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#ifdef USE_MPI +#include <mpi.h> +#endif + +#include "pio_write.h" + +#ifdef USE_MPI +void findPartition2D(int npart[2], int num_parts); +#endif + +int setupGrid(const struct model_config *setup, MPI_Comm comm); + +#endif +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ diff --git a/tests/simple_model.c b/tests/simple_model.c index 8d705de07e0b8d41fde8addc86a0ef692bb67ddd..fdb9d6e599fa1d05a76acf7077973e1ef8b4d850 100644 --- a/tests/simple_model.c +++ b/tests/simple_model.c @@ -1,5 +1,5 @@ -#if defined (HAVE_CONFIG_H) -# include "config.h" +#if defined(HAVE_CONFIG_H) +#include "config.h" #endif #include <math.h> @@ -10,8 +10,6 @@ #ifdef USE_MPI #include <mpi.h> #include <yaxt.h> -#else -typedef int MPI_Comm; #endif #include "cdi.h" @@ -27,42 +25,36 @@ typedef int MPI_Comm; #include "dmemory.h" #include "error.h" #include "pio_write.h" +#include "pio_write_setup_grid.h" #include "simple_model_helper.h" #include "cdi_uuid.h" -enum { - ntfiles = 2, +enum +{ + ntfiles = 2, }; - static void -modelRegionCompute(double region[], size_t offset, size_t len, - int nlev, int nlat, int nlon, - int tsID, const double lons[], const double lats[], - double mscale, double mrscale) +modelRegionCompute(double region[], size_t offset, size_t len, int nlev, int nlat, int nlon, int tsID, double mscale, + double mrscale) { size_t local_pos; - (void)nlev; + (void) nlev; for (local_pos = 0; local_pos < len; ++local_pos) { size_t global_pos = offset + local_pos; - int k = (int)(global_pos / (size_t)(nlon * nlat)); - int j = (int)(global_pos % (size_t)(nlon * nlat) / (size_t)nlon); - int i = (int)(global_pos % (size_t)nlon); - region[local_pos] - = dg_wobble((lons[(i + tsID)%nlon] - lons[0]) - / (lons[nlon-1] - lons[0]), - (lats[(j + k)%nlat] - lats[0]) - / (lats[nlat-1] - lats[0]), mscale, mrscale); + int k = (int) (global_pos / (size_t) (nlon * nlat)); + int j = (int) (global_pos % (size_t) (nlon * nlat) / (size_t) nlon); + int i = (int) (global_pos % (size_t) nlon); + region[local_pos] = dg_wobble((double) ((i + tsID) % nlon) / (double) (nlon - 1), + (double) ((j + k) % nlat) / (double) (nlat - 1), mscale, mrscale); } } void -modelRun(struct model_config setup, MPI_Comm comm) +modelRun(const struct model_config *setup, MPI_Comm comm) { - static const char * const fname_prefix = "example"; - struct varDesc_t { size_t size; @@ -72,87 +64,74 @@ modelRun(struct model_config setup, MPI_Comm comm) int chunkSize, start; Xt_idxlist partDesc; #endif - } *varDesc; - int gridID, taxisID, vlistID, streamID, tsID, tfID = 0; - enum { nmiss = 0 }; - double *lons, *lats, *levs; + bool useFloat; + } * varDesc; + int gridID, taxisID, vlistID, tsID, tfID = 0; + enum + { + nmiss = 0 + }; + double *levs; double *var = NULL, *varslice = NULL; + float *varsliceF = NULL; double mscale, mrscale; time_t current_time; int vdate = 19850101, vtime = 120000; int rank = 0; - char filename[1024]; - int nlon = setup.nlon, nlat = setup.nlat; - size_t nVars = (size_t)setup.nvars; - size_t varslice_size = 0; + char *filename = NULL; + int nlon = setup->nlon, nlat = setup->nlat; + size_t nVars = (size_t) setup->nvars; + size_t varslice_size = 0, varsliceF_size = 0; #if USE_MPI int *chunks = NULL, *displs = NULL, comm_size = 1; + Xt_idxlist *partDescPreset = NULL; + int *conversion = NULL; #endif #if USE_MPI - xmpi ( MPI_Comm_rank ( comm, &rank )); - xmpi ( MPI_Comm_size ( comm, &comm_size )); - if (rank == 0 && setup.compute_checksum) + xmpi(MPI_Comm_rank(comm, &rank)); + xmpi(MPI_Comm_size(comm, &comm_size)); + if (rank == 0 && (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG)) { - chunks = malloc((size_t)comm_size * sizeof (chunks[0])); - displs = malloc((size_t)comm_size * sizeof (displs[0])); - var = malloc((size_t)nlon * (size_t)nlat - * (size_t)setup.max_nlev * sizeof(var[0])); + chunks = Malloc((size_t) comm_size * sizeof(chunks[0])); + displs = Malloc((size_t) comm_size * sizeof(displs[0])); + var = Malloc((size_t) nlon * (size_t) nlat * (size_t) setup->max_nlev * sizeof(var[0])); } #else - (void)comm; + (void) comm; #endif - var_scale(setup.datatype, &mscale, &mrscale); + var_scale(setup->datatype, &mscale, &mrscale); - gridID = gridCreate ( GRID_LONLAT, nlon*nlat ); - gridDefXsize ( gridID, nlon ); - gridDefYsize ( gridID, nlat ); - lons = (double *)malloc((size_t)nlon * sizeof (lons[0])); - for (size_t i = 0; i < (size_t)nlon; ++i) - lons[i] = ((double)(i * 360))/nlon; - lats = (double *)malloc((size_t)nlat * sizeof (lats[0])); - for (size_t i = 0; i < (size_t)nlat; ++i) - lats[i] = ((double)(i * 180))/nlat - 90.0; - gridDefXvals ( gridID, lons ); - gridDefYvals ( gridID, lats ); - if (setup.create_uuid) - { - unsigned char uuid[CDI_UUID_SIZE]; - if (rank == 0) - cdiCreateUUID(uuid); -#if USE_MPI - MPI_Bcast(uuid, CDI_UUID_SIZE, MPI_UNSIGNED_CHAR, 0, comm); -#endif - gridDefUUID(gridID, uuid); - } - levs = (double *)malloc((size_t)setup.max_nlev * sizeof (levs[0])); + gridID = setupGrid(setup, comm); + + levs = (double *) Malloc((size_t) setup->max_nlev * sizeof(levs[0])); { - double lscale = 1.0/(double)(setup.max_nlev - 1); - for (size_t i = 0; i < (size_t)setup.max_nlev; ++i) - levs[i] = 101300.0 - 13000.0 * expm1(2.173 * (double)i * lscale); + double lscale = 1.0 / (double) (setup->max_nlev - 1); + for (size_t i = 0; i < (size_t) setup->max_nlev; ++i) levs[i] = 101300.0 - 13000.0 * expm1(2.173 * (double) i * lscale); } - vlistID = vlistCreate (); + vlistID = vlistCreate(); - varDesc = (struct varDesc_t *)malloc(nVars * sizeof (varDesc[0])); - for (size_t varIdx = 0; varIdx < nVars; varIdx++ ) + varDesc = (struct varDesc_t *) Malloc(nVars * sizeof(varDesc[0])); +#if USE_MPI + if (setup->flags & PIO_WRITE_CONFIG_PRESET_DECOMPOSITION_FLAG) { - int varLevs = (int)random()%4; + partDescPreset = (Xt_idxlist *) Malloc(nVars * sizeof(*partDescPreset)); + conversion = (int *) Malloc(nVars * sizeof(*conversion)); + } +#endif + for (size_t varIdx = 0; varIdx < nVars; varIdx++) + { + int varLevs = (int) cdi_repeatable_random() % 4; switch (varLevs) { - case 1: - varLevs = setup.max_nlev / 3; - break; - case 2: - varLevs = setup.max_nlev >= 11 ? 11 : setup.max_nlev / 2; - break; - case 3: - varLevs = setup.max_nlev - 1; - break; + case 1: varLevs = setup->max_nlev / 3; break; + case 2: varLevs = setup->max_nlev >= 11 ? 11 : setup->max_nlev / 2; break; + case 3: varLevs = setup->max_nlev - 1; break; } ++varLevs; varDesc[varIdx].nlev = varLevs; - for (size_t i = 0; i < (size_t)varIdx; ++i) + for (size_t i = 0; i < (size_t) varIdx; ++i) if (varDesc[i].nlev == varLevs) { varDesc[varIdx].zaxisID = varDesc[i].zaxisID; @@ -162,25 +141,21 @@ modelRun(struct model_config setup, MPI_Comm comm) varDesc[varIdx].zaxisID = zaxisCreate(ZAXIS_SURFACE, 1); else { - varDesc[varIdx].zaxisID - = zaxisCreate(ZAXIS_PRESSURE, varDesc[varIdx].nlev); + varDesc[varIdx].zaxisID = zaxisCreate(ZAXIS_PRESSURE, varDesc[varIdx].nlev); zaxisDefLevels(varDesc[varIdx].zaxisID, levs); } - if (setup.create_uuid) - { - unsigned char uuid[CDI_UUID_SIZE]; - if (rank == 0) - cdiCreateUUID(uuid); + if (setup->flags & PIO_WRITE_CONFIG_CREATE_UUID_FLAG) + { + unsigned char uuid[CDI_UUID_SIZE]; + if (rank == 0) cdiCreateUUID(uuid); #if USE_MPI - MPI_Bcast(uuid, CDI_UUID_SIZE, MPI_UNSIGNED_CHAR, 0, comm); + MPI_Bcast(uuid, CDI_UUID_SIZE, MPI_UNSIGNED_CHAR, 0, comm); #endif - cdiDefKeyBytes(varDesc[varIdx].zaxisID, CDI_GLOBAL, CDI_KEY_UUID, uuid, CDI_UUID_SIZE); - } - zaxisIDset: - varDesc[varIdx].id - = vlistDefVar(vlistID, gridID, varDesc[varIdx].zaxisID, TIME_VARIABLE); - varDesc[varIdx].size - = (size_t)nlon * (size_t)nlat * (size_t)varDesc[varIdx].nlev; + cdiDefKeyBytes(varDesc[varIdx].zaxisID, CDI_GLOBAL, CDI_KEY_UUID, uuid, CDI_UUID_SIZE); + } + zaxisIDset: + varDesc[varIdx].id = vlistDefVar(vlistID, gridID, varDesc[varIdx].zaxisID, TIME_VARIABLE); + varDesc[varIdx].size = (size_t) nlon * (size_t) nlat * (size_t) varDesc[varIdx].nlev; #ifdef USE_MPI { for (size_t i = 0; i < varIdx; ++i) @@ -191,59 +166,55 @@ modelRun(struct model_config setup, MPI_Comm comm) varDesc[varIdx].chunkSize = varDesc[i].chunkSize; goto partDescriptionSet; } - struct PPM_extent range - = PPM_uniform_partition((struct PPM_extent){ 0, - (int32_t)varDesc[varIdx].size }, comm_size, rank); + struct PPM_extent range = PPM_uniform_partition((struct PPM_extent){ 0, (int32_t) varDesc[varIdx].size }, comm_size, rank); int start = range.first; int chunkSize = range.size; varDesc[varIdx].start = start; varDesc[varIdx].chunkSize = chunkSize; - varDesc[varIdx].partDesc - = xt_idxstripes_new(&(struct Xt_stripe){ .start = start, - .nstrides = chunkSize, .stride = 1 }, 1); - partDescriptionSet: ; + varDesc[varIdx].partDesc = xt_idxstripes_new(&(struct Xt_stripe){ .start = start, .nstrides = chunkSize, .stride = 1 }, 1); } + partDescriptionSet:; #endif - varDesc[varIdx].code = GRIB_USERDEF + (int)varIdx; + varDesc[varIdx].code = GRIB_USERDEF + (int) varIdx; vlistDefVarCode(vlistID, varDesc[varIdx].id, varDesc[varIdx].code); - vlistDefVarDatatype(vlistID, varDesc[varIdx].id, setup.datatype); + vlistDefVarDatatype(vlistID, varDesc[varIdx].id, setup->datatype); + varDesc[varIdx].useFloat = (bool) (cdi_repeatable_random() & 1); +#ifdef USE_MPI + if (setup->flags & PIO_WRITE_CONFIG_PRESET_DECOMPOSITION_FLAG) + { + partDescPreset[varIdx] = varDesc[varIdx].partDesc; + conversion[varIdx] = varDesc[varIdx].useFloat ? CDI_DATATYPE_FLT32 : CDI_DATATYPE_FLT64; + } +#endif } - taxisID = taxisCreate ( TAXIS_ABSOLUTE ); - vlistDefTaxis ( vlistID, taxisID ); + taxisID = taxisCreate(setup->taxistype); + if (setup->taxisunit != -1) taxisDefTunit(taxisID, setup->taxisunit); + vlistDefTaxis(vlistID, taxisID); - sprintf ( &filename[0], "%s_%d.%s", fname_prefix, tfID, setup.suffix ); - streamID = streamOpenWrite ( filename, setup.filetype ); - xassert ( streamID >= 0 ); - streamDefVlist ( streamID, vlistID); + for (tfID = 0; tfID < ntfiles; tfID++) + { + for (size_t varIdx = 0; varIdx < nVars; ++varIdx) varDesc[varIdx].checksum_state = 0; + int streamID = composeStream(&filename, setup->prefix, tfID, setup->suffix, setup->filetype); #ifdef USE_MPI - pioEndDef (); + if (partDescPreset) + cdiPioStreamDefDecomposedVlist(streamID, vlistID, partDescPreset, conversion); + else #endif + streamDefVlist(streamID, vlistID); - for ( tfID = 0; tfID < ntfiles; tfID++ ) - { - for (size_t varIdx = 0; varIdx < nVars; ++varIdx) - varDesc[varIdx].checksum_state = 0; - if ( tfID > 0 ) - { - streamClose ( streamID ); - sprintf ( &filename[0], "%s_%d.%s", fname_prefix, tfID, setup.suffix ); - streamID = streamOpenWrite ( filename, setup.filetype ); - xassert ( streamID >= 0 ); - streamDefVlist ( streamID, vlistID ); - } vdate = 19850101; vtime = 120000; current_time = cditime2time_t(vdate, vtime); - for ( tsID = 0; tsID < setup.nts; tsID++ ) - { + for (tsID = 0; tsID < setup->nts; tsID++) + { int vdatetime[2]; time_t2cditime(current_time, &vdatetime[1], &vdatetime[0]); - taxisDefVdate(taxisID, vdatetime[1]); - taxisDefVtime(taxisID, vdatetime[0]); - streamDefTimestep ( streamID, tsID ); - if (setup.filetype == CDI_FILETYPE_EXT) + taxisDefVdate(taxisID, vdatetime[1]); + taxisDefVtime(taxisID, vdatetime[0]); + streamDefTimestep(streamID, tsID); + if (setup->filetype == CDI_FILETYPE_EXT) { /* EXTRA doesn't store time, only date * set the value to 0 before checksumming, because a @@ -251,102 +222,111 @@ modelRun(struct model_config setup, MPI_Comm comm) * return */ vdatetime[0] = 0; } - for (size_t varIdx = 0; varIdx < nVars; ++varIdx) - { + for (size_t varIdx = 0; varIdx < nVars; ++varIdx) + { #ifdef USE_MPI int start = varDesc[varIdx].start; - size_t chunkSize = (size_t)varDesc[varIdx].chunkSize; + size_t chunkSize = (size_t) varDesc[varIdx].chunkSize; #else size_t chunkSize = varDesc[varIdx].size; int start = 0; #endif if (varslice_size < chunkSize) { - varslice = (double *)Realloc(varslice, chunkSize * sizeof (var[0])); + varslice = (double *) Realloc(varslice, chunkSize * sizeof(var[0])); varslice_size = chunkSize; } - modelRegionCompute(varslice, (size_t)start, chunkSize, - varDesc[varIdx].nlev, nlat, nlon, - tsID, lons, lats, - mscale, mrscale); - if (setup.compute_checksum) + modelRegionCompute(varslice, (size_t) start, chunkSize, varDesc[varIdx].nlev, nlat, nlon, tsID, mscale, mrscale); + bool useFloat = varDesc[varIdx].useFloat; + if (useFloat) + { + if (varsliceF_size < chunkSize) + { + varsliceF = (float *) Realloc(varsliceF, chunkSize * sizeof(varsliceF[0])); + varsliceF_size = chunkSize; + } + for (size_t i = 0; i < chunkSize; ++i) varslice[i] = varsliceF[i] = (float) varslice[i]; + } + + if (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG) { #if USE_MPI - int chunk = (int)chunkSize; - xmpi(MPI_Gather(&chunk, 1, MPI_INT, - chunks, 1, MPI_INT, 0, comm)); + int chunk = (int) chunkSize; + xmpi(MPI_Gather(&chunk, 1, MPI_INT, chunks, 1, MPI_INT, 0, comm)); if (rank == 0) { - displs[0] = 0; - for (size_t i = 1; i < (size_t)comm_size; ++i) - displs[i] = displs[i - 1] + chunks[i - 1]; + int accum = 0; + for (size_t i = 0; i < (size_t) comm_size; ++i) + { + displs[i] = accum; + accum += chunks[i]; + } } - xmpi(MPI_Gatherv(varslice, chunk, MPI_DOUBLE, - var, chunks, displs, MPI_DOUBLE, 0, comm)); + xmpi(MPI_Gatherv(varslice, chunk, MPI_DOUBLE, var, chunks, displs, MPI_DOUBLE, 0, comm)); #else var = varslice; #endif } - if (rank == 0 && setup.compute_checksum) + if (rank == 0 && (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG)) { - memcrc_r(&varDesc[varIdx].checksum_state, - (const unsigned char *)vdatetime, - sizeof (vdatetime)); - memcrc_r(&varDesc[varIdx].checksum_state, - (const unsigned char *)var, - varDesc[varIdx].size * sizeof (var[0])); + memcrc_r(&varDesc[varIdx].checksum_state, (const unsigned char *) vdatetime, sizeof(vdatetime)); + memcrc_r(&varDesc[varIdx].checksum_state, (const unsigned char *) var, varDesc[varIdx].size * sizeof(var[0])); } #ifdef USE_MPI - streamWriteVarPart(streamID, varDesc[varIdx].id, varslice, nmiss, - varDesc[varIdx].partDesc); + if (useFloat) + streamWriteVarPartF(streamID, varDesc[varIdx].id, varsliceF, nmiss, varDesc[varIdx].partDesc); + else + streamWriteVarPart(streamID, varDesc[varIdx].id, varslice, nmiss, varDesc[varIdx].partDesc); #else - streamWriteVar(streamID, varDesc[varIdx].id, varslice, nmiss); + if (useFloat) + streamWriteVarF(streamID, varDesc[varIdx].id, varsliceF, nmiss); + else + streamWriteVar(streamID, varDesc[varIdx].id, varslice, nmiss); #endif - } + } current_time += 86400; #ifdef USE_MPI - pioWriteTimestep(); + pioWriteTimestep(); #endif - } - if (rank == 0 && setup.compute_checksum) + } + streamClose(streamID); + if (rank == 0 && (setup->flags & PIO_WRITE_CONFIG_CHECKSUM_FLAG)) { FILE *tablefp; - { - sprintf(filename, "%s_%d.cksum", fname_prefix, tfID); - if (!(tablefp = fopen(filename, "w"))) - { - perror("failed to open table file"); - exit(EXIT_FAILURE); - } - for (size_t i = 0; i < (size_t)nVars; ++i) - { - uint32_t cksum - = memcrc_finish(&varDesc[i].checksum_state, - (off_t)((varDesc[i].size - * sizeof (var[0]) - + sizeof (int) * 2) - * (size_t)setup.nts)); - int code = vlistInqVarCode(vlistID, varDesc[i].id); - if (fprintf(tablefp, "%08lx %d\n", (unsigned long)cksum, - code) < 0) - { - perror("failed to write table file"); - exit(EXIT_FAILURE); - } - } - fclose(tablefp); - } + composeFilename(&filename, setup->prefix, tfID, "cksum"); + if (!(tablefp = fopen(filename, "w"))) + { + perror("failed to open table file"); + exit(EXIT_FAILURE); + } + for (size_t varIdx = 0; varIdx < nVars; ++varIdx) + { + uint32_t cksum + = memcrc_finish(&varDesc[varIdx].checksum_state, + (off_t) ((varDesc[varIdx].size * sizeof(var[0]) + sizeof(int) * 2) * (size_t) setup->nts)); + int code = vlistInqVarCode(vlistID, varDesc[varIdx].id); + if (fprintf(tablefp, "%08lx %d\n", (unsigned long) cksum, code) < 0) + { + perror("failed to write table file"); + exit(EXIT_FAILURE); + } + } + if (fclose(tablefp) != 0) + { + perror("failed to close table file"); + exit(EXIT_FAILURE); + } } } - Free(varslice); #ifdef USE_MPI - pioEndTimestepping (); + pioEndTimestepping(); #endif - streamClose ( streamID ); - vlistDestroy ( vlistID ); - taxisDestroy ( taxisID ); - for (size_t varIdx = 0; varIdx < nVars; varIdx++ ) + Free(varslice); + Free(varsliceF); + vlistDestroy(vlistID); + taxisDestroy(taxisID); + for (size_t varIdx = 0; varIdx < nVars; varIdx++) { int zID = varDesc[varIdx].zaxisID; if (zID != CDI_UNDEFID) @@ -356,20 +336,20 @@ modelRun(struct model_config setup, MPI_Comm comm) xt_idxlist_delete(varDesc[varIdx].partDesc); #endif for (size_t j = varIdx + 1; j < nVars; ++j) - if (zID == varDesc[j].zaxisID) - varDesc[j].zaxisID = CDI_UNDEFID; + if (zID == varDesc[j].zaxisID) varDesc[j].zaxisID = CDI_UNDEFID; } } - gridDestroy ( gridID ); + gridDestroy(gridID); #if USE_MPI + Free(conversion); + Free(partDescPreset); Free(displs); Free(chunks); Free(var); #endif Free(varDesc); Free(levs); - Free(lats); - Free(lons); + Free(filename); } /* diff --git a/tests/simple_model_helper.c b/tests/simple_model_helper.c index 27b41f23e61a5c426e15eae4067b2dc2efa563bc..b660c7fde3686d3ad9cd13bd2ec2feb8ab56d011 100644 --- a/tests/simple_model_helper.c +++ b/tests/simple_model_helper.c @@ -1,13 +1,22 @@ -#if defined (HAVE_CONFIG_H) -# include "config.h" +#if defined(HAVE_CONFIG_H) +#include "config.h" #endif +#include <assert.h> #include <inttypes.h> +#include <math.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> + +#if defined USE_MPI && defined HAVE_PPM_CORE +#include <ppm/ppm_uniform_partition.h> +#include <core/ppm_combinatorics.h> +#endif #include "cdi.h" #include "dmemory.h" +#include "error.h" #include "simple_model_helper.h" @@ -17,30 +26,17 @@ var_scale(int datatype, double *mscale, double *mrscale) int mant_bits; switch (datatype) { - case CDI_DATATYPE_PACK8: - mant_bits = 7; - break; - case CDI_DATATYPE_PACK16: - mant_bits = 15; - break; - case CDI_DATATYPE_PACK24: - mant_bits = 23; - break; - case CDI_DATATYPE_FLT32: - mant_bits = 24; - break; - case CDI_DATATYPE_FLT64: - mant_bits = 53; - break; + case CDI_DATATYPE_PACK8: mant_bits = 7; break; + case CDI_DATATYPE_PACK16: mant_bits = 15; break; + case CDI_DATATYPE_PACK24: mant_bits = 23; break; + case CDI_DATATYPE_FLT32: mant_bits = 24; break; + case CDI_DATATYPE_FLT64: mant_bits = 53; break; case CDI_DATATYPE_INT8: case CDI_DATATYPE_INT16: case CDI_DATATYPE_INT32: - default: - fprintf(stderr, "Unexpected or unusable content format: %d\n", - datatype); - exit(EXIT_FAILURE); + default: fprintf(stderr, "Unexpected or unusable content format: %d\n", datatype); exit(EXIT_FAILURE); } - *mscale = (double)(INT64_C(1) << mant_bits); + *mscale = (double) (INT64_C(1) << mant_bits); *mrscale = 1.0 / *mscale; } @@ -53,12 +49,12 @@ cditime2time_t(int date, int timeofday) struct tm t_s; time_t t; t_s.tm_year = date / 10000; - t_s.tm_mon = (date - t_s.tm_year * 10000)/100; + t_s.tm_mon = (date - t_s.tm_year * 10000) / 100; t_s.tm_mday = date % 100; t_s.tm_year -= 1900; - t_s.tm_hour = timeofday/10000; - t_s.tm_min = (timeofday%10000)/100; - t_s.tm_sec = timeofday%100; + t_s.tm_hour = timeofday / 10000; + t_s.tm_min = (timeofday % 10000) / 100; + t_s.tm_sec = timeofday % 100; t_s.tm_isdst = 0; t = mktime(&t_s); return t; @@ -76,29 +72,158 @@ time_t2cditime(time_t t, int *date, int *timeofday) *timeofday = t_s->tm_hour * 10000 + t_s->tm_min * 100 + t_s->tm_sec; } -#if defined USE_MPI && ! defined HAVE_PPM_CORE +void +composeFilename(char **buf, const char *fname_prefix, int tfID, const char *suffix) +{ + size_t fnSize = strlen(fname_prefix) + (tfID >= 0 ? 1 + sizeof(int) * 3 : 0) + 1 + strlen(suffix) + 1; + char *filename = Realloc(*buf, fnSize); + int plen = tfID >= 0 ? snprintf(filename, fnSize, "%s_%d.%s", fname_prefix, tfID, suffix) + : snprintf(filename, fnSize, "%s.%s", fname_prefix, suffix); + if ((size_t) plen >= fnSize) + { + fprintf(stderr, + "unexpected error: printing to string of size %zu" + " results in %d chars to write\n", + fnSize, plen); + abort(); + } + filename[fnSize - 1] = 0; + *buf = filename; +} -static int32_t -uniform_partition_start(struct PPM_extent set_interval, int nparts, - int part_idx); +int +composeStream(char **buf, const char *fname_prefix, int tfID, const char *suffix, int filetype) +{ + char *temp = buf ? *buf : NULL; + composeFilename(&temp, fname_prefix, tfID, suffix); + int streamID = streamOpenWrite(temp, filetype); + if (streamID < 0) + { + fprintf(stderr, "Failed to open stream: %s\n", cdiStringError(streamID)); + abort(); + } + if (!buf) + free(temp); + else + *buf = temp; + return streamID; +} + +int +createGlobalLatLonGrid(int nlon, int nlat) +{ + int gridID = gridCreate(GRID_LONLAT, nlon * nlat); + gridDefXsize(gridID, nlon); + gridDefYsize(gridID, nlat); + size_t maxAxisSize = (size_t) (nlon > nlat ? nlon : nlat); + double *restrict coords = (double *) Malloc(maxAxisSize * sizeof(coords[0])); + { + double step = 360.0 / (double) nlon, ofs = step * 0.5; + for (size_t i = 0; i < (size_t) nlon; ++i) coords[i] = (double) i * step + ofs; + gridDefXvals(gridID, coords); + } + { + double step = 180.0 / (double) nlat, ofs = step * 0.5; + for (size_t i = 0; i < (size_t) nlat; ++i) coords[i] = (double) i * step - 90.0 + ofs; + gridDefYvals(gridID, coords); + } + Free(coords); + return gridID; +} + +int +createLocalCurvilinearGrid(int sizex, int sizey) +{ + size_t gridsize = (size_t) sizex * (size_t) sizey; + int gridID = gridCreate(GRID_CURVILINEAR, (int) gridsize); + gridDefXsize(gridID, sizex); + gridDefYsize(gridID, sizey); + { + /* anti-clockwise coordinates around Amazonia */ + static const struct cart_coord region[4] +#ifdef __cplusplus + = { { DEG2RAD(-25.0), DEG2RAD(-85.0) }, + { DEG2RAD(-18.0), DEG2RAD(-44.0) }, + { DEG2RAD(-7.0), DEG2RAD(-50.0) }, + { DEG2RAD(10.0), DEG2RAD(-80.0) } }; +#else + = { { .lon = DEG2RAD(-85.0), .lat = DEG2RAD(-25.0) }, + { .lon = DEG2RAD(-44.0), .lat = DEG2RAD(-18.0) }, + { .lon = DEG2RAD(-50.0), .lat = DEG2RAD(7.0) }, + { .lon = DEG2RAD(-80.0), .lat = DEG2RAD(10.0) } }; +#endif + double(*gridCoords)[sizey][sizex] = (double(*)[sizey][sizex]) Malloc(sizeof(*gridCoords) * gridsize * 2); + { + const size_t xyRange[2][2] = { { 0, 0 }, { (size_t) sizex, (size_t) sizey } }; + computeCurvilinearChunk((double *) gridCoords, region, (size_t) sizex, (size_t) sizey, xyRange); + } + gridDefXvals(gridID, (double *) (gridCoords[1])); + gridDefYvals(gridID, (double *) (gridCoords[0])); + Free(gridCoords); + } + return gridID; +} + +static inline double +cartDistance(struct cart_coord p1, struct cart_coord p2) +{ + double d_lat = sin((p1.lat - p2.lat) / 2.0), d_lon = sin((p1.lon - p2.lon) / 2.0), + d = 2.0 * asin(sqrt(d_lat * d_lat + cos(p1.lat) * cos(p2.lat) * (d_lon * d_lon))); + return d; +} + +static inline struct cart_coord +intermediateCoord(struct cart_coord p1, struct cart_coord p2, double f) +{ + double d = cartDistance(p1, p2), sine_of_d = sin(d), A = sin((1 - f) * d) / sine_of_d, B = sin(f * d) / sine_of_d, + x = A * cos(p1.lat) * cos(p1.lon) + B * cos(p2.lat) * cos(p2.lon), + y = A * cos(p1.lat) * sin(p1.lon) + B * cos(p2.lat) * sin(p2.lon), z = A * sin(p1.lat) + B * sin(p2.lat); + struct cart_coord ic = { .lat = atan2(z, sqrt(x * x + y * y)), .lon = atan2(y, x) }; + return ic; +} + +void +computeCurvilinearChunk(double *coords_, const struct cart_coord a[4], size_t sizex, size_t sizey, const size_t xyRange[2][2]) +{ + size_t startx = xyRange[0][0], starty = xyRange[0][1], chunkSizeX = xyRange[1][0], chunkSizeY = xyRange[1][1], + endx = startx + chunkSizeX, endy = starty + chunkSizeY; + assert(startx <= endx && endx <= sizex && starty <= endy && endy <= sizey); +#ifdef __cplusplus + auto coords = (double(*)[chunkSizeY][chunkSizeX]) coords_; +#else + double(*coords)[chunkSizeY][chunkSizeX] = (double(*)[sizey][sizex]) coords_; +#endif + for (size_t j = starty; j < endy; ++j) + { + double g = (double) j / (double) (sizey - 1); + /* compute start/end coordinates of great circle in x direction */ + struct cart_coord gc_left = intermediateCoord(a[0], a[3], g), gc_right = intermediateCoord(a[1], a[2], g); + for (size_t i = startx; i < endx; ++i) + { + double f = (double) i / (double) (sizex - 1); + struct cart_coord pij = intermediateCoord(gc_left, gc_right, f); + coords[0][j - starty][i - startx] = RAD2DEG(pij.lat); + coords[1][j - starty][i - startx] = RAD2DEG(pij.lon); + } + } +} + +#if defined USE_MPI && !defined HAVE_PPM_CORE +static int32_t uniform_partition_start(struct PPM_extent set_interval, int nparts, int part_idx); struct PPM_extent -PPM_uniform_partition(struct PPM_extent set_interval, int nparts, - int part_idx) +PPM_uniform_partition(struct PPM_extent set_interval, int nparts, int part_idx) { struct PPM_extent range; range.first = uniform_partition_start(set_interval, nparts, part_idx); - range.size = uniform_partition_start(set_interval, nparts, part_idx + 1) - - range.first; + range.size = uniform_partition_start(set_interval, nparts, part_idx + 1) - range.first; return range; } static int32_t -uniform_partition_start(struct PPM_extent set_interval, int nparts, - int part_idx) +uniform_partition_start(struct PPM_extent set_interval, int nparts, int part_idx) { - int32_t part_offset - = ((int64_t)set_interval.size * (int64_t)part_idx) / (int64_t)nparts; + int32_t part_offset = ((int64_t) set_interval.size * (int64_t) part_idx) / (int64_t) nparts; int32_t start = set_interval.first + part_offset; return start; } @@ -107,29 +232,58 @@ int PPM_prime_factorization_32(uint32_t n, uint32_t **factors) { if (n <= 1) return 0; - uint32_t * restrict pfactors = realloc(*factors, 32 * sizeof (pfactors[0])); + uint32_t *restrict pfactors = Realloc(*factors, 32 * sizeof(pfactors[0])); size_t numFactors = 0; uint32_t unfactored = n; while (!(unfactored & 1)) - { - pfactors[numFactors] = 2; - ++numFactors; - unfactored >>= 1; - } + { + pfactors[numFactors] = 2; + ++numFactors; + unfactored >>= 1; + } uint32_t divisor = 3; while (unfactored > 1) - { - while (unfactored % divisor == 0) { - unfactored /= divisor; - pfactors[numFactors] = divisor; - ++numFactors; + while (unfactored % divisor == 0) + { + unfactored /= divisor; + pfactors[numFactors] = divisor; + ++numFactors; + } + divisor += 1; } - divisor += 1; - } *factors = pfactors; return numFactors; } #endif +#if !defined USE_MPI || !defined HAVE_PPM_CORE +static char repeatable_rand_state[31 * sizeof(long)]; + +long +cdi_repeatable_random(void) +{ + char *caller_rand_state = setstate(repeatable_rand_state); + long retval = random(); + setstate(caller_rand_state); + return retval; +} + +void +cdi_seed_repeatable_random(unsigned seed) +{ + char *caller_rand_state = initstate(seed, repeatable_rand_state, sizeof(repeatable_rand_state)); + setstate(caller_rand_state); +} +#endif + +/* + * Local Variables: + * c-file-style: "Java" + * c-basic-offset: 2 + * indent-tabs-mode: nil + * show-trailing-whitespace: t + * require-trailing-newline: t + * End: + */ diff --git a/tests/simple_model_helper.h b/tests/simple_model_helper.h index abe2b5c392de9b1984bd2e1c57eb02985108e944..df0ffe3045709c63c460cd831df3f35e964715ac 100644 --- a/tests/simple_model_helper.h +++ b/tests/simple_model_helper.h @@ -1,27 +1,33 @@ #ifndef SIMPLE_MODEL_HELPER_H #define SIMPLE_MODEL_HELPER_H -#if defined (HAVE_CONFIG_H) -# include "config.h" +#if defined(HAVE_CONFIG_H) +#include "config.h" #endif #include <inttypes.h> #include <math.h> #include <time.h> - -enum { +enum +{ /* 129 is the first user-defined code of the GRIB format */ GRIB_USERDEF = 129, }; -void -var_scale(int datatype, double *mscale, double *mrscale); +void var_scale(int datatype, double *mscale, double *mrscale); + +#define DEG2RAD(phi) ((M_PI / 180.0) * (phi)) +#define RAD2DEG(phi) ((180. / M_PI) * (phi)) static inline double sign_flat(double v) { +#ifdef _CRAYC + if (v == 0 && copysign(1.0, v) < 0.0) return 0.0; +#else if (!(v < 0.0 || v > 0.0)) return 0.0; +#endif // if (v == 0.0) return 0.0; return v; } @@ -30,29 +36,81 @@ sign_flat(double v) static inline double dg_wobble(double frac_x, double frac_y, double mscale, double mrscale) { - double r = sign_flat(round((cos(2.0 * M_PI * frac_x) - * sin(2.0 * M_PI * frac_y)) * mscale)) * mrscale; + double r = sign_flat(round((cos(2.0 * M_PI * frac_x) * sin(2.0 * M_PI * frac_y)) * mscale)) * mrscale; return r; } -time_t -cditime2time_t(int date, int timeofday); -void -time_t2cditime(time_t t, int *date, int *timeofday); +time_t cditime2time_t(int date, int timeofday); +void time_t2cditime(time_t t, int *date, int *timeofday); + +void composeFilename(char **buf, const char *fname_prefix, int tfID, const char *suffix); -#if defined (USE_MPI) && ! defined(HAVE_PPM_CORE) +int composeStream(char **buf, const char *fname_prefix, int tfID, const char *suffix, int filetype); + +int createGlobalLatLonGrid(int nlon, int nlat); + +int createLocalCurvilinearGrid(int sizex, int sizey); + +struct cart_coord +{ + double lat, lon; +}; + +/* + * coords_: points to array of size xyRange[0][0] * xyRange[0][1] * 2, where + * the first half of xyRange[0][0] * xyRange[0][1] elements will be + * initialized to longitude values and the second half to the latitude values + * a: cartesian coordinates of rectangular part of globe in + * anti-clockwise order + * sizex, sizey: number of grid points in x and y directions respectively + * xyRange: subset of the ranges [0,sizex) and [0,sizey) to compute, + * given as start in xyRange[0] and count values in xyRange[1] for x + * at index 0 and y at index 1 + */ +void computeCurvilinearChunk(double *coords_, const struct cart_coord a[4], size_t sizex, size_t sizey, const size_t xyRange[2][2]); + +#if defined USE_MPI && !defined HAVE_PPM_CORE struct PPM_extent { int32_t first, size; }; -struct PPM_extent -PPM_uniform_partition(struct PPM_extent set_interval, int nparts, - int part_idx); +struct PPM_extent PPM_uniform_partition(struct PPM_extent set_interval, int nparts, int part_idx); -int -PPM_prime_factorization_32(uint32_t n, uint32_t **factors); +int PPM_prime_factorization_32(uint32_t n, uint32_t **factors); + +#endif + +#if defined USE_MPI && defined HAVE_PPM_CORE +#include <ppm/ppm.h> +#include <core/ppm_random.h> +#ifdef _OPENMP +#define cdi_omp_pragma(prg) _Pragma(prg) +#else +#define cdi_omp_pragma(prg) +#endif +#define cdi_seed_repeatable_random(seed) \ + do \ + { \ + int seed_ = (int) seed; \ + MPI_Comm comm_ = MPI_COMM_WORLD; \ + cdi_omp_pragma("omp parallel") if ((!PPM_initialized() || PPM_finalized())) PPM_initialize(&comm_, &seed_, NULL); \ + else PPM_ya_rand_init(MPI_COMM_WORLD, seed_); \ + } \ + while (0) +#define cdi_repeatable_random() ((long) (PPM_irandp())) +#define cdi_repeatable_finalize() PPM_finalize() +#else +/* add random-wrapper to make call results repeatable, if PPM_random + * can't be used */ +void cdi_seed_repeatable_random(unsigned seed); +long cdi_repeatable_random(void); +#define cdi_repeatable_finalize() \ + do \ + { \ + } \ + while (0) #endif #endif diff --git a/tests/stream_cksum.c b/tests/stream_cksum.c index 5f4d8ff8f339f8746db461e27d1bcb5d069a1269..06e8d9f70d92b9978fe6fcd59fe220c3253fb35a 100644 --- a/tests/stream_cksum.c +++ b/tests/stream_cksum.c @@ -1,5 +1,5 @@ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #include <stdbool.h> @@ -17,8 +17,11 @@ cksum_stream(const char *fname, size_t *table_len) { int nvars; uint32_t *checksum_state = NULL; - enum directionZ { - DIRECTION_DOWN=1, DIRECTION_NONE, DIRECTION_UP + enum directionZ + { + DIRECTION_DOWN = 1, + DIRECTION_NONE, + DIRECTION_UP }; struct var_desc_t { @@ -31,176 +34,158 @@ cksum_stream(const char *fname, size_t *table_len) double *buf = NULL; struct cksum_table *file_vars = NULL; - do { - // Open the dataset - int streamID = streamOpenRead(fname); - if ( streamID < 0 ) - { - fprintf(stderr, "Cannot open data input file %s: %s\n", - fname, cdiStringError(streamID)); - nvars = -1; - break; - } - - // Get the variable list of the dataset - int vlistID = streamInqVlist(streamID); - int fileType = streamInqFiletype(streamID); - bool isLegacyFile = fileType == CDI_FILETYPE_SRV - || fileType == CDI_FILETYPE_EXT; - nvars = vlistNvars(vlistID); - int ngrids = vlistNgrids(vlistID); - int nzaxis = vlistNzaxis(vlistID); - if (nzaxis < 0 || ngrids < 0) - { - fprintf(stderr, "Error in grid/zaxis count query %d:%d\n", - ngrids, nzaxis); - nvars = -1; - break; - } - checksum_state = (uint32_t *) Calloc((size_t)nvars, sizeof (checksum_state[0])); - varDesc = (struct var_desc_t *)malloc((size_t)nvars * sizeof (varDesc[0])); + do + { + // Open the dataset + int streamID = streamOpenRead(fname); + if (streamID < 0) + { + fprintf(stderr, "Cannot open data input file %s: %s\n", fname, cdiStringError(streamID)); + nvars = -1; + break; + } - for (int varIdx = 0; varIdx < nvars; ++varIdx) - { - int grid = vlistInqVarGrid(vlistID, varIdx), gridType, - varCode = vlistInqVarCode(vlistID, varIdx); - varDesc[varIdx].code = varCode; - int zaxisID = vlistInqVarZaxis(vlistID, varIdx); - if (grid == CDI_UNDEFID || zaxisID == CDI_UNDEFID) - { - fputs("error in axis/grid inquiry\n", stderr); - nvars = -1; - break; - } - int zSize; - if ((zSize = varDesc[varIdx].z = zaxisInqSize(zaxisID)) <= 0) - { - fputs("invalid Z-axis found\n", stderr); - nvars = -1; - break; - } - if (isLegacyFile) - varDesc[varIdx].zDirection = DIRECTION_NONE; - else if (zSize > 1) - { - double lev[2]; - for (int levIdx = 0; levIdx < 2; ++levIdx) - lev[levIdx] = zaxisInqLevel(zaxisID, levIdx); - int zaxistype = zaxisInqType(zaxisID); - switch (zaxistype) - { - case ZAXIS_PRESSURE: - if (lev[0] < lev[1]) - varDesc[varIdx].zDirection = DIRECTION_DOWN; - else if (lev[1] < lev[0]) - varDesc[varIdx].zDirection = DIRECTION_UP; - else - { - fprintf(stderr, - "unexpected level ordering on z-Axis for variable" - " code %d found: lev[0]=%g, lev[1]=%g\n", - varCode, lev[0], lev[1]); - nvars = -1; - } - break; - default: - fprintf(stderr, "unexpected type of z-Axis for variable" - " code %d found: %s\n", - varCode, zaxisNamePtr(zaxistype)); - nvars = -1; - } - } - else - varDesc[varIdx].zDirection = DIRECTION_NONE; - if (nvars == -1) + // Get the variable list of the dataset + int vlistID = streamInqVlist(streamID); + int fileType = streamInqFiletype(streamID); + bool isLegacyFile = fileType == CDI_FILETYPE_SRV || fileType == CDI_FILETYPE_EXT; + nvars = vlistNvars(vlistID); + int ngrids = vlistNgrids(vlistID); + int nzaxis = vlistNzaxis(vlistID); + if (nzaxis < 0 || ngrids < 0) + { + fprintf(stderr, "Error in grid/zaxis count query %d:%d\n", ngrids, nzaxis); + nvars = -1; break; - if ((gridType = gridInqType(grid)) != GRID_LONLAT - && gridType != GRID_GENERIC) - { - fprintf(stderr, "unexpected non-lonlat grid found: %d\n", - gridType); - nvars = -1; - break; - } - if ((varDesc[varIdx].x = gridInqXsize(grid)) < 0) - { - fprintf(stderr, "invalid X-size found: %d\n", varDesc[varIdx].x); - nvars = -1; - break; - } - if (varDesc[varIdx].x == 0) varDesc[varIdx].x = 1; - if ((varDesc[varIdx].y = gridInqYsize(grid)) < 0) - { - fprintf(stderr, "invalid Y-size found: %d\n", varDesc[varIdx].y); - nvars = -1; - break; - } - if (varDesc[varIdx].y == 0) varDesc[varIdx].y = 1; - varDesc[varIdx].chars - = (size_t)varDesc[varIdx].x * (size_t)varDesc[varIdx].y - * (size_t)varDesc[varIdx].z * sizeof (buf[0]); - if (var_size_max_chars < varDesc[varIdx].chars) - var_size_max_chars = varDesc[varIdx].chars; - } - buf = (double*)malloc(var_size_max_chars); + } + checksum_state = (uint32_t *) Calloc((size_t) nvars, sizeof(checksum_state[0])); + varDesc = (struct var_desc_t *) Malloc((size_t) nvars * sizeof(varDesc[0])); - if (nvars == -1) - break; + for (int varIdx = 0; varIdx < nvars; ++varIdx) + { + int grid = vlistInqVarGrid(vlistID, varIdx), gridType, varCode = vlistInqVarCode(vlistID, varIdx); + varDesc[varIdx].code = varCode; + int zaxisID = vlistInqVarZaxis(vlistID, varIdx); + if (grid == CDI_UNDEFID || zaxisID == CDI_UNDEFID) + { + fputs("error in axis/grid inquiry\n", stderr); + nvars = -1; + break; + } + int zSize; + if ((zSize = varDesc[varIdx].z = zaxisInqSize(zaxisID)) <= 0) + { + fputs("invalid Z-axis found\n", stderr); + nvars = -1; + break; + } + if (isLegacyFile) + varDesc[varIdx].zDirection = DIRECTION_NONE; + else if (zSize > 1) + { + double lev[2]; + for (int levIdx = 0; levIdx < 2; ++levIdx) lev[levIdx] = zaxisInqLevel(zaxisID, levIdx); + int zaxistype = zaxisInqType(zaxisID); + switch (zaxistype) + { + case ZAXIS_PRESSURE: + if (lev[0] < lev[1]) + varDesc[varIdx].zDirection = DIRECTION_DOWN; + else if (lev[1] < lev[0]) + varDesc[varIdx].zDirection = DIRECTION_UP; + else + { + fprintf(stderr, + "unexpected level ordering on z-Axis for variable" + " code %d found: lev[0]=%g, lev[1]=%g\n", + varCode, lev[0], lev[1]); + nvars = -1; + } + break; + default: + fprintf(stderr, + "unexpected type of z-Axis for variable" + " code %d found: %s\n", + varCode, zaxisNamePtr(zaxistype)); + nvars = -1; + } + } + else + varDesc[varIdx].zDirection = DIRECTION_NONE; + if (nvars == -1) break; + if ((gridType = gridInqType(grid)) != GRID_LONLAT && gridType != GRID_GENERIC && gridType != GRID_CURVILINEAR) + { + fprintf(stderr, "unexpected non-lonlat grid found: %d\n", gridType); + nvars = -1; + break; + } + if ((varDesc[varIdx].x = gridInqXsize(grid)) < 0) + { + fprintf(stderr, "invalid X-size found: %d\n", varDesc[varIdx].x); + nvars = -1; + break; + } + if (varDesc[varIdx].x == 0) varDesc[varIdx].x = 1; + if ((varDesc[varIdx].y = gridInqYsize(grid)) < 0) + { + fprintf(stderr, "invalid Y-size found: %d\n", varDesc[varIdx].y); + nvars = -1; + break; + } + if (varDesc[varIdx].y == 0) varDesc[varIdx].y = 1; + varDesc[varIdx].chars + = (size_t) varDesc[varIdx].x * (size_t) varDesc[varIdx].y * (size_t) varDesc[varIdx].z * sizeof(buf[0]); + if (var_size_max_chars < varDesc[varIdx].chars) var_size_max_chars = varDesc[varIdx].chars; + } + buf = (double *) Malloc(var_size_max_chars); - // Get the Time axis from the variable list - int taxisID = vlistInqTaxis(vlistID); + if (nvars == -1) break; - int tsID = 0; - // Inquire the time step - while (streamInqTimestep(streamID, tsID)) - { - // Get the verification date and time - int vdatetime[2] = { taxisInqVtime(taxisID), (int) taxisInqVdate(taxisID) }; - // Read var1 and var2 - for (int varIdx = 0; varIdx < nvars; ++varIdx) - { - SizeType nmiss; - streamReadVar(streamID, varIdx, buf, &nmiss); - memcrc_r(checksum_state + varIdx, (const unsigned char *)vdatetime, - sizeof (vdatetime)); - if (varDesc[varIdx].zDirection == DIRECTION_UP - || varDesc[varIdx].zDirection == DIRECTION_NONE) - memcrc_r(checksum_state + varIdx, (const unsigned char *)buf, - varDesc[varIdx].chars); - else - { - size_t nlev = (size_t)varDesc[varIdx].z, - charsPerLev = (size_t)varDesc[varIdx].x - * (size_t)varDesc[varIdx].y * sizeof (buf[0]); - for (size_t lev = 0; lev < nlev; ++lev) - memcrc_r(checksum_state + varIdx, - (const unsigned char *)buf + (nlev - lev - 1) - * charsPerLev, charsPerLev); - } - } - ++tsID; - } + // Get the Time axis from the variable list + int taxisID = vlistInqTaxis(vlistID); - file_vars = (struct cksum_table *)malloc((size_t)nvars - * sizeof (file_vars[0])); - for (int varIdx = 0; varIdx < nvars; ++varIdx) - { - file_vars[varIdx].code = varDesc[varIdx].code; - file_vars[varIdx].cksum - = memcrc_finish(checksum_state + varIdx, - (off_t)((varDesc[varIdx].chars + sizeof (int) * 2) - * (size_t)tsID)); - } - // Close the input stream - streamClose(streamID); + int tsID = 0; + // Inquire the time step + while (streamInqTimestep(streamID, tsID)) + { + // Get the verification date and time + int vdatetime[2] = { taxisInqVtime(taxisID), (int) taxisInqVdate(taxisID) }; + // Read var1 and var2 + for (int varIdx = 0; varIdx < nvars; ++varIdx) + { + SizeType nmiss; + streamReadVar(streamID, varIdx, buf, &nmiss); + memcrc_r(checksum_state + varIdx, (const unsigned char *) vdatetime, sizeof(vdatetime)); + if (varDesc[varIdx].zDirection == DIRECTION_UP || varDesc[varIdx].zDirection == DIRECTION_NONE) + memcrc_r(checksum_state + varIdx, (const unsigned char *) buf, varDesc[varIdx].chars); + else + { + size_t nlev = (size_t) varDesc[varIdx].z, + charsPerLev = (size_t) varDesc[varIdx].x * (size_t) varDesc[varIdx].y * sizeof(buf[0]); + for (size_t lev = 0; lev < nlev; ++lev) + memcrc_r(checksum_state + varIdx, (const unsigned char *) buf + (nlev - lev - 1) * charsPerLev, charsPerLev); + } + } + ++tsID; + } - } while (0); + file_vars = (struct cksum_table *) Malloc((size_t) nvars * sizeof(file_vars[0])); + for (int varIdx = 0; varIdx < nvars; ++varIdx) + { + file_vars[varIdx].code = varDesc[varIdx].code; + file_vars[varIdx].cksum + = memcrc_finish(checksum_state + varIdx, (off_t) ((varDesc[varIdx].chars + sizeof(int) * 2) * (size_t) tsID)); + } + // Close the input stream + streamClose(streamID); + } + while (0); // free resources free(checksum_state); free(varDesc); free(buf); - *table_len = (size_t)nvars; + *table_len = (size_t) nvars; return file_vars; } diff --git a/tests/stream_cksum.h b/tests/stream_cksum.h index 32e14fc603f2eca4c82fbc32ba18d85f28921986..9ef414142321bc702da469b9095a4e648430f28c 100644 --- a/tests/stream_cksum.h +++ b/tests/stream_cksum.h @@ -7,7 +7,6 @@ #include "var_cksum.h" -struct cksum_table * -cksum_stream(const char *fname, size_t *table_len); +struct cksum_table *cksum_stream(const char *fname, size_t *table_len); #endif diff --git a/tests/test_byteswap.c b/tests/test_byteswap.c index af87667d1b38364b1018849603f67b7a7c7d44a1..b55dce19e4e3c530c55c7c6f77825a1884d21e52 100644 --- a/tests/test_byteswap.c +++ b/tests/test_byteswap.c @@ -6,7 +6,8 @@ /* function called by CDO */ extern int getByteswap(int); -int main() +int +main() { assert(getByteswap(-1) == -1); return EXIT_SUCCESS; diff --git a/tests/test_byteswap.run.in b/tests/test_byteswap.run.in new file mode 100644 index 0000000000000000000000000000000000000000..e509929e7cbfd7e42c7a660784131fa91c51676f --- /dev/null +++ b/tests/test_byteswap.run.in @@ -0,0 +1,8 @@ +#!@SHELL@ + +@top_builddir@/libtool --mode=execute ${tool_wrap} ./test_byteswap || exit 1 +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/test_byteswap_run.in b/tests/test_byteswap_run.in deleted file mode 100644 index 03c9798ba7d0a1670ec104814df1ddb3b304dd4a..0000000000000000000000000000000000000000 --- a/tests/test_byteswap_run.in +++ /dev/null @@ -1,8 +0,0 @@ -#! @SHELL@ - -../libtool --mode=execute ${tool_wrap} ./test_byteswap -# -# Local Variables: -# mode: sh -# End: -# diff --git a/tests/test_cdf_const.in b/tests/test_cdf_const.run.in similarity index 57% rename from tests/test_cdf_const.in rename to tests/test_cdf_const.run.in index 13afb0dc7f5ea89bd452d3e674e64c20f3e33468..5ad6135cdb953b8cb61d29b54494edd81cf33d50 100644 --- a/tests/test_cdf_const.in +++ b/tests/test_cdf_const.run.in @@ -1,46 +1,36 @@ -#! @SHELL@ +#!@SHELL@ +@ENABLE_NETCDF_FALSE@exit 77 -set -e -if [ @ENABLE_NETCDF@ = yes ]; then - exec >test_cdf_const.log 2>&1 - mkdir -p test_cdf_const.d - cd test_cdf_const.d - \rm -f * - ../../libtool --mode=execute ${tool_wrap} \ - @abs_top_builddir@/examples/cdi_write_const - ( ../../libtool --mode=execute ${tool_wrap} \ - @abs_top_builddir@/app/cdi -s example_const.nc \ - && ../../libtool --mode=execute ${tool_wrap} \ - @abs_top_builddir@/app/cdi example_const.nc) \ - >cdi.$$.stdout 2>cdi.$$.stderr - echo "$0" - exec 6<cdi.$$.stdout 7<../"$0" - while read pattern <&7 ; do - [ "$pattern" != "#PATTERNS" ] || break - done - saved_IFS=$IFS - IFS='' - while read line <&6 ; do - read pattern <&7 - pattern=`echo "$pattern" | sed -e 's/^#//'` - echo "$line" | grep "$pattern" - done - if [ -s cdi.$$.stderr ]; then - echo "unexpected error message from @abs_top_builddir@/app/cdi:" - cat cdi.$$.stderr - fi +cdi_app_stdout="$0.cdi_app.stdout" +cdi_app_stderr="$0.cdi_app.stderr" + +@top_builddir@/libtool --mode=execute ${tool_wrap} @top_builddir@/examples/cdi_write_const || exit 1 +@top_builddir@/libtool --mode=execute ${tool_wrap} @top_builddir@/app/cdi -s example_const.nc >${cdi_app_stdout} 2>${cdi_app_stderr} || exit 1 +@top_builddir@/libtool --mode=execute ${tool_wrap} @top_builddir@/app/cdi example_const.nc >>${cdi_app_stdout} 2>>${cdi_app_stderr} || exit 1 + +exec 6<${cdi_app_stdout} 7<"$0" + +while read pattern <&7 ; do + test "x$pattern" != 'x#PATTERNS' || break +done + +IFS='' +while read line <&6 ; do read pattern <&7 - [ "$pattern" = '#END PATTERNS' ] - exec 5<&- 6<&- - \rm cdi.$$.stdout cdi.$$.stderr example_const.nc - cd .. - rmdir test_cdf_const.d - \rm test_cdf_const.log -else - # skip tests for unsupported formats - exit 77 + pattern=`echo "$pattern" | sed -e 's/^#//'` + echo "$line" | grep "$pattern" || exit 1 +done + +if test -s ${cdi_app_stderr}; then + echo "unexpected error message from @top_builddir@/app/cdi:" + cat ${cdi_app_stderr} fi +read pattern <&7 +test "x$pattern" = 'x#END PATTERNS' || exit 1 + +exec 5<&- 6<&- + #PATTERNS #^ File format : NetCDF #^ Var : Institut Source T Steptype Levels Num Points Num Dtype : Parameter ID diff --git a/tests/test_cdf_read.c b/tests/test_cdf_read.c index 955cdb4253b8f69f671914a9346be4e483008e92..603eec984bc01e12f8db4d9f4ddb842748448e7e 100644 --- a/tests/test_cdf_read.c +++ b/tests/test_cdf_read.c @@ -1,5 +1,5 @@ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #include <math.h> @@ -7,11 +7,12 @@ #include <stdio.h> #include "cdi.h" +#include "dmemory.h" -static void -printAtts(int vlistID); +static void printAtts(int vlistID); -int main(int argc, const char **argv) +int +main(int argc, const char **argv) { // todo: handle optional arguments here to increase test coverage const char *fname = (argc > 1) ? argv[1] : "test.nc"; @@ -21,12 +22,11 @@ int main(int argc, const char **argv) int streamID = streamOpenRead(fname); if (streamID < 0) { - fprintf(stderr, "Open failed for file %s: %s\n", - fname, cdiStringError(streamID)); + fprintf(stderr, "Open failed for file %s: %s\n", fname, cdiStringError(streamID)); return EXIT_FAILURE; } int vlistID = streamInqVlist(streamID); - size_t nVars = (size_t)vlistNvars(vlistID); + size_t nVars = (size_t) vlistNvars(vlistID); double *buf = NULL; size_t bufSize = 0; @@ -38,12 +38,11 @@ int main(int argc, const char **argv) { for (size_t varID = 0; varID < nVars; ++varID) { - size_t memSize = (size_t)vlistInqVarSize(vlistID, (int)varID) - * sizeof (double); + size_t memSize = (size_t) vlistInqVarSize(vlistID, (int) varID) * sizeof(double); SizeType nmiss; if (memSize > bufSize) { - double *temp = (double *)realloc(buf, memSize); + double *temp = (double *) Realloc(buf, memSize); if (!temp) { perror("read buffer reallocation failed"); @@ -51,12 +50,12 @@ int main(int argc, const char **argv) } buf = temp; } - streamReadVar(streamID, (int)varID, buf, &nmiss); + streamReadVar(streamID, (int) varID, buf, &nmiss); allNmissSum += nmiss; } } - if (countMissingValues) - printf("missing values count = %zu\n", allNmissSum); + if (countMissingValues) printf("missing values count = %zu\n", allNmissSum); + free(buf); streamClose(streamID); return EXIT_SUCCESS; } @@ -64,12 +63,11 @@ int main(int argc, const char **argv) static void printAtts(int vlistID) { - size_t nVars = (size_t)vlistNvars(vlistID); - static const char globDesc[] = "global", - varDescPrefix[] = "variable "; + size_t nVars = (size_t) vlistNvars(vlistID); + static const char globDesc[] = "global", varDescPrefix[] = "variable "; size_t digitsPerInt = 9; - size_t bufSize = digitsPerInt + sizeof (varDescPrefix); - void *restrict buf = malloc(bufSize); + size_t bufSize = digitsPerInt + sizeof(varDescPrefix); + void *restrict buf = Malloc(bufSize); if (!buf) { perror("attribute buffer resize failed"); @@ -79,43 +77,34 @@ printAtts(int vlistID) { int nAtts, attType, attLen; char attName[CDI_MAX_NAME + 1]; - int varID = (int)varIdx - 1; + int varID = (int) varIdx - 1; cdiInqNatts(vlistID, varID, &nAtts); - for (size_t attIdx = 0; attIdx < (size_t)nAtts; attIdx++ ) + for (size_t attIdx = 0; attIdx < (size_t) nAtts; attIdx++) { - int rc = cdiInqAtt(vlistID, varID, (int)attIdx, - attName, &attType, &attLen); + int rc = cdiInqAtt(vlistID, varID, (int) attIdx, attName, &attType, &attLen); { - const char *varDesc = varIdx > 0 - ? (sprintf((char *)buf, "%s%d", varDescPrefix, - vlistInqVarCode(vlistID, varID)), (char *)buf) - : globDesc; - printf("%s attribute \"%s\", value: ", - varDesc, attName); + const char *varDesc + = varIdx > 0 ? (sprintf((char *) buf, "%s%d", varDescPrefix, vlistInqVarCode(vlistID, varID)), (char *) buf) + : globDesc; + printf("%s attribute \"%s\", value: ", varDesc, attName); } if (attLen < 0) { - puts("error retrieving value"); - continue; + puts("error retrieving value"); + continue; } size_t elemSize = 0; switch (attType) { - case CDI_DATATYPE_TXT: - elemSize = 1; - break; - case CDI_DATATYPE_FLT: - elemSize = sizeof (double); - break; - case CDI_DATATYPE_INT: - elemSize = sizeof (int); - break; + case CDI_DATATYPE_TXT: elemSize = 1; break; + case CDI_DATATYPE_FLT: elemSize = sizeof(double); break; + case CDI_DATATYPE_INT: elemSize = sizeof(int); break; } - size_t attSize = elemSize * ((size_t)attLen + 1); + size_t attSize = elemSize * ((size_t) attLen + 1); if (attSize > bufSize) { - if (!(buf = realloc(buf, attSize))) + if (!(buf = Realloc(buf, attSize))) { perror("attribute buffer resize failed"); exit(EXIT_FAILURE); @@ -125,31 +114,25 @@ printAtts(int vlistID) switch (attType) { case CDI_DATATYPE_TXT: - rc = cdiInqAttTxt(vlistID, (int)varID, attName, - attLen, (char *)buf); - if (rc == CDI_NOERR) - printf("\"%.*s\"", attLen, (char *)buf); + rc = cdiInqAttTxt(vlistID, (int) varID, attName, attLen, (char *) buf); + if (rc == CDI_NOERR) printf("\"%.*s\"", attLen, (char *) buf); break; case CDI_DATATYPE_FLT: - rc = cdiInqAttFlt(vlistID, (int)varID, attName, - attLen + 1, (double *)buf); + rc = cdiInqAttFlt(vlistID, (int) varID, attName, attLen + 1, (double *) buf); if (rc == CDI_NOERR && attLen) { - const double *restrict dp = (const double*)buf; + const double *restrict dp = (const double *) buf; printf("%10g", dp[0]); - for (size_t i = 1; i < (size_t)attLen; ++i) - printf(", %10g", dp[i]); + for (size_t i = 1; i < (size_t) attLen; ++i) printf(", %10g", dp[i]); } break; case CDI_DATATYPE_INT: - rc = cdiInqAttInt(vlistID, (int)varID, attName, - attLen + 1, (int *)buf); + rc = cdiInqAttInt(vlistID, (int) varID, attName, attLen + 1, (int *) buf); if (rc == CDI_NOERR && attLen) { - const int *restrict ip = (const int *)buf; + const int *restrict ip = (const int *) buf; printf("%d", ip[0]); - for (size_t i = 1; i < (size_t)attLen; ++i) - printf(", %d", ip[i]); + for (size_t i = 1; i < (size_t) attLen; ++i) printf(", %d", ip[i]); } break; } @@ -167,7 +150,6 @@ printAtts(int vlistID) free(buf); } - /* * Local Variables: * c-file-style: "Java" diff --git a/tests/test_cdf_transformation.in b/tests/test_cdf_transformation.in deleted file mode 100644 index 32e03330c002a4e53f10844405f5944081bcddae..0000000000000000000000000000000000000000 --- a/tests/test_cdf_transformation.in +++ /dev/null @@ -1,30 +0,0 @@ -#! @SHELL@ -set -e -[ x${DEBUG+set} != xset ] || set -x -if [ @ENABLE_NETCDF@ != yes ]; then - exit 77 -fi -ncdatafile="test$$.nc" -tempfiles="${ncdatafile}" -trap "EC=\$? ; \rm -f ${tempfiles}; exit \$EC" EXIT -../libtool --mode=execute ${tool_wrap} ./test_cdf_write "${ncdatafile}" -digest=$(../libtool --mode=execute ${tool_wrap} ./test_cdf_read "${ncdatafile}") -missValueCount=$(echo "$digest" | @SED@ -n '/^missing values count =/{ -s/^missing values count *= *// -p -q -}') -if [ "$missValueCount" -ne 1 ]; then - echo "Mismatch in expected number of missing values!" >&2 - exit 1 -fi -if ! echo "$digest" | grep 'variable 1 attribute "CDI Text Attribute test, created by", value: "CDI test_cdf_write"' >/dev/null; then - echo "Expected attribute not found" >&2 - exit 1 -fi - -# -# Local Variables: -# mode: sh -# End: -# diff --git a/tests/test_cdf_transformation.run.in b/tests/test_cdf_transformation.run.in new file mode 100644 index 0000000000000000000000000000000000000000..8e89108b816c874ce6dec2a3b91f593f50020bbc --- /dev/null +++ b/tests/test_cdf_transformation.run.in @@ -0,0 +1,29 @@ +#!@SHELL@ +@ENABLE_NETCDF_FALSE@exit 77 + +ncdatafile="$0.nc" + +@top_builddir@/libtool --mode=execute ${tool_wrap} ./test_cdf_write "${ncdatafile}" || exit 1 + +digest=`@top_builddir@/libtool --mode=execute ${tool_wrap} ./test_cdf_read "${ncdatafile}"` || exit 1 +missValueCount=`echo "$digest" | @SED@ -n '/^missing values count =/{ +s/^missing values count *= *// +p +q +}'` || exit 1 + +if test "$missValueCount" -ne 1; then + echo "Mismatch in expected number of missing values!" >&2 + exit 1 +fi + +if ! echo "$digest" | grep 'variable 1 attribute "CDI Text Attribute test, created by", value: "CDI test_cdf_write"' >/dev/null; then + echo "Expected attribute not found" >&2 + exit 1 +fi + +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/test_cdf_write.c b/tests/test_cdf_write.c index 43a67d1adaa9e40227824d1885021feb2483060f..54e33fa0e2a58b7330aae042f477ab84c0f04b4b 100644 --- a/tests/test_cdf_write.c +++ b/tests/test_cdf_write.c @@ -1,5 +1,5 @@ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #include <math.h> @@ -8,71 +8,34 @@ #include "cdi.h" -struct cart_coord { - double lat, lon; -}; +#include "dmemory.h" -static double -my_gamma_dist(double x); +#include "simple_model_helper.h" -static void -compute_curvilinear(double *coords_, - const struct cart_coord a[4], size_t sizex, size_t sizey); +static double my_gamma_dist(double x); -#define DEG2RAD(phi) ((M_PI / 180.0) * (phi)) -#define RAD2DEG(phi) ((180./M_PI) * (phi)) #define missValue (-50.0) -int main(int argc, const char **argv) +int +main(int argc, const char **argv) { // todo: handle optional arguments here to increase test coverage const char *fname = (argc > 1) ? argv[1] : "test.nc"; int streamID = streamOpenWrite(fname, CDI_FILETYPE_NC); - if ( streamID < 0 ) + if (streamID < 0) { - fprintf(stderr, "Open failed on %s: %s\n", fname, - cdiStringError(streamID)); + fprintf(stderr, "Open failed on %s: %s\n", fname, cdiStringError(streamID)); return EXIT_FAILURE; } - enum { + enum + { sizey = 40, sizex = 2 * sizey, }; - size_t datasize = (size_t)sizex * (size_t)sizey; - int gridID = gridCreate(GRID_CURVILINEAR, (int)datasize); - gridDefXsize(gridID, sizex); - gridDefYsize(gridID, sizey); - { - /* anti-clockwise coordinates around Amazonia */ - static struct cart_coord region[4] -#ifdef __cplusplus - = { { DEG2RAD(-25.0), DEG2RAD(-85.0) }, - { DEG2RAD(-18.0), DEG2RAD(-44.0) }, - { DEG2RAD(-7.0), DEG2RAD(-50.0) }, - { DEG2RAD(10.0), DEG2RAD(-80.0) } }; -#else - = { { .lon = DEG2RAD(-85.0), .lat = DEG2RAD(-25.0) }, - { .lon = DEG2RAD(-44.0), .lat = DEG2RAD(-18.0) }, - { .lon = DEG2RAD(-50.0), .lat = DEG2RAD(7.0) }, - { .lon = DEG2RAD(-80.0), .lat = DEG2RAD(10.0) } }; -#endif - double (*gridCoords)[sizey][sizex] - = (double (*)[sizey][sizex]) - malloc(sizeof (*gridCoords) * sizey * sizex * 2); - if (gridCoords == NULL) - { - perror("grid coordinate memory allocation failed"); - return EXIT_FAILURE; - } - compute_curvilinear((double *)gridCoords, region, sizex, sizey); - gridDefXvals(gridID, (double *)(gridCoords[1])); - gridDefYvals(gridID, (double *)(gridCoords[0])); - free(gridCoords); - } - + int gridID = createLocalCurvilinearGrid(sizex, sizey); int zaxisID = zaxisCreate(ZAXIS_SURFACE, 1); int vlistID = vlistCreate(); @@ -80,8 +43,7 @@ int main(int argc, const char **argv) vlistDefVarMissval(vlistID, varID, missValue); { static const char creatorText[] = "CDI test_cdf_write"; - cdiDefAttTxt(vlistID, varID, "CDI Text Attribute test, created by", - sizeof (creatorText) - 1, creatorText); + cdiDefAttTxt(vlistID, varID, "CDI Text Attribute test, created by", sizeof(creatorText) - 1, creatorText); } int taxisID = taxisCreate(TAXIS_ABSOLUTE); @@ -89,23 +51,18 @@ int main(int argc, const char **argv) streamDefVlist(streamID, vlistID); - (void)streamDefTimestep(streamID, 0); + (void) streamDefTimestep(streamID, 0); { - double (*data)[sizex] = (double(*)[sizex])malloc(sizeof (**data) * sizex * sizey); - if (!data) - { - perror("data values memory allocation failed"); - return EXIT_FAILURE; - } + double(*data)[sizex] = (double(*)[sizex]) Malloc(sizeof(**data) * sizex * sizey); for (size_t j = 0; j < sizey; ++j) for (size_t i = 0; i < sizex; ++i) { - data[j][i] = my_gamma_dist((double)i/(double)(sizex - 1)); + data[j][i] = my_gamma_dist((double) i / (double) (sizex - 1)); } - data[sizey/3][sizex/2] = missValue; - streamWriteVar(streamID, 0, (const double *)data, 1); - free(data); + data[sizey / 3][sizex / 2] = missValue; + streamWriteVar(streamID, 0, (const double *) data, 1); + Free(data); } streamClose(streamID); @@ -113,66 +70,16 @@ int main(int argc, const char **argv) return EXIT_SUCCESS; } -static inline double -cart_distance(struct cart_coord p1, struct cart_coord p2) -{ - double d_lat = sin((p1.lat-p2.lat)/2.0), - d_lon = sin((p1.lon - p2.lon)/2.0), - d = 2.0 * asin(sqrt(d_lat * d_lat + - cos(p1.lat)*cos(p2.lat) * (d_lon * d_lon))); - return d; -} - -static inline struct cart_coord -intermediate_coord(struct cart_coord p1, struct cart_coord p2, double f) -{ - double d = cart_distance(p1, p2), - sine_of_d = sin(d), - A = sin((1 - f) * d) / sine_of_d, - B = sin(f * d) / sine_of_d, - x = A * cos(p1.lat) * cos(p1.lon) + B * cos(p2.lat) * cos(p2.lon), - y = A * cos(p1.lat) * sin(p1.lon) + B * cos(p2.lat) * sin(p2.lon), - z = A * sin(p1.lat) + B * sin(p2.lat); - struct cart_coord ic = { .lat = atan2(z, sqrt(x * x + y * y)), - .lon = atan2(y, x) }; - return ic; -} - -static void -compute_curvilinear(double *coords_, - const struct cart_coord a[4], size_t sizex, size_t sizey) -{ -#ifdef __cplusplus - auto coords = (double (*)[sizey][sizex])coords_; -#else - double (*coords)[sizey][sizex] = (double (*)[sizey][sizex])coords_; -#endif - for (size_t j = 0; j < sizey; ++j) - { - double g = (double)j / (double)(sizey - 1); - /* compute start/end coordinates of great circle in x direction */ - struct cart_coord gc_left = intermediate_coord(a[0], a[3], g), - gc_right = intermediate_coord(a[1], a[2], g); - for (size_t i = 0; i < sizex; ++i) - { - double f = (double)i / (double)(sizex - 1); - struct cart_coord pij = intermediate_coord(gc_left, gc_right, f); - coords[0][j][i] = RAD2DEG(pij.lat); - coords[1][j][i] = RAD2DEG(pij.lon); - } - } -} - static double my_gamma_dist(double x) { - enum { + enum + { k = 9, }; const double theta = 0.5; x *= 20.0; - double pdf_x = 1.0 / ( tgamma(k) * pow(theta, k) ) * pow(x, k - 1) - * exp(-x/theta); + double pdf_x = 1.0 / (tgamma(k) * pow(theta, k)) * pow(x, k - 1) * exp(-x / theta); return pdf_x; } diff --git a/tests/test_chunk_cksum.in b/tests/test_chunk_cksum.in deleted file mode 100644 index 859a6ff56aac21765bdc8570892681563db78b70..0000000000000000000000000000000000000000 --- a/tests/test_chunk_cksum.in +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/sh - -set -e -format=nc -if [ @ENABLE_NETCDF@ = yes ]; then - exec >test_chunk_cksum_$format.log 2>&1 - ../libtool --mode=execute ${tool_wrap} ./cksum_write_chunk -m 17 - ../libtool --mode=execute ${tool_wrap} ./cksum_read example.$format - \rm example.cksum example.$format - \rm test_chunk_cksum_$format.log -else - # skip tests for unsupported formats - exit 77 -fi diff --git a/tests/test_cksum_base b/tests/test_cksum_base deleted file mode 100644 index 775779ec0d37d45b7bc5300b923f067b2eb0755b..0000000000000000000000000000000000000000 --- a/tests/test_cksum_base +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/sh -# this file is meant to be included for the supported file formats - -exec >test_cksum_$format.log 2>&1 -../libtool --mode=execute ${tool_wrap} ./cksum_write -f $format -../libtool --mode=execute ${tool_wrap} ./cksum_read example.$format -\rm example.cksum example.$format -\rm test_cksum_$format.log - -# -# Local Variables: -# mode: sh -# End: -# diff --git a/tests/test_cksum_base.in b/tests/test_cksum_base.in new file mode 100644 index 0000000000000000000000000000000000000000..05a086a5ef089f2d89a549b1173b4ba78cf45af0 --- /dev/null +++ b/tests/test_cksum_base.in @@ -0,0 +1,45 @@ +# This file is meant to be included for the supported file formats. + +prefix=`echo "$0" | sed 's@.*/@@'` +suffix=${suffix-grb} + +case ${suffix} in + grb) + test 'x@ENABLE_GRIB@' = xyes || exit 77 + ;; + grb2) + @HAVE_LIBGRIB_API_FALSE@exit 77 + test 'x@ENABLE_GRIB@' = xyes || exit 77 + ;; + nc) + @ENABLE_NETCDF_FALSE@exit 77 + ;; + nc2) + test 'x@ENABLE_NC2@' = xyes || exit 77 + ;; + nc4) + test 'x@ENABLE_NC4@' = xyes || exit 77 + ;; + srv) + test 'x@ENABLE_SERVICE@' = xyes || exit 77 + ;; + ext) + test 'x@ENABLE_EXTRA@' = xyes || exit 77 + ;; + ieg) + test 'x@ENABLE_IEG@' = xyes || exit 77 + ;; + *) + echo "Unsupported suffix '${suffix}'" >&2 + exit 1 + ;; +esac + +../libtool --mode=execute ${tool_wrap} ./cksum_write -b "${prefix}" -f ${suffix} || exit 1 +../libtool --mode=execute ${tool_wrap} ./cksum_read "${prefix}.${suffix}" "${prefix}.cksum" || exit 1 + +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/test_cksum_ext.run.in b/tests/test_cksum_ext.run.in new file mode 100644 index 0000000000000000000000000000000000000000..48e66b555af7ce9edd372cbd809d1635a09f39d7 --- /dev/null +++ b/tests/test_cksum_ext.run.in @@ -0,0 +1,3 @@ +#!@SHELL@ +suffix=ext +. ./test_cksum_base diff --git a/tests/test_cksum_extra.in b/tests/test_cksum_extra.in deleted file mode 100644 index c6cb9b29eb06e94d9fe0dbb688b74b4c2498f2f9..0000000000000000000000000000000000000000 --- a/tests/test_cksum_extra.in +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh - -set -e -format=ext -if [ @ENABLE_EXTRA@ = yes ]; then - . ${srcdir}/test_cksum_base -else - # skip tests for unsupported formats - exit 77 -fi diff --git a/tests/test_cksum_grb.run.in b/tests/test_cksum_grb.run.in new file mode 100644 index 0000000000000000000000000000000000000000..c376ec294889504b094d1d93d9eece0f09b3fa70 --- /dev/null +++ b/tests/test_cksum_grb.run.in @@ -0,0 +1,9 @@ +#!@SHELL@ +suffix=grb +. ./test_cksum_base + +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/test_cksum_grb2.run.in b/tests/test_cksum_grb2.run.in new file mode 100644 index 0000000000000000000000000000000000000000..f13ab4492a4d948a03fea66c5b163adf64ca6f5b --- /dev/null +++ b/tests/test_cksum_grb2.run.in @@ -0,0 +1,3 @@ +#!@SHELL@ +suffix=grb2 +. ./test_cksum_base diff --git a/tests/test_cksum_grib.in b/tests/test_cksum_grib.in deleted file mode 100644 index e50a579d0a3384de49a2e8dcded93a0946eb920b..0000000000000000000000000000000000000000 --- a/tests/test_cksum_grib.in +++ /dev/null @@ -1,16 +0,0 @@ -#! @SHELL@ - -set -e -format=grb -if [ @ENABLE_GRIB@ = yes ]; then - . ${srcdir}/test_cksum_base -else - # skip tests for unsupported formats - exit 77 -fi - -# -# Local Variables: -# mode: sh -# End: -# diff --git a/tests/test_cksum_ieg.in b/tests/test_cksum_ieg.in deleted file mode 100644 index b373f238d9b65b122a3bf32cc57300210e851dc6..0000000000000000000000000000000000000000 --- a/tests/test_cksum_ieg.in +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh - -set -e -format=ieg -if [ @ENABLE_IEG@ = yes ]; then - . ${srcdir}/test_cksum_base -else - # skip tests for unsupported formats - exit 77 -fi diff --git a/tests/test_cksum_ieg.run.in b/tests/test_cksum_ieg.run.in new file mode 100644 index 0000000000000000000000000000000000000000..30971f94b7135b94b74a8a2e61a6457cd4bb5064 --- /dev/null +++ b/tests/test_cksum_ieg.run.in @@ -0,0 +1,3 @@ +#!@SHELL@ +suffix=ieg +. ./test_cksum_base diff --git a/tests/test_cksum_nc.in b/tests/test_cksum_nc.in deleted file mode 100644 index ef9fc7abc3ba4b6269f71068babbf2c3ba8187f3..0000000000000000000000000000000000000000 --- a/tests/test_cksum_nc.in +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh - -set -e -format=nc -if [ @ENABLE_NETCDF@ = yes ]; then - . ${srcdir}/test_cksum_base -else - # skip tests for unsupported formats - exit 77 -fi diff --git a/tests/test_cksum_nc.run.in b/tests/test_cksum_nc.run.in new file mode 100644 index 0000000000000000000000000000000000000000..eec7948c6fdff5dd94a15d6573b7c527cca7bae6 --- /dev/null +++ b/tests/test_cksum_nc.run.in @@ -0,0 +1,3 @@ +#!@SHELL@ +suffix=nc +. ./test_cksum_base diff --git a/tests/test_cksum_nc2.in b/tests/test_cksum_nc2.in deleted file mode 100644 index c3f76d6903a2220a7b0bbf85abae1e3016d16182..0000000000000000000000000000000000000000 --- a/tests/test_cksum_nc2.in +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh - -set -e -format=nc2 -if [ @ENABLE_NC2@ = yes ]; then - . ${srcdir}/test_cksum_base -else - # skip tests for unsupported formats - exit 77 -fi diff --git a/tests/test_cksum_nc2.run.in b/tests/test_cksum_nc2.run.in new file mode 100644 index 0000000000000000000000000000000000000000..1ef8e1ffd43b276504a11a736f9378ef9a663f51 --- /dev/null +++ b/tests/test_cksum_nc2.run.in @@ -0,0 +1,3 @@ +#!@SHELL@ +suffix=nc2 +. ./test_cksum_base diff --git a/tests/test_cksum_nc4.in b/tests/test_cksum_nc4.in deleted file mode 100644 index 8816bfff905be4c4629f14724dadeb3c154acb8a..0000000000000000000000000000000000000000 --- a/tests/test_cksum_nc4.in +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh - -set -e -format=nc4 -if [ @ENABLE_NC4@ = yes ]; then - . ${srcdir}/test_cksum_base -else - # skip tests for unsupported formats - exit 77 -fi diff --git a/tests/test_cksum_nc4.run.in b/tests/test_cksum_nc4.run.in new file mode 100644 index 0000000000000000000000000000000000000000..3c7d4e1c75ecdc2255a10892b3b3e0b5097820a9 --- /dev/null +++ b/tests/test_cksum_nc4.run.in @@ -0,0 +1,3 @@ +#!@SHELL@ +suffix=nc4 +. ./test_cksum_base diff --git a/tests/test_cksum_nc_chunk.run.in b/tests/test_cksum_nc_chunk.run.in new file mode 100644 index 0000000000000000000000000000000000000000..c67becd4fe23e239b101addd5a6fb006ffecfb2b --- /dev/null +++ b/tests/test_cksum_nc_chunk.run.in @@ -0,0 +1,7 @@ +#!@SHELL@ +@ENABLE_NETCDF_FALSE@exit 77 + +prefix='test_cksum_nc_chunk.run' +format=nc +@top_builddir@/libtool --mode=execute ${tool_wrap} ./cksum_write_chunk -b ${prefix} -m 17 || exit 1 +@top_builddir@/libtool --mode=execute ${tool_wrap} ./cksum_read ${prefix}.${format} ${prefix}.cksum || exit 1 diff --git a/tests/test_cksum_service.in b/tests/test_cksum_service.in deleted file mode 100644 index 115cb200b1e7f7261a02999edba2516f974b6388..0000000000000000000000000000000000000000 --- a/tests/test_cksum_service.in +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh - -set -e -format=srv -if [ @ENABLE_SERVICE@ = yes ]; then - . ${srcdir}/test_cksum_base -else - # skip tests for unsupported formats - exit 77 -fi diff --git a/tests/test_cksum_srv.run.in b/tests/test_cksum_srv.run.in new file mode 100644 index 0000000000000000000000000000000000000000..2d7ce74638c1945ab8ac711052d85235e5bff401 --- /dev/null +++ b/tests/test_cksum_srv.run.in @@ -0,0 +1,3 @@ +#!@SHELL@ +suffix=srv +. ./test_cksum_base diff --git a/tests/test_f2003.in b/tests/test_f2003.run.in similarity index 57% rename from tests/test_f2003.in rename to tests/test_f2003.run.in index 3c2094b67fb333a30f8783ee8b6f0731378729f8..c8b9f9f3190ffff8d7a5ff7db2f8900ab67f51e3 100644 --- a/tests/test_f2003.in +++ b/tests/test_f2003.run.in @@ -1,41 +1,35 @@ -#! @SHELL@ +#!@SHELL@ +@ENABLE_ISOC_INTERFACE_FALSE@exit 77 +@ENABLE_NETCDF_FALSE@exit 77 -set -e -format=nc -if [ @ENABLE_NETCDF@ = yes -a @ENABLE_F2003_ISOC@ = yes ]; then - exec >test_f2003_$format.log 2>&1 - ../libtool --mode=execute ${tool_wrap} \ - @abs_top_builddir@/examples/cdi_write_f2003 - ../libtool --mode=execute ${tool_wrap} \ - @abs_top_builddir@/examples/cdi_read_f2003 \ - >cdi_read_f2003.$$.stdout \ - 2>cdi_read_f2003.$$.stderr - echo "$0" - exec 5<cdi_read_f2003.$$.stdout 6<cdi_read_f2003.$$.stderr 7<"$0" - while read pattern <&7 ; do - [ "$pattern" != "#PATTERNS" ] || break - done - saved_IFS=$IFS - IFS='' - while read line <&6 ; do - read pattern <&7 - pattern=`echo "$pattern" | sed -e 's/^#//'` - echo "$line" | grep "$pattern" - done - while read line <&5 ; do - read pattern <&7 - pattern=`echo "$pattern" | sed -e 's/^#//'` - echo "$line" | grep "$pattern" - done +cdi_read_f2003_stdout="$0.cdi_read_f2003.stdout" +cdi_read_f2003_stderr="$0.cdi_read_f2003.stderr" + +@top_builddir@/libtool --mode=execute ${tool_wrap} @top_builddir@/examples/cdi_write_f2003 || exit 1 +@top_builddir@/libtool --mode=execute ${tool_wrap} @top_builddir@/examples/cdi_read_f2003 >${cdi_read_f2003_stdout} 2>${cdi_read_f2003_stderr} || exit 1 + +exec 5<${cdi_read_f2003_stdout} 6<${cdi_read_f2003_stderr} 7<"$0" +while read pattern <&7 ; do + test "x$pattern" != 'x#PATTERNS' || break +done + +IFS='' +while read line <&6; do read pattern <&7 - [ "$pattern" = '#END PATTERNS' ] - exec 5<&- 6<&- - \rm cdi_read_f2003.$$.stdout cdi_read_f2003.$$.stderr - \rm test_f2003_$format.log -else - # skip tests for unsupported formats - exit 77 -fi + pattern=`echo "$pattern" | sed -e 's/^#//'` + echo "$line" | grep "$pattern" || exit 1 +done + +while read line <&5; do + read pattern <&7 + pattern=`echo "$pattern" | sed -e 's/^#//'` + echo "$line" | grep "$pattern" || exit 1 +done + +read pattern <&7 +test "x$pattern" = 'x#END PATTERNS' || exit 1 + +exec 5<&- 6<&- #PATTERNS #^cdi version: @VERSION@$ diff --git a/tests/test_grib.c b/tests/test_grib.c index d585f45d5d2c2e90f042aa750e15af65680ecd9b..ca16504fa28408bfc43d83ba2ddc37fd45cd5aa7 100644 --- a/tests/test_grib.c +++ b/tests/test_grib.c @@ -1,5 +1,5 @@ #ifdef HAVE_CONFIG_H -# include "config.h" +#include "config.h" #endif #include <stdio.h> @@ -9,31 +9,32 @@ #include "cdi.h" #include "dmemory.h" -int main() +int +main() { - char fname[] = "test.grb"; + char fname[] = "test_grib.grb"; int filetype = CDI_FILETYPE_GRB; - enum { + enum + { nlat = 18, - nlon = 2*nlat, + nlon = 2 * nlat, }; double *data = NULL; int nlevel; int varID; int streamID1, streamID2; int gridID, zaxisID; - int nrecs, nvars; + int nvars; int tsID; int levelID; int vlistID, taxisID; SizeType nmiss; + size_t datasize = (size_t) nlon * (size_t) nlat; + data = (double *) Malloc(datasize * sizeof(double)); + memset(data, 0, datasize * sizeof(double)); - size_t datasize = (size_t)nlon * (size_t)nlat; - data = (double *)malloc(datasize * sizeof (double)); - memset(data, 0, datasize * sizeof (double)); - - gridID = gridCreate(GRID_GAUSSIAN, (int)datasize); + gridID = gridCreate(GRID_GAUSSIAN, (int) datasize); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); @@ -46,7 +47,7 @@ int main() vlistDefTaxis(vlistID, taxisID); streamID1 = streamOpenWrite(fname, filetype); - if ( streamID1 < 0 ) + if (streamID1 < 0) { fprintf(stderr, "Open failed on %s\n", fname); fprintf(stderr, "%s\n", cdiStringError(streamID1)); @@ -59,6 +60,7 @@ int main() streamWriteVar(streamID1, 0, data, 0); + free(data); return (0); vlistID = streamInqVlist(streamID1); @@ -66,7 +68,7 @@ int main() filetype = streamInqFiletype(streamID1); streamID2 = streamOpenWrite(fname, filetype); - if ( streamID2 < 0 ) + if (streamID2 < 0) { fprintf(stderr, "Open failed on %s\n", fname); fprintf(stderr, "%s\n", cdiStringError(streamID2)); @@ -77,48 +79,48 @@ int main() nvars = vlistNvars(vlistID); - for ( varID = 0; varID < nvars; varID++ ) + for (varID = 0; varID < nvars; varID++) { - int varGridID = vlistInqVarGrid(vlistID, varID); - int varZaxisID = vlistInqVarZaxis(vlistID, varID); - size_t gridsize = (size_t)gridInqSize(varGridID); - size_t varNlevel = (size_t)zaxisInqSize(varZaxisID); - if ( gridsize*varNlevel > datasize ) datasize = gridsize*varNlevel; + int varGridID = vlistInqVarGrid(vlistID, varID); + int varZaxisID = vlistInqVarZaxis(vlistID, varID); + size_t gridsize = (size_t) gridInqSize(varGridID); + size_t varNlevel = (size_t) zaxisInqSize(varZaxisID); + if (gridsize * varNlevel > datasize) datasize = gridsize * varNlevel; } - data = (double *)realloc(data, datasize*sizeof(double)); - memset(data, 0, datasize*sizeof(double)); + data = (double *) Realloc(data, datasize * sizeof(double)); + memset(data, 0, datasize * sizeof(double)); taxisID = vlistInqTaxis(vlistID); tsID = 0; - while ( (nrecs = streamInqTimestep(streamID1, tsID)) ) + while (streamInqTimestep(streamID1, tsID)) { - /* int vdate = */taxisInqVdate(taxisID); - /* int vtime = */taxisInqVtime(taxisID); + /* int vdate = */ taxisInqVdate(taxisID); + /* int vtime = */ taxisInqVtime(taxisID); streamDefTimestep(streamID2, tsID); - for ( varID = 0; varID < nvars; varID++ ) - { - streamReadVar(streamID1, varID, data, &nmiss); - - /* int code = */vlistInqVarCode(vlistID, varID); - gridID = vlistInqVarGrid(vlistID, varID); - zaxisID = vlistInqVarZaxis(vlistID, varID); - /* int gridtype = */gridInqType(gridID); - /* int gridsize = */gridInqSize(gridID); - nlevel = zaxisInqSize(zaxisID); - /* double missval = */vlistInqVarMissval(vlistID, varID); - - for ( levelID = 0; levelID < nlevel; levelID++ ) - { - /* int level = (int) */ zaxisInqLevel(zaxisID, levelID); - /* int offset = gridsize*levelID; */ - } - - streamWriteVar(streamID2, varID, data, nmiss); - } + for (varID = 0; varID < nvars; varID++) + { + streamReadVar(streamID1, varID, data, &nmiss); + + /* int code = */ vlistInqVarCode(vlistID, varID); + gridID = vlistInqVarGrid(vlistID, varID); + zaxisID = vlistInqVarZaxis(vlistID, varID); + /* int gridtype = */ gridInqType(gridID); + /* int gridsize = */ gridInqSize(gridID); + nlevel = zaxisInqSize(zaxisID); + /* double missval = */ vlistInqVarMissval(vlistID, varID); + + for (levelID = 0; levelID < nlevel; levelID++) + { + /* int level = (int) */ zaxisInqLevel(zaxisID, levelID); + /* int offset = gridsize*levelID; */ + } + + streamWriteVar(streamID2, varID, data, nmiss); + } tsID++; } diff --git a/tests/test_grib.run.in b/tests/test_grib.run.in new file mode 100644 index 0000000000000000000000000000000000000000..b71618b2999731515be0e10c28ea5eac5c359f75 --- /dev/null +++ b/tests/test_grib.run.in @@ -0,0 +1,4 @@ +#!@SHELL@ +test 'x@ENABLE_GRIB@' = xyes || exit 77 + +./test_grib || exit 1 diff --git a/tests/test_grib.sh b/tests/test_grib.sh deleted file mode 100755 index c66111be448f708663e2962781edb94416ced3f1..0000000000000000000000000000000000000000 --- a/tests/test_grib.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh - -TEST=test_grib - -./${TEST} - -result=$? - -exit $result diff --git a/tests/test_month_adjust.c b/tests/test_month_adjust.c new file mode 100644 index 0000000000000000000000000000000000000000..739e8106090c217166fd1c4f0928cd820227eb82 --- /dev/null +++ b/tests/test_month_adjust.c @@ -0,0 +1,57 @@ +#include <stdio.h> +#include <stdlib.h> +#include <sys/time.h> + +#include "normalize_month.h" + +int +main(void) +{ + static const int vals[] = { -12, -17, 17, 11, -769652651 }; + enum + { + numVals = sizeof(vals) / sizeof(vals[0]) + }; + for (size_t i = 0; i < numVals; ++i) + { + enum + { + startYear = 1900 + }; + int month = vals[i]; + struct YearMonth ym = normalize_month(startYear, month); + if ((long) ym.year * 12 + ym.month != (long) startYear * 12 + month) + { + fprintf(stderr, + "problem: month=%d, ym.month=%d, ym.year=%d\n" + "(long)ym.year * 12 + ym.month = %ld\n" + "(long)startYear * 12 + month = %ld\n", + month, ym.month, ym.year, (long) ym.year * 12 + ym.month, (long) startYear * 12 + month); + abort(); + } + } + { + struct timeval tv; + if (gettimeofday(&tv, NULL)) + { + perror("failed to get time for random number generator initialization"); + exit(EXIT_FAILURE); + } + srandom((unsigned) (tv.tv_sec ^ tv.tv_usec)); + } + for (size_t j = 0; j < 1000000; ++j) + { + int year = (int) (random() - RAND_MAX / 2), month = (int) (random() - RAND_MAX / 2); + struct YearMonth ym = normalize_month(year, month); + if ((long) ym.year * 12 + ym.month != (long) year * 12 + month) + { + fprintf(stderr, + "problem: month=%d, ym.month=%d, ym.year=%d\n" + "(long)ym.year * 12 + ym.month = %ld\n" + "(long)year * 12 + month = %ld\n", + month, ym.month, ym.year, (long) ym.year * 12 + ym.month, (long) year * 12 + month); + abort(); + } + } + return EXIT_SUCCESS; +} diff --git a/tests/test_resource_copy.c b/tests/test_resource_copy.c index b74d4147c64eb18f39b203e1d13f18476296d47a..e8b4b752c6003f594fa054ecfc39091901bbdb0c 100644 --- a/tests/test_resource_copy.c +++ b/tests/test_resource_copy.c @@ -1,4 +1,4 @@ -#if defined (HAVE_CONFIG_H) +#if defined(HAVE_CONFIG_H) #include "config.h" #endif @@ -12,7 +12,7 @@ #include "resource_handle.h" #include "resource_unpack.h" -#ifdef MPI_MARSHALLING +#ifdef USE_MPI #include <mpi.h> #include "cdipio.h" #include "pio_serialize.h" @@ -21,39 +21,40 @@ typedef int MPI_Comm; #endif -enum { +enum +{ DOUBLE_PRECISION = CDI_DATATYPE_FLT64, - nlon = 12, - nlat = 6, - nlev = 5, - ntsteps = 3 }; + nlon = 12, + nlat = 6, + nlev = 5, + ntsteps = 3 +}; -static double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330}; -static double lats[nlat] = {-75, -45, -15, 15, 45, 75}; -static double levs[nlev] = {101300, 92500, 85000, 50000, 20000}; +static double lons[nlon] = { 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 }; +static double lats[nlat] = { -75, -45, -15, 15, 45, 75 }; +static double levs[nlev] = { 101300, 92500, 85000, 50000, 20000 }; -static int defineGrid (void) +static int +defineGrid(void) { - int mask_vec[nlon*nlat]; - const int * mp = &mask_vec[0]; - double area_vec[nlon*nlat]; - const double * ap = &area_vec[0]; + int mask_vec[nlon * nlat]; + const int *mp = &mask_vec[0]; + double area_vec[nlon * nlat]; + const double *ap = &area_vec[0]; int i; - int gridID = gridCreate(GRID_LONLAT, nlon*nlat); + int gridID = gridCreate(GRID_LONLAT, nlon * nlat); gridDefXsize(gridID, nlon); gridDefYsize(gridID, nlat); gridDefXvals(gridID, lons); gridDefYvals(gridID, lats); - gridDefNvertex ( gridID, 1 ); - gridDefXbounds ( gridID, lons ); - gridDefYbounds ( gridID, lats ); - for ( i = 0; i < nlon*nlat; i++ ) - mask_vec[i] = i % 2 ; - gridDefMaskGME ( gridID, mp ); - for ( i = 0; i < nlon*nlat; i++ ) - mask_vec[i] = 1; - gridDefMask ( gridID, mp ); + gridDefNvertex(gridID, 1); + gridDefXbounds(gridID, lons); + gridDefYbounds(gridID, lats); + for (i = 0; i < nlon * nlat; i++) mask_vec[i] = i % 2; + gridDefMaskGME(gridID, mp); + for (i = 0; i < nlon * nlat; i++) mask_vec[i] = 1; + gridDefMask(gridID, mp); cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_NAME, "myXname"); cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_NAME, "myYname"); @@ -62,21 +63,19 @@ static int defineGrid (void) cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, "myXunits"); cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_UNITS, "myYunits"); - gridDefDatatype ( gridID, DOUBLE_PRECISION ); - gridDefTrunc ( gridID, 1 ); - gridDefParamGME ( gridID, 2, 3, 4, 5 ); + gridDefDatatype(gridID, DOUBLE_PRECISION); + gridDefTrunc(gridID, 1); + gridDefParamGME(gridID, 2, 3, 4, 5); cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, 6); cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDINREFERENCE, 7); cdiDefKeyString(gridID, CDI_GLOBAL, CDI_KEY_REFERENCEURI, "myReference"); - for ( i = 0; i < nlon*nlat; i++ ) - area_vec[i] = 0.1 * i; - gridDefArea ( gridID, ap ); - for ( i = 0; i < nlon*nlat; i++ ) - mask_vec[i] = i; - gridDefReducedPoints ( gridID, nlon*nlat, mp ); - gridDefComplexPacking ( gridID, 1 ); + for (i = 0; i < nlon * nlat; i++) area_vec[i] = 0.1 * i; + gridDefArea(gridID, ap); + for (i = 0; i < nlon * nlat; i++) mask_vec[i] = i; + gridDefReducedPoints(gridID, nlon * nlat, mp); + gridDefComplexPacking(gridID, 1); { unsigned char uuid[CDI_UUID_SIZE]; cdiCreateUUID(uuid); @@ -86,24 +85,25 @@ static int defineGrid (void) return gridID; } -static int defineZaxis (void) +static int +defineZaxis(void) { double vct[3] = { 3.0, 3.3, 3.6 }; int zaxisID = zaxisCreate(ZAXIS_PRESSURE, nlev); zaxisDefLevels(zaxisID, levs); - zaxisDefLevel ( zaxisID, 2, 8507.3 ); + zaxisDefLevel(zaxisID, 2, 8507.3); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, "myName"); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_LONGNAME, "myLongname"); cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, "myUnits"); - zaxisDefDatatype ( zaxisID, DOUBLE_PRECISION ); + zaxisDefDatatype(zaxisID, DOUBLE_PRECISION); cdiDefKeyInt(zaxisID, CDI_GLOBAL, CDI_KEY_TYPEOFFIRSTFIXEDSURFACE, 1); - zaxisDefVct ( zaxisID, 3, vct ); - zaxisDefLbounds ( zaxisID, &levs[0] ); - zaxisDefUbounds ( zaxisID, &levs[0] ); - zaxisDefWeights ( zaxisID, &levs[0] ); + zaxisDefVct(zaxisID, 3, vct); + zaxisDefLbounds(zaxisID, &levs[0]); + zaxisDefUbounds(zaxisID, &levs[0]); + zaxisDefWeights(zaxisID, &levs[0]); { unsigned char uuid[CDI_UUID_SIZE]; cdiCreateUUID(uuid); @@ -113,37 +113,41 @@ static int defineZaxis (void) return zaxisID; } -static int defineTaxis (void) +static int +defineTaxis(void) { - int taxisID = taxisCreate(TAXIS_ABSOLUTE); - - taxisDefType ( taxisID, 0 ); - taxisDefVdate ( taxisID, 1 ); - taxisDefVtime ( taxisID, 2 ); - taxisDefRdate ( taxisID, 3 ); - taxisDefRtime ( taxisID, 4 ); - taxisDefVdateBounds ( taxisID, 5, 6 ); - taxisDefVtimeBounds ( taxisID, 7, 8 ); - taxisDefCalendar ( taxisID, 1 ); - taxisDefTunit ( taxisID, 1 ); - taxisDefNumavg ( taxisID, 1 ); + int taxisID = taxisCreate(TAXIS_ABSOLUTE); + + taxisDefType(taxisID, 0); + taxisDefVdate(taxisID, 1); + taxisDefVtime(taxisID, 2); + taxisDefRdate(taxisID, 3); + taxisDefRtime(taxisID, 4); + taxisDefVdateBounds(taxisID, 5, 6); + taxisDefVtimeBounds(taxisID, 7, 8); + taxisDefCalendar(taxisID, 1); + taxisDefTunit(taxisID, 1); + taxisDefNumavg(taxisID, 1); return taxisID; } -static void defineStream ( int streamID, int vlistID ) +static void +defineStream(int streamID, int vlistID) { - streamDefByteorder ( streamID, 1 ); - streamDefCompType ( streamID, 2 ); - streamDefCompLevel ( streamID, 3 ); + streamDefByteorder(streamID, 1); + streamDefCompType(streamID, 2); + streamDefCompLevel(streamID, 3); streamDefVlist(streamID, vlistID); } -struct idPair { +struct idPair +{ int id1, id2; }; -static struct idPair defineVlist ( int gridID, int zaxisID, int taxisID ) +static struct idPair +defineVlist(int gridID, int zaxisID, int taxisID) { int vlistID = CDI_UNDEFID; int zaxisID2 = zaxisCreate(ZAXIS_SURFACE, 1); @@ -165,13 +169,15 @@ static struct idPair defineVlist ( int gridID, int zaxisID, int taxisID ) return (struct idPair){ vlistID, vlistID2 }; } -static int defineInstitute () +static int +defineInstitute() { - int instID = institutDef( 0, 0,"MYINSTITUTE", "myInstitute"); + int instID = institutDef(0, 0, "MYINSTITUTE", "myInstitute"); return instID; } -static int defineModel ( int instID ) +static int +defineModel(int instID) { int modelID = modelDef(instID, 0, "resource_copy"); return modelID; @@ -179,66 +185,71 @@ static int defineModel ( int instID ) static int destNamespace; -static int modelRun(MPI_Comm comm) +static int +modelRun(MPI_Comm comm) { - char * recvBuffer, * sendBuffer; + char *recvBuffer, *sendBuffer; int bufferSize; -#ifdef MPI_MARSHALLING +#ifdef USE_MPI + const char *fname = "example_resource_copy_mpi.grb"; cdiPioSerializeSetMPI(); +#else + const char *fname = "example_resource_copy.grb"; #endif - int gridID = defineGrid (); - int zaxisID = defineZaxis (); - int taxisID = defineTaxis (); - int instID = defineInstitute (); + int gridID = defineGrid(); + int zaxisID = defineZaxis(); + int taxisID = defineTaxis(); + int instID = defineInstitute(); defineModel(instID); struct idPair temp = defineVlist(gridID, zaxisID, taxisID); int vlistID = temp.id1; - int streamID = streamOpenWrite("example.grb", CDI_FILETYPE_GRB); - if ( streamID < 0 ) xabort ( "Could not open file" ); - defineStream ( streamID, vlistID ); + int streamID = streamOpenWrite(fname, CDI_FILETYPE_GRB); + if (streamID < 0) xabort("Could not open file"); + defineStream(streamID, vlistID); vlistDestroy(temp.id1); vlistDestroy(temp.id2); - reshPackBufferCreate ( &sendBuffer, &bufferSize, &comm ); - recvBuffer = (char *)malloc((size_t)bufferSize); -#ifdef MPI_MARSHALLING - xmpi(MPI_Sendrecv(sendBuffer, bufferSize, MPI_PACKED, 0, 0, - recvBuffer, bufferSize, MPI_PACKED, 0, 0, - MPI_COMM_SELF, MPI_STATUS_IGNORE)); + reshPackBufferCreate(&sendBuffer, &bufferSize, &comm); + recvBuffer = (char *) Malloc((size_t) bufferSize); +#ifdef USE_MPI + xmpi(MPI_Sendrecv(sendBuffer, bufferSize, MPI_PACKED, 0, 0, recvBuffer, bufferSize, MPI_PACKED, 0, 0, MPI_COMM_SELF, + MPI_STATUS_IGNORE)); #else - memcpy(recvBuffer, sendBuffer, (size_t)bufferSize); + memcpy(recvBuffer, sendBuffer, (size_t) bufferSize); #endif namespaceSetActive(destNamespace); - reshUnpackResources(recvBuffer, bufferSize, &comm); + reshUnpackResources(recvBuffer, bufferSize, &comm, (cdiPostResUpdateHook) 0); free(recvBuffer); reshPackBufferDestroy(&sendBuffer); - int differ = reshListCompare ( 0, 1 ); + int differ = reshListCompare(0, 1); namespaceSetActive(0); streamClose(streamID); return differ; } -int main (int argc, char *argv[]) +int +main(int argc, char *argv[]) { int exitCode = 77; MPI_Comm commModel; -#ifdef MPI_MARSHALLING +#ifdef USE_MPI MPI_Init(&argc, &argv); commModel = MPI_COMM_WORLD; #else - (void)argc; (void)argv; + (void) argc; + (void) argv; commModel = 0; #endif destNamespace = namespaceNew(); exitCode = modelRun(commModel); -#ifdef MPI_MARSHALLING +#ifdef USE_MPI xmpi(MPI_Finalize()); #endif diff --git a/tests/test_resource_copy.parallel.run.in b/tests/test_resource_copy.parallel.run.in new file mode 100644 index 0000000000000000000000000000000000000000..0be0d82b6f686330c44ba4a025c370ebdeded882 --- /dev/null +++ b/tests/test_resource_copy.parallel.run.in @@ -0,0 +1,7 @@ +#!@SHELL@ +@ENABLE_MPI_FALSE@exit 77 +test 'x@MPI_LAUNCH@' != xtrue || exit 77 + +mpi_task_num="${mpi_task_num-1}" +@top_builddir@/libtool --mode=execute @MPI_LAUNCH@ -n ${mpi_task_num} \ + ./test_resource_copy.parallel || exit 1 diff --git a/tests/test_resource_copy.run.in b/tests/test_resource_copy.run.in new file mode 100644 index 0000000000000000000000000000000000000000..23e7fe46d672375227c203631d9f3d146343d931 --- /dev/null +++ b/tests/test_resource_copy.run.in @@ -0,0 +1,9 @@ +#!@SHELL@ +test 'x@ENABLE_GRIB@' = xyes || exit 77 + +@top_builddir@/libtool --mode=execute ${tool_wrap} ./test_resource_copy || exit 1 +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/test_resource_copy_mpi_run.in b/tests/test_resource_copy_mpi_run.in deleted file mode 100644 index e9f16024e2c43e38b5aad1b78b0846af0da4c989..0000000000000000000000000000000000000000 --- a/tests/test_resource_copy_mpi_run.in +++ /dev/null @@ -1,5 +0,0 @@ -#! @SHELL@ -set -e -mpi_task_num="${mpi_task_num-1}" -../libtool --mode=execute @MPI_LAUNCH@ -n ${mpi_task_num} \ - ./test_resource_copy_mpi diff --git a/tests/test_resource_copy_run.in b/tests/test_resource_copy_run.in deleted file mode 100644 index a12b85fe2d1719b0cf030c9ca99e73b0a743253e..0000000000000000000000000000000000000000 --- a/tests/test_resource_copy_run.in +++ /dev/null @@ -1,10 +0,0 @@ -#! @SHELL@ -set -e -../libtool --mode=execute ${tool_wrap} \ - ./test_resource_copy - -# -# Local Variables: -# mode: sh -# End: -# diff --git a/tests/test_table.c b/tests/test_table.c index 274ae162500c8be36025a96278d289759c4f7cda..27cb4bb6a96d52f516f30af4412ad42688f6027a 100644 --- a/tests/test_table.c +++ b/tests/test_table.c @@ -3,9 +3,10 @@ #include "cdi.h" -int main() +int +main() { tableInqEntry(-1, -1, -1, NULL, NULL, NULL); - //assert(tableInqEntry(-1, -1, -1, NULL, NULL, NULL) != 0); + // assert(tableInqEntry(-1, -1, -1, NULL, NULL, NULL) != 0); return EXIT_SUCCESS; } diff --git a/tests/test_table.run.in b/tests/test_table.run.in new file mode 100644 index 0000000000000000000000000000000000000000..a8ba7b967d3789e14bac42552037b453a642a7b8 --- /dev/null +++ b/tests/test_table.run.in @@ -0,0 +1,8 @@ +#!@SHELL@ + +@top_builddir@/libtool --mode=execute ${tool_wrap} ./test_table || exit 1 +# +# Local Variables: +# mode: sh +# End: +# diff --git a/tests/test_table_run.in b/tests/test_table_run.in deleted file mode 100644 index ceedd2ec7a47da01256e517a715097f032b6af42..0000000000000000000000000000000000000000 --- a/tests/test_table_run.in +++ /dev/null @@ -1,8 +0,0 @@ -#! @SHELL@ - -../libtool --mode=execute ${tool_wrap} ./test_table -# -# Local Variables: -# mode: sh -# End: -# diff --git a/tests/var_cksum.c b/tests/var_cksum.c index da34550ed56bafed86e2812ef04a3ed18271b891..4b5db1cd37967a7535e6724027c06f233914c71e 100644 --- a/tests/var_cksum.c +++ b/tests/var_cksum.c @@ -8,48 +8,44 @@ #include <stdlib.h> int -compare_checksums(struct cksum_table a[], size_t a_size, const char *src_a, - struct cksum_table b[], size_t b_size, const char *src_b) +compare_checksums(struct cksum_table a[], size_t a_size, const char *src_a, struct cksum_table b[], size_t b_size, + const char *src_b) { int checked_a[a_size], checked_b[b_size]; size_t i, j; int retcode = EXIT_SUCCESS; - for (i = 0; i < a_size; ++i) - checked_a[i] = 0; - for (j = 0; j < b_size; ++j) - checked_b[j] = 0; + for (i = 0; i < a_size; ++i) checked_a[i] = 0; + for (j = 0; j < b_size; ++j) checked_b[j] = 0; for (j = 0; j < b_size; ++j) for (i = 0; i < a_size; ++i) if (a[i].code == b[j].code) - { - if (a[i].cksum != b[j].cksum) - { - fprintf(stderr, "checksum error for varID %d, code %d!\n" - "%08lx != %08lx\n", (int)i, a[i].code, - (unsigned long)a[i].cksum, (unsigned long)b[j].cksum); - retcode = EXIT_FAILURE; - } - checked_a[i] = 1; - checked_b[j] = 1; - break; - } + { + if (a[i].cksum != b[j].cksum) + { + fprintf(stderr, + "checksum error for varID %d, code %d!\n" + "%08lx != %08lx\n", + (int) i, a[i].code, (unsigned long) a[i].cksum, (unsigned long) b[j].cksum); + retcode = EXIT_FAILURE; + } + checked_a[i] = 1; + checked_b[j] = 1; + break; + } for (i = 0; i < a_size; ++i) if (!checked_a[i]) { - fprintf(stderr, "variable %d, code %d from %s not checked!\n", - (int)i, a[i].code, src_a); + fprintf(stderr, "variable %d, code %d from %s not checked!\n", (int) i, a[i].code, src_a); retcode = EXIT_FAILURE; } for (j = 0; j < b_size; ++j) if (!checked_b[j]) { - fprintf(stderr, "variable %d, code %d from %s not checked!\n", - (int)j, b[j].code, src_b); + fprintf(stderr, "variable %d, code %d from %s not checked!\n", (int) j, b[j].code, src_b); retcode = EXIT_FAILURE; } return retcode; } - diff --git a/tests/var_cksum.h b/tests/var_cksum.h index 1d18b9b9a36ce8a563388f3f1bd8db290db6aea2..899d7f88ea52b6c7b381580421f5cdf66bd3d922 100644 --- a/tests/var_cksum.h +++ b/tests/var_cksum.h @@ -12,8 +12,7 @@ struct cksum_table /* returns EXIT_SUCCESS if a contains the same entries with the same * checksums as b, EXIT_FAILURE otherwise */ -int -compare_checksums(struct cksum_table a[], size_t a_size, const char *src_a, - struct cksum_table b[], size_t b_size, const char *src_b); +int compare_checksums(struct cksum_table a[], size_t a_size, const char *src_a, struct cksum_table b[], size_t b_size, + const char *src_b); #endif diff --git a/util/crayftnpreproc-wrapper b/util/crayftnpreproc-wrapper deleted file mode 100755 index 563d4564a09b0796c4b4e1bda4f94ac51c66f3b2..0000000000000000000000000000000000000000 --- a/util/crayftnpreproc-wrapper +++ /dev/null @@ -1,114 +0,0 @@ -#! /bin/bash -# -# crayftnpreproc-wrapper --- wrapper to produce Cray ftn style front-end -# preprocessor output on stdout -# -# Copyright (C) 2014 Nathanael Hübbe <nathanael.huebbe@informatik.uni-hamburg.de> -# Thomas Jahns <jahns@dkrz.de> -# -# Author: Nathanael Hübbe <nathanael.huebbe@informatik.uni-hamburg.de> -# Thomas Jahns <jahns@dkrz.de> -# Maintainer: Thomas Jahns <jahns@dkrz.de> -# URL: https://www.dkrz.de/redmine/projects/scales-ppm -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# Neither the name of the DKRZ GmbH nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# Wrapper for the ftn command to write preprocessed fortran files to stdout. -# -test x"$DEBUG" = x || set -x -set -e -# create temp directory for intermediate .i-files -temporaries="$(mktemp -d -t)" -trap "rm -rf $temporaries" EXIT -callDir="$PWD" - -declare -a inargs outargs preprocessedFiles -inargs=("$@") -j=0 -# filter -o option and argument from flags -for (( i = 0 ; i < ${#inargs[@]} ; i++ )) ; do - case ${inargs[$i]} in - (-o) i=$((i + 1)) ;; - (-o*) ;; - (-eZ) ;; - (-e*Z*) - outargs[$j]="${inargs[$i]//Z/}" - j=$((j + 1)) - ;; - (*) - outargs[$j]="${inargs[$i]}" - j=$((j + 1)) - ;; - esac -done - -# find non-option arguments at end of input and convert to absolute -# path if necessary -for (( i = ${#outargs[@]} - 1 ; i >= 0 ; i-- )) ; do - [[ -r "${outargs[$i]}" ]] || break - case "${outargs[$i]}" in - (/*) ;; - (*) outargs[$i]="$callDir/${outargs[$i]}" ;; - esac -done -j=0 -# use previous loop termination to build list of -# names of .i-files produced by compiler -for (( i = i + 1 ; i < ${#outargs[@]} ; i++ )) ; do - preprocessedFiles[$j]="${outargs[$i]%.*}.i" - preprocessedFiles[$j]="${preprocessedFiles[$j]##*/}" - j=$((j + 1)) -done - -# switch to temp directory to no pollute working directory -cd "$temporaries" - -# find compiler if not set -if [ "${FC+set}" != set ]; then - for F90C in ftn '' ; do - test -n "$F90C" || exit 1 - set +e - F90BIN=`which $F90C 2>/dev/null` - set -e - test ! -x "$F90BIN" || break - done -fi -FC=${FC-$F90C} - -# run compiler to produce preprocessor output -${FC} -eP "${outargs[@]}" -# pipe sanitized preprocessor output to stdout -grep -v -h '^#' "${preprocessedFiles[@]}" - -# -# Local Variables: -# license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" -# license-default: "bsd" -# End: -# diff --git a/util/xlfpreproc-wrapper b/util/icomp15/ld similarity index 60% rename from util/xlfpreproc-wrapper rename to util/icomp15/ld index 33a132bceaff45c585ed7e62e4ff51f7a02aeed9..a2a4dc217bae934ad01c302b39ae23a91e198598 100755 --- a/util/xlfpreproc-wrapper +++ b/util/icomp15/ld @@ -1,15 +1,15 @@ -#! /bin/sh +#! /bin/bash # -# xlfpreproc-wrapper --- wrapper to produce IBM xlf style front-end -# preprocessor output on stdout # -# Copyright (C) 2010 Thomas Jahns <jahns@dkrz.de> +# ld --- wrapper of ld to work around a bug in ifort 15.0.1-15.0.3 +# +# Copyright (C) 2022 Thomas Jahns <jahns@dkrz.de> # # Version: 1.0 -# Keywords: # Author: Thomas Jahns <jahns@dkrz.de> +# Keywords: # Maintainer: Thomas Jahns <jahns@dkrz.de> -# URL: http:// +# URL: https://www.dkrz.de/redmine/projects/yaxt # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -38,35 +38,42 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -# Commentary: -# -# -# -# Code: -# -if [ "${DEBUG+set}" = set ]; then - set -x - outputRedir=">&2" -else - outputRedir=">/dev/null 2>&1" -fi -while echo "$1" | grep '^-' >/dev/null 2>&1; do - FPPFLAGS="${FPPFLAGS+${FPPFLAGS} }$1" - shift -done -set -e -for srcfile in "$@" ; do - set +e - eval \$FC \$FCFLAGS \$FPPFLAGS -d -qnoobject \"\$srcfile\" $outputRedir - set -e - FPPOUTNAME=`echo $srcfile | sed -e 's:\(.*/\)*\([^/]*\)\.[^./]*$:F\2.f:'` - test -r "$FPPOUTNAME" || FPPOUTNAME="${FPPOUTNAME}90" - cat "$FPPOUTNAME" 2>/dev/null - test "${DEBUG+set}" = set && cat "$FPPOUTNAME" >&2 - rm "$FPPOUTNAME" -done +declare -a args=("$@") +case " $* " in + # are we building a shared object? + (*\ -shared\ *) + # establish whether the user intended the inclusion of static intel + # libraries into shared object? + shared_intel=1 + while IFS= read -r -d '' arg; do + case $arg in + (-shared-intel|-i-dynamic) + shared_intel=1 + ;; + (-static-intel|-i-static|-fast) + shared_intel=0 + ;; + esac + done <"/proc/$PPID/cmdline" + if ((shared_intel==1)); then + # if so, prevent core routines from being linked into the DSO + # directly. + declare -i i + for ((i=0; i<$#; ++i)); do + case ${args[i]} in + (-lifcoremt_pic|-lifcore_pic) + args[i]=${args[i]%_pic} + ;; + esac + done + fi + ;; +esac +exec ld "${args[@]}" # # Local Variables: -# license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" +# mode: sh +# license-project-url: "https://www.dkrz.de/redmine/projects/yaxt" # license-default: "bsd" # End: +# diff --git a/util/serialrun.in b/util/serialrun.in deleted file mode 100755 index a0fa39d270f4586a0a444cfc4a6dca94484e3d40..0000000000000000000000000000000000000000 --- a/util/serialrun.in +++ /dev/null @@ -1,5 +0,0 @@ -#! @SHELL@ -if [ "$1" = -n ]; then - shift ; shift -fi -exec "$@" diff --git a/util/sunf95preproc-wrapper b/util/sunf95preproc-wrapper deleted file mode 100755 index 4427021de089c21c43be4c13a98bfe7781ad6bd9..0000000000000000000000000000000000000000 --- a/util/sunf95preproc-wrapper +++ /dev/null @@ -1,132 +0,0 @@ -#! /bin/sh -# -# sunf95preproc-wrapper --- wrapper to produce Sun F95 style front-end -# preprocessor output on stdout -# -# Copyright (C) 2010, 2012 Thomas Jahns <jahns@dkrz.de> -# -# Version: 1.0 -# Keywords: -# Author: Thomas Jahns <jahns@dkrz.de> -# Maintainer: Thomas Jahns <jahns@dkrz.de> -# URL: https://www.dkrz.de/redmine/projects/scales-ppm -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# Neither the name of the DKRZ GmbH nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# Commentary: -# -# -# -# Code: -# -if [ "${DEBUG+set}" = set ]; then - set -x - outputRedir=">&2" -else - outputRedir=">/dev/null 2>&1" -fi -while echo "$1" | grep '^-' >/dev/null 2>&1; do - FPPFLAGS="${FPPFLAGS+${FPPFLAGS} }\"$1\"" - shift -done -TRAPCMD=':' -trap 'eval $TRAPCMD' 0 -set -e -test "${DEBUG+set}" = set && echo "$FPPFLAGS" >&2 -if [ "${FC+set}" != set ]; then - for F90C in sunf95 '' ; do - test -n "$F90C" || exit 1 - set +e - F90BIN=`which $F90C 2>/dev/null` - set -e - test ! -x "$F90BIN" || break - done -fi -FC=${FC-$F90C} -# nagfor 5.3 up chokes on -EP flag -nag=`$FC -V 2>&1 | sed -n '/^NAG/s/NAG Fortran Compiler.*/NAG/ -t print -b -: print -p'` -[ x"$nag" = xNAG ] || FCFLAGS=${FCFLAGS--EP} -# append -fpp if necessary -IFStr=`echo "$IFS" | sed -n '$!s/$/\\\\n/ -H -$x -$s/\n//g -$P'` -if echo "$FCFLAGS" \ - | grep -v '\('"[$IFStr]\\|^\\)-[cf]pp\\([$IFStr]\\|\$\\)" >/dev/null -then - FCFLAGS="${FCFLAGS+$FCFLAGS }-fpp" -fi -TMPDIR="${TMPDIR-/tmp}" -{ - tmp=` - (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null - ` && - test -n "$tmp" && test -d "$tmp" -} || { - tmp="$TMPDIR/foo$$-$RANDOM" - (umask 077 && mkdir "$tmp") -} || exit $? -TRAPCMD="$TRAPCMD ; rm -rf \"$tmp\"" -#echo \"$FCFLAGS\" -for FortranFile in "$@" ; do - fppInput=`echo "$FortranFile" | sed 's:.*/:: -s:\.[^./]*:.F90:'` - cp "$FortranFile" "$tmp/$fppInput" - fppOutput=`echo "$fppInput" | sed 's:.*/:: -s:\.F90:.f90:'` - for i in fppOutput ; do - if eval test -e \$$i ; then - eval backup$i=true - eval mv \"\$$i\" \"\$$i.bak\" - eval TRAPCMD${i}Save=\"$TRAPCMD\" - TRAPCMD="$TRAPCMD ; "`eval echo mv \"\\$$i.bak\" \"\\$$i\"` - fi - done - set +e - eval \$FC \$FCFLAGS -F $FPPFLAGS \"\$tmp/\$fppInput\" $outputRedir - set -e - grep -v '^#' "$fppOutput" - test "${DEBUG+set}" = set && cat "$fppOutput" >&2 - rm "$fppOutput" "$tmp/$fppInput" - for i in fppOutput ; do - if eval test \"\$backup$i\" = true ; then - eval mv \"\$$i.bak\" \"\$$i\" - TRAPCMD=`eval echo \\$TRAPCMD\${i}Save` - fi - done -done -# -# Local Variables: -# license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm" -# license-default: "bsd" -# End: diff --git a/util/sxpreproc-wrapper b/util/sxpreproc-wrapper deleted file mode 100755 index f384218666745394d68b3abb6c6771b976d97f92..0000000000000000000000000000000000000000 --- a/util/sxpreproc-wrapper +++ /dev/null @@ -1,109 +0,0 @@ -#! /bin/sh -# -# sxpreproc-wrapper --- capture preprocessed output from frontends of -# NEC SX series Fortran 90 compiler -# -# Copyright (C) 2010 Thomas Jahns <jahns@dkrz.de> -# -# Version: 1.0 -# Keywords: -# Author: Thomas Jahns <jahns@dkrz.de> -# Maintainer: Thomas Jahns <jahns@dkrz.de> -# URL: https://www.dkrz.de/redmine/projects/show/scales-ppm -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# Neither the name of the DKRZ GmbH nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# Commentary: -# -# -# -# Code: -# -if [ "${DEBUG+set}" = set ]; then - set -x - outputRedir=">&2" -else - outputRedir=">/dev/null 2>&1" -fi -while echo "$1" | grep '^-' >/dev/null 2>&1; do - FPPFLAGS="${FPPFLAGS+${FPPFLAGS} }$1" - shift -done -set -e -test "${DEBUG+set}" = set && echo "$FPPFLAGS" >&2 -FCFLAGS=${FCFLAGS--EP} -if [ "${FC+set}" != set ]; then - for F90C in sxf90 f90 '' ; do - test -n "$F90C" || exit 1 - set +e - F90BIN=`which $F90C 2>/dev/null` - set -e - test ! -x "$F90BIN" || break - done -fi -FC=${FC-$F90C} -IFStr=`echo "$IFS" | sed -n '$!s/$/\\\\n/ -H -$x -$s/\n//g -$P'` -#translate -Ep to -EP in FCFLAGS -FCFLAGS=`echo "$FCFLAGS" | sed -e 's/\('"[$IFStr]\\|^\\)-Ep\\([$IFStr]\\|\$\\)"'/\1-EP\2/'` -# append -EP if necessary -if echo "$FCFLAGS" \ - | grep -v '\('"[$IFStr]\\|^\\)-EP\\([$IFStr]\\|\$\\)" >/dev/null -then - FCFLAGS="${FCFLAGS+$FCFLAGS }-EP" -fi -TMPDIR="${TMPDIR-/tmp}" -{ - tmp=` - (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null - ` && - test -n "$tmp" && test -d "$tmp" -} || { - tmp=$TMPDIR/foo$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || exit $? -#echo \"$FCFLAGS\" -for FortranFile in "$@" ; do - fppOutput=`echo "$FortranFile" | sed 's:.*/:: -s:^:'"$tmp/"'i.:'` - set +e - eval \$FC \$FCFLAGS -ts \"'$tmp'\" \$FPPFLAGS \"\$FortranFile\" $outputRedir - set -e - cat "$fppOutput" 2>/dev/null - test "${DEBUG+set}" = set && cat "$fppOutput" >&2 - rm "$fppOutput" -done -rm -rf "$tmp" -# -# Local Variables: -# license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm" -# license-default: "bsd" -# End: