From 2615b0911ed4554af0d3436e7ab442fd9bcc6796 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 11 Mar 2020 16:35:48 +0100 Subject: [PATCH] Fix CGNS code for version < 3.4 Install libhdf5 on ubuntu test (cgns depends on it) --- CMakeLists.txt | 4 ++++ libsrc/interface/rw_cgns.cpp | 4 ++++ tests/dockerfile | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 14cc43e8..3f26e0dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -396,6 +396,10 @@ if(USE_CGNS) target_compile_definitions(netgen_cgns INTERFACE NG_CGNS) target_include_directories(netgen_cgns INTERFACE ${CGNS_INCLUDE_DIR}) target_link_libraries(netgen_cgns INTERFACE ${CGNS_LIBRARY}) + if(NOT WIN32) # hdf5 is statically linked into cgns in Windows binaries + find_library(HDF5_LIBRARY NAMES hdf5 hdf5_serial) + target_link_libraries(netgen_cgns INTERFACE ${HDF5_LIBRARY}) + endif(NOT WIN32) endif(USE_CGNS) add_subdirectory(libsrc) diff --git a/libsrc/interface/rw_cgns.cpp b/libsrc/interface/rw_cgns.cpp index 2936f3e8..2e45daa4 100644 --- a/libsrc/interface/rw_cgns.cpp +++ b/libsrc/interface/rw_cgns.cpp @@ -291,7 +291,11 @@ namespace netgen::cg cg_ElementDataSize(fn, base, zone, section, &nv); Array vertices(nv); +#if CGNS_VERSION < 3400 + cg_elements_read(fn, base, zone, section, &vertices[0], nullptr); +#else cg_poly_elements_read(fn, base, zone, section, &vertices[0], nullptr, nullptr); +#endif size_t vi = 0; while(vi -RUN apt-get update && apt-get -y install python3 libpython3-dev libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev ccache python3-pytest python3-numpy python3-tk clang-tidy python3-distutils clang libocct-data-exchange-dev libcgns-dev +RUN apt-get update && apt-get -y install python3 libpython3-dev libxmu-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev ccache python3-pytest python3-numpy python3-tk clang-tidy python3-distutils clang libocct-data-exchange-dev libcgns-dev libhdf5-dev ADD . /root/src/netgen