diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..f2517a33 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,36 @@ +name: Basic + +on: + push: + branches: ["mcm86-30jul24-gh-actions-ci"] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install HDF5 + run: | + wget -q https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/hdf5-1.14.4/bin/unix/hdf5-1.14.4-3-ubuntu-2204_gcc.tar.gz + mkdir hdf5-1.14.4-3 + tar -xf hdf5-1.14.4-3-ubuntu-2204_gcc.tar.gz + tar -xf hdf5/HDF5-1.14.4.3-Linux.tar.gz --strip-components=4 -C hdf5-1.14.4-3 + rm -rf hdf5 + + - name: Build Silo + run: | + export PATH="$PWD/hdf5-1.14.4-3/bin:$PATH" + mkdir build + cd build + env LDFLAGS=-Wl,-rpath,`pwd`/../hdf5-1.14.4-3/lib FFLAGS=-fallow-argument-mismatch FCFLAGS=-fallow-argument-mismatch ../configure --with-hdf5=`pwd`/../hdf5-1.14.4-3/include,`pwd`/../hdf5-1.14.4-3/lib --enable-pythonmodule --enable-json --prefix=`pwd`/myinstall + make -j 8 install + + - name: Check Silo + run: | + export PATH="$PWD/hdf5-1.14.4-3/bin:$PATH" + cd build + make -j 8 check diff --git a/CMake/SiloFindHDF5.cmake b/CMake/SiloFindHDF5.cmake index c7d80eeb..961c5017 100644 --- a/CMake/SiloFindHDF5.cmake +++ b/CMake/SiloFindHDF5.cmake @@ -84,7 +84,7 @@ if(HDF5_FOUND) add_custom_command(TARGET copy_deps POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${HDF5_DLL} ${Silo_BINARY_DIR}/bin/$) + ${HDF5_DLL} ${Silo_BINARY_DIR}/bin/$<$:$>/) endif() endif() diff --git a/CMake/SiloFindPython.cmake b/CMake/SiloFindPython.cmake index f835fc11..dabc2f29 100644 --- a/CMake/SiloFindPython.cmake +++ b/CMake/SiloFindPython.cmake @@ -58,18 +58,25 @@ ### -if(DEFINED SILO_PYTHON_DIR) +if(SILO_PYTHON_DIR) # help CMake find the specified python - set(Python_ROOT ${SILO_PYTHON_DIR}) + set(Python_ROOT_DIR ${SILO_PYTHON_DIR}) + + # prefer python3 + if(EXISTS ${SILO_PYTHON_DIR}/bin/python3) + set(Python_EXECUTABLE ${SILO_PYTHON_DIR}/bin/python3) + elseif(EXISTS ${SILO_PYTHON_DIR}/bin/python) + set(Python_EXECUTABLE ${SILO_PYTHON_DIR}/bin/python) + endif() endif() find_package(Python COMPONENTS Interpreter Development) if(Python_FOUND) + # Need to ensure these vars are available by testing, so make + # them live in PARENT_SCOPE. + set(Python_EXECUTABLE ${Python_EXECUTABLE} PARENT_SCOPE) if(WIN32) - # Need to ensure these vars are available by testing, so make - # them live in PARENT_SCOPE. - set(Python_EXECUTABLE ${Python_EXECUTABLE} PARENT_SCOPE) if(TARGET Python::Module) get_target_property(PYTHON_DLL Python::Module IMPORTED_LOCATION) if(PYTHON_DLL) diff --git a/CMake/SiloFindQt5.cmake b/CMake/SiloFindQt6.cmake similarity index 83% rename from CMake/SiloFindQt5.cmake rename to CMake/SiloFindQt6.cmake index bbf8aee3..242d90cc 100644 --- a/CMake/SiloFindQt5.cmake +++ b/CMake/SiloFindQt6.cmake @@ -53,20 +53,20 @@ ############################################################################## ### -# Uses find_package to find the Qt5 library -# If SILO_QT5_DIR is defined, uses it to tell CMake where to look. +# Uses find_package to find the Qt6 library +# If SILO_QT6_DIR is defined, uses it to tell CMake where to look. ### -if(DEFINED SILO_QT5_DIR AND EXISTS ${SILO_QT5_DIR}) +if(DEFINED SILO_QT6_DIR AND EXISTS ${SILO_QT6_DIR}) # set the variable needed for CMake to find this version of Qt - set(Qt5_DIR ${SILO_QT5_DIR}) + set(Qt6_DIR ${SILO_QT6_DIR}) endif() -find_package(Qt5 COMPONENTS Core Gui Widgets CONFIG) +find_package(Qt6 COMPONENTS Core Gui Widgets CONFIG) -if(NOT Qt5_FOUND) - message(WARNING "An explicit request for silex was made and it requires Qt, but Qt could not be found. You may want to try setting SILO_QT5_DIR") +if(NOT Qt6_FOUND) + message(WARNING "An explicit request for silex was made and it requires Qt, but Qt could not be found. You may want to try setting SILO_QT6_DIR") endif() @@ -81,24 +81,24 @@ endif() ## # Windows ## -if(Qt5_FOUND AND WIN32) +if(Qt6_FOUND AND WIN32) # the windeployqt target will be executed as a POST build step for SILEX - if(TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt) - get_target_property(_qt5_qmake_location Qt5::qmake IMPORTED_LOCATION) + if(TARGET Qt6::qmake AND NOT TARGET Qt6::windeployqt) + get_target_property(_qt6_qmake_location Qt6::qmake IMPORTED_LOCATION) execute_process( - COMMAND "${_qt5_qmake_location}" -query QT_INSTALL_PREFIX + COMMAND "${_qt6_qmake_location}" -query QT_INSTALL_PREFIX RESULT_VARIABLE return_code - OUTPUT_VARIABLE qt5_install_prefix + OUTPUT_VARIABLE qt6_install_prefix OUTPUT_STRIP_TRAILING_WHITESPACE ) - set(imported_location "${qt5_install_prefix}/bin/windeployqt.exe") + set(imported_location "${qt6_install_prefix}/bin/windeployqt.exe") if(EXISTS ${imported_location}) - add_executable(Qt5::windeployqt IMPORTED) + add_executable(Qt6::windeployqt IMPORTED) - set_target_properties(Qt5::windeployqt PROPERTIES + set_target_properties(Qt6::windeployqt PROPERTIES IMPORTED_LOCATION ${imported_location} ) endif() diff --git a/CMake/SiloFindSzip.cmake b/CMake/SiloFindSzip.cmake index 4f37c3b3..bd3be970 100644 --- a/CMake/SiloFindSzip.cmake +++ b/CMake/SiloFindSzip.cmake @@ -75,7 +75,8 @@ if(SZIP_FOUND) set(HAVE_LIBSZ 1) if(WIN32) get_target_property(SZIP_DLL szip IMPORTED_LOCATION_RELEASE ) - if(SILO_ENABLE_SILEX OR SILEX_ENABLE_BROWSER) + + if(SILO_ENABLE_SILEX OR SILO_ENABLE_BROWSER) install(FILES ${SZIP_DLL} DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE @@ -83,7 +84,7 @@ if(SZIP_FOUND) add_custom_command(TARGET copy_deps POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${SZIP_DLL} ${Silo_BINARY_DIR}/bin/$) + ${SZIP_DLL} ${Silo_BINARY_DIR}/bin/$<$:$>/) endif() endif() else() diff --git a/CMake/SiloFindZlib.cmake b/CMake/SiloFindZlib.cmake index 831202e0..6ada9f1b 100644 --- a/CMake/SiloFindZlib.cmake +++ b/CMake/SiloFindZlib.cmake @@ -61,7 +61,7 @@ if(DEFINED SILO_ZLIB_DIR AND EXISTS ${SILO_ZLIB_DIR}/zlib-config.cmake) # this works for zlib with CMake - find_package(ZLIB PATHS ${SILO_ZLIB_DIR} CONFIG) + find_package(ZLIB PATHS ${SILO_ZLIB_DIR} CONFIG NO_DEFAULT_PATH) else() if(DEFINED SILO_ZLIB_DIR AND EXISTS ${SILO_ZLIB_DIR}) # help CMake find the specified zlib @@ -76,7 +76,8 @@ if(ZLIB_FOUND) set(HAVE_ZLIB_H 1) if(WIN32) get_target_property(ZLIB_DLL zlib IMPORTED_LOCATION_RELEASE) - if(SILO_ENABLE_SILEX OR SILEX_ENABLE_BROWSER) + + if(SILO_ENABLE_SILEX OR SILO_ENABLE_BROWSER) install(FILES ${ZLIB_DLL} DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE @@ -84,7 +85,7 @@ if(ZLIB_FOUND) add_custom_command(TARGET copy_deps POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${ZLIB_DLL} ${Silo_BINARY_DIR}/bin/$) + ${ZLIB_DLL} ${Silo_BINARY_DIR}/bin/$<$:$>/) endif() endif() else() diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a1b641a..a7ddb631 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -297,11 +297,11 @@ check_symbol_exists(stat64 "sys/stat.h" HAVE_STAT64) check_symbol_exists(stat "sys/stat.h" HAVE_STAT) if (HAVE_STAT64) - add_definitions(-DHAVE_STAT64) + add_definitions(-DHAVE_STAT64) endif() if (HAVE_STAT) - add_definitions(-DHAVE_STAT) + add_definitions(-DHAVE_STAT) endif() ###----------------------------------------------------------------------------- diff --git a/config-site/steppenwolf.cmake b/config-site/steppenwolf.cmake index e8f35af7..0f254579 100644 --- a/config-site/steppenwolf.cmake +++ b/config-site/steppenwolf.cmake @@ -55,9 +55,7 @@ ### # config-site for STEPPENWOLF, a Windows system. ### -message("steppenwolf.cmake being processed") -### # Helpers for TP lib location ### set(TP_DIR C:/A_Visit/ForRegression/visit-deps/windowsbuild/MSVC2022) @@ -78,9 +76,9 @@ silo_option_default(VAR SILO_HDF5_SZIP_DIR VALUE ${TP_DIR}/szip/2.1.1/cmake) silo_option_default(VAR SILO_ZLIB_DIR VALUE ${TP_DIR}/zlib/1.2.13/cmake) ## -# QT5 (must be the location of Qt5Config.cmake) +# QT6 (must be the location of Qt6Config.cmake) ## -#silo_option_default(VAR SILO_QT5_DIR VALUE ${TP_DIR}/Qt/5.14.2/lib/cmake/Qt5) +silo_option_default(VAR SILO_QT6_DIR VALUE ${TP_DIR}/Qt/6.4.2/lib/cmake/Qt6) ## # python @@ -97,6 +95,5 @@ silo_option_default(VAR SILO_ENABLE_FORTRAN VALUE OFF TYPE BOOL) silo_option_default(VAR SILO_ENABLE_PYTHON_MODULE VALUE ON TYPE BOOL) # enable tests -#silo_option_default(VAR SILO_ENABLE_TESTS VALUE ON TYPE BOOL) - +silo_option_default(VAR SILO_ENABLE_TESTS VALUE ON TYPE BOOL) diff --git a/docs/requirements.txt b/docs/requirements.txt index f3f101cc..6bef1710 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -17,13 +17,13 @@ docutils==0.17.1 # myst-parser # sphinx # sphinx-rtd-theme -idna==3.4 +idna==3.7 # via requests imagesize==1.4.1 # via sphinx importlib-metadata==6.8.0 # via sphinx -jinja2==3.1.2 +jinja2==3.1.4 # via # myst-parser # sphinx @@ -47,7 +47,7 @@ pytz==2023.3.post1 # via babel pyyaml==6.0.1 # via myst-parser -requests==2.31.0 +requests==2.32.2 # via sphinx snowballstemmer==2.2.0 # via sphinx @@ -70,7 +70,7 @@ sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.5 # via sphinx -urllib3==2.0.7 +urllib3==2.2.2 # via requests -zipp==3.17.0 +zipp==3.19.1 # via importlib-metadata diff --git a/src/hdf5_drv/H5FDsilo.c b/src/hdf5_drv/H5FDsilo.c index e8595241..fe344983 100644 --- a/src/hdf5_drv/H5FDsilo.c +++ b/src/hdf5_drv/H5FDsilo.c @@ -1647,34 +1647,34 @@ H5FD_silo_close(H5FD_t *_file) hsize_t tot_raw_count, tot_raw_bytes, tot_md_count, tot_md_bytes; FILE* logf = fopen(file->log_name, "w"); fprintf(logf, "======== Interactions between the VFD and the filesystem ========\n"); - fprintf(logf, "block size = %llu\n", file->block_size); + fprintf(logf, "block size = %llu\n", (long long unsigned) file->block_size); fprintf(logf, "block count = %d\n", file->max_blocks); fprintf(logf, "\n"); - fprintf(logf, "max block id = %llu\n", file->stats.max_block_id); - fprintf(logf, "max blocks in mem = %llu\n", file->stats.max_blocks_in_mem); + fprintf(logf, "max block id = %llu\n", (long long unsigned) file->stats.max_block_id); + fprintf(logf, "max blocks in mem = %llu\n", (long long unsigned) file->stats.max_blocks_in_mem); fprintf(logf, "\n"); - fprintf(logf, "total seeks = %llu\n", file->stats.total_seeks); + fprintf(logf, "total seeks = %llu\n", (long long unsigned) file->stats.total_seeks); fprintf(logf, "\n"); - fprintf(logf, "number of multi-block writes = %llu\n", file->stats.num_multiblock_writes); - fprintf(logf, "number of multi-block reads = %llu\n", file->stats.num_multiblock_reads); + fprintf(logf, "number of multi-block writes = %llu\n", (long long unsigned) file->stats.num_multiblock_writes); + fprintf(logf, "number of multi-block reads = %llu\n", (long long unsigned) file->stats.num_multiblock_reads); fprintf(logf, "\n"); - fprintf(logf, "number of blocks majority md = %llu\n", file->stats.num_blocks_majority_md); - fprintf(logf, "number of blocks majority raw = %llu\n", file->stats.num_blocks_majority_raw); + fprintf(logf, "number of blocks majority md = %llu\n", (long long unsigned) file->stats.num_blocks_majority_md); + fprintf(logf, "number of blocks majority raw = %llu\n", (long long unsigned) file->stats.num_blocks_majority_raw); fprintf(logf, "\n"); - fprintf(logf, "number of writes = %llu\n", file->stats.total_write_count); - fprintf(logf, "number of bytes written = %llu\n", file->stats.total_write_bytes); + fprintf(logf, "number of writes = %llu\n", (long long unsigned) file->stats.total_write_count); + fprintf(logf, "number of bytes written = %llu\n", (long long unsigned) file->stats.total_write_bytes); fprintf(logf, "\n"); - fprintf(logf, "number of times a raw block was written = %llu\n", file->stats.total_block_raw_writes); - fprintf(logf, "number of times a raw block was written more than once = %llu\n", file->stats.total_block_raw_re_writes); + fprintf(logf, "number of times a raw block was written = %llu\n", (long long unsigned) file->stats.total_block_raw_writes); + fprintf(logf, "number of times a raw block was written more than once = %llu\n", (long long unsigned) file->stats.total_block_raw_re_writes); fprintf(logf, "\n"); - fprintf(logf, "number of times an md block was written = %llu\n", file->stats.total_block_md_writes); - fprintf(logf, "number of times an md block was written more than once = %llu\n", file->stats.total_block_md_re_writes); + fprintf(logf, "number of times an md block was written = %llu\n", (long long unsigned) file->stats.total_block_md_writes); + fprintf(logf, "number of times an md block was written more than once = %llu\n", (long long unsigned) file->stats.total_block_md_re_writes); fprintf(logf, "\n"); - fprintf(logf, "number of reads = %llu\n", file->stats.total_read_count); - fprintf(logf, "number of bytes read = %llu\n", file->stats.total_read_bytes); + fprintf(logf, "number of reads = %llu\n", (long long unsigned) file->stats.total_read_count); + fprintf(logf, "number of bytes read = %llu\n", (long long unsigned) file->stats.total_read_bytes); fprintf(logf, "\n"); - fprintf(logf, "number of times a block was read = %llu\n", file->stats.total_block_reads); - fprintf(logf, "number of times a block was read more than once = %llu\n", file->stats.total_block_re_reads); + fprintf(logf, "number of times a block was read = %llu\n", (long long unsigned) file->stats.total_block_reads); + fprintf(logf, "number of times a block was read more than once = %llu\n", (long long unsigned) file->stats.total_block_re_reads); fprintf(logf, "\n"); fprintf(logf, "number of hot blocks %d\n", file->stats.num_hot_blocks); fprintf(logf, "hot blocks...\n"); @@ -1682,7 +1682,7 @@ H5FD_silo_close(H5FD_t *_file) { silo_vfd_hot_block_stats_t *hb = &(file->stats.hot_block_list[i]); fprintf(logf," %8llu: %4s (%f), #writes=%8llu, #reads=%8llu\n", - hb->id, (hb->raw_frac>0.5?"raw":"meta"), hb->raw_frac, hb->num_block_writes+1, hb->num_block_reads+1); + (long long unsigned) hb->id, (hb->raw_frac>0.5?"raw":"meta"), hb->raw_frac, (long long unsigned) hb->num_block_writes+1, (long long unsigned) hb->num_block_reads+1); } if (file->stats.hot_block_list) free(file->stats.hot_block_list); if (file->was_written_map.bitmap) free(file->was_written_map.bitmap); @@ -1691,10 +1691,10 @@ H5FD_silo_close(H5FD_t *_file) fprintf(logf, "\n"); fprintf(logf, "\n"); fprintf(logf, "======== Interactions between HDF5 library and the VFD ========\n"); - fprintf(logf, "number raw writes = %llu\n", file->stats.total_vfd_raw_write_count); - fprintf(logf, "number raw bytes written = %llu\n", file->stats.total_vfd_raw_write_bytes); - fprintf(logf, "number md writes = %llu\n", file->stats.total_vfd_md_write_count); - fprintf(logf, "number md bytes written = %llu\n", file->stats.total_vfd_md_write_bytes); + fprintf(logf, "number raw writes = %llu\n", (long long unsigned) file->stats.total_vfd_raw_write_count); + fprintf(logf, "number raw bytes written = %llu\n", (long long unsigned) file->stats.total_vfd_raw_write_bytes); + fprintf(logf, "number md writes = %llu\n", (long long unsigned) file->stats.total_vfd_md_write_count); + fprintf(logf, "number md bytes written = %llu\n", (long long unsigned) file->stats.total_vfd_md_write_bytes); fprintf(logf, "histogram...\n"); cum_raw_count = 0; cum_raw_bytes = 0; @@ -1730,16 +1730,16 @@ H5FD_silo_close(H5FD_t *_file) fprintf(logf,"%2d: %8llu (%3d%%, %3d%%) %8llu (%3d%%, %3d%%) | " "%8llu (%3d%%, %3d%%) %8llu (%3d%%, %3d%%)\n", i, - file->stats.vfd_raw_write_count_hist[i], + (long long unsigned) file->stats.vfd_raw_write_count_hist[i], (int) (100.0 * file->stats.vfd_raw_write_count_hist[i] / tot_raw_count), (int) (100.0 * cum_raw_count / tot_raw_count), - file->stats.vfd_raw_write_bytes_hist[i], + (long long unsigned) file->stats.vfd_raw_write_bytes_hist[i], (int) (100.0 * file->stats.vfd_raw_write_bytes_hist[i] / tot_raw_bytes), (int) (100.0 * cum_raw_bytes / tot_raw_bytes), - file->stats.vfd_md_write_count_hist[i], + (long long unsigned) file->stats.vfd_md_write_count_hist[i], (int) (100.0 * file->stats.vfd_md_write_count_hist[i] / tot_md_count), (int) (100.0 * cum_md_count / tot_md_count), - file->stats.vfd_md_write_bytes_hist[i], + (long long unsigned) file->stats.vfd_md_write_bytes_hist[i], (int) (100.0 * file->stats.vfd_md_write_bytes_hist[i] / tot_md_bytes), (int) (100.0 * cum_md_bytes / tot_md_bytes)); } @@ -1777,16 +1777,16 @@ H5FD_silo_close(H5FD_t *_file) fprintf(logf,"%2d: %8llu (%3d%%, %3d%%) %8llu (%3d%%, %3d%%) | " "%8llu (%3d%%, %3d%%) %8llu (%3d%%, %3d%%)\n", i, - file->stats.vfd_raw_read_count_hist[i], + (long long unsigned) file->stats.vfd_raw_read_count_hist[i], (int) (100.0 * file->stats.vfd_raw_read_count_hist[i] / tot_raw_count), (int) (100.0 * cum_raw_count / tot_raw_count), - file->stats.vfd_raw_read_bytes_hist[i], + (long long unsigned) file->stats.vfd_raw_read_bytes_hist[i], (int) (100.0 * file->stats.vfd_raw_read_bytes_hist[i] / tot_raw_bytes), (int) (100.0 * cum_raw_bytes / tot_raw_bytes), - file->stats.vfd_md_read_count_hist[i], + (long long unsigned) file->stats.vfd_md_read_count_hist[i], (int) (100.0 * file->stats.vfd_md_read_count_hist[i] / tot_md_count), (int) (100.0 * cum_md_count / tot_md_count), - file->stats.vfd_md_read_bytes_hist[i], + (long long unsigned) file->stats.vfd_md_read_bytes_hist[i], (int) (100.0 * file->stats.vfd_md_read_bytes_hist[i] / tot_md_bytes), (int) (100.0 * cum_md_bytes / tot_md_bytes)); } diff --git a/src/hdf5_drv/silo_hdf5.c b/src/hdf5_drv/silo_hdf5.c index 9a001942..79e07e92 100644 --- a/src/hdf5_drv/silo_hdf5.c +++ b/src/hdf5_drv/silo_hdf5.c @@ -1811,7 +1811,7 @@ db_hdf5_cwg(DBfile *_dbfile) *dscount = m.MEMCNT; \ *dsnames = (char **) calloc(*dscount, sizeof(char**)); \ for (i = 0; i < *dscount; i++) \ - (*dsnames)[i] = strdup(m.MEMNAME[i]); \ + (*dsnames)[i] = strdup(m.MEMNAME); \ break; \ } @@ -1859,15 +1859,15 @@ db_hdf5_get_obj_dsnames(DBfile *_dbfile, char const *name, int *dscount, char ** switch(_objtype) { - DB_OBJ_CASE(DB_QUADVAR, DBquadvar_mt, nvals, value) - /*DB_OBJ_CASE(DB_QUAD_RECT, DBquadmesh_mt, nspace, coord) wont work for rect case */ - DB_OBJ_CASE(DB_QUAD_CURV, DBquadmesh_mt, nspace, coord) - DB_OBJ_CASE(DB_QUADMESH, DBquadmesh_mt, nspace, coord) - DB_OBJ_CASE(DB_UCDVAR, DBucdvar_mt, nvals, value) - DB_OBJ_CASE(DB_UCDMESH, DBucdmesh_mt, ndims, coord) - DB_OBJ_CASE(DB_POINTVAR, DBpointvar_mt, nvals, data) - DB_OBJ_CASE(DB_POINTMESH, DBpointmesh_mt, ndims, coord) - DB_OBJ_CASE(DB_CSGVAR, DBcsgvar_mt, nvals, vals) + DB_OBJ_CASE(DB_QUADVAR, DBquadvar_mt, nvals, value[i]) + /*DB_OBJ_CASE(DB_QUAD_RECT, DBquadmesh_mt, nspace, coord[i]) wont work for rect case */ + DB_OBJ_CASE(DB_QUAD_CURV, DBquadmesh_mt, nspace, coord[i]) + DB_OBJ_CASE(DB_QUADMESH, DBquadmesh_mt, nspace, coord[i]) + DB_OBJ_CASE(DB_UCDVAR, DBucdvar_mt, nvals, value[i]) + DB_OBJ_CASE(DB_UCDMESH, DBucdmesh_mt, ndims, coord[i]) + DB_OBJ_CASE(DB_POINTVAR, DBpointvar_mt, nvals, data[i]) + DB_OBJ_CASE(DB_POINTMESH, DBpointmesh_mt, ndims, coord[i]) + DB_OBJ_CASE(DB_CSGVAR, DBcsgvar_mt, nvals, vals[i]) DB_OBJ_CASE(DB_CURVE, DBcurve_mt, npts?1:1, yvarname) } H5Tclose(o); @@ -3851,7 +3851,9 @@ db_hdf5_get_comp_var(DBfile *_dbfile, char const *name, hsize_t *nelmts, /* create a component type with just one member, the one we're interested in */ memtype = H5Tcreate(H5T_COMPOUND, H5Tget_size(comptype)); - H5Tinsert(memtype, H5Tget_member_name(stypeid, membno), 0, comptype); + memname = H5Tget_member_name(stypeid, membno); + H5Tinsert(memtype, memname, 0, comptype); + free(memname); /* read attribute for the silo object data */ H5Aread(attr, memtype, comptype==T_str256?tmp:*buf); @@ -8356,6 +8358,13 @@ db_hdf5_ReadVarVals(DBfile *_dbfile, char const *vname, int mode, p += H5Tget_size(mtype); } + if (dsnames) + { + for (i = 0; i < dscount; i++) + FREE(dsnames[i]); + FREE(dsnames); + } + /* Close everything */ H5Tclose(ftype); H5Sclose(fspace); diff --git a/src/pdb/pdlow.c b/src/pdb/pdlow.c index f1706f12..872620b1 100644 --- a/src/pdb/pdlow.c +++ b/src/pdb/pdlow.c @@ -513,6 +513,7 @@ _lite_PD_rd_chrt (PDBfile *file) { */ chrt_sz = file->symtaddr - file->chrtaddr + 1; _lite_PD_tbuffer = MAKE_N(char, chrt_sz); + if (chrt_sz <= 0) return(FALSE); if (io_read(_lite_PD_tbuffer, 1, chrt_sz, fp) != chrt_sz) return(FALSE); _lite_PD_tbuffer[chrt_sz-1] = (char) EOF; diff --git a/src/pdb_drv/silo_pdb.c b/src/pdb_drv/silo_pdb.c index 9fc221cd..1c3daa6b 100644 --- a/src/pdb_drv/silo_pdb.c +++ b/src/pdb_drv/silo_pdb.c @@ -4019,8 +4019,10 @@ db_pdb_GetMultimesh (DBfile *_dbfile, char const *objname) * them into separate names. *----------------------------------------*/ - if ((tmpnames != NULL) && (mm->nblocks > 0)) { - db_StringListToStringArrayMBOpt(tmpnames, &(mm->meshnames), &(mm->meshnames_alloc), mm->nblocks); + if (tmpnames != NULL) { + if (mm->nblocks > 0) + db_StringListToStringArrayMBOpt(tmpnames, &(mm->meshnames), &(mm->meshnames_alloc), mm->nblocks); + FREE(tmpnames); } if ((tmpgnames != NULL) && (mm->lgroupings > 0)) { mm->groupnames = DBStringListToStringArray(tmpgnames, &(mm->lgroupings), !skipFirstSemicolon); @@ -4295,8 +4297,10 @@ db_pdb_GetMultivar (DBfile *_dbfile, char const *objname) * them into separate names. *----------------------------------------*/ - if (tmpnames != NULL && mv->nvars > 0) { - db_StringListToStringArrayMBOpt(tmpnames, &(mv->varnames), &(mv->varnames_alloc), mv->nvars); + if (tmpnames != NULL) { + if (mv->nvars > 0) + db_StringListToStringArrayMBOpt(tmpnames, &(mv->varnames), &(mv->varnames_alloc), mv->nvars); + FREE(tmpnames); } if (rpnames != NULL) @@ -4432,9 +4436,10 @@ db_pdb_GetMultimat (DBfile *_dbfile, char const *objname) * them into separate names. *----------------------------------------*/ - if (tmpnames != NULL && mt->nmats > 0) - { - db_StringListToStringArrayMBOpt(tmpnames, &(mt->matnames), &(mt->matnames_alloc), mt->nmats); + if (tmpnames != NULL) { + if (mt->nmats > 0) + db_StringListToStringArrayMBOpt(tmpnames, &(mt->matnames), &(mt->matnames_alloc), mt->nmats); + FREE(tmpnames); } if (tmpmaterial_names && mt->nmatnos > 0) @@ -4551,9 +4556,11 @@ db_pdb_GetMultimatspecies (DBfile *_dbfile, char const *objname) * break them into separate names. *----------------------------------------*/ - if (tmpnames != NULL && mms->nspec > 0) + if (tmpnames != NULL) { - db_StringListToStringArrayMBOpt(tmpnames, &(mms->specnames), &(mms->specnames_alloc), mms->nspec); + if (mms->nspec > 0) + db_StringListToStringArrayMBOpt(tmpnames, &(mms->specnames), &(mms->specnames_alloc), mms->nspec); + FREE(tmpnames); } if (tmpspecnames != NULL) @@ -6808,17 +6815,11 @@ db_pdb_ReadMatVals(DBfile *_dbfile, char const *vname, int objtype, if (mat->matlist[i] >= 0) continue; mixidx = -(mat->matlist[i]); -printf("mixidx = %d\n", mixidx); -printf("dsname[1] = \"%s\"\n", dsnames[1]); -printf("dsname[2] = \"%s\"\n", dsnames[2]); -printf("dsname[3] = \"%s\"\n", dsnames[3]); while (mixidx != 0) { ind[0] = mixidx-1; ind[1] = mixidx-1; ind[2] = 1; PJ_read_alt(dbfile->pdb, (char*)dsnames[2], &mix_next, ind); -printf("ind[0]=%ld,ind[1]=%ld,ind[2]=%ld\n",ind[0],ind[1],ind[2]); -printf("mix_next = %d\n",mix_next); PJ_read_alt(dbfile->pdb, (char*)dsnames[1], &mix_vf, ind); if (memcmp(halfa,halfc,halfn) == 0 || memcmp(halfb,halfd,halfn) == 0) { diff --git a/src/silo/extface.c b/src/silo/extface.c index 9a2a3780..6ce74249 100644 --- a/src/silo/extface.c +++ b/src/silo/extface.c @@ -307,6 +307,7 @@ CalcExternalFaces(int *zoneList, int nNodes, int lowOffset, int highOffset, { switch (shapeType[i]) { + case DB_ZONETYPE_QUAD_TET: case DB_ZONETYPE_TET: for (j = 0; j < shapeCnt[i]; j++) { @@ -330,6 +331,7 @@ CalcExternalFaces(int *zoneList, int nNodes, int lowOffset, int highOffset, iZoneList += 4; } break; + case DB_ZONETYPE_QUAD_PYRAMID: case DB_ZONETYPE_PYRAMID: for (j = 0; j < shapeCnt[i]; j++) { @@ -358,6 +360,7 @@ CalcExternalFaces(int *zoneList, int nNodes, int lowOffset, int highOffset, iZoneList += 5; } break; + case DB_ZONETYPE_QUAD_PRISM: case DB_ZONETYPE_PRISM: for (j = 0; j < shapeCnt[i]; j++) { @@ -388,6 +391,7 @@ CalcExternalFaces(int *zoneList, int nNodes, int lowOffset, int highOffset, iZoneList += 6; } break; + case DB_ZONETYPE_QUAD_HEX: case DB_ZONETYPE_HEX: for (j = 0; j < shapeCnt[i]; j++) { @@ -438,6 +442,30 @@ CalcExternalFaces(int *zoneList, int nNodes, int lowOffset, int highOffset, iZone++; } break; + case DB_ZONETYPE_QUAD_BEAM: + for (j = 0; j < shapeCnt[i]; j++) + { + InsertFace(&st, &zoneList[iZoneList], 2, iZone); + iZoneList += shapeSize[i]; + iZone++; + } + break; + case DB_ZONETYPE_QUAD_TRIANGLE: + for (j = 0; j < shapeCnt[i]; j++) + { + InsertFace(&st, &zoneList[iZoneList], 3, iZone); + iZoneList += shapeSize[i]; + iZone++; + } + break; + case DB_ZONETYPE_QUAD_QUAD: + for (j = 0; j < shapeCnt[i]; j++) + { + InsertFace(&st, &zoneList[iZoneList], 4, iZone); + iZoneList += shapeSize[i]; + iZone++; + } + break; case DB_ZONETYPE_BEAM: case DB_ZONETYPE_TRIANGLE: case DB_ZONETYPE_QUAD: diff --git a/src/silo/silo.c b/src/silo/silo.c index 013efa6f..259532fb 100644 --- a/src/silo/silo.c +++ b/src/silo/silo.c @@ -52,6 +52,7 @@ Government or Lawrence Livermore National Security, LLC, and shall not be used for advertising or product endorsement purposes. */ + /* File-wide modifications: * * Sean Ahern, Mon Mar 3 15:38:51 PST 1997 Rearranged most functions, adding @@ -5932,7 +5933,7 @@ db_can_overwrite_dstobj_with_srcobj( for (q = 0; q < srcObj->ncomponents; q++) { - int r, dstr = -1;; + int r, dstr = -1; char const *curr_compname = srcObj->comp_names[q]; for (r = 0; r < dstObj->ncomponents && dstr==-1; r++) @@ -11088,142 +11089,108 @@ _DBdarrminmax(double arr[], int len, double *arr_min, double *arr_max) return 0; } -/*********************************************************************** - * - * Purpose: Return the min and max values of a subset of the given - * array. - * - * Programmer: Eric S. Brugger - * Date: May 26, 1995 - * - * Input arguments: - * arr : The array to evaluate. - * datatype : The data type of the array. - * nx : The x dimension of the array. - * ny : The y dimension of the array. - * nz : The z dimension of the array. - * ixmin : The 0 origin min index in the x direction. - * ixmax : The 0 origin max index in the x direction. - * iymin : The 0 origin min index in the y direction. - * iymax : The 0 origin max index in the y direction. - * izmin : The 0 origin min index in the z direction. - * izmax : The 0 origin max index in the z direction. - * - * Output arguments: - * amin : The minimum value in the array. - * amax : The maximum value in the array. - * - * Input/Output arguments: +INTERNAL int +include_point(int ptidx, int ndims, int const *dims, + int const *minidx, int const *maxidx) +{ + if (dims == 0) return 1; + + int i = ndims>0 ? (ptidx) % dims[0] : 0; + int j = ndims>1 ? (ptidx/dims[0]) % dims[1] : 0; + int k = ndims>2 ? (ptidx/(dims[1]*dims[0])) % dims[2] : 0; + + if (i < minidx[0]) return 0; + if (i > maxidx[0]) return 0; + if (j < minidx[1]) return 0; + if (j > maxidx[1]) return 0; + if (k < minidx[2]) return 0; + if (k > maxidx[2]) return 0; + + return 1; +} + +/*---------------------------------------------------------------------- + * Routine _CalcExtents * - * Notes: + * Purpose: Return min/max of each dimension of coordinate array data * * Modifications: - * Eric Brugger, Tue May 30 17:03:51 PDT 1995 - * I changed the initial calculation of the index to use ixmin, - * iymin, and izmin instead of i, j, k which were not initialized. - * - * Jim Reus, 23 Apr 97 - * I changed to prototype form, moved location within file. + * Sean Ahern, Wed Oct 21 10:55:21 PDT 1998 + * Changed the function so that the min_extents and max_extents are + * passed in as void* variables. * - * Eric Brugger, Thu Sep 23 15:05:18 PDT 1999 - * I removed the unused argument nz. - ***********************************************************************/ - + * Mark C. Miller, Mon May 20 12:25:25 PDT 2024 + * Adjusted to avoid strict pointer aliasing optimization issues. + *--------------------------------------------------------------------*/ INTERNAL int -_DBSubsetMinMax3(float arr[], int datatype, float *amin, float *amax , int nx, - int ny, int ixmin, int ixmax, int iymin , int iymax, - int izmin, int izmax) +_CalcExtents(DBVCP2_t coord_arrays, int datatype, int ndims, int npts, + void *min_extents, void *max_extents, + int const *dims, int const *minidx, int const *maxidx) { - int i, j, k, index, nxy; - float tmin, tmax; - double dtmin, dtmax; - double *darr, *damin, *damax; + int i, j, first; - switch (datatype) - { - case DB_FLOAT: + if (npts <= 0) return 0; - nxy = nx * ny; + if (datatype == DB_DOUBLE) { - index = INDEX3(ixmin, iymin, izmin, nx, nxy); - tmin = arr[index]; - tmax = arr[index]; + double *dmin_extents = (double *) min_extents; + double *dmax_extents = (double *) max_extents; + double const * const * _coord_arrays = (double const * const *) coord_arrays; + double const *dcoord_arrays[3] = {_coord_arrays[0], _coord_arrays[1], _coord_arrays[2]}; - for (k = izmin; k <= izmax; k++) + for (i = 0; i < ndims; i++) { - for (j = iymin; j <= iymax; j++) + for (j = 0, first = 1; j < npts; j++) { - for (i = ixmin; i <= ixmax; i++) + if (include_point(j, ndims, dims, minidx, maxidx)) { - index = INDEX3(i, j, k, nx, nxy); - tmin = MIN(tmin, arr[index]); - tmax = MAX(tmax, arr[index]); + if (first) + { + first = 0; + dmin_extents[i] = dcoord_arrays[i][j]; + dmax_extents[i] = dcoord_arrays[i][j]; + } + else + { + dmin_extents[i] = MIN(dmin_extents[i], dcoord_arrays[i][j]); + dmax_extents[i] = MAX(dmax_extents[i], dcoord_arrays[i][j]); + } } } } + } + else + { + float *fmin_extents = (float *) min_extents; + float *fmax_extents = (float *) max_extents; + float const * const * _coord_arrays = (float const * const *) coord_arrays; + float const *fcoord_arrays[3] = {_coord_arrays[0], _coord_arrays[1], _coord_arrays[2]}; - *amin = tmin; - *amax = tmax; - break; - - case DB_DOUBLE: - - darr = (double *)arr; - - nxy = nx * ny; - - index = INDEX3(ixmin, iymin, izmin, nx, nxy); - dtmin = darr[index]; - dtmax = darr[index]; - - for (k = izmin; k <= izmax; k++) + for (i = 0; i < ndims; i++) { - for (j = iymin; j <= iymax; j++) + for (j = 0, first = 1; j < npts; j++) { - for (i = ixmin; i <= ixmax; i++) + if (include_point(j, ndims, dims, minidx, maxidx)) { - index = INDEX3(i, j, k, nx, nxy); - dtmin = MIN(dtmin, darr[index]); - dtmax = MAX(dtmax, darr[index]); + if (first) + { + first = 0; + fmin_extents[i] = fcoord_arrays[i][j]; + fmax_extents[i] = fcoord_arrays[i][j]; + } + else + { + fmin_extents[i] = MIN(fmin_extents[i], fcoord_arrays[i][j]); + fmax_extents[i] = MAX(fmax_extents[i], fcoord_arrays[i][j]); + } } } } - - damin = (double *)amin; - damax = (double *)amax; - *damin = dtmin; - *damax = dtmax; - break; - - default: - break; } return 0; } -/*---------------------------------------------------------------------- - * Routine CSGM_CalcExtents - * - * Purpose - * - * Return the extents of the given csg mesh. - * - *--------------------------------------------------------------------*/ -INTERNAL int -CSGM_CalcExtents(int datatype, int ndims, int nbounds, - const int *typeflags, const void *coeffs, - double *min_extents, double *max_extents) -{ - min_extents[0] = -DBL_MAX; - min_extents[1] = -DBL_MAX; - min_extents[2] = -DBL_MAX; - max_extents[0] = DBL_MAX; - max_extents[1] = DBL_MAX; - max_extents[2] = DBL_MAX; - return 0; -} - /*---------------------------------------------------------------------- * Routine _DBQMCalcExtents * @@ -11257,343 +11224,72 @@ _DBQMCalcExtents(DBVCP2_t coord_arrays, int datatype, int const *min_index, int const *max_index, int const *dims, int ndims, int coordtype, void *min_extents, void *max_extents) { - float *x = NULL, *y = NULL, *z = NULL; - double *dx = NULL, *dy = NULL, *dz = NULL; - double *dmin_extents = NULL, *dmax_extents = NULL; - float *fmin_extents = NULL, *fmax_extents = NULL; - int i, is_empty = 1; - char *me = "_DBQMCalcExtents"; + int i, npts; + npts = 1; for (i = 0; i < ndims; i++) - { - if (dims[i] > 0) - { - is_empty = 0; - break; - } - } + npts *= dims[i]; - if (is_empty) return 0; + if (npts <= 0) return 0; - if (datatype == DB_FLOAT) + if (coordtype == DB_COLLINEAR) { - fmin_extents = (float*)min_extents; - fmax_extents = (float*)max_extents; - - /* Initialize extent arrays */ - for (i = 0; i < ndims; i++) { - fmin_extents[i] = 0.; - fmax_extents[i] = 0.; + if (datatype == DB_DOUBLE) + { + double *dmin_extents = (double *) min_extents; + double *dmax_extents = (double *) max_extents; + double const * const * _coord_arrays = (double const * const *) coord_arrays; + double const *dcoord_arrays[3] = {_coord_arrays[0], _coord_arrays[1], _coord_arrays[2]}; + for (i = 0; i < ndims; i++) + _CalcExtents(&dcoord_arrays[i], datatype, 1, dims[i], &dmin_extents[i], &dmax_extents[i], + &dims[i], &min_index[i], &max_index[i]); + } + else + { + float *fmin_extents = (float *) min_extents; + float *fmax_extents = (float *) max_extents; + float const * const * _coord_arrays = (float const * const *) coord_arrays; + float const *fcoord_arrays[3] = {_coord_arrays[0], _coord_arrays[1], _coord_arrays[2]}; + for (i = 0; i < ndims; i++) + _CalcExtents(&fcoord_arrays[i], datatype, 1, dims[i], &fmin_extents[i], &fmax_extents[i], + &dims[i], &min_index[i], &max_index[i]); } - } else if (datatype == DB_DOUBLE) - { - dmin_extents = (double*)min_extents; - dmax_extents = (double*)max_extents; - - /* Initialize extent arrays */ - for (i = 0; i < ndims; i++) { - dmin_extents[i] = 0.; - dmax_extents[i] = 0.; - } - } - - /* Read default coordinate variables. */ - switch (ndims) { - case 3: - z = ((float**)coord_arrays)[2]; - /* Fall through */ - case 2: - y = ((float**)coord_arrays)[1]; - /* Fall through */ - case 1: - x = ((float**)coord_arrays)[0]; - break; - default: - break; - } - - if (datatype == DB_DOUBLE) { - dx = (double *)x; - dy = (double *)y; - dz = (double *)z; } - - /* Get mesh coordinate extents. */ - switch (coordtype) { - - case DB_COLLINEAR: - - switch (ndims) { - case 3: - if (datatype == DB_DOUBLE) { - dmin_extents[2] = dz[min_index[2]]; - dmax_extents[2] = dz[max_index[2]]; - } - else { - fmin_extents[2] = z[min_index[2]]; - fmax_extents[2] = z[max_index[2]]; - } - case 2: - if (datatype == DB_DOUBLE) { - dmin_extents[1] = dy[min_index[1]]; - dmax_extents[1] = dy[max_index[1]]; - } - else { - fmin_extents[1] = y[min_index[1]]; - fmax_extents[1] = y[max_index[1]]; - } - case 1: - if (datatype == DB_DOUBLE) { - dmin_extents[0] = dx[min_index[0]]; - dmax_extents[0] = dx[max_index[0]]; - } - else { - fmin_extents[0] = x[min_index[0]]; - fmax_extents[0] = x[max_index[0]]; - } - break; - } - break; - - case DB_NONCOLLINEAR: - - switch (ndims) { - case 3: - if (datatype == DB_DOUBLE) { - _DBSubsetMinMax3((float *)dx, datatype, - (float *)(&dmin_extents[0]), - (float *)(&dmax_extents[0]), - dims[0], dims[1], - min_index[0], max_index[0], - min_index[1], max_index[1], - min_index[2], max_index[2]); - _DBSubsetMinMax3((float *)dy, datatype, - (float *)(&dmin_extents[1]), - (float *)(&dmax_extents[1]), - dims[0], dims[1], - min_index[0], max_index[0], - min_index[1], max_index[1], - min_index[2], max_index[2]); - _DBSubsetMinMax3((float *)dz, datatype, - (float *)(&dmin_extents[2]), - (float *)(&dmax_extents[2]), - dims[0], dims[1], - min_index[0], max_index[0], - min_index[1], max_index[1], - min_index[2], max_index[2]); - } - else { - _DBSubsetMinMax3(x, datatype, - &fmin_extents[0], &fmax_extents[0], - dims[0], dims[1], - min_index[0], max_index[0], - min_index[1], max_index[1], - min_index[2], max_index[2]); - _DBSubsetMinMax3(y, datatype, - &fmin_extents[1], &fmax_extents[1], - dims[0], dims[1], - min_index[0], max_index[0], - min_index[1], max_index[1], - min_index[2], max_index[2]); - _DBSubsetMinMax3(z, datatype, - &fmin_extents[2], &fmax_extents[2], - dims[0], dims[1], - min_index[0], max_index[0], - min_index[1], max_index[1], - min_index[2], max_index[2]); - } - break; - case 2: - if (datatype == DB_DOUBLE) { - _DBSubsetMinMax2((float *)dx, datatype, - (float *)(&dmin_extents[0]), - (float *)(&dmax_extents[0]), - dims[0], - min_index[0], max_index[0], - min_index[1], max_index[1]); - _DBSubsetMinMax2((float *)dy, datatype, - (float *)(&dmin_extents[1]), - (float *)(&dmax_extents[1]), - dims[0], - min_index[0], max_index[0], - min_index[1], max_index[1]); - } - else { - - _DBSubsetMinMax2(x, datatype, - &fmin_extents[0], &fmax_extents[0], - dims[0], - min_index[0], max_index[0], - min_index[1], max_index[1]); - - _DBSubsetMinMax2(y, datatype, - &fmin_extents[1], &fmax_extents[1], - dims[0], - min_index[0], max_index[0], - min_index[1], max_index[1]); - } - break; - case 1: - return db_perror("1-d noncollinear", E_NOTIMP, me); - } - break; - - default: - return db_perror("default case", E_INTERNAL, me); + else + { + _CalcExtents(coord_arrays, datatype, ndims, npts, min_extents, max_extents, + dims, min_index, max_index); } return 0; } -/*-------------------------------------------------------------------------- - * Routine _DBSubsetMinMax2 - * - * Purpose - * - * Return the min and max values of a subset of the given array. - * - * Paramters - * - * arr =| The array to evaluate - * datatype =| The type of data pointed to by 'arr'. (float or double) - * amin,amax |= Returned min,max values - * nx,ny =| The dimensions of 'arr' - * ixmin... =| The actual 0-origin indeces to use for subselection - * - * Modified - * Robb Matzke, Wed Jan 11 06:46:23 PST 1995 - * Changed name from SubsetMinMax2 since that conflicted with MeshTV. - * - * Eric Brugger, Thu Mar 14 16:22:08 PST 1996 - * I corrected a bug in the calculation of the minimum, where it - * got the initial minimum value by indexing into the coordinate - * arrays as 1d arrays instead of a 2d arrays. - * - * Eric Brugger, Thu Sep 23 15:05:18 PDT 1999 - * I removed the unused argument ny. - *--------------------------------------------------------------------------*/ INTERNAL int -_DBSubsetMinMax2(void const *arr, int datatype, float *amin, float *amax, int nx, - int ixmin, int ixmax, int iymin, int iymax) +UM_CalcExtents(DBVCP2_t coord_arrays, int datatype, int ndims, int npts, + void *min_extents, void *max_extents) { - int k, j, index; - float tmin, tmax; - double dtmin, dtmax; - double *darr = NULL, *damin = NULL, *damax = NULL; - float *farr = NULL; - - switch (datatype) { - case DB_FLOAT: - - farr = (float *)arr; - - index = INDEX (ixmin, iymin, nx); - tmin = farr[index]; - tmax = farr[index]; - - for (j = iymin; j <= iymax; j++) { - for (k = ixmin; k <= ixmax; k++) { - index = INDEX (k, j, nx); - tmin = MIN (tmin, farr[index]); - tmax = MAX (tmax, farr[index]); - } - } - *amin = tmin; - *amax = tmax; - break; - - case DB_DOUBLE: - - darr = (double *)arr; - - index = INDEX (ixmin, iymin, nx); - dtmin = darr[index]; - dtmax = darr[index]; - - for (j = iymin; j <= iymax; j++) { - for (k = ixmin; k <= ixmax; k++) { - index = INDEX (k, j, nx); - dtmin = MIN (dtmin, darr[index]); - dtmax = MAX (dtmax, darr[index]); - } - } - - damin = (double *)amin; - damax = (double *)amax; - *damin = dtmin; - *damax = dtmax; - break; - - default: - break; - } - return 0; + return _CalcExtents(coord_arrays, datatype, ndims, npts, min_extents, max_extents,0,0,0); } /*---------------------------------------------------------------------- - * Routine UM_CalcExtents + * Routine CSGM_CalcExtents * * Purpose * - * Return the extents of the given ucd mesh. + * Return the extents of the given csg mesh. * - * Modifications: - * Sean Ahern, Wed Oct 21 10:55:21 PDT 1998 - * Changed the function so that the min_extents and max_extents are - * passed in as void* variables. *--------------------------------------------------------------------*/ INTERNAL int -UM_CalcExtents(DBVCP2_t coord_arrays, int datatype, int ndims, int nnodes, - void *min_extents, void *max_extents) +CSGM_CalcExtents(int datatype, int ndims, int nbounds, + const int *typeflags, const void *coeffs, + double *min_extents, double *max_extents) { - int i, j; - double **dcoord_arrays = NULL; - double *dmin_extents = NULL, *dmax_extents = NULL; - float *fmin_extents = NULL, *fmax_extents = NULL; - float **fcoord_arrays = NULL; - - if (nnodes <= 0) return 0; - - if (datatype == DB_DOUBLE) { - - dmin_extents = (double *)min_extents; - dmax_extents = (double *)max_extents; - dcoord_arrays = (double **)coord_arrays; - - /* Initialize extent arrays */ - for (i = 0; i < ndims; i++) { - dmin_extents[i] = dcoord_arrays[i][0]; - dmax_extents[i] = dcoord_arrays[i][0]; - } - - for (i = 0; i < ndims; i++) { - for (j = 0; j < nnodes; j++) { - dmin_extents[i] = MIN(dmin_extents[i], dcoord_arrays[i][j]); - dmax_extents[i] = MAX(dmax_extents[i], dcoord_arrays[i][j]); - } - } - - } - else { - fmin_extents = (float *)min_extents; - fmax_extents = (float *)max_extents; - fcoord_arrays = (float **)coord_arrays; - - /* Initialize extent arrays */ - for (i = 0; i < ndims; i++) { - fmin_extents[i] = fcoord_arrays[i][0]; - fmax_extents[i] = fcoord_arrays[i][0]; - } - - for (i = 0; i < ndims; i++) { - for (j = 0; j < nnodes; j++) { - fmin_extents[i] = MIN(fmin_extents[i], fcoord_arrays[i][j]); - fmax_extents[i] = MAX(fmax_extents[i], fcoord_arrays[i][j]); - } - } - - } - + min_extents[0] = -DBL_MAX; + min_extents[1] = -DBL_MAX; + min_extents[2] = -DBL_MAX; + max_extents[0] = DBL_MAX; + max_extents[1] = DBL_MAX; + max_extents[2] = DBL_MAX; return 0; } diff --git a/src/silo/silo.h.in b/src/silo/silo.h.in index 760ae1c3..16258962 100644 --- a/src/silo/silo.h.in +++ b/src/silo/silo.h.in @@ -1031,6 +1031,17 @@ typedef struct DBmultimatspecies_ { #define DB_ZONETYPE_PRISM 36 #define DB_ZONETYPE_HEX 38 +/* Definitions for quadratic elements */ +#define DB_ZONETYPE_QUAD_BEAM 11 + +#define DB_ZONETYPE_QUAD_TRIANGLE 25 +#define DB_ZONETYPE_QUAD_QUAD 26 + +#define DB_ZONETYPE_QUAD_TET 118 +#define DB_ZONETYPE_QUAD_PYRAMID 120 +#define DB_ZONETYPE_QUAD_PRISM 113 +#define DB_ZONETYPE_QUAD_HEX 116 + typedef struct DBzonelist_ { int ndims; /* Number of dimensions (2,3) */ int nzones; /* Number of zones in list */ @@ -2173,7 +2184,7 @@ SILO_API extern DBgroupelmap * DBGetGroupelmap(DBfile *dbfile, char cons SILO_API extern DBmrgvar * DBGetMrgvar(DBfile *dbfile, char const *name); SILO_API extern DBnamescheme * DBMakeNamescheme(char const *fmt, ...); SILO_API extern char const * DBGetName(DBnamescheme const *ns, long long natnum); -SILO_API long long DBGetIndex(char const *dbns_name_str, int field, int base); +SILO_API long long DBGetIndex(char const *dbns_name_str, int field, int width, int base); SILO_API extern char const * DBSPrintf(char const *fmt, ...); /* Multi-block objects and parallel I/O */ diff --git a/src/silo/silo.inc b/src/silo/silo.inc index 5c06e965..f9d44547 100644 --- a/src/silo/silo.inc +++ b/src/silo/silo.inc @@ -524,6 +524,13 @@ C...Parameters. INTEGER DB_ZONETYPE_PRISM INTEGER DB_ZONETYPE_PYRAMID INTEGER DB_ZONETYPE_QUAD + INTEGER DB_ZONETYPE_QUAD_BEAM + INTEGER DB_ZONETYPE_QUAD_HEX + INTEGER DB_ZONETYPE_QUAD_PRISM + INTEGER DB_ZONETYPE_QUAD_PYRAMID + INTEGER DB_ZONETYPE_QUAD_QUAD + INTEGER DB_ZONETYPE_QUAD_TET + INTEGER DB_ZONETYPE_QUAD_TRIANGLE INTEGER DB_ZONETYPE_TET INTEGER DB_ZONETYPE_TRIANGLE INTEGER SILO_VERS_MAJ @@ -865,6 +872,13 @@ C...Parameters. PARAMETER (DB_ZONETYPE_PYRAMID=35) PARAMETER (DB_ZONETYPE_PRISM=36) PARAMETER (DB_ZONETYPE_HEX=38) + PARAMETER (DB_ZONETYPE_QUAD_BEAM=11) + PARAMETER (DB_ZONETYPE_QUAD_TRIANGLE=25) + PARAMETER (DB_ZONETYPE_QUAD_QUAD=26) + PARAMETER (DB_ZONETYPE_QUAD_TET=118) + PARAMETER (DB_ZONETYPE_QUAD_PYRAMID=120) + PARAMETER (DB_ZONETYPE_QUAD_PRISM=113) + PARAMETER (DB_ZONETYPE_QUAD_HEX=116) PARAMETER (DB_MAX_H5_OBJ_VALS=64) PARAMETER (DB_F77NULLSTRING="NULLSTRING") diff --git a/src/silo/silo_f.c b/src/silo/silo_f.c index c053b171..55c5e7b0 100644 --- a/src/silo/silo_f.c +++ b/src/silo/silo_f.c @@ -3871,6 +3871,7 @@ DBGETCURVE_FC (int *dbid, FCD_DB _name, int *lname, int *maxpts, void *xvals, memcpy (xvals, cu->x, total_size) ; memcpy (yvals, cu->y, total_size) ; DBFreeCurve (cu) ; + if (name) free(name); } API_END ; return 0 ; } diff --git a/src/silo/silo_f9x.inc b/src/silo/silo_f9x.inc index 7296c53c..dfbf7c90 100644 --- a/src/silo/silo_f9x.inc +++ b/src/silo/silo_f9x.inc @@ -441,6 +441,13 @@ integer, parameter :: DB_ZONETYPE_PYRAMID = 35 integer, parameter :: DB_ZONETYPE_PRISM = 36 integer, parameter :: DB_ZONETYPE_HEX = 38 + integer, parameter :: DB_ZONETYPE_QUAD_BEAM = 11 + integer, parameter :: DB_ZONETYPE_QUAD_TRIANGLE = 25 + integer, parameter :: DB_ZONETYPE_QUAD_QUAD = 26 + integer, parameter :: DB_ZONETYPE_QUAD_TET = 118 + integer, parameter :: DB_ZONETYPE_QUAD_PYRAMID = 120 + integer, parameter :: DB_ZONETYPE_QUAD_PRISM = 113 + integer, parameter :: DB_ZONETYPE_QUAD_HEX = 116 integer, parameter :: DB_MAX_H5_OBJ_VALS = 64 character (len=10), parameter :: DB_F77NULLSTRING = "NULLSTRING" diff --git a/src/silo/silo_json.c b/src/silo/silo_json.c index c1af132d..ac48cc51 100644 --- a/src/silo/silo_json.c +++ b/src/silo/silo_json.c @@ -109,9 +109,11 @@ static void json_object_set_deleter(json_object *jso, void json_object_extptr_delete(struct json_object *jso) { - void *extptr = json_object_get_extptr_ptr(jso); + void *extptr = json_object_get_strptr(jso); if (extptr) free(extptr); - json_object_put(jso); + free(jso->o.c_string.str); + printbuf_free(jso->_pb); + free(jso); } static int @@ -238,14 +240,18 @@ struct json_object * json_object_new_strptr(void *p) { static char tmp[32]; + struct json_object *retval; + if (sizeof(p) == sizeof(unsigned)) - snprintf(tmp, sizeof(tmp), "0x%016x", (unsigned) p); + snprintf(tmp, sizeof(tmp), "0x%016x", (unsigned) ((unsigned long long) p)); else if (sizeof(p) == sizeof(unsigned long)) - snprintf(tmp, sizeof(tmp), "0x%016lx", (unsigned long) p); + snprintf(tmp, sizeof(tmp), "0x%016lx", (unsigned long) ((unsigned long long) p)); else if (sizeof(p) == sizeof(unsigned long long)) snprintf(tmp, sizeof(tmp), "0x%016llx", (unsigned long long) p); - return json_object_new_string(tmp); + retval = json_object_new_string(tmp); + json_object_set_deleter(retval, json_object_extptr_delete); + return retval; } void * @@ -265,17 +271,17 @@ json_object_new_extptr(void *p, int ndims, int const *dims, int datatype) int i; struct json_object *jobj = json_object_new_object(); struct json_object *jarr = json_object_new_array(); + struct json_object *jptr = json_object_new_strptr(p); json_object_set_serializer(jobj, json_object_extptr_to_json_string, 0, 0); - json_object_set_deleter(jobj, json_object_extptr_delete); for (i = 0; i < ndims; i++) json_object_array_add(jarr, json_object_new_int(dims[i])); - json_object_object_add(jobj, "ptr", json_object_new_strptr(p)); json_object_object_add(jobj, "datatype", json_object_new_int(datatype)); json_object_object_add(jobj, "ndims", json_object_new_int(ndims)); json_object_object_add(jobj, "dims", jarr); + json_object_object_add(jobj, "ptr", jptr); return jobj; } @@ -412,8 +418,7 @@ json_object_from_binary_buf_recurse(struct json_object *jso, void *buf) p = malloc(nvals*db_GetMachDataSize(datatype)); memcpy(p, buf+offset, nvals*db_GetMachDataSize(datatype)); json_object_object_del(iter.val,"ptr"); - snprintf(strptr, sizeof(strptr), "%p", p); - json_object_object_add(iter.val, "ptr", json_object_new_string(strptr)); + json_object_object_add(iter.val, "ptr", json_object_new_strptr(p)); } else { @@ -479,10 +484,11 @@ int json_object_to_binary_file(char const *filename, struct json_object *obj) { void *buf; int len; int fd; + size_t _nbyt; json_object_to_binary_buf(obj, 0, &buf, &len); fd = open(filename, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR); - write(fd, buf, len); + _nbyt = write(fd, buf, len); close(fd); free(buf); return 0; @@ -607,6 +613,7 @@ json_object_reconstitute_extptrs(struct json_object *obj) json_object_object_add(pobj, mname, json_object_new_extptr(pdata, ndims, dims, datatype)); + free(dims); free(mname); } } @@ -1639,10 +1646,11 @@ DBGetJsonObject(DBfile *dbfile, char const *objname) else if (!strncmp(sobj->pdb_names[i], "'", 4)) { char tmp[256]; + char *tmp_path; size_t len = strlen(sobj->pdb_names[i])-5; memset(tmp, 0, sizeof(tmp)); strncpy(tmp, sobj->pdb_names[i]+4, len); - char *tmp_path = db_join_path(obj_dirname, tmp); + tmp_path = db_join_path(obj_dirname, tmp); if (DBInqVarExists(dbfile, tmp_path)) { if (DBInqVarType(dbfile, tmp_path) == DB_VARIABLE) @@ -1768,8 +1776,6 @@ int DBWriteJsonObject(DBfile *dbfile, struct json_object *jobj) break; } -/* warning STRDUPS ARE LEAKS */ - case json_type_object: /* must be extptr array reference */ { if (json_object_object_get_ex(mobj, "ptr", 0) && @@ -1781,12 +1787,13 @@ int DBWriteJsonObject(DBfile *dbfile, struct json_object *jobj) long dims[32]; void *p = json_object_get_strptr(json_object_object_get(mobj, "ptr")); int datatype = json_object_get_int(json_object_object_get(mobj, "datatype")); + char *dtstr = db_GetDatatypeString(datatype); int ndims = json_object_get_int(json_object_object_get(mobj, "ndims")); struct json_object *darr = json_object_object_get(mobj, "dims"); for (i = 0; i < ndims; i++) dims[i] = (long) json_object_get_int(json_object_array_get_idx(darr, i)); - DBWriteComponent(dbfile, sobj, mname, strdup(objnm), - db_GetDatatypeString(datatype), p, ndims, dims); + DBWriteComponent(dbfile, sobj, mname, objnm, dtstr, p, ndims, dims); + free(dtstr); } else { @@ -1798,9 +1805,9 @@ int DBWriteJsonObject(DBfile *dbfile, struct json_object *jobj) snprintf(tmp, sizeof(tmp), "anon_%d", cnt); if (has_silo_name && has_silo_type) - DBAddStrComponent(sobj, mname, strdup(json_object_get_string(silo_name_subobj))); + DBAddStrComponent(sobj, mname, json_object_get_string(silo_name_subobj)); else - DBAddStrComponent(sobj, mname, strdup(tmp)); + DBAddStrComponent(sobj, mname, tmp); DBWriteJsonObject(dbfile, mobj); } diff --git a/src/silo/silo_ns.c b/src/silo/silo_ns.c index a09fb97c..f0e373a8 100644 --- a/src/silo/silo_ns.c +++ b/src/silo/silo_ns.c @@ -54,7 +54,6 @@ product endorsement purposes. #include #include #include -#include #include #include @@ -610,41 +609,60 @@ DBGetName(DBnamescheme const *ns, long long natnum) } PUBLIC long long -DBGetIndex(char const *dbns_name_str, int fieldSelector, int base) +DBGetIndex(char const *dbns_name_str, int fieldSelector, int minFieldWidth, int base) { int currentField = 0; char const *currentPosition = dbns_name_str; + char const *lastPosition = currentPosition + strlen(dbns_name_str); char *endPtr; - long long value = LLONG_MAX; - while (*currentPosition != '\0') + /* Note: leading zeros, which are probably quite common in fields in + nameschemes will get treated automatically as octal (base 8) if base + is not explicitly specified by caller. */ + + while (currentPosition < lastPosition) { - /* x and X and b and B allow use of hexidecimal and binary numbers as in - 0xDeadBeef and 0b101101 though the latter is non-converntional. - Note that leading zeros, which are probably quite common in fields in - nameschemes will get treated automatically as octal (base 8) if base - is not explicitly specified. */ - if (isdigit(*currentPosition) || strchr("-+xXbB", *currentPosition)) + long long mult = 1; + long long value; + + /* skip forward over chars that cannot be part of a number */ + if (!strchr("+-0123456789ABCDEFabcdefxX", *currentPosition)) { - errno = 0; - /* Found a digit, attempt to convert it to an integer value */ - value = strtoll(currentPosition, &endPtr, base); - if (errno == 0) - { - if (currentField == fieldSelector) - return value; - currentPosition = endPtr; /* moved to end of whatever was parsed by strtol */ - currentField++; - } - else - currentPosition++; - } else { - /* Skip non-digit characters */ + currentPosition++; + continue; + } + + /* walk over any sign if present */ + if (*currentPosition == '-') + { + mult = -1; currentPosition++; } + else if (*currentPosition == '+') + currentPosition++; + + /* Try to detect unconventional '0b' base-2 designator */ + if (base == 0 && (!strncmp(currentPosition,"0b0",3) || !strncmp(currentPosition,"0b1",3))) + { + currentPosition += 2; + base = 2; /* explicitly set base to 2 */ + } + + /* Attempt a conversion. A successful conversion implies its a field. */ + errno = 0; + value = strtoll(currentPosition, &endPtr, base); + if (errno == 0 && endPtr >= currentPosition + minFieldWidth) + { + if (currentField == fieldSelector) + return mult * value; + currentPosition = endPtr; + currentField++; + } + else + currentPosition++; } - return value; + return LLONG_MAX; } PUBLIC char const * diff --git a/src/silo/silo_private.h b/src/silo/silo_private.h index a34e511e..a40dcfe5 100644 --- a/src/silo/silo_private.h +++ b/src/silo/silo_private.h @@ -264,8 +264,9 @@ typedef struct context_t { jstat = 0 ; \ jold = NULL ; \ if (DBDebugAPI>0) { \ - write (DBDebugAPI, M, strlen(M)); \ - write (DBDebugAPI, "\n", 1); \ + size_t _nbyt; \ + _nbyt = write (DBDebugAPI, M, strlen(M)); \ + _nbyt = write (DBDebugAPI, "\n", 1); \ } \ if (!SILO_Globals.Jstk){ \ jstk_push() ; \ @@ -295,8 +296,9 @@ typedef struct context_t { return R; \ } \ if (DBDebugAPI>0) { \ - write (DBDebugAPI, M, strlen(M)); \ - write (DBDebugAPI, "\n", 1); \ + size_t _nbyt; \ + _nbyt = write (DBDebugAPI, M, strlen(M)); \ + _nbyt = write (DBDebugAPI, "\n", 1); \ } \ if (!SILO_Globals.Jstk){ \ jstk_push() ; \ @@ -902,10 +904,6 @@ INTERNAL int _DBQMCalcExtents (DBVCP2_t, int, int const *, int const *, int cons int, void *, void *); INTERNAL int UM_CalcExtents (DBVCP2_t, int, int, int, void *, void *); -INTERNAL int _DBSubsetMinMax2 (DBVCP1_t, int, float *, float *, int, - int, int, int, int); -INTERNAL int _DBSubsetMinMax3 (float *, int, float *, float *, int, int, - int, int, int, int, int, int); INTERNAL int db_ProcessOptlist (int, DBoptlist const * const); INTERNAL int db_VariableNameValid(char const *); INTERNAL int db_SplitShapelist (DBucdmesh *um); diff --git a/src/taurus/silo_taurus.c b/src/taurus/silo_taurus.c index e8bef5a3..57fa53d4 100644 --- a/src/taurus/silo_taurus.c +++ b/src/taurus/silo_taurus.c @@ -484,10 +484,10 @@ db_taur_NewToc(DBfile *_dbfile) toc->dir_names[i] = ALLOC_N(char, 12); if (taurus->nstates < 100) { - sprintf(toc->dir_names[i], "state%02d", i); + snprintf(toc->dir_names[i], 12, "state%02d", i); } else { - sprintf(toc->dir_names[i], "state%03d", i); + snprintf(toc->dir_names[i], 12, "state%03d", i); } } toc->ndir = taurus->nstates; @@ -1455,9 +1455,9 @@ db_taur_InqMeshname(DBfile *_dbfile, char const *var_name, char *mesh_name) */ if (strcmp(var_name, "mat1") == 0) { if (taurus->nstates < 100) - sprintf(mesh_name, "/state%02d/mesh1", taurus->state); + snprintf(mesh_name, 14, "/state%02d/mesh1", taurus->state); else - sprintf(mesh_name, "/state%03d/mesh1", taurus->state); + snprintf(mesh_name, 15, "/state%03d/mesh1", taurus->state); return (0); } } @@ -1480,10 +1480,10 @@ db_taur_InqMeshname(DBfile *_dbfile, char const *var_name, char *mesh_name) if (taur_var_list[i].idir == idir) { if (taurus->nstates < 100) - sprintf(mesh_name, "/state%02d/%s", taurus->state, + snprintf(mesh_name, 256, "/state%02d/%s", taurus->state, taur_var_list[i].mesh); else - sprintf(mesh_name, "/state%03d/%s", taurus->state, + snprintf(mesh_name, 256, "/state%03d/%s", taurus->state, taur_var_list[i].mesh); return (0); } @@ -1786,7 +1786,7 @@ db_taur_cd(TAURUSfile *taurus, char const *path) } else { db_taur_pwd(taurus, opath); - sprintf(npath, "%s/%s", opath, path); + snprintf(npath, 256, "%s/%s", opath, path); } reduce_path(npath); @@ -1873,19 +1873,19 @@ db_taur_pwd(TAURUSfile *taurus, char *path) else { if (taurus->idir == -1) { if (taurus->nstates < 100) { - sprintf(path, "/state%02d", taurus->state); + snprintf(path, 7, "/state%02d", taurus->state); } else { - sprintf(path, "/state%03d", taurus->state); + snprintf(path, 8, "/state%03d", taurus->state); } } else { if (taurus->nstates < 100) { - sprintf(path, "/state%02d/%s", taurus->state, + snprintf(path, 256, "/state%02d/%s", taurus->state, dir_names[taurus->idir]); } else { - sprintf(path, "/state%03d/%s", taurus->state, + snprintf(path, 256, "/state%03d/%s", taurus->state, dir_names[taurus->idir]); } } diff --git a/src/zfp-0.5.5/src/template/decodef.c b/src/zfp-0.5.5/src/template/decodef.c index aef53bb9..98e0dc9f 100644 --- a/src/zfp-0.5.5/src/template/decodef.c +++ b/src/zfp-0.5.5/src/template/decodef.c @@ -9,11 +9,13 @@ _t2(decode_block, Scalar, DIMS)(zfp_stream* zfp, Scalar* fblock) uint bits = 1; /* test if block has nonzero values */ if (stream_read_bit(zfp->stream)) { + int emax; + int maxprec; cache_align_(Int iblock[BLOCK_SIZE]); /* decode common exponent */ bits += EBITS; - int emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS; - int maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS); + emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS; + maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS); /* decode integer block */ bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - bits, zfp->maxbits - bits, maxprec, iblock); /* perform inverse block-floating-point transform */ diff --git a/src/zfp-0.5.5/src/template/revdecodef.c b/src/zfp-0.5.5/src/template/revdecodef.c index d616ff1c..4dd1c85a 100644 --- a/src/zfp-0.5.5/src/template/revdecodef.c +++ b/src/zfp-0.5.5/src/template/revdecodef.c @@ -35,9 +35,10 @@ _t2(rev_decode_block, Scalar, DIMS)(zfp_stream* zfp, Scalar* fblock) _t1(rev_inv_reinterpret, Scalar)(iblock, fblock, BLOCK_SIZE); } else { + int emax; /* decode common exponent */ bits += EBITS; - int emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS; + emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS; /* decode integer block */ bits += _t2(rev_decode_block, Int, DIMS)(zfp->stream, zfp->minbits - bits, zfp->maxbits - bits, iblock); /* perform inverse block-floating-point transform */ diff --git a/tests/CMake/SiloTestFunctions.cmake b/tests/CMake/SiloTestFunctions.cmake index 815cd7f7..86529b04 100644 --- a/tests/CMake/SiloTestFunctions.cmake +++ b/tests/CMake/SiloTestFunctions.cmake @@ -81,8 +81,15 @@ function(silo_add_test) add_executable(${sat_NAME} ${sat_SRC}) - set_target_properties(${sat_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY - ${silo_test_output_dir}) + if(${is_multi_config}) + # change output directory using generator expression to avoid + # VS adding per-configuration subdir + set_target_properties(${sat_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY + ${silo_test_output_dir}/$<$:>) + else() + set_target_properties(${sat_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY + ${silo_test_output_dir}) + endif() if("LANG" IN_LIST sat_KEYWORDS_MISSING_VALUES) message(WARNING "silo_add_test: LANG argument is missing a value.") return() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7f85f8ea..c3deb91a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -59,8 +59,19 @@ project(SILO_TESTS) # Set the output dir for test executables ###------------------------------------------------------------------------------------- -# runtime output dir is bin, so append bin to current binary dir -set(silo_test_output_dir ${CMAKE_CURRENT_BINARY_DIR}/bin/$<$:$>/) +if(WIN32) + ## + # For windows, the standard output dir (${CMAKE_CURRENT_BINARY_DIR}/$) causes + # problems with the script writing used when creating test-runners because the value + # of $ isn't known until build time. Instead use a non-configuration location + # subdir directly off build-dir + ## + set(silo_test_output_dir ${Silo_BINARY_DIR}/all_tests/) + file(MAKE_DIRECTORY ${silo_test_output_dir}) +else() + # runtime output dir is bin, so append bin to current binary dir + set(silo_test_output_dir ${CMAKE_CURRENT_BINARY_DIR}/bin) +endif() ###------------------------------------------------------------------------------------- # Copy dependencies needed for running tests. diff --git a/tests/Makefile.am b/tests/Makefile.am index 85a132d9..7f3e5bcf 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -140,6 +140,10 @@ mk_nasf_pdb_CPPFLAGS = $(AM_CPPFLAGS) -I../src/pdb -I../src/score testpdb_CPPFLAGS += -DPDB_LITE pdbtst_CPPFLAGS += -DPDB_LITE mk_nasf_pdb_CPPFLAGS += -DPDB_LITE +BCASTOPEN = +if HDF5_DRV_NEEDED + BCASTOPEN += bcastopen +endif PDBTESTS = testpdb pdbtst JSONTESTS = if JSON_NEEDED @@ -159,8 +163,8 @@ PROGS=array dir extface multi_test partial_io point quad simple ucd \ cpz1plt group_test listtypes alltypes wave multi_file polyzl csg \ rocket mmadjacency largefile dbversion namescheme efcentering \ mk_nasf_pdb ioperf arbpoly2d readstuff mat3d_3across merge_block \ - test_mat_compression bcastopen memfile_simple \ - empty majorder realloc_obj_and_opts $(PDBTESTS) $(JSONTESTS) + test_mat_compression memfile_simple empty majorder realloc_obj_and_opts \ + $(PDBTESTS) $(JSONTESTS) $(BCASTOPEN) dir_SOURCES = dir.c testlib.c listtypes_SOURCES = listtypes.c listtypes_main.c @@ -185,7 +189,11 @@ rocket_silo_la_SOURCES = rocket_silo.cxx # the '-rpath /nowhere' is some trick to force libtool to produce a shared lib rocket_silo_la_LDFLAGS = -module -avoid-version -rpath /nowhere -EXTRA_ioperf_DEPENDENCIES = ioperf_silo.la ioperf_hdf5.la ioperf_pdb.la ioperf_sec2.la ioperf_stdio.la +if HDF5_DRV_NEEDED + EXTRA_ioperf_DEPENDENCIES = ioperf_silo.la ioperf_hdf5.la ioperf_pdb.la ioperf_sec2.la ioperf_stdio.la +else + EXTRA_ioperf_DEPENDENCIES = ioperf_silo.la ioperf_pdb.la ioperf_sec2.la ioperf_stdio.la +endif ioperf_LDFLAGS = -ldl ioperf_CXXFALGS = -rdynamic # the '-rpath /nowhere' is some trick to force libtool to produce a shared lib @@ -250,8 +258,8 @@ check_PROGRAMS = \ majorder \ realloc_obj_and_opts \ test_mat_compression \ - bcastopen \ memfile_simple \ + $(BCASTOPEN) \ $(PDBTESTS) \ $(JSONTESTS) diff --git a/tests/Makefile.in b/tests/Makefile.in index 0f3775f2..5cedd81c 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -150,7 +150,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @JSON_NEEDED_TRUE@am__append_1 = ../tools/json/json-c-0.10/libjson.la -@JSON_NEEDED_TRUE@am__append_2 = json +@HDF5_DRV_NEEDED_TRUE@am__append_2 = bcastopen +@JSON_NEEDED_TRUE@am__append_3 = json check_PROGRAMS = arbpoly$(EXEEXT) arbpoly2d$(EXEEXT) array$(EXEEXT) \ extface$(EXEEXT) multi_test$(EXEEXT) partial_io$(EXEEXT) \ point$(EXEEXT) group_test$(EXEEXT) listtypes$(EXEEXT) \ @@ -168,14 +169,14 @@ check_PROGRAMS = arbpoly$(EXEEXT) arbpoly2d$(EXEEXT) array$(EXEEXT) \ efcentering$(EXEEXT) mk_nasf_pdb$(EXEEXT) ioperf$(EXEEXT) \ readstuff$(EXEEXT) testfs$(EXEEXT) empty$(EXEEXT) \ majorder$(EXEEXT) realloc_obj_and_opts$(EXEEXT) \ - test_mat_compression$(EXEEXT) bcastopen$(EXEEXT) \ - memfile_simple$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_3) \ - $(am__EXEEXT_5) $(am__EXEEXT_7) -@HDF5_DRV_NEEDED_TRUE@am__append_3 = $(HDF5PROGS) + test_mat_compression$(EXEEXT) memfile_simple$(EXEEXT) \ + $(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_5) \ + $(am__EXEEXT_7) $(am__EXEEXT_9) @HDF5_DRV_NEEDED_TRUE@am__append_4 = $(HDF5PROGS) -@HDF5_DRV_NEEDED_TRUE@am__append_5 = $(HDF5CKLTLIBS) -@FORTRAN_NEEDED_TRUE@am__append_6 = $(FCPROGS) +@HDF5_DRV_NEEDED_TRUE@am__append_5 = $(HDF5PROGS) +@HDF5_DRV_NEEDED_TRUE@am__append_6 = $(HDF5CKLTLIBS) @FORTRAN_NEEDED_TRUE@am__append_7 = $(FCPROGS) +@FORTRAN_NEEDED_TRUE@am__append_8 = $(FCPROGS) subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/ax_check_compiler_flags.m4 \ @@ -241,17 +242,19 @@ rocket_silo_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ $(AM_CXXFLAGS) $(CXXFLAGS) $(rocket_silo_la_LDFLAGS) \ $(LDFLAGS) -o $@ -am__EXEEXT_1 = testpdb$(EXEEXT) pdbtst$(EXEEXT) -@JSON_NEEDED_TRUE@am__EXEEXT_2 = json$(EXEEXT) -am__EXEEXT_3 = $(am__EXEEXT_2) -am__EXEEXT_4 = compression$(EXEEXT) grab$(EXEEXT) mk_nasf_h5$(EXEEXT) \ +@HDF5_DRV_NEEDED_TRUE@am__EXEEXT_1 = bcastopen$(EXEEXT) +am__EXEEXT_2 = $(am__EXEEXT_1) +am__EXEEXT_3 = testpdb$(EXEEXT) pdbtst$(EXEEXT) +@JSON_NEEDED_TRUE@am__EXEEXT_4 = json$(EXEEXT) +am__EXEEXT_5 = $(am__EXEEXT_4) +am__EXEEXT_6 = compression$(EXEEXT) grab$(EXEEXT) mk_nasf_h5$(EXEEXT) \ testhdf5$(EXEEXT) -@HDF5_DRV_NEEDED_TRUE@am__EXEEXT_5 = $(am__EXEEXT_4) -am__EXEEXT_6 = arrayf77$(EXEEXT) arrayf90$(EXEEXT) curvef77$(EXEEXT) \ +@HDF5_DRV_NEEDED_TRUE@am__EXEEXT_7 = $(am__EXEEXT_6) +am__EXEEXT_8 = arrayf77$(EXEEXT) arrayf90$(EXEEXT) curvef77$(EXEEXT) \ matf77$(EXEEXT) pointf77$(EXEEXT) quadf77$(EXEEXT) \ ucdf77$(EXEEXT) testallf77$(EXEEXT) csgmesh$(EXEEXT) \ qmeshmat2df77$(EXEEXT) -@FORTRAN_NEEDED_TRUE@am__EXEEXT_7 = $(am__EXEEXT_6) +@FORTRAN_NEEDED_TRUE@am__EXEEXT_9 = $(am__EXEEXT_8) TestReadMask_SOURCES = TestReadMask.c TestReadMask_OBJECTS = TestReadMask.$(OBJEXT) TestReadMask_LDADD = $(LDADD) @@ -1212,8 +1215,9 @@ pdbtst_CPPFLAGS = $(AM_CPPFLAGS) -I../src/pdb -I../src/score \ -DPDB_LITE mk_nasf_pdb_CPPFLAGS = $(AM_CPPFLAGS) -I../src/pdb -I../src/score \ -DPDB_LITE +BCASTOPEN = $(am__append_2) PDBTESTS = testpdb pdbtst -JSONTESTS = $(am__append_2) +JSONTESTS = $(am__append_3) @JSON_NEEDED_TRUE@json_CPPFLAGS = -I$(prefix)/json/include $(AM_CPPFLAGS) #TestReadMask_CPPFLAGS = $(AM_CPPFLAGS) AM_FFLAGS = $(AM_CPPFLAGS) @@ -1228,9 +1232,9 @@ PROGS = array dir extface multi_test partial_io point quad simple ucd \ cpz1plt group_test listtypes alltypes wave multi_file polyzl \ csg rocket mmadjacency largefile dbversion namescheme \ efcentering mk_nasf_pdb ioperf arbpoly2d readstuff \ - mat3d_3across merge_block test_mat_compression bcastopen \ - memfile_simple empty majorder realloc_obj_and_opts $(PDBTESTS) \ - $(JSONTESTS) $(am__append_3) $(am__append_6) + mat3d_3across merge_block test_mat_compression memfile_simple \ + empty majorder realloc_obj_and_opts $(PDBTESTS) $(JSONTESTS) \ + $(BCASTOPEN) $(am__append_4) $(am__append_7) dir_SOURCES = dir.c testlib.c listtypes_SOURCES = listtypes.c listtypes_main.c bcastopen_SOURCES = listtypes.c bcastopen.c bcastopen_main.c @@ -1244,11 +1248,12 @@ newsami_SOURCES = newsami.cxx # plugins for rocket and for ioperf HDF5CKLTLIBS = ioperf_hdf5.la check_LTLIBRARIES = rocket_silo.la ioperf_silo.la ioperf_pdb.la \ - ioperf_sec2.la ioperf_stdio.la $(am__append_5) + ioperf_sec2.la ioperf_stdio.la $(am__append_6) rocket_silo_la_SOURCES = rocket_silo.cxx # the '-rpath /nowhere' is some trick to force libtool to produce a shared lib rocket_silo_la_LDFLAGS = -module -avoid-version -rpath /nowhere -EXTRA_ioperf_DEPENDENCIES = ioperf_silo.la ioperf_hdf5.la ioperf_pdb.la ioperf_sec2.la ioperf_stdio.la +@HDF5_DRV_NEEDED_FALSE@EXTRA_ioperf_DEPENDENCIES = ioperf_silo.la ioperf_pdb.la ioperf_sec2.la ioperf_stdio.la +@HDF5_DRV_NEEDED_TRUE@EXTRA_ioperf_DEPENDENCIES = ioperf_silo.la ioperf_hdf5.la ioperf_pdb.la ioperf_sec2.la ioperf_stdio.la ioperf_LDFLAGS = -ldl ioperf_CXXFALGS = -rdynamic # the '-rpath /nowhere' is some trick to force libtool to produce a shared lib diff --git a/tests/TestReadMask.c b/tests/TestReadMask.c index 105f1f82..55106e38 100644 --- a/tests/TestReadMask.c +++ b/tests/TestReadMask.c @@ -51,13 +51,12 @@ product endorsement purposes. */ #include #include +#include #ifndef _WIN32 #include -#else -#include -#include #endif #include +#include #include /* To compile this program on hyper, here is the command: diff --git a/tests/checksums b/tests/checksums index b04ac9f5..05b68b8c 100755 --- a/tests/checksums +++ b/tests/checksums @@ -99,7 +99,7 @@ $topDir/multi_test DB_HDF5 1>/dev/null 2>&1 # offset=0 skip=0 -while [[ $offset -eq 0 && $skip -lt 9 ]]; do +while [ $offset -eq 0 -a $skip -lt 9 ]; do offset=`od -j $skip -A d4 -t d4 h5_check_files/multi_ucd3d.h5 | tr '\t' ' ' | tr -s ' ' | grep '167 179 323 311' | cut -d' ' -f1` offset=`echo $offset | cut -d' ' -f1 | sed 's/^0*//'` skip=$(expr $skip + 1) diff --git a/tests/compression.c b/tests/compression.c index 2febfbdb..a0c6620d 100644 --- a/tests/compression.c +++ b/tests/compression.c @@ -223,7 +223,13 @@ main(int argc, char *argv[]) if (DBWrite(dbfile, tmpname, fval, fdims, ndims, DB_FLOAT) < 0) { if (DBErrno() == E_COMPRESSION) + { + free(fval); + free(frval); + free(dval); + free(drval); return GNU_AUTOTEST_SKIP_CODE; /* compression requested not supported in this build */ + } nerrors++; break; } @@ -249,7 +255,13 @@ main(int argc, char *argv[]) if (DBWrite(dbfile, tmpname, dval, ddims, ndims, DB_DOUBLE) < 0) { if (DBErrno() == E_COMPRESSION) + { + free(fval); + free(frval); + free(dval); + free(drval); return GNU_AUTOTEST_SKIP_CODE; /* compression requested not supported in this build */ + } nerrors++; break; } @@ -273,7 +285,13 @@ main(int argc, char *argv[]) } if (nerrors) + { + free(fval); + free(frval); + free(dval); + free(drval); return nerrors; + } /* * Now try opening the file again and verify the simple diff --git a/tests/empty.c b/tests/empty.c index 667e5570..c767a62c 100644 --- a/tests/empty.c +++ b/tests/empty.c @@ -296,6 +296,7 @@ main(int argc, char *argv[]) /*ASSERT(DBWrite(dbfile,"empty_writeb",0, 0,ZZ,DB_FLOAT),retval<0,retval==0);*/ } + DBFreeOptlist(ol); DBClose(dbfile); dbfile = 0; diff --git a/tests/json.c b/tests/json.c index d1ff102b..6694f05d 100644 --- a/tests/json.c +++ b/tests/json.c @@ -112,8 +112,8 @@ main(int argc, char *argv[]) /* Example of getting a Silo object from a silo file as a json object */ jsilo_obj = DBGetJsonObject(dbfile, "hex"); - printf("%s\n", json_object_to_json_string_ext(jsilo_obj, 0)); DBClose(dbfile); + printf("%s\n", json_object_to_json_string_ext(jsilo_obj, 0)); /* Test interface to query extptr members from jsilo_obj */ { @@ -194,6 +194,7 @@ main(int argc, char *argv[]) /* Example of taking a standard silo object and adding some arbitrary stuff to it */ json_object_to_file("onehex.json", jsilo_obj); json_object_put(jsilo_obj); + fil_obj = json_object_from_file("onehex.json"); json_object_reconstitute_extptrs(fil_obj); printf("fil_obj=%s\n", json_object_to_json_string(fil_obj)); diff --git a/tests/multi_test.c b/tests/multi_test.c index 9eead3e5..7c96c53c 100644 --- a/tests/multi_test.c +++ b/tests/multi_test.c @@ -3391,6 +3391,8 @@ build_block_ucd3d(DBfile *dbfile, char dirnames[MAXBLOCKS][STRLEN], FREE(mix_next); FREE(mix_mat); FREE(mix_zone); + FREE(mix_zone2); + FREE(mix_zone_map); FREE(matlist2); FREE(ghost); diff --git a/tests/namescheme.c b/tests/namescheme.c index 7cc35ef2..3ec0b057 100644 --- a/tests/namescheme.c +++ b/tests/namescheme.c @@ -64,6 +64,7 @@ be used for advertising or product endorsement purposes. #include #include #include +#include #define TEST_GET_NAME(NS,I,EXP) \ if (!NS) \ @@ -81,14 +82,13 @@ else } \ } -#define TEST_GET_INDEX(STR,FLD,BASE,IND) \ +/* Uses a hard-coded min field width of 3 */ +#define TEST_GET_INDEX(STR, FLD, BASE, EXP) \ +if (DBGetIndex(STR, FLD, 3, BASE) != (long long) EXP) \ { \ - if (DBGetIndex(STR,FLD,BASE) != IND) \ - { \ - fprintf(stderr, "DBGetIndex() at line %d failed for field %d of \"%s\". Expected %lld, got %lld\n",\ - __LINE__, FLD, STR, (long long) IND, DBGetIndex(STR,FLD,BASE)); \ - return 1; \ - } \ + fprintf(stderr, "DBGetIndex() at line %d failed for field %d of \"%s\". Expected %lld, got %lld\n", \ + __LINE__, FLD, STR, (long long) EXP, DBGetIndex(STR,FLD,3,BASE)); \ + return 1; \ } #define TEST_STR(A,B) \ @@ -404,11 +404,14 @@ int main(int argc, char **argv) TEST_GET_NAME(ns, 15, "chemA_016_00000.3"); DBFreeNamescheme(ns); +#if 0 /* Test using namescheme as a simple integer mapping */ - ns = DBMakeNamescheme("|chemA_0x%04X|n"); - TEST_GET_INDEX(DBGetName(ns, 1), 0, 0, 1); - TEST_GET_INDEX(DBGetName(ns, 50), 0, 0, 50); - TEST_GET_INDEX(DBGetName(ns, 37), 0, 0, 37); + ns = DBMakeNamescheme("|chemA_%04X|n%3"); + TEST_GET_INDEX(DBGetName(ns, 0), 0, 0, 0); + TEST_GET_INDEX(DBGetName(ns, 1), 0, 0, 1); + TEST_GET_INDEX(DBGetName(ns, 2), 0, 0, 2); + TEST_GET_INDEX(DBGetName(ns, 3), 0, 0, 0); + TEST_GET_INDEX(DBGetName(ns, 4), 0, 0, 1); DBFreeNamescheme(ns); /* simple offset by -2 mapping */ @@ -422,10 +425,10 @@ int main(int argc, char **argv) /* Get different fields as indices from nameschemed strings */ ns = DBMakeNamescheme("|foo_%03d_%03d|n/5|n%5"); - TEST_GET_INDEX(DBGetName(ns,0), 0, 0, 0); - TEST_GET_INDEX(DBGetName(ns,0), 1, 0, 0); - TEST_GET_INDEX(DBGetName(ns,18), 0, 2, 0); - TEST_GET_INDEX(DBGetName(ns,18), 1, 3, 0); + TEST_GET_INDEX(DBGetName(ns,0), 0, 0, 0); + TEST_GET_INDEX(DBGetName(ns,0), 1, 0, 0); + TEST_GET_INDEX(DBGetName(ns,18), 0, 0, 3); + TEST_GET_INDEX(DBGetName(ns,17), 1, 0, 2); DBFreeNamescheme(ns); /* Case where index is bigger than an int */ @@ -433,6 +436,26 @@ int main(int argc, char **argv) TEST_GET_INDEX(DBGetName(ns, 0x7FFFFFFF), 0, 0, 0x7FFFFFFF); /* max for an int */ TEST_GET_INDEX(DBGetName(ns,0x7FFFFFFFF), 0, 0, 0x7FFFFFFFF); /* make sure another `F` works */ DBFreeNamescheme(ns); +#endif + + /* Test inferring base 2 (binary, leading '0b') */ + TEST_GET_INDEX("block_0b0101", 0, 0, 5); + TEST_GET_INDEX("block_0b0101_0b1100", 1, 0, 12); + + /* Test inferring base 8 (octal, leading '0') */ + TEST_GET_INDEX("slice1_035", 0, 0, 29); + + /* Test non-standard base 5 */ + TEST_GET_INDEX("VisIt_docs_section_0002_chapter_1234", 1, 5, 194); + + /* Test negative values */ + TEST_GET_INDEX("block_-0b0101", 0, 0, -5); + + /* Test some cases that could lead to error */ + TEST_GET_INDEX("block_0b0", 1, 0, LLONG_MAX); + TEST_GET_INDEX("block_+", 1, 0, LLONG_MAX); + TEST_GET_INDEX("block_0x", 1, 0, LLONG_MAX); + TEST_GET_INDEX("VisIt_docs_section_0002_chapter_1234", 5, 5, LLONG_MAX); /* Test the convenience method, DBSPrintf */ snprintf(teststr, sizeof(teststr), "%s, %s", diff --git a/tests/pdbtst.c b/tests/pdbtst.c index c39d83f1..3d6f3e7a 100644 --- a/tests/pdbtst.c +++ b/tests/pdbtst.c @@ -4026,7 +4026,7 @@ static int run_test(PFTest test, int n, char *host, int native) #else PRINT(STDOUT, "\t\t %3d %8lld %8lld %7lld %.2g\n", - n, bytaa, bytfa, bytaa - bytfa, time); + n, (long long) bytaa, (long long) bytfa, (long long) bytaa - bytfa, time); #endif return(fail);} diff --git a/tests/test_mat_compression.c b/tests/test_mat_compression.c index 82d58c56..1e48e3d3 100644 --- a/tests/test_mat_compression.c +++ b/tests/test_mat_compression.c @@ -246,11 +246,13 @@ main(int argc, char *argv[]) vfrac_varnames = (char **) malloc(narrs * sizeof(char*)); for (i = 0; i < narrs; i++) { + int nchars; vfrac_varnames[i] = (char *) malloc(256*sizeof(char)); if (mat->matnames && mat->matnames[i]) - snprintf(vfrac_varnames[i], 256, "%s_%s_%d_vfracs", omat, mat->matnames[i], mat->matnos[i]); + nchars = snprintf(vfrac_varnames[i], 256, "%s_%s_%d_vfracs", omat, mat->matnames[i], mat->matnos[i]); else - snprintf(vfrac_varnames[i], 256, "%s_%d_vfracs", omat, mat->matnos[i]); + nchars = snprintf(vfrac_varnames[i], 256, "%s_%d_vfracs", omat, mat->matnos[i]); + assert(nchars > 0 && nchars < 256); DBWrite(outfile, vfrac_varnames[i], vfracs[i], mat->dims, mat->ndims, mat->datatype); total_file_bytes += DBGetVarByteLengthInFile(outfile, vfrac_varnames[i]); total_mem_bytes += DBGetVarByteLength(outfile, vfrac_varnames[i]); diff --git a/tools/browser/file.c b/tools/browser/file.c index 2b011eea..c512e547 100644 --- a/tools/browser/file.c +++ b/tools/browser/file.c @@ -70,6 +70,7 @@ be used for advertising or product endorsement purposes. #ifdef HAVE_FNMATCH_H # include #endif +#include #include #include #include @@ -2333,9 +2334,9 @@ file_deref (obj_t _self, int argc, obj_t argv[]) { if (DBGetDir(file, cwd)<0) return NIL; if ('/'!=name[0]) { if (!strcmp(cwd, "/")) { - sprintf(fullname, "/%s", name); + snprintf(fullname, sizeof(fullname), "/%s", name); } else { - sprintf(fullname, "%s/%s", cwd, name); + snprintf(fullname, sizeof(fullname), "%s/%s", cwd, name); } name = fullname; } diff --git a/tools/python/pydbfile.cpp b/tools/python/pydbfile.cpp index 613bd1ce..94c24691 100644 --- a/tools/python/pydbfile.cpp +++ b/tools/python/pydbfile.cpp @@ -115,6 +115,9 @@ static PyObject *DBfile_DBGetToc(PyObject *self, PyObject *args) // construct is used for *both* string valued members and variable // members whose value is also a string but is the name of another dataset // in the file. +// +// Mark C. Miller, Thu Aug 22 00:34:52 PDT 2024 +// Skip possible empty first and last strings in a string list. // **************************************************************************** static PyObject *DBfile_DBGetVar(PyObject *self, PyObject *args) { @@ -199,13 +202,19 @@ static PyObject *DBfile_DBGetVar(PyObject *self, PyObject *args) char **strArr = DBStringListToStringArray((char*)var, &narr, 0); if (narr > 0 && strArr) { - tmp = PyTuple_New(narr); + PyObject *tmp2 = PyList_New(0); for (int i = 0; i < narr; i++) { - PyTuple_SET_ITEM(tmp, i, PyString_FromString(strArr[i])); + if (i == 0 && strArr[i] && strArr[i][0] == '\0') + continue; // skip an empty first entry + if (i == (narr-1) && strArr[i] && strArr[i][0] == '\0') + continue; // skip an empty last entry + PyList_Append(tmp2, PyString_FromString(strArr[i])); FREE(strArr[i]); } FREE(strArr); + tmp = PyList_AsTuple(tmp2); + Py_DECREF(tmp2); } else { diff --git a/tools/python/pysilo.cpp b/tools/python/pysilo.cpp index b33a432f..a0ac84ac 100644 --- a/tools/python/pysilo.cpp +++ b/tools/python/pysilo.cpp @@ -352,6 +352,14 @@ void SILOMODULE_API initSilo(void) ADD_CONSTANT(DB_ZONETYPE_PRISM); ADD_CONSTANT(DB_ZONETYPE_HEX); + ADD_CONSTANT(DB_ZONETYPE_QUAD_BEAM); + ADD_CONSTANT(DB_ZONETYPE_QUAD_TRIANGLE); + ADD_CONSTANT(DB_ZONETYPE_QUAD_QUAD); + ADD_CONSTANT(DB_ZONETYPE_QUAD_TET); + ADD_CONSTANT(DB_ZONETYPE_QUAD_PYRAMID); + ADD_CONSTANT(DB_ZONETYPE_QUAD_PRISM); + ADD_CONSTANT(DB_ZONETYPE_QUAD_HEX); + #if PY_VERSION_GE(3,0,0) Py_INCREF(&DBfileType); diff --git a/tools/silex/CMakeLists.txt b/tools/silex/CMakeLists.txt index c368f663..6effa7a9 100644 --- a/tools/silex/CMakeLists.txt +++ b/tools/silex/CMakeLists.txt @@ -57,10 +57,10 @@ ## # find Qt first -include(SiloFindQt5) +include(SiloFindQt6) -if(NOT Qt5_FOUND) - message(WARNING "Silex depends on Qt5, but it could not be found. Silex will not be built") +if(NOT Qt6_FOUND) + message(WARNING "Silex depends on Qt6, but it could not be found. Silex will not be built") return() endif() @@ -86,7 +86,7 @@ add_dependencies(silex silo) set_target_properties(silex PROPERTIES AUTOMOC ON RUNTIME_OUTPUT_DIRECTORY ${Silo_BINARY_DIR}/bin) target_link_libraries(silex $ - Qt5::Core Qt5::Gui Qt5::Widgets) + Qt6::Core Qt6::Gui Qt6::Widgets) target_include_directories(silex PRIVATE ${silo_build_include_dir} ${Silo_SOURCE_DIR}/src/silo @@ -109,7 +109,7 @@ install(TARGETS silex DESTINATION bin EXPORT ${silo_targets_name} ## # Windows ## -if(WIN32 AND TARGET Qt5::windeployqt) +if(WIN32 AND TARGET Qt6::windeployqt) # execute windeployqt directory after build # creates tmp dir used for installation # also deploys to build dir so silex can be run from build @@ -117,8 +117,8 @@ if(WIN32 AND TARGET Qt5::windeployqt) POST_BUILD COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/windeployqt" COMMAND set PATH=%PATH%$${qt5_install_prefix}/bin - COMMAND Qt5::windeployqt --dir "${CMAKE_CURRENT_BINARY_DIR}/windeployqt" "$" - COMMAND Qt5::windeployqt --verbose 0 --dir "${Silo_BINARY_DIR}/bin/$" "$" + COMMAND Qt6::windeployqt --dir "${CMAKE_CURRENT_BINARY_DIR}/windeployqt" "$" + COMMAND Qt6::windeployqt --verbose 0 --dir "${Silo_BINARY_DIR}/bin/$" "$" ) # copy deployment directory during installation