]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add VTK support
authorPasquale Africa <pafrica@sissa.it>
Wed, 24 May 2023 20:16:33 +0000 (20:16 +0000)
committerPasquale Africa <pafrica@sissa.it>
Wed, 31 May 2023 13:39:32 +0000 (13:39 +0000)
.github/workflows/linux.yml
cmake/configure/configure_50_vtk.cmake [new file with mode: 0644]
cmake/modules/FindDEAL_II_VTK.cmake [new file with mode: 0644]
contrib/docker/Dockerfile
doc/doxygen/options.dox.in
doc/news/changes/major/20230524Africa [new file with mode: 0644]
doc/readme.html
doc/users/cmake_dealii.html
doc/users/config.sample
include/deal.II/base/config.h.in

index 66ab61f5eed0cb56760ad713d752bd0661e66384..fd58f0a1e295204503106622fb6a3f0d6deaebbb 100644 (file)
@@ -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 (file)
index 0000000..994e8f1
--- /dev/null
@@ -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 (file)
index 0000000..31b39fe
--- /dev/null
@@ -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}
+)
index 2893cd2cfbe29b1924b81884a12ab3928f35fb48..4cebdaf2ae96270218e8e82b2a88879e17f997db 100644 (file)
@@ -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 \
index 963ace9cbe82fd03b77dc9b4d94c006b9bc3af61..95ab2736a54b1ed9a2fa37b5b178f958acdbaa55 100644 (file)
@@ -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 (file)
index 0000000..2dec6d7
--- /dev/null
@@ -0,0 +1,3 @@
+New: Added support for the VTK library (https://vtk.org/).
+<br>
+(Pasquale Africa, 2023/05/24)
index 32d9aa805d8f9c6de86d699aa02f757d820e8c82..05c2b72a75625746e72f115a701c8bf1ba563711 100644 (file)
             </dd>
     </dl>
 
+    <dt><a name="vtk"/>
+        <a href="https://vtk.org/" target="_top">VTK</a></dt>
+    <dd>
+        <p>
+            The <a href="https://vtk.org/" target="_top">Visualization Toolkit (VTK)</a> 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
+            <code>-DVTK_DIR=/path/to/vtk</code> to the deal.II CMake call.
+        </p>
+    </dd>
+
     <dt><a name="zlib"/>
               <a href="http://zlib.net/" target="_top">zlib</a></dt>
     <dd>
index 7f801cc76ff866640eaa903b219b1add1ddfc688..ea8b3b7b3088af3f1f09ca17abf8ea908978cd30 100644 (file)
@@ -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
 </pre>
       They all have standard meanings with the exception of one:
index c735d9588824ddc49ee8852a08b5b4419d828717..0e2869ca5eaad1bf2d1388de722a4f914017c794 100644 (file)
 # 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 "")
 #
 
index 350e38efcd6b67045afa9e8b6859727f638588bb..9b5299b43e9d2074d77586d707e28e19e277ed16 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.