From: Pasquale Africa Date: Wed, 24 May 2023 20:16:33 +0000 (+0000) Subject: Add VTK support X-Git-Tag: v9.5.0-rc1~141^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c905c33762b6e9adcf8362c268c13068644e704d;p=dealii.git Add VTK support --- diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 66ab61f5ee..fd58f0a1e2 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -88,6 +88,7 @@ jobs: -D DEAL_II_WITH_PETSC="ON" \ -D DEAL_II_WITH_METIS="ON" \ -D DEAL_II_WITH_HDF5="ON" \ + -D DEAL_II_WITH_VTK="ON" \ -D DEAL_II_COMPONENT_EXAMPLES="OFF" \ .. - name: print detailed.log @@ -104,7 +105,7 @@ jobs: export OMPI_MCA_btl_base_warn_component_unused='0' cd build - make -j2 setup_tests_simplex + make -j2 setup_tests_simplex setup_tests_vtk ctest --output-on-failure -j2 - name: failed test log if: ${{ failure() }} diff --git a/cmake/configure/configure_50_vtk.cmake b/cmake/configure/configure_50_vtk.cmake new file mode 100644 index 0000000000..994e8f157e --- /dev/null +++ b/cmake/configure/configure_50_vtk.cmake @@ -0,0 +1,20 @@ +## --------------------------------------------------------------------- +## +## Copyright (C) 2012 - 2015 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE.md at +## the top level directory of deal.II. +## +## --------------------------------------------------------------------- + +# +# Configuration for the VTK library: +# + +configure_feature(VTK) diff --git a/cmake/modules/FindDEAL_II_VTK.cmake b/cmake/modules/FindDEAL_II_VTK.cmake new file mode 100644 index 0000000000..31b39fe4b4 --- /dev/null +++ b/cmake/modules/FindDEAL_II_VTK.cmake @@ -0,0 +1,81 @@ +## --------------------------------------------------------------------- +## +## Copyright (C) 2022 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE.md at +## the top level directory of deal.II. +## +## --------------------------------------------------------------------- + +# +# Try to find the VTK libraries +# +# This module exports: +# +# VTK_INCLUDE_DIR +# VTK_VERSION_MAJOR +# VTK_VERSION_MINOR +# VTK_LIBRARIES +# + +set(VTK_DIR "" CACHE PATH "An optional hint to a VTK installation") +set_if_empty(VTK_DIR "$ENV{VTK_DIR}") + +if(NOT "${VTK_DIR}" STREQUAL "") + set(VTK_DIR ${VTK_DIR}) +endif() + +find_package(VTK 9.0.0 QUIET HINTS ${VTK_DIR}) + +if(VTK_FOUND) + set(VTK_VERSION "${VTK_VERSION}") + set(VTK_MAJOR_VERSION "${VTK_MAJOR_VERSION}") + set(VTK_MINOR_VERSION "${VTK_MINOR_VERSION}") + + set(VTK_INCLUDE_DIR + ${VTK_PREFIX_PATH}/include/vtk-${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}) + + # + # We'd like to have the full library names but the VTK package only + # exports a list with namespace-qualified names, e.g. VTK::CommonCore. + # So we check again for every lib and store the full path: + # + set(_libraries "") + + foreach(_component ${VTK_AVAILABLE_COMPONENTS}) + deal_ii_find_library(VTK_LIBRARY_${_component} + NAMES libvtk${_component}-${VTK_VERSION_MAJOR}.${VTK_VERSION_MINOR}.so + HINTS ${VTK_PREFIX_PATH}/lib + NO_DEFAULT_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_CMAKE_PATH + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH + NO_CMAKE_FIND_ROOT_PATH + ) + + if (NOT "${VTK_LIBRARY_${_component}}" MATCHES "-NOTFOUND") + list(APPEND _libraries VTK_LIBRARY_${_component}) + else() + # VTK_AVAILABLE_COMPONENTS contains also header-only modules. + # If the library has not been found, check if corresponding + # headers exist. + if (NOT EXISTS "${VTK_INCLUDE_DIR}/${_component}" AND + NOT EXISTS "${VTK_INCLUDE_DIR}/vtk_${_component}.h") + message(FATAL_ERROR "VTK: component ${_component} not found.") + endif() + endif() + endforeach() +endif() + +process_feature(VTK + LIBRARIES REQUIRED ${_libraries} + INCLUDE_DIRS REQUIRED VTK_INCLUDE_DIR + CLEAR VTK_INCLUDE_DIR VTK_LIBRARIES ${_libraries} +) diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile index 2893cd2cfb..4cebdaf2ae 100644 --- a/contrib/docker/Dockerfile +++ b/contrib/docker/Dockerfile @@ -47,6 +47,7 @@ RUN cd /usr/src && \ -DDEAL_II_WITH_TBB=ON \ -DDEAL_II_WITH_TRILINOS=ON \ -DDEAL_II_WITH_UMFPACK=ON \ + -DDEAL_II_WITH_VTK=ON \ -DDEAL_II_WITH_ZLIB=ON \ .. \ && ninja -j 2 install \ diff --git a/doc/doxygen/options.dox.in b/doc/doxygen/options.dox.in index 963ace9cbe..95ab2736a5 100644 --- a/doc/doxygen/options.dox.in +++ b/doc/doxygen/options.dox.in @@ -249,6 +249,7 @@ PREDEFINED = DOXYGEN=1 \ DEAL_II_TRILINOS_WITH_ZOLTAN=1 \ DEAL_II_TRILINOS_VERSION_GTE=1 \ DEAL_II_WITH_UMFPACK=1 \ + DEAL_II_WITH_VTK=1 \ DEAL_II_WITH_ZLIB=1 # do not expand exception declarations diff --git a/doc/news/changes/major/20230524Africa b/doc/news/changes/major/20230524Africa new file mode 100644 index 0000000000..2dec6d7419 --- /dev/null +++ b/doc/news/changes/major/20230524Africa @@ -0,0 +1,3 @@ +New: Added support for the VTK library (https://vtk.org/). +
+(Pasquale Africa, 2023/05/24) diff --git a/doc/readme.html b/doc/readme.html index 32d9aa805d..05c2b72a75 100644 --- a/doc/readme.html +++ b/doc/readme.html @@ -727,6 +727,23 @@ +
+ VTK
+
+

+ The Visualization Toolkit (VTK) is an open-source, + freely available software system for 3D computer graphics, modeling, image processing, volume rendering, + scientific visualization, and 2D plotting. + + It supports a wide variety of visualization algorithms and advanced modeling techniques, + and it takes advantage of both threaded and distributed memory parallel processing for speed and scalability, + respectively. + + In order to use VTK, add + -DVTK_DIR=/path/to/vtk to the deal.II CMake call. +

+
+
zlib
diff --git a/doc/users/cmake_dealii.html b/doc/users/cmake_dealii.html index 7f801cc76f..ea8b3b7b30 100644 --- a/doc/users/cmake_dealii.html +++ b/doc/users/cmake_dealii.html @@ -477,6 +477,7 @@ DEAL_II_WITH_SYMENGINE DEAL_II_WITH_TBB DEAL_II_WITH_TRILINOS DEAL_II_WITH_UMFPACK +DEAL_II_WITH_VTK DEAL_II_WITH_ZLIB They all have standard meanings with the exception of one: diff --git a/doc/users/config.sample b/doc/users/config.sample index c735d95888..0e2869ca5e 100644 --- a/doc/users/config.sample +++ b/doc/users/config.sample @@ -139,6 +139,7 @@ # set(DEAL_II_WITH_TBB "ON" CACHE BOOL "") # set(DEAL_II_WITH_TRILINOS "ON" CACHE BOOL "") # set(DEAL_II_WITH_UMFPACK "ON" CACHE BOOL "") +# set(DEAL_II_WITH_VTK "ON" CACHE BOOL "") # set(DEAL_II_WITH_ZLIB "ON" CACHE BOOL "") # diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index 350e38efcd..9b5299b43e 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -70,6 +70,7 @@ #cmakedefine DEAL_II_WITH_TRILINOS #cmakedefine DEAL_II_WITH_UMFPACK #cmakedefine DEAL_II_FEATURE_UMFPACK_BUNDLED_CONFIGURED +#cmakedefine DEAL_II_WITH_VTK #cmakedefine DEAL_II_WITH_ZLIB #ifdef DEAL_II_WITH_TBB