Add ParaView-5.4.1 cmake-3.3.2 and qt-5.8.0 to ThirdParty and rework PVReaders

This commit is contained in:
Pascal Beckstein 2018-02-20 16:48:10 +01:00
parent ec83275923
commit b5e9533f2b
108 changed files with 1582 additions and 12027 deletions

View file

@ -51,21 +51,25 @@ echo ========================================
echo echo
# gmp # gmp
uninstallPackage gmp-4.3.2 $1
uninstallPackage gmp-5.0.1 $1 uninstallPackage gmp-5.0.1 $1
uninstallPackage gmp-5.0.5 $1 uninstallPackage gmp-5.1.2 $1
# mpfr # mpfr
uninstallPackage mpfr-2.4.2 $1
uninstallPackage mpfr-3.0.0 $1
uninstallPackage mpfr-3.0.1 $1 uninstallPackage mpfr-3.0.1 $1
uninstallPackage mpfr-3.1.0 $1 uninstallPackage mpfr-3.1.2 $1
# mpc # mpc
uninstallPackage mpc-0.8.2 $1 uninstallPackage mpc-0.8.2 $1
uninstallPackage mpc-0.9 $1 uninstallPackage mpc-1.0.1 $1
# gcc # gcc
uninstallPackage gcc-4.4.5 $1 uninstallPackage gcc-4.4.5 $1
uninstallPackage gcc-4.5.1 $1 uninstallPackage gcc-4.5.1 $1
uninstallPackage gcc-4.6.3 $1 uninstallPackage gcc-4.6.4 $1
uninstallPackage gcc-4.7.4 $1
uninstallPackage gcc-4.8.4 $1 uninstallPackage gcc-4.8.4 $1
uninstallPackage gcc-4.9.2 $1 uninstallPackage gcc-4.9.2 $1
@ -79,14 +83,21 @@ uninstallPackage Python-2.7 $1
uninstallPackage m4-1.4.16 $1 uninstallPackage m4-1.4.16 $1
# bison # bison
uninstallPackage bison-2.7 $1 uninstallPackage bison-2.4.3 $1
uninstallPackage bison-2.7 $1
# flex # flex
uninstallPackage flex-2.5.35 $1 uninstallPackage flex-2.5.35 $1
# cmake # cmake
uninstallPackage cmake-2.8.3 $1
uninstallPackage cmake-2.8.5 $1
uninstallPackage cmake-2.8.6 $1
uninstallPackage cmake-2.8.8 $1
uninstallPackage cmake-2.8.11 $1
uninstallPackage cmake-2.8.12 $1 uninstallPackage cmake-2.8.12 $1
uninstallPackage cmake-3.2.2 $1 uninstallPackage cmake-3.2.2 $1
uninstallPackage cmake-3.3.2 $1
echo echo

View file

@ -51,13 +51,19 @@ echo ========================================
echo echo
# QT # QT
uninstallPackage qt-everywhere-opensource-src-4.8.6 $1 uninstallPackage qt-everywhere-opensource-src-4.7.0 $1
uninstallPackage qt-everywhere-opensource-src-4.7.4 $1 uninstallPackage qt-everywhere-opensource-src-4.7.4 $1
uninstallPackage qt-everywhere-opensource-src-4.8.5 $1
uninstallPackage qt-everywhere-opensource-src-4.8.6 $1
uninstallPackage qt-everywhere-opensource-src-5.8.0 $1
# ParaView # ParaView
uninstallPackage ParaView-4.0.1 $1 uninstallPackage ParaView-4.0.1 $1
uninstallPackage ParaView-4.1.0 $1 uninstallPackage ParaView-4.1.0 $1
uninstallPackage ParaView-4.2.0 $1
uninstallPackage ParaView-4.3.1 $1 uninstallPackage ParaView-4.3.1 $1
uninstallPackage ParaView-4.4.0 $1
uninstallPackage ParaView-5.4.1 $1
# ParaView-Server # ParaView-Server
uninstallPackage llvm-3.6.0 uninstallPackage llvm-3.6.0

View file

@ -175,6 +175,13 @@ echo
( rpm_make -p cmake-3.2.2 -s cmake-3.2.2.spec -u http://www.cmake.org/files/v3.2/cmake-3.2.2.tar.gz ) ( rpm_make -p cmake-3.2.2 -s cmake-3.2.2.spec -u http://www.cmake.org/files/v3.2/cmake-3.2.2.tar.gz )
} }
# cmake 3.3.2
#
[ ! -z "$WM_THIRD_PARTY_USE_CMAKE_332" ] && {
echo "Building cmake 3.3.2"
( rpm_make -p cmake-3.3.2 -s cmake-3.3.2.spec -u http://www.cmake.org/files/v3.3/cmake-3.3.2.tar.gz )
}
echo ======================================== echo ========================================
echo Done ThirdParty AllMake: Stage1 echo Done ThirdParty AllMake: Stage1
echo ======================================== echo ========================================

View file

@ -65,6 +65,12 @@ then
echo "Building Qt 4.8.6" echo "Building Qt 4.8.6"
( rpm_make -p qt-everywhere-opensource-src-4.8.6 -s qt-everywhere-opensource-src-4.8.6.spec -u http://download.qt.io/archive/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz ) ( rpm_make -p qt-everywhere-opensource-src-4.8.6 -s qt-everywhere-opensource-src-4.8.6.spec -u http://download.qt.io/archive/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz )
} }
# Qt 5.8.0
#
[ ! -z "$WM_THIRD_PARTY_USE_QT_580" ] && {
echo "Building Qt 5.8.0"
( rpm_make -p qt-everywhere-opensource-src-5.8.0 -s qt-everywhere-opensource-src-5.8.0.spec -u http://download.qt.io/archive/qt/5.8/5.8.0/single/qt-everywhere-opensource-src-5.8.0.tar.gz )
}
else else
echo "Using system installed QT" echo "Using system installed QT"
echo "" echo ""
@ -110,6 +116,14 @@ then
-f --define='_qmakePath $QT_BIN_DIR/qmake' -f --define='_qmakePath $QT_BIN_DIR/qmake'
) )
} }
# ParaView 5.4.1
#
[ ! -z "$WM_THIRD_PARTY_USE_PARAVIEW_541" ] && {
echo "Building ParaView 5.4.1"
( rpm_make -p ParaView-5.4.1 -s ParaView-5.4.1.spec -u http://www.paraview.org/files/v5.4/ParaView-v5.4.1.tar.gz \
-f --define='_qmakePath $QT_BIN_DIR/qmake'
)
}
else else
echo "WARNING: " echo "WARNING: "
echo "WARNING: Skipping the installation of ParaView-4.x.x." echo "WARNING: Skipping the installation of ParaView-4.x.x."

View file

@ -1,6 +1,6 @@
diff -ruN ParaView-4.3.1_orig/Applications/ParaView-4.3.1_extra_install_Darwin.cmake ParaView-4.3.1/Applications/ParaView-4.3.1_extra_install_Darwin.cmake diff -ruN ParaView-4.4.0_orig/Applications/ParaView-4.4.0_extra_install_Darwin.cmake ParaView-4.4.0/Applications/ParaView-4.4.0_extra_install_Darwin.cmake
--- ParaView-4.3.1_orig/Applications/ParaView-4.3.1_extra_install_Darwin.cmake 1969-12-31 19:00:00.000000000 -0500 --- ParaView-4.4.0_orig/Applications/ParaView-4.4.0_extra_install_Darwin.cmake 1969-12-31 19:00:00.000000000 -0500
+++ ParaView-4.3.1/Applications/ParaView-4.3.1_extra_install_Darwin.cmake 2013-10-02 19:00:00.000000000 -0400 +++ ParaView-4.4.0/Applications/ParaView-4.4.0_extra_install_Darwin.cmake 2013-10-02 19:00:00.000000000 -0400
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
+# +#
+# Additional install rules for Mac OS X platforms +# Additional install rules for Mac OS X platforms

View file

@ -0,0 +1,12 @@
diff -ruN ParaView-5.4.1_orig/Applications/ParaView-5.4.1_extra_install_Darwin.cmake ParaView-5.4.1/Applications/ParaView-5.4.1_extra_install_Darwin.cmake
--- ParaView-5.4.1_orig/Applications/ParaView-5.4.1_extra_install_Darwin.cmake 1969-12-31 19:00:00.000000000 -0500
+++ ParaView-5.4.1/Applications/ParaView-5.4.1_extra_install_Darwin.cmake 2013-10-02 19:00:00.000000000 -0400
@@ -0,0 +1,8 @@
+#
+# Additional install rules for Mac OS X platforms
+#
+INSTALL (DIRECTORY buildObj/bin/paraview.app
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+ USE_SOURCE_PERMISSIONS
+ COMPONENT Runtime)
+

View file

@ -0,0 +1,297 @@
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration |
# \\ / A nd | For copyright notice see file Copyright
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of foam-extend.
#
# foam-extend is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# foam-extend is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# RPM spec file for ParaView-5.4.1
#
# Description
# RPM spec file for creating a relocatable RPM
#
# Authors:
# Martin Beaudoin, Hydro-Quebec, (2010)
# Andreas Feymark, Chalmers University of Technology, (2013)
# Pascal Beckstein, HZDR, (2018)
#
#------------------------------------------------------------------------------
# We grab the value of WM_THIRD_PARTY and WM_OPTIONS from the environment variable
%{expand:%%define _WM_THIRD_PARTY_DIR %(echo $WM_THIRD_PARTY_DIR)}
%{expand:%%define _WM_OPTIONS %(echo $WM_OPTIONS)}
# Disable the generation of debuginfo packages
%define debug_package %{nil}
# Turning off the Fascist build policy
# Useful for debugging the install section
%define _unpackaged_files_terminate_build 0
# The topdir needs to point to the $WM_THIRD_PARTY/rpmbuild directory
%define _topdir %{_WM_THIRD_PARTY_DIR}/rpmBuild
%define _tmppath %{_topdir}/tmp
# Will install the package directly $WM_THIRD_PARTY_DIR
# Some comments about package relocation:
# By using this prefix for the Prefix: parameter in this file, you will make this
# package relocatable.
#
# This is fine, as long as your software is itself relocatable.
#
# Simply take note that libraries built with libtool are not relocatable because the
# prefix we specify will be hard-coded in the library .la files.
# Ref: http://sourceware.org/autobook/autobook/autobook_80.html
#
# In that case, if you ever change the value of the $WM_THIRD_PARTY_DIR, you will
# not be able to reutilize this RPM, even though it is relocatable. You will need to
# regenerate the RPM.
#
%define _prefix %{_WM_THIRD_PARTY_DIR}
%define name ParaView
%define release %{_WM_OPTIONS}
%define version 5.4.1
%define buildroot %{_topdir}/BUILD/%{name}-%{version}-root
BuildRoot: %{buildroot}
Summary: ParaView
License: Unkown
Name: %{name}
Version: %{version}
Release: %{release}
URL: http://www.paraview.org/files/v5.4/
Source: %url/%{name}-v%{version}.tar.gz
Prefix: %{_prefix}
Group: Development/Tools
Patch0: ParaView-5.4.1.patch_darwin
%define _installPrefix %{_prefix}/packages/%{name}-%{version}/platforms/%{_WM_OPTIONS}
#--------------------------------------------------------------------------
#
# Here, we define default compiling options for cmake
#
# One can override the option on the commande line : --define='MACRO EXPR'
#
%{!?_withVerbose: %define _withVerbose false}
%{!?_withMesa: %define _withMesa false}
%{!?_withMPI: %define _withMPI false}
%{!?_withPython: %define _withPython false}
%{!?_withQt: %define _withQt true}
%{!?_qmakePath: %define _qmakePath Undefined}
%{!?_mesaIncludePath: %define _mesaIncludePath Undefined}
%{!?_mesaLibPath: %define _mesaLibPath Undefined}
%{!?_pythonLibPath: %define _pythonLibPath Undefined}
#--------------------------------------------------------------------------
%description
%{summary}
%prep
%setup -q -n %{name}-v%{version}
%ifos darwin
%patch0 -p1
%endif
%build
#
# set CMake cache variables
#
addCMakeVariable()
{
while [ -n "$1" ]
do
CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1"
shift
done
}
# export WM settings in a form that GNU configure recognizes
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
[ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS"
[ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS"
[ -n "$WM_LDFLAGS" ] && export LDFLAGS="$WM_LDFLAGS"
set +x
echo ""
echo "Compilation options:"
echo " _withVerbose : %{_withVerbose}"
echo " _withMesa : %{_withMesa}"
echo " _withMPI : %{_withMPI}"
echo " _withPython : %{_withPython}"
echo " _withQt : %{_withQt}"
echo " _qmakePath : %{_qmakePath}"
echo " _mesaIncludePath : %{_mesaIncludePath}"
echo " _mesaLibPath : %{_mesaLibPath}"
echo " _pythonLibPath : %{_pythonLibPath}"
echo ""
set -x
# start with these general settings
addCMakeVariable BUILD_SHARED_LIBS:BOOL=ON
addCMakeVariable CMAKE_BUILD_TYPE:STRING=Release
addCMakeVariable BUILD_TESTING:BOOL=OFF
# We build with Python. This is ust too useful
addCMakeVariable PARAVIEW_ENABLE_PYTHON:BOOL=ON
# include development files in "make install"
addCMakeVariable PARAVIEW_INSTALL_DEVELOPMENT_FILES:BOOL=ON
%ifos darwin
# Additional installation rules for Mac OSX
addCMakeVariable PARAVIEW_EXTRA_INSTALL_RULES_FILE:FILEPATH=%{_topdir}/BUILD/%{name}-v%{version}-source/Applications/ParaView-4.4.0_extra_install_Darwin.cmake
# We activate the new Unix-style installation for Mac OS X
addCMakeVariable PARAVIEW_DO_UNIX_STYLE_INSTALLS:BOOL=ON
# Recent version of Mac OSX (Yosemite) cannot compile ParaView with the gcc compiler
# Using clang instead
CC=clang
CXX=clang++
%endif
# Add the value of _qmakePath for QT_QMAKE_EXECUTABLE
addCMakeVariable QT_QMAKE_EXECUTABLE:FILEPATH=%{_qmakePath}
echo "CMAKE_VARIABLES: $CMAKE_VARIABLES"
mkdir -p ./buildObj
cd ./buildObj
cmake \
-DCMAKE_INSTALL_PREFIX:PATH=%{_installPrefix} \
$CMAKE_VARIABLES \
..
[ -z "$WM_NCOMPPROCS" ] && WM_NCOMPPROCS=1
make -j $WM_NCOMPPROCS
%install
# On OpenSUSE, rpmbuild, will choke when detecting unreferenced symlinks
# created during installation.
# Qt version 4.8.0 will generate some unreferenced symlinks when
# ParaView is compiled and installed. By enabling the following
# environment variable, the command brp-symlink will still complain
# about missing link targets, but it won't stop rpmbuild from generating
# the final rpm.
# For all other Unix distros, this is a no-op.
export NO_BRP_STALE_LINK_ERROR=yes
cd buildObj
make install DESTDIR=$RPM_BUILD_ROOT
%ifos darwin
# Cleaning up some strange install side effect from option
# PARAVIEW_DO_UNIX_STYLE_INSTALLS
# Need to revisit this section eventually.
if [ -d "$RPM_BUILD_ROOT/$RPM_BUILD_ROOT" ]; then
mv $RPM_BUILD_ROOT/$RPM_BUILD_ROOT/%{_installPrefix}/bin/* $RPM_BUILD_ROOT/%{_installPrefix}/bin
fi
%endif
# Creation of foam-extend specific .csh and .sh files"
echo ""
echo "Generating foam-extend specific .csh and .sh files for the package %{name}-%{version}"
echo ""
#
# Generate package specific .sh file for foam-extend
#
mkdir -p $RPM_BUILD_ROOT/%{_installPrefix}/etc
cat << DOT_SH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.sh
# Load %{name}-%{version} libraries and binaries if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export PARAVIEW_DIR=\$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS
export PARAVIEW_BIN_DIR=\$PARAVIEW_DIR/bin
export PARAVIEW_LIB_DIR=\$PARAVIEW_DIR/lib
export PARAVIEW_INCLUDE_DIR=\$PARAVIEW_DIR/include/paraview-5.4
export PARAVIEW_VERSION=%{version}
# NB: It is important to set the PV_PLUGIN_PATH location to a directory containing only the ParaView plugins.
# Otherwise, paraview will try to automatically autoload each and every dynamic library it can find in the
# specified directory to see if a given library is a paraview plugin.
# In the case of \$FOAM_LIBBIN, with over 80 libraries, this is a total waste of time that will slow down the
# startup of paraview or even make paraview crash on startup.
export PV_PLUGIN_PATH=\$FOAM_LIBBIN/paraview-5.4_plugins
[ -d \$PARAVIEW_LIB_DIR/paraview-5.4 ] && _foamAddLib \$PARAVIEW_LIB_DIR/paraview-5.4
# Enable access to the package applications if present
[ -d \$PARAVIEW_BIN_DIR ] && _foamAddPath \$PARAVIEW_BIN_DIR
# Additional binary path if running on Mac OS X
[ -d \$PARAVIEW_BIN_DIR/paraview.app/Contents/MacOS ] && _foamAddPath \$PARAVIEW_BIN_DIR/paraview.app/Contents/MacOS
DOT_SH_EOF
#
# Generate package specific .csh file for foam-extend
#
cat << DOT_CSH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.csh
# Load %{name}-%{version} libraries and binaries if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
setenv PARAVIEW_DIR \$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS
setenv PARAVIEW_BIN_DIR \$PARAVIEW_DIR/bin
setenv PARAVIEW_LIB_DIR \$PARAVIEW_DIR/lib
setenv PARAVIEW_INCLUDE_DIR \$PARAVIEW_DIR/include/paraview-5.4
setenv PARAVIEW_VERSION %{version}
# NB: It is important to set the PV_PLUGIN_PATH location to a directory containing only the ParaView plugins.
# Otherwise, paraview will try to automatically autoload each and every dynamic library it can find in the
# specified directory to see if a given library is a paraview plugin.
# In the case of \$FOAM_LIBBIN, with over 80 libraries, this is a total waste of time that will slow down the
# startup of paraview or even make paraview crash on startup.
setenv PV_PLUGIN_PATH \$FOAM_LIBBIN/paraview-5.4_plugins
if ( -e \$PARAVIEW_BIN_DIR ) then
_foamAddPath \$PARAVIEW_BIN_DIR
endif
if ( -e \$PARAVIEW_LIB_DIR/paraview-5.4 ) then
_foamAddLib \$PARAVIEW_LIB_DIR/paraview-5.4
endif
# Additional binary path if running on Mac OS X
if ( -e \$PARAVIEW_BIN_DIR/paraview.app/Contents/MacOS ) then
_foamAddPath \$PARAVIEW_BIN_DIR/paraview.app/Contents/MacOS
endif
DOT_CSH_EOF
#finally, generate a .tgz file for systems where using rpm for installing packages
# as a non-root user might be a problem.
(mkdir -p %{_topdir}/TGZS/%{_target_cpu}; cd $RPM_BUILD_ROOT/%{_prefix}; tar -zcvf %{_topdir}/TGZS/%{_target_cpu}/%{name}-%{version}.tgz packages/%{name}-%{version})
%clean
%files
%defattr(-,root,root)
%{_installPrefix}

View file

@ -0,0 +1,167 @@
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration |
# \\ / A nd | For copyright notice see file Copyright
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of foam-extend.
#
# foam-extend is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# foam-extend is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# RPM spec file for cmake-3.3.2
#
# Description
# RPM spec file for creating a relocatable RPM
#
# Author:
# Martin Beaudoin, Hydro-Quebec, (2015)
# Pascal Beckstein, HZDR, (2018)
#
#------------------------------------------------------------------------------
# We grab the value of WM_THIRD_PARTY and WM_OPTIONS from the environment variable
%{expand:%%define _WM_THIRD_PARTY_DIR %(echo $WM_THIRD_PARTY_DIR)}
%{expand:%%define _WM_OPTIONS %(echo $WM_OPTIONS)}
# Disable the generation of debuginfo packages
%define debug_package %{nil}
# The topdir needs to point to the $WM_THIRD_PARTY/rpmbuild directory
%define _topdir %{_WM_THIRD_PARTY_DIR}/rpmBuild
%define _tmppath %{_topdir}/tmp
# Will install the package directly $WM_THIRD_PARTY_DIR
# Some comments about package relocation:
# By using this prefix for the Prefix: parameter in this file, you will make this
# package relocatable.
#
# This is fine, as long as your software is itself relocatable.
#
# Simply take note that libraries built with libtool are not relocatable because the
# prefix we specify will be hard-coded in the library .la files.
# Ref: http://sourceware.org/autobook/autobook/autobook_80.html
#
# In that case, if you ever change the value of the $WM_THIRD_PARTY_DIR, you will
# not be able to reutilize this RPM, even though it is relocatable. You will need to
# regenerate the RPM.
#
%define _prefix %{_WM_THIRD_PARTY_DIR}
%define name cmake
%define release %{_WM_OPTIONS}
%define version 3.3.2
%define buildroot %{_topdir}/BUILD/%{name}-%{version}-root
BuildRoot: %{buildroot}
Summary: cmake
License: Unkown
Name: %{name}
Version: %{version}
Release: %{release}
URL: http://www.cmake.org/files/v3.3/
Source: %url/%{name}-%{version}.tar.gz
Prefix: %{_prefix}
Group: Development/Tools
%define _installPrefix %{_prefix}/packages/%{name}-%{version}/platforms/%{_WM_OPTIONS}
%description
%{summary}
%prep
%setup -q
%build
# export WM settings in a form that GNU configure recognizes
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
[ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS"
[ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS"
[ -n "$WM_LDFLAGS" ] && export LDFLAGS="$WM_LDFLAGS"
%ifos darwin
# For Mac OSX:
# The configuration of cmake will be using the environment variable MACOSX_DEPLOYMENT_TARGET.
# This variable was initialized using 'sw_vers -productVersion' in etc/bashrc.
# We need to get rid of the revision number from this string. eg turn "10.7.5" into "10.7"
v=( ${MACOSX_DEPLOYMENT_TARGET//./ } )
export MACOSX_DEPLOYMENT_TARGET="${v[0]}.${v[1]}"
echo "Resetting MACOSX_DEPLOYMENT_TARGET to ${MACOSX_DEPLOYMENT_TARGET}"
# Recent version of Mac OSX (Yosemite) cannot compile cmake when gcc is the compiler
# Using clang instead
CC=clang
CXX=clang++
%endif
./configure \
--prefix=%{_installPrefix}
[ -z "$WM_NCOMPPROCS" ] && WM_NCOMPPROCS=1
make -j $WM_NCOMPPROCS
%install
make install DESTDIR=$RPM_BUILD_ROOT
# Creation of foam-extend specific .csh and .sh files"
echo ""
echo "Generating foam-extend specific .csh and .sh files for the package %{name}-%{version}"
echo ""
#
# Generate package specific .sh file for foam-extend
#
mkdir -p $RPM_BUILD_ROOT/%{_installPrefix}/etc
cat << DOT_SH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.sh
# Load %{name}-%{version} libraries and binaries if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export CMAKE_DIR=\$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS
export CMAKE_BIN_DIR=\$CMAKE_DIR/bin
# Enable access to the runtime package applications
[ -d \$CMAKE_BIN_DIR ] && _foamAddPath \$CMAKE_BIN_DIR
DOT_SH_EOF
#
# Generate package specific .csh file for foam-extend
#
cat << DOT_CSH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.csh
# Load %{name}-%{version} libraries and binaries if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
setenv CMAKE_DIR \$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS
setenv CMAKE_BIN_DIR \$CMAKE_DIR/bin
if ( -e \$CMAKE_BIN_DIR ) then
_foamAddPath \$CMAKE_BIN_DIR
endif
DOT_CSH_EOF
#finally, generate a .tgz file for systems where using rpm for installing packages
# as a non-root user might be a problem.
(mkdir -p %{_topdir}/TGZS/%{_target_cpu}; cd $RPM_BUILD_ROOT/%{_prefix}; tar -zcvf %{_topdir}/TGZS/%{_target_cpu}/%{name}-%{version}.tgz packages/%{name}-%{version})
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%{_installPrefix}

View file

@ -0,0 +1,175 @@
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration |
# \\ / A nd | For copyright notice see file Copyright
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of foam-extend.
#
# foam-extend is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# foam-extend is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# RPM spec file for qt-everywhere-opensource-src-5.8.0
#
# Description
# RPM spec file for creating a relocatable RPM
#
# Author:
# Martin Beaudoin, Hydro-Quebec, (2015)
# Pascal Beckstein, HZDR, (2018)
#
#------------------------------------------------------------------------------
# We grab the value of WM_THIRD_PARTY and WM_OPTIONS from the environment variable
%{expand:%%define _WM_THIRD_PARTY_DIR %(echo $WM_THIRD_PARTY_DIR)}
%{expand:%%define _WM_OPTIONS %(echo $WM_OPTIONS)}
# Disable the generation of debuginfo packages
%define debug_package %{nil}
# The topdir needs to point to the $WM_THIRD_PARTY/rpmbuild directory
%define _topdir %{_WM_THIRD_PARTY_DIR}/rpmBuild
%define _tmppath %{_topdir}/tmp
# Will install the package directly $WM_THIRD_PARTY_DIR
# Some comments about package relocation:
# By using this prefix for the Prefix: parameter in this file, you will make this
# package relocatable.
#
# This is fine, as long as your software is itself relocatable.
#
# Simply take note that libraries built with libtool are not relocatable because the
# prefix we specify will be hard-coded in the library .la files.
# Ref: http://sourceware.org/autobook/autobook/autobook_80.html
#
# In that case, if you ever change the value of the $WM_THIRD_PARTY_DIR, you will
# not be able to reutilize this RPM, even though it is relocatable. You will need to
# regenerate the RPM.
#
%define _prefix %{_WM_THIRD_PARTY_DIR}
%define name qt-everywhere-opensource-src
%define release %{_WM_OPTIONS}
%define version 5.8.0
%define buildroot %{_topdir}/BUILD/%{name}-%{version}-root
%define _unpackaged_files_terminate_build 0
%define _missing_doc_files_terminate_build 0
BuildRoot: %{buildroot}
Summary: qt-everywhere-opensource-src
License: Unkown
Name: %{name}
Version: %{version}
Release: %{release}
URL: http://download.qt.io/archive/qt/5.8/5.8.0/single/qt-everywhere-opensource-src-5.8.0.tar.gz
Source: %url/%{name}-%{version}.tar.gz
Prefix: %{_prefix}
Group: Development/Tools
%define _installPrefix %{_prefix}/packages/%{name}-%{version}/platforms/%{_WM_OPTIONS}
%description
%{summary}
%prep
%setup -q
%build
# export WM settings in a form that GNU configure recognizes
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
[ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS"
[ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS"
[ -n "$WM_LDFLAGS" ] && export LDFLAGS="$WM_LDFLAGS"
./configure \
-opensource -confirm-license \
-release -shared \
-nomake examples \
-prefix %{_installPrefix}
# Explicitely specify LD_LIBRARY_PATH so it can find QT own libraries
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{_builddir}/%{name}-%{version}/lib
[ -z "$WM_NCOMPPROCS" ] && WM_NCOMPPROCS=1
make -j $WM_NCOMPPROCS
%install
# Makefiles generated by qmake do not to support the DESTDIR= option
# We need to use the INSTALL_ROOT= option instead
# Somehow, we need to clean up for the RPM to install properly
rm -rf %{_installPrefix}
make install INSTALL_ROOT=$RPM_BUILD_ROOT
# Creation of foam-extend specific .csh and .sh files"
echo ""
echo "Generating foam-extend specific .csh and .sh files for the package %{name}-%{version}"
echo ""
#
# Generate package specific .sh file for foam-extend
#
mkdir -p $RPM_BUILD_ROOT/%{_installPrefix}/etc
cat << DOT_SH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.sh
# Load %{name}-%{version} libraries and binaries if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export QT_DIR=\$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS
export QT_BIN_DIR=\$QT_DIR/bin
export QT_LIB_DIR=\$QT_DIR/lib
# Enable access to the runtime package applications
[ -d \$QT_BIN_DIR ] && _foamAddPath \$QT_BIN_DIR
[ -d \$QT_LIB_DIR ] && _foamAddLib \$QT_LIB_DIR
DOT_SH_EOF
#
# Generate package specific .csh file for foam-extend
#
cat << DOT_CSH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.csh
# Load %{name}-%{version} libraries and binaries if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
setenv QT_DIR \$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS
setenv QT_BIN_DIR \$QT_DIR/bin
setenv QT_LIB_DIR \$QT_DIR/lib
if ( -e \$QT_BIN_DIR ) then
_foamAddPath \$QT_BIN_DIR
endif
if ( -e \$QT_LIB_DIR ) then
_foamAddLib \$QT_LIB_DIR
endif
DOT_CSH_EOF
#finally, generate a .tgz file for systems where using rpm for installing packages
# as a non-root user might be a problem.
(mkdir -p %{_topdir}/TGZS/%{_target_cpu}; cd $RPM_BUILD_ROOT/%{_prefix}; tar -zcvf %{_topdir}/TGZS/%{_target_cpu}/%{name}-%{version}.tgz packages/%{name}-%{version})
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%{_installPrefix}

View file

@ -1,8 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
rm -rf PV3FoamReader/Make
wclean libso vtkPV3Foam
# ----------------------------------------------------------------- end-of-file

View file

@ -1,26 +0,0 @@
#!/bin/bash
cd ${0%/*} || exit 1 # run from this directory
set -x
if [ -d "$PARAVIEW_DIR" -a -r "$PARAVIEW_DIR" ]
then
case "$PARAVIEW_VERSION" in
3*)
wmake libso vtkPV3Foam
(
cd PV3FoamReader
mkdir -p Make/$WM_OPTIONS > /dev/null 2>&1
cd Make/$WM_OPTIONS
cmake ../..
if [ "$WM_ARCH_BASE" == "darwin" ]
then
sed -i bak -e 's/-dynamiclib /& -undefined dynamic_lookup /' CMakeFiles/PV3FoamReader.dir/link.txt
sed -i bak -e 's/-dynamiclib /& -undefined dynamic_lookup /' CMakeFiles/PV3FoamReader_SM.dir/link.txt
fi
make
)
;;
esac
fi
# ----------------------------------------------------------------- end-of-file

View file

@ -1,61 +0,0 @@
# create a plugin that adds a reader to the ParaView GUI
# it is added in the file dialog when doing opens/saves.
# The qrc file is processed by Qt's resource compiler (rcc)
# the qrc file must have a resource prefix of "/ParaViewResources"
# and ParaView will read anything contained under that prefix
# the pqReader.xml file contains xml defining readers with their
# file extensions and descriptions.
cmake_minimum_required(VERSION 2.4)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
FIND_PACKAGE(ParaView REQUIRED)
INCLUDE(${PARAVIEW_USE_FILE})
LINK_DIRECTORIES(
$ENV{FOAM_LIBBIN}
)
INCLUDE_DIRECTORIES(
$ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
$ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude
${PROJECT_SOURCE_DIR}/../vtkPV3Foam
)
ADD_DEFINITIONS(
-DWM_$ENV{WM_PRECISION_OPTION}
)
# Set output library destination to plugin folder
SET(
LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH}
CACHE INTERNAL
"Single output directory for building all libraries."
)
# Build the server-side plugin
ADD_PARAVIEW_PLUGIN(
PV3FoamReader_SM "1.0"
SERVER_MANAGER_XML PV3FoamReader_SM.xml
SERVER_MANAGER_SOURCES vtkPV3FoamReader.cxx
)
# Build the client-side plugin
ADD_PARAVIEW_PLUGIN(
PV3FoamReader
"1.0"
GUI_RESOURCES PV3FoamReader.qrc
)
TARGET_LINK_LIBRARIES(
PV3FoamReader_SM
OpenFOAM
finiteVolume
vtkPV3Foam
pqCore
)
#-----------------------------------------------------------------------------

View file

@ -1,5 +0,0 @@
<RCC>
<qresource prefix="/ParaViewResources" >
<file>PV3FoamReader.xml</file>
</qresource>
</RCC>

View file

@ -1,6 +0,0 @@
<ParaViewReaders>
<Reader name="PV3FoamReader"
extensions="OpenFOAM"
file_description="OpenFOAM Reader">
</Reader>
</ParaViewReaders>

View file

@ -1,209 +0,0 @@
<ServerManagerConfiguration>
<ProxyGroup name="sources">
<SourceProxy
name="PV3FoamReader"
class="vtkPV3FoamReader">
<!-- File name - compulsory -->
<StringVectorProperty
name="FileName"
command="SetFileName"
number_of_elements="1"
animateable="0">
<FileListDomain name="files"/>
<Documentation>
Specifies the filename for the OpenFOAM Reader.
</Documentation>
</StringVectorProperty>
<!-- Send discrete time info to the animation panel -->
<DoubleVectorProperty
name="TimestepValues"
repeatable="1"
information_only="1">
<TimeStepsInformationHelper/>
<Documentation>
Available timestep values.
</Documentation>
</DoubleVectorProperty>
<!-- Global settings -->
<!-- Extrapolate Patches check-box -->
<IntVectorProperty
name="ExtrapolatePatches"
command="SetExtrapolatePatches"
number_of_elements="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Extrapolate internalField to non-constraint patches
</Documentation>
</IntVectorProperty>
<!-- Include Sets check-box -->
<IntVectorProperty
name="IncludeSets"
command="SetIncludeSets"
number_of_elements="1"
default_values="0"
animateable="0">
<Documentation>
Searches the polyMesh/sets/ directory
</Documentation>
<BooleanDomain name="bool"/>
</IntVectorProperty>
<!-- Include Zones check-box -->
<IntVectorProperty
name="IncludeZones"
command="SetIncludeZones"
number_of_elements="1"
default_values="0"
animateable="0">
<Documentation>
ZoneMesh information is used to find {cell,face,point}Zones.
The polyMesh/ directory is only checked on startup.
</Documentation>
<BooleanDomain name="bool"/>
</IntVectorProperty>
<!-- Show Patch Names check-box -->
<IntVectorProperty
name="ShowPatchNames"
command="SetShowPatchNames"
number_of_elements="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Show patch names in render window.
</Documentation>
</IntVectorProperty>
<!-- Cache Mesh check-box -->
<IntVectorProperty
name="CacheMesh"
command="SetCacheMesh"
number_of_elements="1"
default_values="1"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Cache the fvMesh in memory.
</Documentation>
</IntVectorProperty>
<!-- Update GUI check box -->
<IntVectorProperty
name="UpdateGUI"
command="SetUpdateGUI"
number_of_elements="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
A simple way cause a reader GUI modification.
</Documentation>
</IntVectorProperty>
<!-- Selections -->
<!-- Available Parts (volume, patches, lagrangian) array -->
<StringVectorProperty
name="PartArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="Part"/>
</StringVectorProperty>
<StringVectorProperty
name="PartStatus"
label="Mesh Parts"
command="SetPartArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="PartArrayInfo"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="PartArrayInfo" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<!-- Available volFields array -->
<StringVectorProperty
name="VolFieldArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="VolField"/>
</StringVectorProperty>
<StringVectorProperty
name="VolFieldStatus"
label="Volume Fields"
command="SetVolFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="VolFieldArrayInfo"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="VolFieldArrayInfo" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<!-- Available Lagrangian fields array -->
<StringVectorProperty
name="LagrangianFieldArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="LagrangianField"/>
</StringVectorProperty>
<StringVectorProperty
name="LagrangianFieldStatus"
label="Lagrangian Fields"
command="SetLagrangianFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="LagrangianFieldArrayInfo"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="LagrangianFieldArrayInfo" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<!-- Available pointFields array -->
<StringVectorProperty
name="PointFieldArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="PointField"/>
</StringVectorProperty>
<StringVectorProperty
name="PointFieldStatus"
label="Point Fields"
command="SetPointFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="PointFieldArrayInfo"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="PointFieldArrayInfo" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>

View file

@ -1,689 +0,0 @@
/*=========================================================================
Program: Visualization Toolkit
Module: $RCSfile: vtkPV3FoamReader.cxx,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkPV3FoamReader.h"
#include "pqApplicationCore.h"
#include "pqRenderView.h"
#include "pqServerManagerModel.h"
// VTK includes
#include "vtkCallbackCommand.h"
#include "vtkDataArraySelection.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkObjectFactory.h"
#include "vtkSMRenderViewProxy.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkStringArray.h"
// Foam includes
#include "vtkPV3Foam.H"
vtkCxxRevisionMacro(vtkPV3FoamReader, "$Revision: 1.5$");
vtkStandardNewMacro(vtkPV3FoamReader);
#undef EXPERIMENTAL_TIME_CACHING
vtkPV3FoamReader::vtkPV3FoamReader()
{
Debug = 0;
vtkDebugMacro(<<"Constructor");
SetNumberOfInputPorts(0);
FileName = NULL;
foamData_ = NULL;
output0_ = NULL;
#ifdef VTKPV3FOAM_DUALPORT
// Add second output for the Lagrangian
this->SetNumberOfOutputPorts(2);
vtkMultiBlockDataSet *lagrangian = vtkMultiBlockDataSet::New();
lagrangian->ReleaseData();
this->GetExecutive()->SetOutputData(1, lagrangian);
lagrangian->Delete();
#endif
TimeStepRange[0] = 0;
TimeStepRange[1] = 0;
CacheMesh = 1;
ExtrapolatePatches = 0;
IncludeSets = 0;
IncludeZones = 0;
ShowPatchNames = 0;
UpdateGUI = 0;
PartSelection = vtkDataArraySelection::New();
VolFieldSelection = vtkDataArraySelection::New();
PointFieldSelection = vtkDataArraySelection::New();
LagrangianFieldSelection = vtkDataArraySelection::New();
// Setup the selection callback to modify this object when an array
// selection is changed.
SelectionObserver = vtkCallbackCommand::New();
SelectionObserver->SetCallback
(
&vtkPV3FoamReader::SelectionModifiedCallback
);
SelectionObserver->SetClientData(this);
PartSelection->AddObserver
(
vtkCommand::ModifiedEvent,
this->SelectionObserver
);
VolFieldSelection->AddObserver
(
vtkCommand::ModifiedEvent,
this->SelectionObserver
);
PointFieldSelection->AddObserver
(
vtkCommand::ModifiedEvent,
this->SelectionObserver
);
LagrangianFieldSelection->AddObserver
(
vtkCommand::ModifiedEvent,
this->SelectionObserver
);
}
vtkPV3FoamReader::~vtkPV3FoamReader()
{
vtkDebugMacro(<<"Deconstructor");
delete foamData_;
if (FileName)
{
delete [] FileName;
}
if (output0_)
{
output0_->Delete();
}
PartSelection->RemoveObserver(this->SelectionObserver);
VolFieldSelection->RemoveObserver(this->SelectionObserver);
PointFieldSelection->RemoveObserver(this->SelectionObserver);
LagrangianFieldSelection->RemoveObserver(this->SelectionObserver);
SelectionObserver->Delete();
PartSelection->Delete();
VolFieldSelection->Delete();
PointFieldSelection->Delete();
LagrangianFieldSelection->Delete();
}
// Do everything except set the output info
int vtkPV3FoamReader::RequestInformation
(
vtkInformation* vtkNotUsed(request),
vtkInformationVector** vtkNotUsed(inputVector),
vtkInformationVector* outputVector
)
{
vtkDebugMacro(<<"RequestInformation");
if (Foam::vtkPV3Foam::debug)
{
cout<<"REQUEST_INFORMATION\n";
}
if (!FileName)
{
vtkErrorMacro("FileName has to be specified!");
return 0;
}
int nInfo = outputVector->GetNumberOfInformationObjects();
if (Foam::vtkPV3Foam::debug)
{
cout<<"RequestInformation with " << nInfo << " item(s)\n";
for (int infoI = 0; infoI < nInfo; ++infoI)
{
outputVector->GetInformationObject(infoI)->Print(cout);
}
}
if (!foamData_)
{
foamData_ = new Foam::vtkPV3Foam(FileName, this);
}
else
{
foamData_->updateInfo();
}
int nTimeSteps = 0;
double* timeSteps = foamData_->findTimes(nTimeSteps);
if (!nTimeSteps)
{
vtkErrorMacro("could not find valid OpenFOAM mesh");
// delete foamData and flag it as fatal error
delete foamData_;
foamData_ = NULL;
return 0;
}
// set identical time steps for all ports
for (int infoI = 0; infoI < nInfo; ++infoI)
{
outputVector->GetInformationObject(infoI)->Set
(
vtkStreamingDemandDrivenPipeline::TIME_STEPS(),
timeSteps,
nTimeSteps
);
}
if (nTimeSteps)
{
double timeRange[2];
timeRange[0] = timeSteps[0];
timeRange[1] = timeSteps[nTimeSteps-1];
if (Foam::vtkPV3Foam::debug > 1)
{
cout<<"nTimeSteps " << nTimeSteps << "\n"
<<"timeRange " << timeRange[0] << " to " << timeRange[1]
<< "\n";
for (int timeI = 0; timeI < nTimeSteps; ++timeI)
{
cout<< "step[" << timeI << "] = " << timeSteps[timeI] << "\n";
}
}
for (int infoI = 0; infoI < nInfo; ++infoI)
{
outputVector->GetInformationObject(infoI)->Set
(
vtkStreamingDemandDrivenPipeline::TIME_RANGE(),
timeRange,
2
);
}
}
delete timeSteps;
return 1;
}
// Set the output info
int vtkPV3FoamReader::RequestData
(
vtkInformation* vtkNotUsed(request),
vtkInformationVector** vtkNotUsed(inputVector),
vtkInformationVector* outputVector
)
{
vtkDebugMacro(<<"RequestData");
if (!FileName)
{
vtkErrorMacro("FileName has to be specified!");
return 0;
}
// catch previous error
if (!foamData_)
{
vtkErrorMacro("Reader failed - perhaps no mesh?");
return 0;
}
int nInfo = outputVector->GetNumberOfInformationObjects();
if (Foam::vtkPV3Foam::debug)
{
cout<<"RequestData with " << nInfo << " item(s)\n";
for (int infoI = 0; infoI < nInfo; ++infoI)
{
outputVector->GetInformationObject(infoI)->Print(cout);
}
}
// Get the requested time step.
// We only support requests for a single time step
int nRequestTime = 0;
double requestTime[nInfo];
// taking port0 as the lead for other outputs would be nice, but fails when
// a filter is added - we need to check everything
// but since PREVIOUS_UPDATE_TIME_STEPS() is protected, relay the logic
// to the vtkPV3Foam::setTime() method
for (int infoI = 0; infoI < nInfo; ++infoI)
{
vtkInformation *outInfo = outputVector->GetInformationObject(infoI);
if
(
outInfo->Has
(
vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()
)
&& outInfo->Length
(
vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()
) >= 1
)
{
requestTime[nRequestTime++] = outInfo->Get
(
vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()
)[0];
}
}
if (nRequestTime)
{
foamData_->setTime(nRequestTime, requestTime);
}
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
(
outputVector->GetInformationObject(0)->Get
(
vtkMultiBlockDataSet::DATA_OBJECT()
)
);
if (Foam::vtkPV3Foam::debug)
{
cout<< "update output with "
<< output->GetNumberOfBlocks() << " blocks\n";
}
#ifdef EXPERIMENTAL_TIME_CACHING
bool needsUpdate = false;
if (!output0_)
{
output0_ = vtkMultiBlockDataSet::New();
needsUpdate = true;
}
// This experimental bit of code seems to work for the geometry,
// but trashes the fields and still triggers the GeometryFilter
if (needsUpdate)
{
foamData_->Update(output);
output0_->ShallowCopy(output);
}
else
{
output->ShallowCopy(output0_);
}
if (Foam::vtkPV3Foam::debug)
{
if (needsUpdate)
{
cout<< "full UPDATE ---------\n";
}
else
{
cout<< "cached UPDATE ---------\n";
}
cout<< "UPDATED output: ";
output->Print(cout);
cout<< "UPDATED output0_: ";
output0_->Print(cout);
}
#else
#ifdef VTKPV3FOAM_DUALPORT
foamData_->Update
(
output,
vtkMultiBlockDataSet::SafeDownCast
(
outputVector->GetInformationObject(1)->Get
(
vtkMultiBlockDataSet::DATA_OBJECT()
)
);
);
#else
foamData_->Update(output, output);
#endif
if (ShowPatchNames)
{
addPatchNamesToView();
}
else
{
removePatchNamesFromView();
}
#endif
// Do any cleanup on the Foam side
foamData_->CleanUp();
return 1;
}
void vtkPV3FoamReader::addPatchNamesToView()
{
pqApplicationCore* appCore = pqApplicationCore::instance();
// Server manager model for querying items in the server manager
pqServerManagerModel* smModel = appCore->getServerManagerModel();
// Get all the pqRenderView instances
QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
for (int viewI=0; viewI<renderViews.size(); viewI++)
{
foamData_->addPatchNames
(
renderViews[viewI]->getRenderViewProxy()->GetRenderer()
);
}
}
void vtkPV3FoamReader::removePatchNamesFromView()
{
pqApplicationCore* appCore = pqApplicationCore::instance();
// Server manager model for querying items in the server manager
pqServerManagerModel* smModel = appCore->getServerManagerModel();
// Get all the pqRenderView instances
QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
for (int viewI=0; viewI<renderViews.size(); viewI++)
{
foamData_->removePatchNames
(
renderViews[viewI]->getRenderViewProxy()->GetRenderer()
);
}
}
void vtkPV3FoamReader::PrintSelf(ostream& os, vtkIndent indent)
{
vtkDebugMacro(<<"PrintSelf");
this->Superclass::PrintSelf(os,indent);
os<< indent << "File name: "
<< (this->FileName ? this->FileName : "(none)") << "\n";
foamData_->PrintSelf(os, indent);
os<< indent << "Time step range: "
<< this->TimeStepRange[0] << " - " << this->TimeStepRange[1]
<< "\n";
os<< indent << "Time step: " << this->GetTimeStep() << endl;
}
int vtkPV3FoamReader::GetTimeStep()
{
return foamData_ ? foamData_->timeIndex() : -1;
}
// ----------------------------------------------------------------------
// Parts selection list control
vtkDataArraySelection* vtkPV3FoamReader::GetPartSelection()
{
vtkDebugMacro(<<"GetPartSelection");
return PartSelection;
}
int vtkPV3FoamReader::GetNumberOfPartArrays()
{
vtkDebugMacro(<<"GetNumberOfPartArrays");
return PartSelection->GetNumberOfArrays();
}
const char* vtkPV3FoamReader::GetPartArrayName(int index)
{
vtkDebugMacro(<<"GetPartArrayName");
return PartSelection->GetArrayName(index);
}
int vtkPV3FoamReader::GetPartArrayStatus(const char* name)
{
vtkDebugMacro(<<"GetPartArrayStatus");
return PartSelection->ArrayIsEnabled(name);
}
void vtkPV3FoamReader::SetPartArrayStatus(const char* name, int status)
{
vtkDebugMacro(<<"SetPartArrayStatus");
if (status)
{
PartSelection->EnableArray(name);
}
else
{
PartSelection->DisableArray(name);
}
}
// ----------------------------------------------------------------------
// volField selection list control
vtkDataArraySelection* vtkPV3FoamReader::GetVolFieldSelection()
{
vtkDebugMacro(<<"GetVolFieldSelection");
return VolFieldSelection;
}
int vtkPV3FoamReader::GetNumberOfVolFieldArrays()
{
vtkDebugMacro(<<"GetNumberOfVolFieldArrays");
return VolFieldSelection->GetNumberOfArrays();
}
const char* vtkPV3FoamReader::GetVolFieldArrayName(int index)
{
vtkDebugMacro(<<"GetVolFieldArrayName");
return VolFieldSelection->GetArrayName(index);
}
int vtkPV3FoamReader::GetVolFieldArrayStatus(const char* name)
{
vtkDebugMacro(<<"GetVolFieldArrayStatus");
return VolFieldSelection->ArrayIsEnabled(name);
}
void vtkPV3FoamReader::SetVolFieldArrayStatus(const char* name, int status)
{
vtkDebugMacro(<<"SetVolFieldArrayStatus");
if (status)
{
VolFieldSelection->EnableArray(name);
}
else
{
VolFieldSelection->DisableArray(name);
}
}
// ----------------------------------------------------------------------
// pointField selection list control
vtkDataArraySelection* vtkPV3FoamReader::GetPointFieldSelection()
{
vtkDebugMacro(<<"GetPointFieldSelection");
return PointFieldSelection;
}
int vtkPV3FoamReader::GetNumberOfPointFieldArrays()
{
vtkDebugMacro(<<"GetNumberOfPointFieldArrays");
return PointFieldSelection->GetNumberOfArrays();
}
const char* vtkPV3FoamReader::GetPointFieldArrayName(int index)
{
vtkDebugMacro(<<"GetPointFieldArrayName");
return PointFieldSelection->GetArrayName(index);
}
int vtkPV3FoamReader::GetPointFieldArrayStatus(const char* name)
{
vtkDebugMacro(<<"GetPointFieldArrayStatus");
return PointFieldSelection->ArrayIsEnabled(name);
}
void vtkPV3FoamReader::SetPointFieldArrayStatus(const char* name, int status)
{
vtkDebugMacro(<<"SetPointFieldArrayStatus");
if (status)
{
PointFieldSelection->EnableArray(name);
}
else
{
PointFieldSelection->DisableArray(name);
}
}
// ----------------------------------------------------------------------
// lagrangianField selection list control
vtkDataArraySelection* vtkPV3FoamReader::GetLagrangianFieldSelection()
{
vtkDebugMacro(<<"GetLagrangianFieldSelection");
return LagrangianFieldSelection;
}
int vtkPV3FoamReader::GetNumberOfLagrangianFieldArrays()
{
vtkDebugMacro(<<"GetNumberOfLagrangianFieldArrays");
return LagrangianFieldSelection->GetNumberOfArrays();
}
const char* vtkPV3FoamReader::GetLagrangianFieldArrayName(int index)
{
vtkDebugMacro(<<"GetLagrangianFieldArrayName");
return LagrangianFieldSelection->GetArrayName(index);
}
int vtkPV3FoamReader::GetLagrangianFieldArrayStatus(const char* name)
{
vtkDebugMacro(<<"GetLagrangianFieldArrayStatus");
return LagrangianFieldSelection->ArrayIsEnabled(name);
}
void vtkPV3FoamReader::SetLagrangianFieldArrayStatus
(
const char* name,
int status
)
{
vtkDebugMacro(<<"SetLagrangianFieldArrayStatus");
if (status)
{
LagrangianFieldSelection->EnableArray(name);
}
else
{
LagrangianFieldSelection->DisableArray(name);
}
}
// ----------------------------------------------------------------------
void vtkPV3FoamReader::SelectionModifiedCallback
(
vtkObject*,
unsigned long,
void* clientdata,
void*
)
{
static_cast<vtkPV3FoamReader*>(clientdata)->SelectionModified();
}
void vtkPV3FoamReader::SelectionModified()
{
vtkDebugMacro(<<"SelectionModified");
Modified();
}
int vtkPV3FoamReader::FillOutputPortInformation
(
int port,
vtkInformation* info
)
{
if (port == 0)
{
return this->Superclass::FillOutputPortInformation(port, info);
}
info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkMultiBlockDataSet");
return 1;
}
// ************************************************************************* //

View file

@ -1,211 +0,0 @@
/*=========================================================================
Program: Visualization Toolkit
Module: $RCSfile: vtkPV3FoamReader.h,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkPV3FoamReader - reads a dataset in OpenFOAM format
// .SECTION Description
// vtkPV3FoamReader creates an multiblock dataset.
// It uses the OpenFOAM infrastructure (fvMesh, etc) to
// handle mesh and field data.
#ifndef __vtkPV3FoamReader_h
#define __vtkPV3FoamReader_h
// Foam forward declarations
namespace Foam
{
class vtkPV3Foam;
}
// VTK includes
#include "vtkMultiBlockDataSetAlgorithm.h"
// VTK forward declarations
class vtkDataArraySelection;
class vtkCallbackCommand;
class VTK_IO_EXPORT vtkPV3FoamReader
:
public vtkMultiBlockDataSetAlgorithm
{
public:
vtkTypeRevisionMacro(vtkPV3FoamReader,vtkMultiBlockDataSetAlgorithm);
void PrintSelf(ostream&, vtkIndent);
static vtkPV3FoamReader* New();
// Description:
// Get the current timestep and the timestep range.
vtkGetVector2Macro(TimeStepRange, int);
// Description:
// Set/Get the filename.
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
// Description:
// GUI update control
vtkSetMacro(UpdateGUI, int);
vtkGetMacro(UpdateGUI, int);
// Description:
// FOAM mesh caching control
vtkSetMacro(CacheMesh, int);
vtkGetMacro(CacheMesh, int);
// Description:
// FOAM extrapolate internal values onto the patches
vtkSetMacro(ExtrapolatePatches, int);
vtkGetMacro(ExtrapolatePatches, int);
// FOAM read sets control
vtkSetMacro(IncludeSets, int);
vtkGetMacro(IncludeSets, int);
// Description:
// FOAM read zones control
vtkSetMacro(IncludeZones, int);
vtkGetMacro(IncludeZones, int);
// Description:
// FOAM display patch names control
vtkSetMacro(ShowPatchNames, int);
vtkGetMacro(ShowPatchNames, int);
// Description:
// Get the current timestep
int GetTimeStep();
// Description:
// Parts selection list control
vtkDataArraySelection* GetPartSelection();
int GetNumberOfPartArrays();
int GetPartArrayStatus(const char* name);
void SetPartArrayStatus(const char* name, int status);
const char* GetPartArrayName(int index);
// Description:
// volField selection list control
vtkDataArraySelection* GetVolFieldSelection();
int GetNumberOfVolFieldArrays();
int GetVolFieldArrayStatus(const char* name);
void SetVolFieldArrayStatus(const char* name, int status);
const char* GetVolFieldArrayName(int index);
// Description:
// pointField selection list control
vtkDataArraySelection* GetPointFieldSelection();
int GetNumberOfPointFieldArrays();
int GetPointFieldArrayStatus(const char* name);
void SetPointFieldArrayStatus(const char* name, int status);
const char* GetPointFieldArrayName(int index);
// Description:
// lagrangianField selection list control
vtkDataArraySelection* GetLagrangianFieldSelection();
int GetNumberOfLagrangianFieldArrays();
int GetLagrangianFieldArrayStatus(const char* name);
void SetLagrangianFieldArrayStatus(const char* name, int status);
const char* GetLagrangianFieldArrayName(int index);
// Description:
// Callback registered with the SelectionObserver
// for all the selection lists
static void SelectionModifiedCallback
(
vtkObject* caller,
unsigned long eid,
void* clientdata,
void* calldata
);
void SelectionModified();
protected:
//- Construct null
vtkPV3FoamReader();
//- Destructor
~vtkPV3FoamReader();
//- Return information about mesh, times, etc without loading anything
virtual int RequestInformation
(
vtkInformation*,
vtkInformationVector**,
vtkInformationVector*
);
//- Get the mesh/fields for a particular time
//- Destructor
virtual int RequestData
(
vtkInformation*,
vtkInformationVector**,
vtkInformationVector*
);
//- Fill in additional port information
virtual int FillOutputPortInformation(int, vtkInformation*);
// The observer to modify this object when array selections are modified
vtkCallbackCommand* SelectionObserver;
char* FileName;
private:
//- Disallow default bitwise copy construct
vtkPV3FoamReader(const vtkPV3FoamReader&);
//- Disallow default bitwise assignment
void operator=(const vtkPV3FoamReader&);
//- Add patch names to the view
void addPatchNamesToView();
//- Remove patch names from the view
void removePatchNamesFromView();
int TimeStepRange[2];
int CacheMesh;
int ExtrapolatePatches;
int IncludeSets;
int IncludeZones;
int ShowPatchNames;
//- Dummy variable/switch for invoke a reader update
int UpdateGUI;
vtkDataArraySelection* PartSelection;
vtkDataArraySelection* VolFieldSelection;
vtkDataArraySelection* PointFieldSelection;
vtkDataArraySelection* LagrangianFieldSelection;
//- Cached data for output port0 (experimental!)
vtkMultiBlockDataSet* output0_;
//BTX
Foam::vtkPV3Foam* foamData_;
//ETX
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,12 +0,0 @@
vtkPV3Foam.C
vtkPV3FoamFields.C
vtkPV3FoamMesh.C
vtkPV3FoamMeshLagrangian.C
vtkPV3FoamMeshPatch.C
vtkPV3FoamMeshSet.C
vtkPV3FoamMeshVolume.C
vtkPV3FoamMeshZone.C
vtkPV3FoamUpdateInfo.C
vtkPV3FoamUtilities.C
LIB = $(FOAM_LIBBIN)/libvtkPV3Foam

View file

@ -1,12 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(PARAVIEW_INCLUDE_DIR) \
-I../PV3FoamReader
LIB_LIBS = \
-lfiniteVolume \
-llagrangian \
-lmeshTools \
$(GLIBS)

View file

@ -1,71 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass
vtkPV3Foam
\*---------------------------------------------------------------------------*/
#ifndef vtkFOAMTupleRemap_H
#define vtkFOAMTupleRemap_H
// FOAM includes
#include "StaticAssert.H"
#include "Swap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
inline void vtkFOAMTupleRemap(float vec[]);
// a symmTensor specialization to remap FOAM -> ParaView naming order
// Qt/Core/pqScalarBarRepresentation.cxx defines this order
// { "XX", "YY", "ZZ", "XY", "YZ", "XZ" }
// in pqScalarBarRepresentation::getDefaultComponentLabel()
// whereas FOAM uses this order
// { XX, XY, XZ, YY, YZ, ZZ }
//
// for extra safety, assert that symmTensor indeed has 6 components
StaticAssert(Foam::symmTensor::nComponents == 6);
// Template specialization for symmTensor
template<>
inline void vtkFOAMTupleRemap<Foam::symmTensor>(float vec[])
{
Foam::Swap(vec[1], vec[3]); // swap XY <-> YY
Foam::Swap(vec[2], vec[5]); // swap XZ <-> ZZ
}
template<class Type>
inline void vtkFOAMTupleRemap(float vec[])
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,757 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::vtkPV3Foam
Description
Provides a reader interface for FOAM to VTK interaction.
SourceFiles
vtkPV3Foam.C
vtkPV3Foam.H
vtkPV3FoamI.H
vtkPV3FoamFields.C
vtkPV3FoamMesh.C
vtkPV3FoamMeshLagrangian.C
vtkPV3FoamMeshPatch.C
vtkPV3FoamMeshSet.C
vtkPV3FoamMeshVolume.C
vtkPV3FoamMeshZone.C
vtkPV3FoamFaceField.H
vtkPV3FoamLagrangianFields.H
vtkPV3FoamPatchField.H
vtkPV3FoamPointFields.H
vtkPV3FoamPoints.H
vtkPV3FoamUpdateInfo.C
vtkPV3FoamUpdateInfoFields.H
vtkPV3FoamUtilities.C
vtkPV3FoamVolFields.H
vtkPV3FoamAddToSelection.H
// Needed by VTK:
vtkDataArrayTemplateImplicit.txx
\*---------------------------------------------------------------------------*/
#ifndef vtkPV3Foam_H
#define vtkPV3Foam_H
// do not include legacy strstream headers
#ifndef VTK_EXCLUDE_STRSTREAM_HEADERS
# define VTK_EXCLUDE_STRSTREAM_HEADERS
#endif
#include "className.H"
#include "fileName.H"
#include "stringList.H"
#include "wordList.H"
#include "primitivePatch.H"
#include "PrimitivePatchInterpolation.H"
#include "volPointInterpolation.H"
#undef VTKPV3FOAM_DUALPORT
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
class vtkDataArraySelection;
class vtkDataSet;
class vtkPoints;
class vtkPV3FoamReader;
class vtkRenderer;
class vtkTextActor;
class vtkMultiBlockDataSet;
class vtkPolyData;
class vtkUnstructuredGrid;
class vtkIndent;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Foam class forward declarations
class argList;
class Time;
class fvMesh;
class IOobjectList;
class polyPatch;
class faceSet;
class pointSet;
template<class Type> class IOField;
template<class Type> class List;
/*---------------------------------------------------------------------------*\
Class vtkPV3Foam Declaration
\*---------------------------------------------------------------------------*/
class vtkPV3Foam
{
// Private classes
//- Bookkeeping for GUI checklists and the multi-block organization
class partInfo
{
const char *name_;
int block_;
int start_;
int size_;
public:
partInfo(const char *name, const int blockNo=0)
:
name_(name),
block_(blockNo),
start_(-1),
size_(0)
{}
//- Return the block holding these datasets
int block() const
{
return block_;
}
//- Assign block number, return previous value
int block(int blockNo)
{
int prev = block_;
block_ = blockNo;
return prev;
}
const char* name() const
{
return name_;
}
int start() const
{
return start_;
}
int end() const
{
return start_ + size_;
}
int size() const
{
return size_;
}
bool empty() const
{
return !size_;
}
void reset()
{
start_ = -1;
size_ = 0;
}
//- Assign new start and reset the size
void operator=(const int i)
{
start_ = i;
size_ = 0;
}
//- Increment the size
void operator+=(const int n)
{
size_ += n;
}
};
//- bookkeeping for polyhedral cell decomposition
// hide in extra pointMap (cellSet/cellZone) for now
class polyDecomp
{
labelList superCells_;
labelList addPointCellLabels_;
labelList pointMap_;
public:
polyDecomp()
{}
//- Label of original cell for decomposed cells
labelList& superCells()
{
return superCells_;
}
//- Label of original cell for decomposed cells
const labelList& superCells() const
{
return superCells_;
}
//- Cell-centre labels for additional points of decomposed cells
labelList& addPointCellLabels()
{
return addPointCellLabels_;
}
//- Cell-centre labels for additional points of decomposed cells
const labelList& addPointCellLabels() const
{
return addPointCellLabels_;
}
//- Point labels for subsetted meshes
labelList& pointMap()
{
return pointMap_;
}
//- Point labels for subsetted meshes
const labelList& pointMap() const
{
return pointMap_;
}
//- Clear
void clear()
{
superCells_.clear();
addPointCellLabels_.clear();
pointMap_.clear();
}
};
// Private Data
//- Access to the controlling vtkPV3FoamReader
vtkPV3FoamReader* reader_;
//- Foam time control
autoPtr<Time> dbPtr_;
//- Foam mesh
fvMesh* meshPtr_;
//- The mesh region
word meshRegion_;
//- The mesh directory for the region
fileName meshDir_;
//- The time index
int timeIndex_;
//- Track changes in mesh geometry
bool meshChanged_;
//- Track changes in fields
bool fieldsChanged_;
//- Selected geometrical parts (internalMesh, patches, ...)
boolList partStatus_;
//- Datasets corresponding to selected geometrical pieces
// a negative number indicates that no vtkmesh exists for this piece
labelList partDataset_;
//- First instance and size of various mesh parts
// used to index into partStatus_ and partDataset_
partInfo partInfoVolume_;
partInfo partInfoPatches_;
partInfo partInfoLagrangian_;
partInfo partInfoCellZones_;
partInfo partInfoFaceZones_;
partInfo partInfoPointZones_;
partInfo partInfoCellSets_;
partInfo partInfoFaceSets_;
partInfo partInfoPointSets_;
//- Decomposed cells information (mesh regions)
// TODO: regions
List<polyDecomp> regionPolyDecomp_;
//- Decomposed cells information (cellZone meshes)
List<polyDecomp> zonePolyDecomp_;
//- Decomposed cells information (cellSet meshes)
List<polyDecomp> csetPolyDecomp_;
//- List of patch names for rendering to window
List<vtkTextActor*> patchTextActorsPtrs_;
// Private Member Functions
// Convenience method use to convert the readers from VTK 5
// multiblock API to the current composite data infrastructure
static void AddToBlock
(
vtkMultiBlockDataSet* output,
vtkDataSet* dataset,
const partInfo&,
const label datasetNo,
const string& datasetName
);
// Convenience method use to convert the readers from VTK 5
// multiblock API to the current composite data infrastructure
static vtkDataSet* GetDataSetFromBlock
(
vtkMultiBlockDataSet* output,
const partInfo&,
const label datasetNo
);
// Convenience method use to convert the readers from VTK 5
// multiblock API to the current composite data infrastructure
static label GetNumberOfDataSets
(
vtkMultiBlockDataSet* output,
const partInfo&
);
//- Reset data counters
void resetCounters();
// Update information helper functions
//- Update the mesh parts selected in the GUI
void updateMeshPartsStatus();
//- Internal mesh info
void updateInfoInternalMesh();
//- Lagrangian info
void updateInfoLagrangian();
//- Patch info
void updateInfoPatches();
//- Set info
void updateInfoSets();
//- Zone info
void updateInfoZones();
//- Read zone names for zoneType from file
wordList readZoneNames(const word& zoneType);
//- Add objects of Type to paraview array selection
template<class Type>
label addToSelection
(
vtkDataArraySelection*,
const IOobjectList&,
const string& suffix=string::null
);
//- Field info
template<template<class> class patchType, class meshType>
void updateInfoFields(vtkDataArraySelection*);
//- Lagrangian field info
void updateInfoLagrangianFields();
// Update helper functions
//- Foam mesh
void updateFoamMesh();
//- Reduce memory footprint after conversion
void reduceMemory();
//- Volume fields
void updateVolFields(vtkMultiBlockDataSet*);
//- Point fields
void updatePointFields(vtkMultiBlockDataSet*);
//- Lagrangian fields
void updateLagrangianFields(vtkMultiBlockDataSet*);
// Mesh conversion functions
//- Volume mesh
void convertMeshVolume(vtkMultiBlockDataSet*, int& blockNo);
//- Lagrangian mesh
void convertMeshLagrangian(vtkMultiBlockDataSet*, int& blockNo);
//- Patch meshes
void convertMeshPatches(vtkMultiBlockDataSet*, int& blockNo);
//- Cell zone meshes
void convertMeshCellZones(vtkMultiBlockDataSet*, int& blockNo);
//- Face zone meshes
void convertMeshFaceZones(vtkMultiBlockDataSet*, int& blockNo);
//- Point zone meshes
void convertMeshPointZones(vtkMultiBlockDataSet*, int& blockNo);
//- Cell set meshes
void convertMeshCellSets(vtkMultiBlockDataSet*, int& blockNo);
//- Face set meshes
void convertMeshFaceSets(vtkMultiBlockDataSet*, int& blockNo);
//- Point set meshes
void convertMeshPointSets(vtkMultiBlockDataSet*, int& blockNo);
// Add mesh functions
//- Add internal mesh/cell set meshes
vtkUnstructuredGrid* volumeVTKMesh(const fvMesh&, polyDecomp&);
//- Add Lagrangian mesh
vtkPolyData* lagrangianVTKMesh
(
const fvMesh&,
const word& cloudName
);
//- Add patch mesh
vtkPolyData* patchVTKMesh(const polyPatch&);
//- Add face zone mesh
vtkPolyData* faceZoneVTKMesh
(
const fvMesh&,
const labelList& faceLabels
);
//- Add point zone
vtkPolyData* pointZoneVTKMesh
(
const fvMesh&,
const labelList& pointLabels
);
//- Add face set mesh
vtkPolyData* faceSetVTKMesh
(
const fvMesh&,
const faceSet&
);
//- Add point mesh
vtkPolyData* pointSetVTKMesh
(
const fvMesh&,
const pointSet&
);
// Field conversion functions
//- Convert volume fields
void convertVolFields(vtkMultiBlockDataSet*);
//- Convert point fields
void convertPointFields(vtkMultiBlockDataSet*);
//- Convert Lagrangian fields
void convertLagrangianFields(vtkMultiBlockDataSet*);
//- Add the fields in the selected time directory to the selection
// lists
template<class GeoField>
label addObjectsToSelection
(
vtkDataArraySelection*,
const IOobjectList&,
const string& suffix=string::null
);
// Convert Foam fields
//- Volume fields - all types
template<class Type>
void convertVolFields
(
const fvMesh&,
const PtrList<PrimitivePatchInterpolation<primitivePatch> >&,
const IOobjectList&,
vtkMultiBlockDataSet* output
);
//- Volume field - all selected parts
template<class Type>
void convertVolFieldBlock
(
const GeometricField<Type, fvPatchField, volMesh>&,
autoPtr<GeometricField<Type, pointPatchField, pointMesh> >&,
vtkMultiBlockDataSet* output,
const partInfo& selector,
const List<polyDecomp>& decompLst
);
//- Volume field
template<class Type>
void convertVolField
(
const GeometricField<Type, fvPatchField, volMesh>&,
vtkMultiBlockDataSet* output,
const partInfo&,
const label datasetNo,
const polyDecomp&
);
//- Patch field
template<class Type>
void convertPatchField
(
const word& name,
const Field<Type>&,
vtkMultiBlockDataSet* output,
const partInfo&,
const label datasetNo
);
//- face set/zone field
template<class Type>
void convertFaceField
(
const GeometricField<Type, fvPatchField, volMesh>&,
vtkMultiBlockDataSet* output,
const partInfo&,
const label datasetNo,
const fvMesh&,
const labelList& faceLabels
);
//- face set/zone field
template<class Type>
void convertFaceField
(
const GeometricField<Type, fvPatchField, volMesh>&,
vtkMultiBlockDataSet* output,
const partInfo&,
const label datasetNo,
const fvMesh&,
const faceSet&
);
//- Lagrangian fields - all types
template<class Type>
void convertLagrangianFields
(
const IOobjectList&,
vtkMultiBlockDataSet* output,
const label datasetNo
);
//- Lagrangian field
template<class Type>
void convertLagrangianField
(
const IOField<Type>&,
vtkMultiBlockDataSet* output,
const partInfo&,
const label datasetNo
);
//- Point fields - all types
template<class Type>
void convertPointFields
(
const fvMesh&,
const pointMesh&,
const IOobjectList&,
vtkMultiBlockDataSet* output
);
//- Point field - all selected parts
template<class Type>
void convertPointFieldBlock
(
const GeometricField<Type, pointPatchField, pointMesh>&,
vtkMultiBlockDataSet* output,
const partInfo& selector,
const List<polyDecomp>&
);
//- Point fields
template<class Type>
void convertPointField
(
const GeometricField<Type, pointPatchField, pointMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&,
vtkMultiBlockDataSet* output,
const partInfo&,
const label datasetNo,
const polyDecomp&
);
//- Patch point field
template<class Type>
void convertPatchPointField
(
const word& name,
const Field<Type>&,
vtkMultiBlockDataSet* output,
const partInfo&,
const label datasetNo
);
// GUI selection helper functions
//- Extract up to the first non-word characters
inline static word getFirstWord(const char*);
//- Only keep what is listed in hashSet
static void pruneObjectList
(
IOobjectList&,
const wordHashSet&
);
//- Retrieve the current selections
static wordHashSet getSelected(vtkDataArraySelection*);
//- Retrieve a sub-list of the current selections
static wordHashSet getSelected
(
vtkDataArraySelection*,
const partInfo&
);
//- Retrieve the current selections
static stringList getSelectedArrayEntries(vtkDataArraySelection*);
//- Retrieve a sub-list of the current selections
static stringList getSelectedArrayEntries
(
vtkDataArraySelection*,
const partInfo&
);
//- Set selection(s)
static void setSelectedArrayEntries
(
vtkDataArraySelection*,
const stringList&
);
//- Get the first word from the mesh parts selection
word getPartName(int);
//- Disallow default bitwise copy construct
vtkPV3Foam(const vtkPV3Foam&);
//- Disallow default bitwise assignment
void operator=(const vtkPV3Foam&);
public:
//- Static data members
ClassName("vtkPV3Foam");
// Constructors
//- Construct from components
vtkPV3Foam
(
const char* const FileName,
vtkPV3FoamReader* reader
);
//- Destructor
~vtkPV3Foam();
// Member Functions
//- Update
void updateInfo();
void Update
(
vtkMultiBlockDataSet* output,
vtkMultiBlockDataSet* lagrangianOutput
);
//- Clean any storage
void CleanUp();
//- Allocate and return a list of selected times
// returns the count via the parameter
double* findTimes(int& nTimeSteps);
//- Add patch names to the display
void addPatchNames(vtkRenderer* renderer);
//- Remove patch names from the display
void removePatchNames(vtkRenderer* renderer);
//- set the runTime to the first plausible request time,
// returns the timeIndex
// sets to "constant" on error
int setTime(int count, const double requestTimes[]);
//- The current time index
int timeIndex() const
{
return timeIndex_;
}
// Access
//- Debug information
void PrintSelf(ostream&, vtkIndent) const;
//- Simple memory used debugging information
static void printMemory();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
# include "vtkPV3FoamI.H"
#endif
// ************************************************************************* //

View file

@ -1,68 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef vtkPV3FoamAddToSelection_H
#define vtkPV3FoamAddToSelection_H
// FOAM includes
#include "IOobjectList.H"
#include "SortableList.H"
// VTK includes
#include "vtkDataArraySelection.h"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
Foam::label Foam::vtkPV3Foam::addToSelection
(
vtkDataArraySelection *select,
const IOobjectList& objectLst,
const string& suffix
)
{
SortableList<word> names(objectLst.names(Type::typeName));
forAll(names, nameI)
{
if (suffix.size())
{
select->AddArray((names[nameI] + suffix).c_str());
}
else
{
select->AddArray(names[nameI].c_str());
}
}
return names.size();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,209 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass
vtkPV3Foam
\*---------------------------------------------------------------------------*/
#ifndef vtkPV3FoamFaceField_H
#define vtkPV3FoamFaceField_H
// VTK includes
#include "vtkCellData.h"
#include "vtkFloatArray.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkPolyData.h"
#include "vtkFOAMTupleRemap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void Foam::vtkPV3Foam::convertFaceField
(
const GeometricField<Type, fvPatchField, volMesh>& tf,
vtkMultiBlockDataSet* output,
const partInfo& selector,
const label datasetNo,
const fvMesh& mesh,
const labelList& faceLabels
)
{
const label nComp = pTraits<Type>::nComponents;
const label nInternalFaces = mesh.nInternalFaces();
const label nFaces = mesh.nFaces();
const labelList& faceOwner = mesh.faceOwner();
const labelList& faceNeigh = mesh.faceNeighbour();
vtkFloatArray *cellData = vtkFloatArray::New();
cellData->SetNumberOfTuples( faceLabels.size() );
cellData->SetNumberOfComponents( nComp );
cellData->Allocate( nComp*faceLabels.size() );
cellData->SetName( tf.name().c_str() );
if (debug)
{
Info<< "convert convertFaceField: "
<< tf.name()
<< " size = " << tf.size()
<< " nComp=" << nComp
<< " nTuples = " << faceLabels.size() << endl;
}
float vec[nComp];
// for interior faces: average owner/neighbour
// for boundary faces: owner
forAll(faceLabels, faceI)
{
// Bug fix: filter inactive faces. HJ, 21/Mar/2011
const label faceNo = faceLabels[faceI];
if (faceNo < nInternalFaces)
{
Type t = 0.5*(tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]);
for (direction d = 0; d < nComp; d++)
{
vec[d] = component(t, d);
}
}
else if (faceNo < nFaces)
{
const Type& t = tf[faceOwner[faceNo]];
for (direction d = 0; d < nComp; d++)
{
vec[d] = component(t, d);
}
}
else
{
for (direction d = 0; d < nComp; d++)
{
vec[d] = 0;
}
}
vtkFOAMTupleRemap<Type>(vec);
cellData->InsertTuple(faceI, vec);
}
vtkPolyData::SafeDownCast
(
GetDataSetFromBlock(output, selector, datasetNo)
) ->GetCellData()
->AddArray(cellData);
cellData->Delete();
}
template<class Type>
void Foam::vtkPV3Foam::convertFaceField
(
const GeometricField<Type, fvPatchField, volMesh>& tf,
vtkMultiBlockDataSet* output,
const partInfo& selector,
const label datasetNo,
const fvMesh& mesh,
const faceSet& fSet
)
{
const label nComp = pTraits<Type>::nComponents;
const label nInternalFaces = mesh.nInternalFaces();
const label nFaces = mesh.nFaces();
const labelList& faceOwner = mesh.faceOwner();
const labelList& faceNeigh = mesh.faceNeighbour();
vtkFloatArray *cellData = vtkFloatArray::New();
cellData->SetNumberOfTuples( fSet.size() );
cellData->SetNumberOfComponents( nComp );
cellData->Allocate( nComp*fSet.size() );
cellData->SetName( tf.name().c_str() );
if (debug)
{
Info<< "convert convertFaceField: "
<< tf.name()
<< " size = " << tf.size()
<< " nComp=" << nComp
<< " nTuples = " << fSet.size() << endl;
}
float vec[nComp];
// for interior faces: average owner/neighbour
// for boundary faces: owner
label faceI = 0;
forAllConstIter(faceSet, fSet, iter)
{
const label faceNo = iter.key();
// Bug fix: filter inactive faces. HJ, 21/Mar/2011
if (faceNo < nInternalFaces)
{
Type t = 0.5*(tf[faceOwner[faceNo]] + tf[faceNeigh[faceNo]]);
for (direction d = 0; d < nComp; d++)
{
vec[d] = component(t, d);
}
}
else if (faceNo < nFaces)
{
const Type& t = tf[faceOwner[faceNo]];
for (direction d = 0; d < nComp; d++)
{
vec[d] = component(t, d);
}
}
else
{
for (direction d = 0; d < nComp; d++)
{
vec[d] = 0;
}
}
vtkFOAMTupleRemap<Type>(vec);
cellData->InsertTuple(faceI, vec);
++faceI;
}
vtkPolyData::SafeDownCast
(
GetDataSetFromBlock(output, selector, datasetNo)
) ->GetCellData()
->AddArray(cellData);
cellData->Delete();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,325 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "vtkPV3Foam.H"
// Foam includes
#include "IOobjectList.H"
#include "vtkPV3FoamReader.h"
// VTK includes
#include "vtkDataArraySelection.h"
#include "vtkPolyData.h"
#include "vtkUnstructuredGrid.h"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
#include "vtkPV3FoamVolFields.H"
#include "vtkPV3FoamPointFields.H"
#include "vtkPV3FoamLagrangianFields.H"
void Foam::vtkPV3Foam::pruneObjectList
(
IOobjectList& objects,
const wordHashSet& selected
)
{
// hash all the selected field names
if (!selected.size())
{
objects.clear();
}
// only keep selected fields
forAllIter(IOobjectList, objects, iter)
{
if (!selected.found(iter()->name()))
{
objects.erase(iter);
}
}
}
void Foam::vtkPV3Foam::convertVolFields
(
vtkMultiBlockDataSet* output
)
{
const fvMesh& mesh = *meshPtr_;
wordHashSet selectedFields = getSelected
(
reader_->GetVolFieldSelection()
);
if (!selectedFields.size())
{
return;
}
// Get objects (fields) for this time - only keep selected fields
// the region name is already in the mesh db
IOobjectList objects(mesh, dbPtr_().timeName());
pruneObjectList(objects, selectedFields);
if (!objects.size())
{
return;
}
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::convertVolFields" << nl
<< "converting Foam volume fields" << endl;
forAllConstIter(IOobjectList, objects, iter)
{
Info<< " " << iter()->name()
<< " == " << iter()->objectPath() << nl;
}
printMemory();
}
PtrList<PrimitivePatchInterpolation<primitivePatch> >
ppInterpList(mesh.boundaryMesh().size());
forAll(ppInterpList, i)
{
ppInterpList.set
(
i,
new PrimitivePatchInterpolation<primitivePatch>
(
mesh.boundaryMesh()[i]
)
);
}
convertVolFields<scalar>
(
mesh, ppInterpList, objects, output
);
convertVolFields<vector>
(
mesh, ppInterpList, objects, output
);
convertVolFields<sphericalTensor>
(
mesh, ppInterpList, objects, output
);
convertVolFields<symmTensor>
(
mesh, ppInterpList, objects, output
);
convertVolFields<tensor>
(
mesh, ppInterpList, objects, output
);
if (debug)
{
Info<< "<end> Foam::vtkPV3Foam::convertVolFields" << endl;
printMemory();
}
}
void Foam::vtkPV3Foam::convertPointFields
(
vtkMultiBlockDataSet* output
)
{
const fvMesh& mesh = *meshPtr_;
wordHashSet selectedFields = getSelected
(
reader_->GetPointFieldSelection()
);
if (!selectedFields.size())
{
return;
}
// Get objects (fields) for this time - only keep selected fields
// the region name is already in the mesh db
IOobjectList objects(mesh, dbPtr_().timeName());
pruneObjectList(objects, selectedFields);
if (!objects.size())
{
return;
}
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::convertPointFields" << nl
<< "converting Foam volume fields" << endl;
forAllConstIter(IOobjectList, objects, iter)
{
Info<< " " << iter()->name()
<< " == " << iter()->objectPath() << nl;
}
printMemory();
}
// Construct interpolation on the raw mesh
// HJ, bug fix? Point mesh handled by objectRegistry
// HJ, 11/Nov/2010
const pointMesh& pMesh = pointMesh::New(mesh);
// pointMesh pMesh(mesh);
convertPointFields<scalar>
(
mesh, pMesh, objects, output
);
convertPointFields<vector>
(
mesh, pMesh, objects, output
);
convertPointFields<sphericalTensor>
(
mesh, pMesh, objects, output
);
convertPointFields<symmTensor>
(
mesh, pMesh, objects, output
);
convertPointFields<tensor>
(
mesh, pMesh, objects, output
);
if (debug)
{
Info<< "<end> Foam::vtkPV3Foam::convertPointFields" << endl;
printMemory();
}
}
void Foam::vtkPV3Foam::convertLagrangianFields
(
vtkMultiBlockDataSet* output
)
{
partInfo& selector = partInfoLagrangian_;
const fvMesh& mesh = *meshPtr_;
wordHashSet selectedFields = getSelected
(
reader_->GetLagrangianFieldSelection()
);
if (!selectedFields.size())
{
return;
}
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::convertLagrangianFields" << endl;
printMemory();
}
for (int partId = selector.start(); partId < selector.end(); ++partId)
{
const word cloudName = getPartName(partId);
const label datasetNo = partDataset_[partId];
if (!partStatus_[partId] || datasetNo < 0)
{
continue;
}
// Get the Lagrangian fields for this time and this cloud
// but only keep selected fields
// the region name is already in the mesh db
IOobjectList objects
(
mesh,
dbPtr_().timeName(),
cloud::prefix/cloudName
);
pruneObjectList(objects, selectedFields);
if (!objects.size())
{
continue;
}
if (debug)
{
Info<< "converting Foam lagrangian fields" << nl;
forAllConstIter(IOobjectList, objects, iter)
{
Info<< " " << iter()->name()
<< " == " << iter()->objectPath() << nl;
}
}
convertLagrangianFields<label>
(
objects, output, datasetNo
);
convertLagrangianFields<scalar>
(
objects, output, datasetNo
);
convertLagrangianFields<vector>
(
objects, output, datasetNo
);
convertLagrangianFields<sphericalTensor>
(
objects, output, datasetNo
);
convertLagrangianFields<symmTensor>
(
objects, output, datasetNo
);
convertLagrangianFields<tensor>
(
objects, output, datasetNo
);
}
if (debug)
{
Info<< "<end> Foam::vtkPV3Foam::convertLagrangianFields" << endl;
printMemory();
}
}
// ************************************************************************* //

View file

@ -1,47 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline Foam::word Foam::vtkPV3Foam::getFirstWord(const char* str)
{
if (str)
{
label n = 0;
while (str[n] && word::valid(str[n]))
{
++n;
}
return word(str, n, true);
}
else
{
return word::null;
}
}
// ************************************************************************* //

View file

@ -1,113 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass
vtkPV3Foam
\*---------------------------------------------------------------------------*/
#ifndef vtkPV3FoamLagrangianFields_H
#define vtkPV3FoamLagrangianFields_H
#include "Cloud.H"
#include "vtkFOAMTupleRemap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void Foam::vtkPV3Foam::convertLagrangianFields
(
const IOobjectList& objects,
vtkMultiBlockDataSet* output,
const label datasetNo
)
{
const partInfo& selector = partInfoLagrangian_;
forAllConstIter(IOobjectList, objects, iter)
{
// restrict to this IOField<Type>
if (iter()->headerClassName() == IOField<Type>::typeName)
{
IOField<Type> tf(*iter());
convertLagrangianField(tf, output, selector, datasetNo);
}
}
}
template<class Type>
void Foam::vtkPV3Foam::convertLagrangianField
(
const IOField<Type>& tf,
vtkMultiBlockDataSet* output,
const partInfo& selector,
const label datasetNo
)
{
const label nComp = pTraits<Type>::nComponents;
vtkFloatArray *pointData = vtkFloatArray::New();
pointData->SetNumberOfTuples( tf.size() );
pointData->SetNumberOfComponents( nComp );
pointData->Allocate( nComp*tf.size() );
pointData->SetName( tf.name().c_str() );
if (debug)
{
Info<< "convert LagrangianField: "
<< tf.name()
<< " size = " << tf.size()
<< " nComp=" << nComp
<< " nTuples = " << tf.size() << endl;
}
float vec[nComp];
forAll(tf, i)
{
const Type& t = tf[i];
for (direction d=0; d<nComp; d++)
{
vec[d] = component(t, d);
}
vtkFOAMTupleRemap<Type>(vec);
pointData->InsertTuple(i, vec);
}
vtkPolyData::SafeDownCast
(
GetDataSetFromBlock(output, selector, datasetNo)
) ->GetPointData()
->AddArray(pointData);
pointData->Delete();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,111 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "vtkPV3Foam.H"
// Foam includes
#include "Cloud.H"
#include "fvMesh.H"
#include "IOobjectList.H"
#include "passiveParticle.H"
#include "vtkPV3FoamPoints.H"
// VTK includes
#include "vtkCellArray.h"
#include "vtkPoints.h"
#include "vtkPolyData.h"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh
(
const fvMesh& mesh,
const word& cloudName
)
{
vtkPolyData* vtkmesh = NULL;
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::lagrangianVTKMesh - timePath "
<< mesh.time().timePath()/cloud::prefix/cloudName << endl;
printMemory();
}
// the region name is already in the mesh db
IOobjectList sprayObjs
(
mesh,
mesh.time().timeName(),
cloud::prefix/cloudName
);
IOobject* positionsPtr = sprayObjs.lookup("positions");
if (positionsPtr)
{
Cloud<passiveParticle> parcels(mesh, cloudName, false);
if (debug)
{
Info<< "cloud with " << parcels.size() << " parcels" << endl;
}
vtkmesh = vtkPolyData::New();
vtkPoints* vtkpoints = vtkPoints::New();
vtkCellArray* vtkcells = vtkCellArray::New();
vtkpoints->Allocate( parcels.size() );
vtkcells->Allocate( parcels.size() );
vtkIdType particleId = 0;
forAllConstIter(Cloud<passiveParticle>, parcels, iter)
{
vtkPV3FoamInsertNextPoint(vtkpoints, iter().position());
vtkcells->InsertNextCell(1, &particleId);
particleId++;
}
vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete();
vtkmesh->SetVerts(vtkcells);
vtkcells->Delete();
}
if (debug)
{
Info<< "<end> Foam::vtkPV3Foam::lagrangianVTKMesh" << endl;
printMemory();
}
return vtkmesh;
}
// ************************************************************************* //

View file

@ -1,150 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "vtkPV3Foam.H"
// Foam includes
#include "faceSet.H"
#include "pointSet.H"
#include "vtkPV3FoamPoints.H"
// VTK includes
#include "vtkPoints.h"
#include "vtkPolyData.h"
#include "vtkCellArray.h"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
vtkPolyData* Foam::vtkPV3Foam::faceSetVTKMesh
(
const fvMesh& mesh,
const faceSet& fSet
)
{
vtkPolyData* vtkmesh = vtkPolyData::New();
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::faceSetVTKMesh" << endl;
printMemory();
}
// Construct primitivePatch of faces in fSet.
const faceList& meshFaces = mesh.faces();
faceList patchFaces(fSet.size());
label faceI = 0;
forAllConstIter(faceSet, fSet, iter)
{
patchFaces[faceI++] = meshFaces[iter.key()];
}
primitiveFacePatch p(patchFaces, mesh.points());
// The balance of this routine should be identical to patchVTKMesh
// Convert Foam mesh vertices to VTK
const pointField& points = p.localPoints();
vtkPoints *vtkpoints = vtkPoints::New();
vtkpoints->Allocate( points.size() );
forAll(points, i)
{
vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
}
vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete();
// Add faces as polygons
const faceList& faces = p.localFaces();
vtkCellArray* vtkcells = vtkCellArray::New();
vtkcells->Allocate( faces.size() );
forAll(faces, faceI)
{
const face& f = faces[faceI];
vtkIdType nodeIds[f.size()];
forAll(f, fp)
{
nodeIds[fp] = f[fp];
}
vtkcells->InsertNextCell(f.size(), nodeIds);
}
vtkmesh->SetPolys(vtkcells);
vtkcells->Delete();
if (debug)
{
Info<< "<end> Foam::vtkPV3Foam::faceSetVTKMesh" << endl;
printMemory();
}
return vtkmesh;
}
vtkPolyData* Foam::vtkPV3Foam::pointSetVTKMesh
(
const fvMesh& mesh,
const pointSet& pSet
)
{
vtkPolyData* vtkmesh = vtkPolyData::New();
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::pointSetVTKMesh" << endl;
printMemory();
}
const pointField& meshPoints = mesh.points();
vtkPoints *vtkpoints = vtkPoints::New();
vtkpoints->Allocate( pSet.size() );
forAllConstIter(pointSet, pSet, iter)
{
vtkPV3FoamInsertNextPoint(vtkpoints, meshPoints[iter.key()]);
}
vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete();
if (debug)
{
Info<< "<end> Foam::vtkPV3Foam::pointSetVTKMesh" << endl;
printMemory();
}
return vtkmesh;
}
// ************************************************************************* //

View file

@ -1,354 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "vtkPV3Foam.H"
// Foam includes
#include "fvMesh.H"
#include "cellModeller.H"
#include "vtkPV3FoamPoints.H"
// VTK includes
#include "vtkCellArray.h"
#include "vtkUnstructuredGrid.h"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
(
const fvMesh& mesh,
polyDecomp& decompInfo
)
{
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::volumeVTKMesh" << endl;
printMemory();
}
// Number of additional points needed by the decomposition of polyhedra
label nAddPoints = 0;
// Number of additional cells generated by the decomposition of polyhedra
label nAddCells = 0;
labelList& superCells = decompInfo.superCells();
labelList& addPointCellLabels = decompInfo.addPointCellLabels();
const cellModel& tet = *(cellModeller::lookup("tet"));
const cellModel& pyr = *(cellModeller::lookup("pyr"));
const cellModel& prism = *(cellModeller::lookup("prism"));
const cellModel& wedge = *(cellModeller::lookup("wedge"));
const cellModel& tetWedge = *(cellModeller::lookup("tetWedge"));
const cellModel& hex = *(cellModeller::lookup("hex"));
// Scan for cells which need to be decomposed and count additional points
// and cells
if (debug)
{
Info<< "... building cell-shapes" << endl;
}
const cellShapeList& cellShapes = mesh.cellShapes();
if (debug)
{
Info<< "... scanning" << endl;
}
forAll(cellShapes, cellI)
{
const cellModel& model = cellShapes[cellI].model();
if
(
model != hex
&& model != wedge
&& model != prism
&& model != pyr
&& model != tet
&& model != tetWedge
)
{
const cell& cFaces = mesh.cells()[cellI];
forAll(cFaces, cFaceI)
{
const face& f = mesh.faces()[cFaces[cFaceI]];
label nFacePoints = f.size();
label nQuads = (nFacePoints - 2)/2;
label nTris = (nFacePoints - 2)%2;
nAddCells += nQuads + nTris;
}
nAddCells--;
nAddPoints++;
}
}
// Set size of additional point addressing array
// (from added point to original cell)
addPointCellLabels.setSize(nAddPoints);
// Set size of additional cells mapping array
// (from added cell to original cell)
if (debug)
{
Info<<" mesh nCells = " << mesh.nCells() << nl
<<" nPoints = " << mesh.nPoints() << nl
<<" nAddCells = " << nAddCells << nl
<<" nAddPoints = " << nAddPoints << endl;
}
superCells.setSize(mesh.nCells() + nAddCells);
if (debug)
{
Info<< "... converting points" << endl;
}
// Convert Foam mesh vertices to VTK
vtkPoints *vtkpoints = vtkPoints::New();
vtkpoints->Allocate( mesh.nPoints() + nAddPoints );
const Foam::pointField& points = mesh.points();
forAll(points, i)
{
vtkPV3FoamInsertNextPoint(vtkpoints, points[i]);
}
if (debug)
{
Info<< "... converting cells" << endl;
}
vtkmesh->Allocate( mesh.nCells() + nAddCells );
// Set counters for additional points and additional cells
label addPointI = 0, addCellI = 0;
// Create storage for points - needed for mapping from Foam to VTK
// data types - max 'order' = hex = 8 points
vtkIdType nodeIds[8];
forAll(cellShapes, cellI)
{
const cellShape& cellShape = cellShapes[cellI];
const cellModel& cellModel = cellShape.model();
superCells[addCellI++] = cellI;
if (cellModel == tet)
{
for (int j = 0; j < 4; j++)
{
nodeIds[j] = cellShape[j];
}
vtkmesh->InsertNextCell
(
VTK_TETRA,
4,
nodeIds
);
}
else if (cellModel == pyr)
{
for (int j = 0; j < 5; j++)
{
nodeIds[j] = cellShape[j];
}
vtkmesh->InsertNextCell
(
VTK_PYRAMID,
5,
nodeIds
);
}
else if (cellModel == prism)
{
for (int j = 0; j < 6; j++)
{
nodeIds[j] = cellShape[j];
}
vtkmesh->InsertNextCell
(
VTK_WEDGE,
6,
nodeIds
);
}
else if (cellModel == tetWedge)
{
// Treat as squeezed prism
nodeIds[0] = cellShape[0];
nodeIds[1] = cellShape[2];
nodeIds[2] = cellShape[1];
nodeIds[3] = cellShape[3];
nodeIds[4] = cellShape[4];
nodeIds[5] = cellShape[4];
vtkmesh->InsertNextCell
(
VTK_WEDGE,
6,
nodeIds
);
}
else if (cellModel == wedge)
{
// Treat as squeezed hex
nodeIds[0] = cellShape[0];
nodeIds[1] = cellShape[1];
nodeIds[2] = cellShape[2];
nodeIds[3] = cellShape[2];
nodeIds[4] = cellShape[3];
nodeIds[5] = cellShape[4];
nodeIds[6] = cellShape[5];
nodeIds[7] = cellShape[6];
vtkmesh->InsertNextCell
(
VTK_HEXAHEDRON,
8,
nodeIds
);
}
else if (cellModel == hex)
{
for (int j = 0; j < 8; j++)
{
nodeIds[j] = cellShape[j];
}
vtkmesh->InsertNextCell
(
VTK_HEXAHEDRON,
8,
nodeIds
);
}
else
{
// Polyhedral cell. Decompose into tets + prisms.
// Mapping from additional point to cell
addPointCellLabels[addPointI] = cellI;
// Insert the new vertex from the cell-centre
label newVertexLabel = mesh.nPoints() + addPointI;
vtkPV3FoamInsertNextPoint(vtkpoints, mesh.C()[cellI]);
// Whether to insert cell in place of original or not.
bool substituteCell = true;
const labelList& cFaces = mesh.cells()[cellI];
forAll(cFaces, cFaceI)
{
const face& f = mesh.faces()[cFaces[cFaceI]];
label nFacePoints = f.size();
label nQuads = (nFacePoints - 2)/2;
label nTris = (nFacePoints - 2)%2;
label qpi = 0;
for (label quadi=0; quadi<nQuads; quadi++)
{
if (substituteCell)
{
substituteCell = false;
}
else
{
superCells[addCellI++] = cellI;
}
nodeIds[0] = f[0];
nodeIds[1] = f[qpi + 1];
nodeIds[2] = f[qpi + 2];
nodeIds[3] = f[qpi + 3];
nodeIds[4] = newVertexLabel;
vtkmesh->InsertNextCell
(
VTK_PYRAMID,
5,
nodeIds
);
qpi += 2;
}
if (nTris)
{
if (substituteCell)
{
substituteCell = false;
}
else
{
superCells[addCellI++] = cellI;
}
nodeIds[0] = f[0];
nodeIds[1] = f[qpi + 1];
nodeIds[2] = f[qpi + 2];
nodeIds[3] = newVertexLabel;
vtkmesh->InsertNextCell
(
VTK_TETRA,
4,
nodeIds
);
}
}
addPointI++;
}
}
vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete();
if (debug)
{
Info<< "<end> Foam::vtkPV3Foam::volumeVTKMesh" << endl;
printMemory();
}
return vtkmesh;
}
// ************************************************************************* //

View file

@ -1,129 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass
vtkPV3Foam
\*---------------------------------------------------------------------------*/
#ifndef vtkPV3FoamPatchField_H
#define vtkPV3FoamPatchField_H
// VTK includes
#include "vtkCellData.h"
#include "vtkFloatArray.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkPointData.h"
#include "vtkPolyData.h"
#include "vtkFOAMTupleRemap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void Foam::vtkPV3Foam::convertPatchField
(
const word& name,
const Field<Type>& ptf,
vtkMultiBlockDataSet* output,
const partInfo& selector,
const label datasetNo
)
{
const label nComp = pTraits<Type>::nComponents;
vtkFloatArray* cellData = vtkFloatArray::New();
cellData->SetNumberOfTuples( ptf.size() );
cellData->SetNumberOfComponents( nComp );
cellData->Allocate( nComp*ptf.size() );
cellData->SetName( name.c_str() );
float vec[nComp];
forAll(ptf, i)
{
const Type& t = ptf[i];
for (direction d=0; d<nComp; d++)
{
vec[d] = component(t, d);
}
vtkFOAMTupleRemap<Type>(vec);
cellData->InsertTuple(i, vec);
}
vtkPolyData::SafeDownCast
(
GetDataSetFromBlock(output, selector, datasetNo)
) ->GetCellData()
->AddArray(cellData);
cellData->Delete();
}
// as above, but with PointData()
template<class Type>
void Foam::vtkPV3Foam::convertPatchPointField
(
const word& name,
const Field<Type>& pptf,
vtkMultiBlockDataSet* output,
const partInfo& selector,
const label datasetNo
)
{
const label nComp = pTraits<Type>::nComponents;
vtkFloatArray *pointData = vtkFloatArray::New();
pointData->SetNumberOfTuples( pptf.size() );
pointData->SetNumberOfComponents( nComp );
pointData->Allocate( nComp*pptf.size() );
pointData->SetName( name.c_str() );
float vec[nComp];
forAll(pptf, i)
{
const Type& t = pptf[i];
for (direction d=0; d<nComp; d++)
{
vec[d] = component(t, d);
}
vtkFOAMTupleRemap<Type>(vec);
pointData->InsertTuple(i, vec);
}
vtkPolyData::SafeDownCast
(
GetDataSetFromBlock(output, selector, datasetNo)
) ->GetPointData()
->AddArray(pointData);
pointData->Delete();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,284 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass
vtkPV3Foam
\*---------------------------------------------------------------------------*/
#ifndef vtkPV3FoamPointFields_H
#define vtkPV3FoamPointFields_H
// Foam includes
#include "interpolatePointToCell.H"
#include "vtkFOAMTupleRemap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void Foam::vtkPV3Foam::convertPointFields
(
const fvMesh& mesh,
const pointMesh& pMesh,
const IOobjectList& objects,
vtkMultiBlockDataSet* output
)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAllConstIter(IOobjectList, objects, iter)
{
const word& fieldName = iter()->name();
// restrict to this GeometricField<Type, ...>
if
(
iter()->headerClassName()
!= GeometricField<Type, pointPatchField, pointMesh>::typeName
)
{
continue;
}
if (debug)
{
Info<< "Foam::vtkPV3Foam::convertPointFields : "
<< fieldName << endl;
}
GeometricField<Type, pointPatchField, pointMesh> ptf
(
*iter(),
pMesh
);
// Convert activated internalMesh regions
convertPointFieldBlock
(
ptf,
output,
partInfoVolume_,
regionPolyDecomp_
);
// Convert activated cellZones
convertPointFieldBlock
(
ptf,
output,
partInfoCellZones_,
zonePolyDecomp_
);
// Convert activated cellSets
convertPointFieldBlock
(
ptf,
output,
partInfoCellSets_,
csetPolyDecomp_
);
//
// Convert patches - if activated
//
for
(
int partId = partInfoPatches_.start();
partId < partInfoPatches_.end();
++partId
)
{
const word patchName = getPartName(partId);
const label datasetNo = partDataset_[partId];
const label patchId = patches.findPatchID(patchName);
if (!partStatus_[partId] || datasetNo < 0 || patchId < 0)
{
continue;
}
convertPatchPointField
(
fieldName,
ptf.boundaryField()[patchId].patchInternalField()(),
output,
partInfoPatches_,
datasetNo
);
}
}
}
template<class Type>
void Foam::vtkPV3Foam::convertPointFieldBlock
(
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
vtkMultiBlockDataSet* output,
const partInfo& selector,
const List<polyDecomp>& decompLst
)
{
for (int partId = selector.start(); partId < selector.end(); ++partId)
{
const label datasetNo = partDataset_[partId];
if (datasetNo >= 0 && partStatus_[partId])
{
convertPointField
(
ptf,
GeometricField<Type, fvPatchField, volMesh>::null(),
output,
selector,
datasetNo,
decompLst[datasetNo]
);
}
}
}
template<class Type>
void Foam::vtkPV3Foam::convertPointField
(
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
const GeometricField<Type, fvPatchField, volMesh>& tf,
vtkMultiBlockDataSet* output,
const partInfo& selector,
const label datasetNo,
const polyDecomp& decomp
)
{
const label nComp = pTraits<Type>::nComponents;
const labelList& addPointCellLabels = decomp.addPointCellLabels();
const labelList& pointMap = decomp.pointMap();
// use a pointMap or address directly into mesh
label nPoints;
if (pointMap.size())
{
nPoints = pointMap.size();
}
else
{
nPoints = ptf.size();
}
vtkFloatArray *pointData = vtkFloatArray::New();
pointData->SetNumberOfTuples(nPoints + addPointCellLabels.size());
pointData->SetNumberOfComponents(nComp);
pointData->Allocate(nComp*(nPoints + addPointCellLabels.size()));
pointData->SetName(ptf.name().c_str());
if (debug)
{
Info<< "convert convertPointField: "
<< ptf.name()
<< " size = " << nPoints
<< " nComp=" << nComp
<< " nTuples = " << (nPoints + addPointCellLabels.size())
<< endl;
}
float vec[nComp];
if (pointMap.size())
{
forAll(pointMap, i)
{
const Type& t = ptf[pointMap[i]];
for (direction d=0; d<nComp; d++)
{
vec[d] = component(t, d);
}
vtkFOAMTupleRemap<Type>(vec);
pointData->InsertTuple(i, vec);
}
}
else
{
forAll(ptf, i)
{
const Type& t = ptf[i];
for (direction d=0; d<nComp; d++)
{
vec[d] = component(t, d);
}
vtkFOAMTupleRemap<Type>(vec);
pointData->InsertTuple(i, vec);
}
}
// continue insertion from here
label i = nPoints;
if (&tf != &GeometricField<Type, fvPatchField, volMesh>::null())
{
forAll(addPointCellLabels, apI)
{
const Type& t = tf[addPointCellLabels[apI]];
for (direction d=0; d<nComp; d++)
{
vec[d] = component(t, d);
}
vtkFOAMTupleRemap<Type>(vec);
pointData->InsertTuple(i++, vec);
}
}
else
{
forAll(addPointCellLabels, apI)
{
Type t = interpolatePointToCell(ptf, addPointCellLabels[apI]);
for (direction d=0; d<nComp; d++)
{
vec[d] = component(t, d);
}
vtkFOAMTupleRemap<Type>(vec);
pointData->InsertTuple(i++, vec);
}
}
vtkUnstructuredGrid::SafeDownCast
(
GetDataSetFromBlock(output, selector, datasetNo)
) ->GetPointData()
->AddArray(pointData);
pointData->Delete();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,79 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass
vtkPV3Foam
\*---------------------------------------------------------------------------*/
#ifndef vtkPV3FoamPoints_H
#define vtkPV3FoamPoints_H
// VTK includes
#include "vtkPoints.h"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline void vtkPV3FoamInsertNextPoint
(
vtkPoints *points,
const Foam::point& p
)
{
points->InsertNextPoint(p.x(), p.y(), p.z());
}
#if 0
// this should be faster, but didn't get it working ...
inline void vtkPV3FoamSetPoint
(
vtkPoints *points,
const Foam::label id,
const Foam::point& p
)
{
points->SetPoint(id, p.x(), p.y(), p.z());
}
// Convert Foam mesh vertices to VTK
inline vtkPoints* vtkPV3FoamVTKPoints(const Foam::pointField& points)
{
vtkPoints *vtkpoints = vtkPoints::New();
vtkpoints->SetNumberOfPoints(points.size());
forAll(points, i)
{
const Foam::point& p = points[i];
vtkpoints->SetPoint(i, p.x(), p.y(), p.z());
}
return vtkpoints;
}
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,522 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "vtkPV3Foam.H"
// Foam includes
#include "cellSet.H"
#include "faceSet.H"
#include "pointSet.H"
#include "IOobjectList.H"
#include "IOPtrList.H"
#include "polyBoundaryMeshEntries.H"
#include "entry.H"
#include "Cloud.H"
#include "vtkPV3FoamReader.h"
// local headers
#include "vtkPV3FoamAddToSelection.H"
#include "vtkPV3FoamUpdateInfoFields.H"
// VTK includes
#include "vtkDataArraySelection.h"
// * * * * * * * * * * * * * * * Private Classes * * * * * * * * * * * * * * //
namespace Foam
{
//- A class for reading zone information without requiring a mesh
class zonesEntries
:
public regIOobject,
public PtrList<entry>
{
public:
// Constructors
explicit zonesEntries(const IOobject& io)
:
regIOobject(io),
PtrList<entry>(readStream("regIOobject"))
{
close();
}
// Member functions
bool writeData(Ostream&) const
{
notImplemented("zonesEntries::writeData(Ostream&) const");
return false;
}
};
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::wordList Foam::vtkPV3Foam::readZoneNames(const word& zoneType)
{
wordList zoneNames;
// mesh not loaded - read from file
IOobject ioObj
(
zoneType,
dbPtr_().findInstance
(
meshDir_,
zoneType,
IOobject::READ_IF_PRESENT
),
meshDir_,
dbPtr_(),
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
);
if (ioObj.headerOk())
{
zonesEntries zones(ioObj);
zoneNames.setSize(zones.size());
forAll(zones, zoneI)
{
zoneNames[zoneI] = zones[zoneI].keyword();
}
}
return zoneNames;
}
void Foam::vtkPV3Foam::updateInfoInternalMesh()
{
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::updateInfoInternalMesh" << endl;
}
vtkDataArraySelection* partSelection = reader_->GetPartSelection();
// Determine mesh parts (internalMesh, patches...)
//- Add internal mesh as first entry
partInfoVolume_ = partSelection->GetNumberOfArrays();
partSelection->AddArray("internalMesh");
partInfoVolume_ += 1;
if (debug)
{
// just for debug info
getSelectedArrayEntries(partSelection);
Info<< "<end> Foam::vtkPV3Foam::updateInfoInternalMesh" << endl;
}
}
void Foam::vtkPV3Foam::updateInfoLagrangian()
{
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::updateInfoLagrangian" << nl
<< " " << dbPtr_->timePath()/cloud::prefix << endl;
}
// use the db directly since this might be called without a mesh,
// but the region must get added back in
fileName lagrangianPrefix(cloud::prefix);
if (meshRegion_ != polyMesh::defaultRegion)
{
lagrangianPrefix = meshRegion_/cloud::prefix;
}
// Search for list of lagrangian objects for this time
fileNameList cloudDirs
(
readDir(dbPtr_->timePath()/lagrangianPrefix, fileName::DIRECTORY)
);
vtkDataArraySelection* partSelection = reader_->GetPartSelection();
partInfoLagrangian_ = partSelection->GetNumberOfArrays();
int nClouds = 0;
forAll(cloudDirs, cloudI)
{
// Add cloud to GUI list
partSelection->AddArray
(
(cloudDirs[cloudI] + " - lagrangian").c_str()
);
++nClouds;
}
partInfoLagrangian_ += nClouds;
if (debug)
{
// just for debug info
getSelectedArrayEntries(partSelection);
Info<< "<end> Foam::vtkPV3Foam::updateInfoLagrangian" << endl;
}
}
void Foam::vtkPV3Foam::updateInfoPatches()
{
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::updateInfoPatches"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
}
vtkDataArraySelection* partSelection = reader_->GetPartSelection();
partInfoPatches_ = partSelection->GetNumberOfArrays();
int nPatches = 0;
if (meshPtr_)
{
const polyBoundaryMesh& patches = meshPtr_->boundaryMesh();
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
if (pp.size())
{
// Add patch to GUI list
partSelection->AddArray
(
(pp.name() + " - patch").c_str()
);
++nPatches;
}
}
}
else
{
// mesh not loaded - read from file
// but this could fail if we've supplied a bad region name
IOobject ioObj
(
"boundary",
dbPtr_().findInstance
(
meshDir_,
"boundary",
IOobject::READ_IF_PRESENT
),
meshDir_,
dbPtr_(),
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
);
// this should only ever fail if the mesh region doesn't exist
if (ioObj.headerOk())
{
polyBoundaryMeshEntries patchEntries(ioObj);
// Add (non-zero) patches to the list of mesh parts
forAll(patchEntries, entryI)
{
label nFaces
(
readLabel(patchEntries[entryI].dict().lookup("nFaces"))
);
// Valid patch if nFace > 0 - add patch to GUI list
if (nFaces)
{
partSelection->AddArray
(
(patchEntries[entryI].keyword() + " - patch").c_str()
);
++nPatches;
}
}
}
}
partInfoPatches_ += nPatches;
if (debug)
{
// just for debug info
getSelectedArrayEntries(partSelection);
Info<< "<end> Foam::vtkPV3Foam::updateInfoPatches" << endl;
}
}
void Foam::vtkPV3Foam::updateInfoZones()
{
if (!reader_->GetIncludeZones())
{
return;
}
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::updateInfoZones"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]" << endl;
}
vtkDataArraySelection* partSelection = reader_->GetPartSelection();
wordList namesLst;
//
// cellZones information
// ~~~~~~~~~~~~~~~~~~~~~
if (meshPtr_)
{
namesLst = meshPtr_->cellZones().names();
}
else
{
namesLst = readZoneNames("cellZones");
}
partInfoCellZones_ = partSelection->GetNumberOfArrays();
forAll(namesLst, elemI)
{
partSelection->AddArray((namesLst[elemI] + " - cellZone").c_str());
}
partInfoCellZones_ += namesLst.size();
//
// faceZones information
// ~~~~~~~~~~~~~~~~~~~~~
if (meshPtr_)
{
namesLst = meshPtr_->faceZones().names();
}
else
{
namesLst = readZoneNames("faceZones");
}
partInfoFaceZones_ = partSelection->GetNumberOfArrays();
forAll(namesLst, elemI)
{
partSelection->AddArray
(
(namesLst[elemI] + " - faceZone").c_str()
);
}
partInfoFaceZones_ += namesLst.size();
//
// pointZones information
// ~~~~~~~~~~~~~~~~~~~~~~
if (meshPtr_)
{
namesLst = meshPtr_->pointZones().names();
}
else
{
namesLst = readZoneNames("pointZones");
}
partInfoPointZones_ = partSelection->GetNumberOfArrays();
forAll(namesLst, elemI)
{
partSelection->AddArray
(
(namesLst[elemI] + " - pointZone").c_str()
);
}
partInfoPointZones_ += namesLst.size();
if (debug)
{
// just for debug info
getSelectedArrayEntries(partSelection);
Info<< "<end> Foam::vtkPV3Foam::updateInfoZones" << endl;
}
}
void Foam::vtkPV3Foam::updateInfoSets()
{
if (!reader_->GetIncludeSets())
{
return;
}
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::updateInfoSets" << endl;
}
vtkDataArraySelection* partSelection = reader_->GetPartSelection();
// Add names of sets
IOobjectList objects
(
dbPtr_(),
dbPtr_().findInstance(meshDir_, "faces", IOobject::READ_IF_PRESENT),
meshDir_/"sets"
);
partInfoCellSets_ = partSelection->GetNumberOfArrays();
partInfoCellSets_ += addToSelection<cellSet>
(
partSelection,
objects,
" - cellSet"
);
partInfoFaceSets_ = partSelection->GetNumberOfArrays();
partInfoFaceSets_ += addToSelection<faceSet>
(
partSelection,
objects,
" - faceSet"
);
partInfoPointSets_ = partSelection->GetNumberOfArrays();
partInfoPointSets_ += addToSelection<pointSet>
(
partSelection,
objects,
" - pointSet"
);
if (debug)
{
// just for debug info
getSelectedArrayEntries(partSelection);
Info<< "<end> Foam::vtkPV3Foam::updateInfoSets" << endl;
}
}
void Foam::vtkPV3Foam::updateInfoLagrangianFields()
{
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::updateInfoLagrangianFields"
<< endl;
}
vtkDataArraySelection *fieldSelection =
reader_->GetLagrangianFieldSelection();
// preserve the enabled selections
stringList enabledEntries = getSelectedArrayEntries(fieldSelection);
fieldSelection->RemoveAllArrays();
//
// TODO - currently only get fields from ONE cloud
// have to decide if the second set of fields get mixed in
// or dealt with separately
const partInfo& selector = partInfoLagrangian_;
int partId = selector.start();
if (!selector.size() || partId < 0)
{
return;
}
word cloudName = getPartName(partId);
// use the db directly since this might be called without a mesh,
// but the region must get added back in
fileName lagrangianPrefix(cloud::prefix);
if (meshRegion_ != polyMesh::defaultRegion)
{
lagrangianPrefix = meshRegion_/cloud::prefix;
}
IOobjectList objects
(
dbPtr_(),
dbPtr_().timeName(),
lagrangianPrefix/cloudName
);
addToSelection<IOField<label> >
(
fieldSelection,
objects
);
addToSelection<IOField<scalar> >
(
fieldSelection,
objects
);
addToSelection<IOField<vector> >
(
fieldSelection,
objects
);
addToSelection<IOField<sphericalTensor> >
(
fieldSelection,
objects
);
addToSelection<IOField<symmTensor> >
(
fieldSelection,
objects
);
addToSelection<IOField<tensor> >
(
fieldSelection,
objects
);
// restore the enabled selections
setSelectedArrayEntries(fieldSelection, enabledEntries);
if (debug)
{
Info<< "<end> Foam::vtkPV3Foam::updateInfoLagrangianFields - "
<< "lagrangian objects.size() = " << objects.size() << endl;
}
}
// ************************************************************************* //

View file

@ -1,114 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass
vtkPV3Foam
\*---------------------------------------------------------------------------*/
#ifndef vtkPV3FoamUpdateInfoFields_H
#define vtkPV3FoamUpdateInfoFields_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<template<class> class patchType, class meshType>
void Foam::vtkPV3Foam::updateInfoFields
(
vtkDataArraySelection *select
)
{
if (debug)
{
Info<< "<beg> Foam::vtkPV3Foam::updateInfoFields <"
<< meshType::Mesh::typeName
<< "> [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "]"
<< endl;
}
stringList enabledEntries;
// enable 'p' and 'U' on the first call
if (select->GetNumberOfArrays() == 0 && !meshPtr_)
{
enabledEntries.setSize(2);
enabledEntries[0] = "p";
enabledEntries[1] = "U";
}
else
{
// preserve the enabled selections
enabledEntries = getSelectedArrayEntries(select);
}
select->RemoveAllArrays();
// use the db directly since this might be called without a mesh,
// but the region must get added back in
word regionPrefix;
if (meshRegion_ != polyMesh::defaultRegion)
{
regionPrefix = meshRegion_;
}
// Search for list of objects for this time and mesh region
IOobjectList objects(dbPtr_(), dbPtr_().timeName(), regionPrefix);
//- Add volume fields to GUI
addToSelection<GeometricField<scalar, patchType, meshType> >
(
select,
objects
);
addToSelection<GeometricField<vector, patchType, meshType> >
(
select,
objects
);
addToSelection<GeometricField<sphericalTensor, patchType, meshType> >
(
select,
objects
);
addToSelection<GeometricField<symmTensor, patchType, meshType> >
(
select,
objects
);
addToSelection<GeometricField<tensor, patchType, meshType> >
(
select,
objects
);
// restore the enabled selections
setSelectedArrayEntries(select, enabledEntries);
if (debug)
{
Info<< "<end> Foam::vtkPV3Foam::updateInfoFields" << endl;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,341 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
Misc helper methods and utilities
\*---------------------------------------------------------------------------*/
#include "vtkPV3Foam.H"
#include "vtkPV3FoamReader.h"
// Foam includes
#include "fvMesh.H"
#include "foamTime.H"
#include "IFstream.H"
// VTK includes
#include "vtkDataArraySelection.h"
#include "vtkDataSet.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkInformation.h"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::vtkPV3Foam::AddToBlock
(
vtkMultiBlockDataSet* output,
vtkDataSet* dataset,
const partInfo& selector,
const label datasetNo,
const string& datasetName
)
{
const int blockNo = selector.block();
vtkDataObject* blockDO = output->GetBlock(blockNo);
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
if (!block)
{
if (blockDO)
{
FatalErrorIn("Foam::vtkPV3Foam::AddToBlock")
<< "Block already has a vtkDataSet assigned to it"
<< endl;
return;
}
block = vtkMultiBlockDataSet::New();
output->SetBlock(blockNo, block);
block->Delete();
}
if (debug)
{
Info<< "block[" << blockNo << "] has "
<< block->GetNumberOfBlocks()
<< " datasets prior to adding set " << datasetNo
<< " with name: " << datasetName << endl;
}
block->SetBlock(datasetNo, dataset);
// name the block when assigning dataset 0
if (datasetNo == 0)
{
output->GetMetaData(blockNo)->Set
(
vtkCompositeDataSet::NAME(),
selector.name()
);
}
if (datasetName.size())
{
block->GetMetaData(datasetNo)->Set
(
vtkCompositeDataSet::NAME(),
datasetName.c_str()
);
}
}
vtkDataSet* Foam::vtkPV3Foam::GetDataSetFromBlock
(
vtkMultiBlockDataSet* output,
const partInfo& selector,
const label datasetNo
)
{
const int blockNo = selector.block();
vtkDataObject* blockDO = output->GetBlock(blockNo);
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
if (block)
{
return vtkDataSet::SafeDownCast(block->GetBlock(datasetNo));
}
return 0;
}
// ununsed at the moment
Foam::label Foam::vtkPV3Foam::GetNumberOfDataSets
(
vtkMultiBlockDataSet* output,
const partInfo& selector
)
{
const int blockNo = selector.block();
vtkDataObject* blockDO = output->GetBlock(blockNo);
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
if (block)
{
return block->GetNumberOfBlocks();
}
return 0;
}
Foam::word Foam::vtkPV3Foam::getPartName(int partId)
{
return getFirstWord(reader_->GetPartArrayName(partId));
}
Foam::wordHashSet Foam::vtkPV3Foam::getSelected
(
vtkDataArraySelection* select
)
{
int nElem = select->GetNumberOfArrays();
wordHashSet selections(2*nElem);
for (int elemI=0; elemI < nElem; ++elemI)
{
if (select->GetArraySetting(elemI))
{
selections.insert(getFirstWord(select->GetArrayName(elemI)));
}
}
return selections;
}
Foam::wordHashSet Foam::vtkPV3Foam::getSelected
(
vtkDataArraySelection* select,
const partInfo& selector
)
{
int nElem = select->GetNumberOfArrays();
wordHashSet selections(2*nElem);
for (int elemI = selector.start(); elemI < selector.end(); ++elemI)
{
if (select->GetArraySetting(elemI))
{
selections.insert(getFirstWord(select->GetArrayName(elemI)));
}
}
return selections;
}
Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries
(
vtkDataArraySelection* select
)
{
stringList selections(select->GetNumberOfArrays());
label nElem = 0;
forAll(selections, elemI)
{
if (select->GetArraySetting(elemI))
{
selections[nElem++] = select->GetArrayName(elemI);
}
}
selections.setSize(nElem);
if (debug)
{
label nElem = select->GetNumberOfArrays();
Info<< "available(";
for (int elemI = 0; elemI < nElem; ++elemI)
{
Info<< " \"" << select->GetArrayName(elemI) << "\"";
}
Info<< " )\nselected(";
forAll(selections, elemI)
{
Info<< " " << selections[elemI];
}
Info<< " )\n";
}
return selections;
}
Foam::stringList Foam::vtkPV3Foam::getSelectedArrayEntries
(
vtkDataArraySelection* select,
const partInfo& selector
)
{
stringList selections(selector.size());
label nElem = 0;
for (int elemI = selector.start(); elemI < selector.end(); ++elemI)
{
if (select->GetArraySetting(elemI))
{
selections[nElem++] = select->GetArrayName(elemI);
}
}
selections.setSize(nElem);
if (debug)
{
Info<< "available(";
for (int elemI = selector.start(); elemI < selector.end(); ++elemI)
{
Info<< " \"" << select->GetArrayName(elemI) << "\"";
}
Info<< " )\nselected(";
forAll(selections, elemI)
{
Info<< " " << selections[elemI];
}
Info<< " )\n";
}
return selections;
}
void Foam::vtkPV3Foam::setSelectedArrayEntries
(
vtkDataArraySelection* select,
const stringList& selections
)
{
const int nElem = select->GetNumberOfArrays();
select->DisableAllArrays();
// Loop through entries, setting values from selectedEntries
for (int elemI=0; elemI < nElem; ++elemI)
{
string arrayName(select->GetArrayName(elemI));
forAll(selections, elemI)
{
if (selections[elemI] == arrayName)
{
select->EnableArray(arrayName.c_str());
break;
}
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// parse these bits of info from /proc/meminfo (Linux)
//
// MemTotal: 2062660 kB
// MemFree: 1124400 kB
//
// used = MemTotal - MemFree is what the free(1) uses.
//
void Foam::vtkPV3Foam::printMemory()
{
const char* meminfo = "/proc/meminfo";
if (exists(meminfo))
{
IFstream is(meminfo);
label memTotal = 0;
label memFree = 0;
string line;
while (is.getLine(line).good())
{
char tag[32];
int value;
if (sscanf(line.c_str(), "%30s %d", tag, &value) == 2)
{
if (!strcmp(tag, "MemTotal:"))
{
memTotal = value;
}
else if (!strcmp(tag, "MemFree:"))
{
memFree = value;
}
}
}
Info << "memUsed: " << (memTotal - memFree) << " kB\n";
}
}
// ************************************************************************* //

View file

@ -1,377 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass
vtkPV3Foam
\*---------------------------------------------------------------------------*/
#ifndef vtkPV3FoamVolFields_H
#define vtkPV3FoamVolFields_H
// Foam includes
#include "emptyFvPatchField.H"
#include "wallPolyPatch.H"
#include "faceSet.H"
#include "volPointInterpolation.H"
#include "vtkPV3FoamFaceField.H"
#include "vtkPV3FoamPatchField.H"
#include "vtkFOAMTupleRemap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void Foam::vtkPV3Foam::convertVolFields
(
const fvMesh& mesh,
const PtrList<PrimitivePatchInterpolation<primitivePatch> >& ppInterpList,
const IOobjectList& objects,
vtkMultiBlockDataSet* output
)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAllConstIter(IOobjectList, objects, iter)
{
// restrict to GeometricField<Type, ...>
if
(
iter()->headerClassName()
!= GeometricField<Type, fvPatchField, volMesh>::typeName
)
{
continue;
}
// Load field
GeometricField<Type, fvPatchField, volMesh> tf
(
*iter(),
mesh
);
// Interpolated field (demand driven)
autoPtr<GeometricField<Type, pointPatchField, pointMesh> > ptfPtr;
// Convert activated internalMesh regions
convertVolFieldBlock
(
tf,
ptfPtr,
output,
partInfoVolume_,
regionPolyDecomp_
);
// Convert activated cellZones
convertVolFieldBlock
(
tf,
ptfPtr,
output,
partInfoCellZones_,
zonePolyDecomp_
);
// Convert activated cellSets
convertVolFieldBlock
(
tf,
ptfPtr,
output,
partInfoCellSets_,
csetPolyDecomp_
);
//
// Convert patches - if activated
//
// The name for the interpolated patch point field must be consistent
// with the interpolated volume point field.
// This could be done better.
const word pointFldName = "volPointInterpolate(" + tf.name() + ')';
for
(
int partId = partInfoPatches_.start();
partId < partInfoPatches_.end();
++partId
)
{
const word patchName = getPartName(partId);
const label datasetNo = partDataset_[partId];
const label patchId = patches.findPatchID(patchName);
if (!partStatus_[partId] || datasetNo < 0 || patchId < 0)
{
continue;
}
const fvPatchField<Type>& ptf = tf.boundaryField()[patchId];
if
(
isType<emptyFvPatchField<Type> >(ptf)
||
(
reader_->GetExtrapolatePatches()
&& !polyPatch::constraintType(patches[patchId].type())
)
)
{
fvPatch p(ptf.patch().patch(), tf.mesh().boundary());
tmp<Field<Type> > tpptf
(
fvPatchField<Type>(p, tf).patchInternalField()
);
convertPatchField
(
tf.name(),
tpptf(),
output,
partInfoPatches_,
datasetNo
);
convertPatchPointField
(
pointFldName,
ppInterpList[patchId].faceToPointInterpolate(tpptf)(),
output,
partInfoPatches_,
datasetNo
);
}
else
{
convertPatchField
(
tf.name(),
ptf,
output,
partInfoPatches_,
datasetNo
);
convertPatchPointField
(
pointFldName,
ppInterpList[patchId].faceToPointInterpolate(ptf)(),
output,
partInfoPatches_,
datasetNo
);
}
}
//
// Convert face zones - if activated
//
for
(
int partId = partInfoFaceZones_.start();
partId < partInfoFaceZones_.end();
++partId
)
{
const word zoneName = getPartName(partId);
const label datasetNo = partDataset_[partId];
if (!partStatus_[partId] || datasetNo < 0)
{
continue;
}
const faceZoneMesh& zMesh = mesh.faceZones();
const label zoneId = zMesh.findZoneID(zoneName);
if (zoneId < 0)
{
continue;
}
convertFaceField
(
tf,
output,
partInfoFaceZones_,
datasetNo,
mesh,
zMesh[zoneId]
);
// TODO: points
}
//
// Convert face sets - if activated
//
for
(
int partId = partInfoFaceSets_.start();
partId < partInfoFaceSets_.end();
++partId
)
{
const word selectName = getPartName(partId);
const label datasetNo = partDataset_[partId];
if (!partStatus_[partId] || datasetNo < 0)
{
continue;
}
const faceSet fSet(mesh, selectName);
convertFaceField
(
tf,
output,
partInfoFaceSets_,
datasetNo,
mesh,
fSet
);
// TODO: points
}
}
}
template<class Type>
void Foam::vtkPV3Foam::convertVolFieldBlock
(
const GeometricField<Type, fvPatchField, volMesh>& tf,
autoPtr<GeometricField<Type, pointPatchField, pointMesh> >& ptfPtr,
vtkMultiBlockDataSet* output,
const partInfo& selector,
const List<polyDecomp>& decompLst
)
{
for (int partId = selector.start(); partId < selector.end(); ++partId)
{
const label datasetNo = partDataset_[partId];
if (datasetNo >= 0 && partStatus_[partId])
{
convertVolField
(
tf,
output,
selector,
datasetNo,
decompLst[datasetNo]
);
if (!ptfPtr.valid())
{
if (debug)
{
Info<< "convertVolFieldBlock interpolating:" << tf.name()
<< endl;
}
ptfPtr.reset
(
volPointInterpolation::New(tf.mesh()).interpolate(tf).ptr()
);
}
convertPointField
(
ptfPtr(),
tf,
output,
selector,
datasetNo,
decompLst[datasetNo]
);
}
}
}
template<class Type>
void Foam::vtkPV3Foam::convertVolField
(
const GeometricField<Type, fvPatchField, volMesh>& tf,
vtkMultiBlockDataSet* output,
const partInfo& selector,
const label datasetNo,
const polyDecomp& decompInfo
)
{
const label nComp = pTraits<Type>::nComponents;
const labelList& superCells = decompInfo.superCells();
vtkFloatArray* celldata = vtkFloatArray::New();
celldata->SetNumberOfTuples(superCells.size());
celldata->SetNumberOfComponents(nComp);
celldata->Allocate(nComp*superCells.size());
celldata->SetName(tf.name().c_str());
if (debug)
{
Info<< "convert volField: "
<< tf.name()
<< " size = " << tf.size()
<< " nComp=" << nComp
<< " nTuples = " << superCells.size() << endl;
}
float vec[nComp];
forAll(superCells, i)
{
const Type& t = tf[superCells[i]];
for (direction d=0; d<nComp; d++)
{
vec[d] = component(t, d);
}
vtkFOAMTupleRemap<Type>(vec);
celldata->InsertTuple(i, vec);
}
vtkUnstructuredGrid::SafeDownCast
(
GetDataSetFromBlock(output, selector, datasetNo)
) ->GetCellData()
->AddArray(celldata);
celldata->Delete();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,8 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
rm -rf PV4FoamReader/Make
wclean vtkPV4Foam
# ----------------------------------------------------------------- end-of-file

View file

@ -1,26 +0,0 @@
#!/bin/bash
cd ${0%/*} || exit 1 # run from this directory
set -x
if [ -d "$PARAVIEW_DIR" -a -r "$PARAVIEW_DIR" ]
then
case "$PARAVIEW_VERSION" in
4*)
wmake libso vtkPV4Foam
(
cd PV4FoamReader
mkdir -p Make/$WM_OPTIONS > /dev/null 2>&1
cd Make/$WM_OPTIONS
cmake ../..
if [ "$WM_ARCH_BASE" == "darwin" ]
then
sed -i bak -e 's/-dynamiclib /& -undefined dynamic_lookup /' CMakeFiles/PV4FoamReader.dir/link.txt
sed -i bak -e 's/-dynamiclib /& -undefined dynamic_lookup /' CMakeFiles/PV4FoamReader_SM.dir/link.txt
fi
make
)
;;
esac
fi
# ----------------------------------------------------------------- end-of-file

View file

@ -1,12 +0,0 @@
vtkPV4Foam.C
vtkPV4FoamFields.C
vtkPV4FoamMesh.C
vtkPV4FoamMeshLagrangian.C
vtkPV4FoamMeshPatch.C
vtkPV4FoamMeshSet.C
vtkPV4FoamMeshVolume.C
vtkPV4FoamMeshZone.C
vtkPV4FoamUpdateInfo.C
vtkPV4FoamUtilities.C
LIB = $(FOAM_LIBBIN)/libvtkPV4Foam

View file

@ -1,13 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(PARAVIEW_INCLUDE_DIR) \
-I../PV4FoamReader
LIB_LIBS = \
-l$(WM_PROJECT) \
-lfiniteVolume \
-llagrangian \
-lmeshTools \
$(GLIBS)

View file

@ -1,820 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "vtkPV4Foam.H"
#include "vtkPV4FoamReader.h"
// Foam includes
#include "fvMesh.H"
#include "foamTime.H"
#include "patchZones.H"
// VTK includes
#include "vtkDataArraySelection.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkRenderer.h"
#include "vtkTextActor.h"
#include "vtkTextProperty.h"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::vtkPV4Foam, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
#include "vtkPV4FoamAddToSelection.H"
#include "vtkPV4FoamUpdateInfoFields.H"
void Foam::vtkPV4Foam::resetCounters()
{
// Reset mesh part ids and sizes
partInfoVolume_.reset();
partInfoPatches_.reset();
partInfoLagrangian_.reset();
partInfoCellZones_.reset();
partInfoFaceZones_.reset();
partInfoPointZones_.reset();
partInfoCellSets_.reset();
partInfoFaceSets_.reset();
partInfoPointSets_.reset();
}
void Foam::vtkPV4Foam::reduceMemory()
{
forAll(regionPolyDecomp_, i)
{
regionPolyDecomp_[i].clear();
}
forAll(zonePolyDecomp_, i)
{
zonePolyDecomp_[i].clear();
}
forAll(csetPolyDecomp_, i)
{
csetPolyDecomp_[i].clear();
}
if (!reader_->GetCacheMesh())
{
delete meshPtr_;
meshPtr_ = NULL;
}
}
int Foam::vtkPV4Foam::setTime(int nRequest, const double requestTimes[])
{
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::setTime(";
for (int requestI = 0; requestI < nRequest; ++requestI)
{
if (requestI)
{
Info<< ", ";
}
Info<< requestTimes[requestI];
}
Info << ") - previousIndex = " << timeIndex_ << endl;
}
Time& runTime = dbPtr_();
// Get times list
instantList Times = runTime.times();
int nearestIndex = timeIndex_;
for (int requestI = 0; requestI < nRequest; ++requestI)
{
int index = Time::findClosestTimeIndex(Times, requestTimes[requestI]);
if (index >= 0 && index != timeIndex_)
{
nearestIndex = index;
break;
}
}
if (nearestIndex < 0)
{
nearestIndex = 0;
}
// see what has changed
if (timeIndex_ != nearestIndex)
{
timeIndex_ = nearestIndex;
runTime.setTime(Times[nearestIndex], nearestIndex);
// the fields change each time
fieldsChanged_ = true;
if (meshPtr_)
{
if (meshPtr_->readUpdate() != polyMesh::UNCHANGED)
{
meshChanged_ = true;
}
}
else
{
meshChanged_ = true;
}
reader_->UpdateProgress(0.05);
// this seems to be needed for catching Lagrangian fields
updateInfo();
}
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::setTime() - selectedTime="
<< Times[nearestIndex].name() << " index=" << timeIndex_
<< "/" << Times.size()
<< " meshChanged=" << Switch(meshChanged_)
<< " fieldsChanged=" << Switch(fieldsChanged_) << endl;
}
return nearestIndex;
}
void Foam::vtkPV4Foam::updateMeshPartsStatus()
{
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::updateMeshPartsStatus" << endl;
}
vtkDataArraySelection* selection = reader_->GetPartSelection();
label nElem = selection->GetNumberOfArrays();
if (partStatus_.size() != nElem)
{
partStatus_.setSize(nElem);
partStatus_ = false;
meshChanged_ = true;
}
// this needs fixing if we wish to re-use the datasets
partDataset_.setSize(nElem);
partDataset_ = -1;
// Read the selected mesh parts (zones, patches ...) and add to list
forAll(partStatus_, partId)
{
const int setting = selection->GetArraySetting(partId);
if (partStatus_[partId] != setting)
{
partStatus_[partId] = setting;
meshChanged_ = true;
}
if (debug)
{
Info<< " part[" << partId << "] = "
<< partStatus_[partId]
<< " : " << selection->GetArrayName(partId) << endl;
}
}
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::updateMeshPartsStatus" << endl;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::vtkPV4Foam::vtkPV4Foam
(
const char* const FileName,
vtkPV4FoamReader* reader
)
:
reader_(reader),
dbPtr_(NULL),
meshPtr_(NULL),
meshRegion_(polyMesh::defaultRegion),
meshDir_(polyMesh::meshSubDir),
timeIndex_(-1),
meshChanged_(true),
fieldsChanged_(true),
partInfoVolume_("unzoned"),
partInfoPatches_("patches"),
partInfoLagrangian_("lagrangian"),
partInfoCellZones_("cellZone"),
partInfoFaceZones_("faceZone"),
partInfoPointZones_("pointZone"),
partInfoCellSets_("cellSet"),
partInfoFaceSets_("faceSet"),
partInfoPointSets_("pointSet")
{
if (debug)
{
Info<< "Foam::vtkPV4Foam::vtkPV4Foam - " << FileName << endl;
printMemory();
}
// avoid argList and get rootPath/caseName directly from the file
fileName fullCasePath(fileName(FileName).path());
if (!isDir(fullCasePath))
{
return;
}
if (fullCasePath == ".")
{
fullCasePath = cwd();
}
// Set the case as an environment variable - some BCs might use this
if (fullCasePath.name().find("processor", 0) == 0)
{
const fileName globalCase = fullCasePath.path();
setEnv("FOAM_CASE", globalCase, true);
setEnv("FOAM_CASENAME", globalCase.name(), true);
}
else
{
setEnv("FOAM_CASE", fullCasePath, true);
setEnv("FOAM_CASENAME", fullCasePath.name(), true);
}
// look for 'case{region}.FOAM'
// could be stringent and insist the prefix match the directory name...
// Note: cannot use fileName::name() due to the embedded '{}'
string caseName(fileName(FileName).lessExt());
string::size_type beg = caseName.find_last_of("/{");
string::size_type end = caseName.find('}', beg);
if
(
beg != string::npos && caseName[beg] == '{'
&& end != string::npos && end == caseName.size()-1
)
{
meshRegion_ = caseName.substr(beg+1, end-beg-1);
// some safety
if (!meshRegion_.size())
{
meshRegion_ = polyMesh::defaultRegion;
}
if (meshRegion_ != polyMesh::defaultRegion)
{
meshDir_ = meshRegion_/polyMesh::meshSubDir;
}
}
if (debug)
{
Info<< "fullCasePath=" << fullCasePath << nl
<< "FOAM_CASE=" << getEnv("FOAM_CASE") << nl
<< "FOAM_CASENAME=" << getEnv("FOAM_CASENAME") << nl
<< "region=" << meshRegion_ << endl;
}
// Create time object
dbPtr_.reset
(
new Time
(
Time::controlDictName,
fileName(fullCasePath.path()),
fileName(fullCasePath.name())
)
);
dbPtr_().functionObjects().off();
updateInfo();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::vtkPV4Foam::~vtkPV4Foam()
{
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::~vtkPV4Foam" << endl;
}
delete meshPtr_;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::vtkPV4Foam::updateInfo()
{
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::updateInfo"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] timeIndex="
<< timeIndex_ << endl;
}
resetCounters();
vtkDataArraySelection* partSelection = reader_->GetPartSelection();
// enable 'internalMesh' on the first call
// or preserve the enabled selections
stringList enabledEntries;
if (!partSelection->GetNumberOfArrays() && !meshPtr_)
{
enabledEntries.setSize(1);
enabledEntries[0] = "internalMesh";
}
else
{
enabledEntries = getSelectedArrayEntries(partSelection);
}
// Clear current mesh parts list
partSelection->RemoveAllArrays();
// Update mesh parts list - add Lagrangian at the bottom
updateInfoInternalMesh();
updateInfoPatches();
updateInfoSets();
updateInfoZones();
updateInfoLagrangian();
// restore the enabled selections
setSelectedArrayEntries(partSelection, enabledEntries);
if (meshChanged_)
{
fieldsChanged_ = true;
}
// Update volume, point and lagrangian fields
updateInfoFields<fvPatchField, volMesh>
(
reader_->GetVolFieldSelection()
);
updateInfoFields<pointPatchField, pointMesh>
(
reader_->GetPointFieldSelection()
);
updateInfoLagrangianFields();
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::updateInfo" << endl;
}
}
void Foam::vtkPV4Foam::updateFoamMesh()
{
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::updateFoamMesh" << endl;
printMemory();
}
if (!reader_->GetCacheMesh())
{
delete meshPtr_;
meshPtr_ = NULL;
}
// Check to see if the FOAM mesh has been created
if (!meshPtr_)
{
if (debug)
{
Info<< "Creating Foam mesh for region " << meshRegion_
<< " at time=" << dbPtr_().timeName()
<< endl;
}
meshPtr_ = new fvMesh
(
IOobject
(
meshRegion_,
dbPtr_().timeName(),
dbPtr_(),
IOobject::MUST_READ
)
);
meshChanged_ = true;
}
else
{
if (debug)
{
Info<< "Using existing Foam mesh" << endl;
}
}
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::updateFoamMesh" << endl;
printMemory();
}
}
void Foam::vtkPV4Foam::Update
(
vtkMultiBlockDataSet* output,
vtkMultiBlockDataSet* lagrangianOutput
)
{
if (debug)
{
cout<< "<beg> Foam::vtkPV4Foam::Update - output with "
<< output->GetNumberOfBlocks() << " and "
<< lagrangianOutput->GetNumberOfBlocks() << " blocks\n";
output->Print(cout);
lagrangianOutput->Print(cout);
printMemory();
}
reader_->UpdateProgress(0.1);
// Set up mesh parts selection(s)
updateMeshPartsStatus();
reader_->UpdateProgress(0.15);
// Update the Foam mesh
updateFoamMesh();
reader_->UpdateProgress(0.4);
// Convert meshes - start port0 at block=0
int blockNo = 0;
convertMeshVolume(output, blockNo);
convertMeshPatches(output, blockNo);
reader_->UpdateProgress(0.6);
if (reader_->GetIncludeZones())
{
convertMeshCellZones(output, blockNo);
convertMeshFaceZones(output, blockNo);
convertMeshPointZones(output, blockNo);
reader_->UpdateProgress(0.65);
}
if (reader_->GetIncludeSets())
{
convertMeshCellSets(output, blockNo);
convertMeshFaceSets(output, blockNo);
convertMeshPointSets(output, blockNo);
reader_->UpdateProgress(0.7);
}
#ifdef VTKPV4FOAM_DUALPORT
// restart port1 at block=0
blockNo = 0;
#endif
convertMeshLagrangian(lagrangianOutput, blockNo);
reader_->UpdateProgress(0.8);
// Update fields
convertVolFields(output);
convertPointFields(output);
convertLagrangianFields(lagrangianOutput);
reader_->UpdateProgress(0.95);
meshChanged_ = fieldsChanged_ = false;
}
void Foam::vtkPV4Foam::CleanUp()
{
// reclaim some memory
reduceMemory();
reader_->UpdateProgress(1.0);
}
double* Foam::vtkPV4Foam::findTimes(int& nTimeSteps)
{
int nTimes = 0;
double* tsteps = NULL;
if (dbPtr_.valid())
{
Time& runTime = dbPtr_();
instantList timeLst = runTime.times();
// find the first time for which this mesh appears to exist
label timeI = 0;
for (; timeI < timeLst.size(); ++timeI)
{
const word& timeName = timeLst[timeI].name();
if
(
isFile(runTime.path()/timeName/meshDir_/"points")
&& IOobject("points", timeName, meshDir_, runTime).headerOk()
)
{
break;
}
}
nTimes = timeLst.size() - timeI;
// always skip "constant" time if possible
if (timeI == 0 && nTimes > 1)
{
timeI = 1;
--nTimes;
}
if (nTimes)
{
tsteps = new double[nTimes];
for (label stepI = 0; stepI < nTimes; ++stepI, ++timeI)
{
tsteps[stepI] = timeLst[timeI].value();
}
}
}
else
{
if (debug)
{
cout<< "no valid dbPtr:\n";
}
}
// vector length returned via the parameter
nTimeSteps = nTimes;
return tsteps;
}
void Foam::vtkPV4Foam::addPatchNames(vtkRenderer* renderer)
{
// Remove any patch names previously added to the renderer
removePatchNames(renderer);
// get the display patches, strip off any suffix
wordHashSet selectedPatches = getSelected
(
reader_->GetPartSelection(),
partInfoPatches_
);
if (!selectedPatches.size())
{
return;
}
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::addPatchNames" << nl
<<"... add patches: " << selectedPatches << endl;
}
const polyBoundaryMesh& pbMesh = meshPtr_->boundaryMesh();
// Find the total number of zones
// Each zone will take the patch name
// Number of zones per patch ... zero zones should be skipped
labelList nZones(pbMesh.size(), 0);
// Per global zone number the average face centre position
DynamicList<point> zoneCentre(pbMesh.size());
if (debug)
{
Info<< "... determining patch zones" << endl;
}
// Loop through all patches to determine zones, and centre of each zone
forAll(pbMesh, patchI)
{
const polyPatch& pp = pbMesh[patchI];
// Only include the patch if it is selected
if (!selectedPatches.found(pp.name()))
{
continue;
}
const labelListList& edgeFaces = pp.edgeFaces();
const vectorField& n = pp.faceNormals();
boolList featEdge(pp.nEdges(), false);
forAll(edgeFaces, edgeI)
{
const labelList& eFaces = edgeFaces[edgeI];
if (eFaces.size() == 1)
{
// Note: could also do ones with > 2 faces but this gives
// too many zones for baffles
featEdge[edgeI] = true;
}
else if (mag(n[eFaces[0]] & n[eFaces[1]]) < 0.5)
{
featEdge[edgeI] = true;
}
}
// Do topological analysis of patch, find disconnected regions
patchZones pZones(pp, featEdge);
nZones[patchI] = pZones.nZones();
labelList zoneNFaces(pZones.nZones(), 0);
// Save start of information for current patch
label patchStart = zoneCentre.size();
// Create storage for additional zone centres
forAll(zoneNFaces, zoneI)
{
zoneCentre.append(vector::zero);
}
// Do averaging per individual zone
forAll(pp, faceI)
{
label zoneI = pZones[faceI];
zoneCentre[patchStart+zoneI] += pp[faceI].centre(pp.points());
zoneNFaces[zoneI]++;
}
for (label i=0; i<nZones[patchI]; i++)
{
zoneCentre[patchStart + i] /= zoneNFaces[i];
}
}
// Count number of zones we're actually going to display. This is truncated
// to a max per patch
const label MAXPATCHZONES = 20;
label displayZoneI = 0;
forAll(pbMesh, patchI)
{
displayZoneI += min(MAXPATCHZONES, nZones[patchI]);
}
zoneCentre.shrink();
if (debug)
{
Info<< "patch zone centres = " << zoneCentre << nl
<< "displayed zone centres = " << displayZoneI << nl
<< "zones per patch = " << nZones << endl;
}
// Set the size of the patch labels to max number of zones
patchTextActorsPtrs_.setSize(displayZoneI);
if (debug)
{
Info<< "constructing patch labels" << endl;
}
// Actor index
displayZoneI = 0;
// Index in zone centres
label globalZoneI = 0;
forAll(pbMesh, patchI)
{
const polyPatch& pp = pbMesh[patchI];
// Only selected patches will have a non-zero number of zones
label nDisplayZones = min(MAXPATCHZONES, nZones[patchI]);
label increment = 1;
if (nZones[patchI] >= MAXPATCHZONES)
{
increment = nZones[patchI]/MAXPATCHZONES;
}
for (label i = 0; i < nDisplayZones; i++)
{
if (debug)
{
Info<< "patch name = " << pp.name() << nl
<< "anchor = " << zoneCentre[globalZoneI] << nl
<< "globalZoneI = " << globalZoneI << endl;
}
vtkTextActor* txt = vtkTextActor::New();
txt->SetInput(pp.name().c_str());
// Set text properties
vtkTextProperty* tprop = txt->GetTextProperty();
tprop->SetFontFamilyToArial();
tprop->BoldOff();
tprop->ShadowOff();
tprop->SetLineSpacing(1.0);
tprop->SetFontSize(12);
tprop->SetColor(1.0, 0.0, 0.0);
tprop->SetJustificationToCentered();
// Set text to use 3-D world co-ordinates
txt->GetPositionCoordinate()->SetCoordinateSystemToWorld();
txt->GetPositionCoordinate()->SetValue
(
zoneCentre[globalZoneI].x(),
zoneCentre[globalZoneI].y(),
zoneCentre[globalZoneI].z()
);
// Add text to each renderer
renderer->AddViewProp(txt);
// Maintain a list of text labels added so that they can be
// removed later
patchTextActorsPtrs_[displayZoneI] = txt;
globalZoneI += increment;
displayZoneI++;
}
}
// Resize the patch names list to the actual number of patch names added
patchTextActorsPtrs_.setSize(displayZoneI);
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::addPatchNames" << endl;
}
}
void Foam::vtkPV4Foam::removePatchNames(vtkRenderer* renderer)
{
forAll(patchTextActorsPtrs_, patchI)
{
renderer->RemoveViewProp(patchTextActorsPtrs_[patchI]);
patchTextActorsPtrs_[patchI]->Delete();
}
patchTextActorsPtrs_.clear();
}
void Foam::vtkPV4Foam::PrintSelf(ostream& os, vtkIndent indent) const
{
os << indent << "Number of nodes: "
<< (meshPtr_ ? meshPtr_->nPoints() : 0) << "\n";
os << indent << "Number of cells: "
<< (meshPtr_ ? meshPtr_->nCells() : 0) << "\n";
os << indent << "Number of available time steps: "
<< (dbPtr_.valid() ? dbPtr_().times().size() : 0) << endl;
os << indent << "mesh region: " << meshRegion_ << "\n";
}
// ************************************************************************* //

View file

@ -1,643 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "vtkPV4Foam.H"
// Foam includes
#include "cellSet.H"
#include "faceSet.H"
#include "pointSet.H"
#include "fvMeshSubset.H"
#include "vtkPV4FoamReader.h"
// VTK includes
#include "vtkDataArraySelection.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkPolyData.h"
#include "vtkUnstructuredGrid.h"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::vtkPV4Foam::convertMeshVolume
(
vtkMultiBlockDataSet* output,
int& blockNo
)
{
partInfo& selector = partInfoVolume_;
selector.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
const fvMesh& mesh = *meshPtr_;
// resize for decomposed polyhedra
regionPolyDecomp_.setSize(selector.size());
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::convertMeshVolume" << endl;
printMemory();
}
// Convert the internalMesh
// this looks like more than one part, but it isn't
for (int partId = selector.start(); partId < selector.end(); ++partId)
{
const word partName = "internalMesh";
if (!partStatus_[partId])
{
continue;
}
vtkUnstructuredGrid* vtkmesh = volumeVTKMesh
(
mesh,
regionPolyDecomp_[datasetNo]
);
if (vtkmesh)
{
AddToBlock(output, vtkmesh, selector, datasetNo, partName);
vtkmesh->Delete();
partDataset_[partId] = datasetNo++;
}
}
// anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::convertMeshVolume" << endl;
printMemory();
}
}
void Foam::vtkPV4Foam::convertMeshLagrangian
(
vtkMultiBlockDataSet* output,
int& blockNo
)
{
partInfo& selector = partInfoLagrangian_;
selector.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
const fvMesh& mesh = *meshPtr_;
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::convertMeshLagrangian" << endl;
printMemory();
}
for (int partId = selector.start(); partId < selector.end(); ++partId)
{
const word cloudName = getPartName(partId);
if (!partStatus_[partId])
{
continue;
}
vtkPolyData* vtkmesh = lagrangianVTKMesh(mesh, cloudName);
if (vtkmesh)
{
AddToBlock(output, vtkmesh, selector, datasetNo, cloudName);
vtkmesh->Delete();
partDataset_[partId] = datasetNo++;
}
}
// anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::convertMeshLagrangian" << endl;
printMemory();
}
}
void Foam::vtkPV4Foam::convertMeshPatches
(
vtkMultiBlockDataSet* output,
int& blockNo
)
{
partInfo& selector = partInfoPatches_;
selector.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
const fvMesh& mesh = *meshPtr_;
const polyBoundaryMesh& patches = mesh.boundaryMesh();
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::convertMeshPatches" << endl;
printMemory();
}
for (int partId = selector.start(); partId < selector.end(); ++partId)
{
const word patchName = getPartName(partId);
const label patchId = patches.findPatchID(patchName);
if (!partStatus_[partId] || patchId < 0)
{
continue;
}
if (debug)
{
Info<< "Creating VTK mesh for patch[" << patchId <<"] "
<< patchName << endl;
}
vtkPolyData* vtkmesh = patchVTKMesh(patches[patchId]);
if (vtkmesh)
{
AddToBlock(output, vtkmesh, selector, datasetNo, patchName);
vtkmesh->Delete();
partDataset_[partId] = datasetNo++;
}
}
// anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::convertMeshPatches" << endl;
printMemory();
}
}
void Foam::vtkPV4Foam::convertMeshCellZones
(
vtkMultiBlockDataSet* output,
int& blockNo
)
{
partInfo& selector = partInfoCellZones_;
selector.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
const fvMesh& mesh = *meshPtr_;
// resize for decomposed polyhedra
zonePolyDecomp_.setSize(selector.size());
if (!selector.size())
{
return;
}
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::convertMeshCellZones" << endl;
printMemory();
}
const cellZoneMesh& zMesh = mesh.cellZones();
for (int partId = selector.start(); partId < selector.end(); ++partId)
{
const word zoneName = getPartName(partId);
const label zoneId = zMesh.findZoneID(zoneName);
if (!partStatus_[partId] || zoneId < 0)
{
continue;
}
if (debug)
{
Info<< "Creating VTK mesh for cellZone[" << zoneId << "] "
<< zoneName << endl;
}
fvMeshSubset subsetMesh
(
IOobject
(
"set",
mesh.time().constant(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh
);
subsetMesh.setLargeCellSubset(labelHashSet(zMesh[zoneId]));
vtkUnstructuredGrid* vtkmesh = volumeVTKMesh
(
subsetMesh.subMesh(),
zonePolyDecomp_[datasetNo]
);
if (vtkmesh)
{
// superCells + addPointCellLabels must contain global cell ids
inplaceRenumber
(
subsetMesh.cellMap(),
zonePolyDecomp_[datasetNo].superCells()
);
inplaceRenumber
(
subsetMesh.cellMap(),
zonePolyDecomp_[datasetNo].addPointCellLabels()
);
// copy pointMap as well, otherwise pointFields fail
zonePolyDecomp_[datasetNo].pointMap() = subsetMesh.pointMap();
AddToBlock(output, vtkmesh, selector, datasetNo, zoneName);
vtkmesh->Delete();
partDataset_[partId] = datasetNo++;
}
}
// anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::convertMeshCellZones" << endl;
printMemory();
}
}
void Foam::vtkPV4Foam::convertMeshCellSets
(
vtkMultiBlockDataSet* output,
int& blockNo
)
{
partInfo& selector = partInfoCellSets_;
selector.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
const fvMesh& mesh = *meshPtr_;
// resize for decomposed polyhedra
csetPolyDecomp_.setSize(selector.size());
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::convertMeshCellSets" << endl;
printMemory();
}
for (int partId = selector.start(); partId < selector.end(); ++partId)
{
const word partName = getPartName(partId);
if (!partStatus_[partId])
{
continue;
}
if (debug)
{
Info<< "Creating VTK mesh for cellSet=" << partName << endl;
}
const cellSet cSet(mesh, partName);
fvMeshSubset subsetMesh
(
IOobject
(
"set",
mesh.time().constant(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh
);
subsetMesh.setLargeCellSubset(cSet);
vtkUnstructuredGrid* vtkmesh = volumeVTKMesh
(
subsetMesh.subMesh(),
csetPolyDecomp_[datasetNo]
);
if (vtkmesh)
{
// superCells + addPointCellLabels must contain global cell ids
inplaceRenumber
(
subsetMesh.cellMap(),
csetPolyDecomp_[datasetNo].superCells()
);
inplaceRenumber
(
subsetMesh.cellMap(),
csetPolyDecomp_[datasetNo].addPointCellLabels()
);
// copy pointMap as well, otherwise pointFields fail
csetPolyDecomp_[datasetNo].pointMap() = subsetMesh.pointMap();
AddToBlock(output, vtkmesh, selector, datasetNo, partName);
vtkmesh->Delete();
partDataset_[partId] = datasetNo++;
}
}
// anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::convertMeshCellSets" << endl;
printMemory();
}
}
void Foam::vtkPV4Foam::convertMeshFaceZones
(
vtkMultiBlockDataSet* output,
int& blockNo
)
{
partInfo& selector = partInfoFaceZones_;
selector.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
const fvMesh& mesh = *meshPtr_;
if (!selector.size())
{
return;
}
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::convertMeshFaceZones" << endl;
printMemory();
}
const faceZoneMesh& zMesh = mesh.faceZones();
for (int partId = selector.start(); partId < selector.end(); ++partId)
{
const word zoneName = getPartName(partId);
const label zoneId = zMesh.findZoneID(zoneName);
if (!partStatus_[partId] || zoneId < 0)
{
continue;
}
if (debug)
{
Info<< "Creating VTKmesh for faceZone[" << zoneId << "] "
<< zoneName << endl;
}
vtkPolyData* vtkmesh = faceZoneVTKMesh(mesh, zMesh[zoneId]);
if (vtkmesh)
{
AddToBlock(output, vtkmesh, selector, datasetNo, zoneName);
vtkmesh->Delete();
partDataset_[partId] = datasetNo++;
}
}
// anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::convertMeshFaceZones" << endl;
printMemory();
}
}
void Foam::vtkPV4Foam::convertMeshFaceSets
(
vtkMultiBlockDataSet* output,
int& blockNo
)
{
partInfo& selector = partInfoFaceSets_;
selector.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
const fvMesh& mesh = *meshPtr_;
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::convertMeshFaceSets" << endl;
printMemory();
}
for (int partId = selector.start(); partId < selector.end(); ++partId)
{
const word partName = getPartName(partId);
if (!partStatus_[partId])
{
continue;
}
if (debug)
{
Info<< "Creating VTK mesh for faceSet=" << partName << endl;
}
const faceSet fSet(mesh, partName);
vtkPolyData* vtkmesh = faceSetVTKMesh(mesh, fSet);
if (vtkmesh)
{
AddToBlock(output, vtkmesh, selector, datasetNo, partName);
vtkmesh->Delete();
partDataset_[partId] = datasetNo++;
}
}
// anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::convertMeshFaceSets" << endl;
printMemory();
}
}
void Foam::vtkPV4Foam::convertMeshPointZones
(
vtkMultiBlockDataSet* output,
int& blockNo
)
{
partInfo& selector = partInfoPointZones_;
selector.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
const fvMesh& mesh = *meshPtr_;
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::convertMeshPointZones" << endl;
printMemory();
}
if (selector.size())
{
const pointZoneMesh& zMesh = mesh.pointZones();
for (int partId = selector.start(); partId < selector.end(); ++partId)
{
word zoneName = getPartName(partId);
label zoneId = zMesh.findZoneID(zoneName);
if (!partStatus_[partId] || zoneId < 0)
{
continue;
}
vtkPolyData* vtkmesh = pointZoneVTKMesh(mesh, zMesh[zoneId]);
if (vtkmesh)
{
AddToBlock(output, vtkmesh, selector, datasetNo, zoneName);
vtkmesh->Delete();
partDataset_[partId] = datasetNo++;
}
}
}
// anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::convertMeshPointZones" << endl;
printMemory();
}
}
void Foam::vtkPV4Foam::convertMeshPointSets
(
vtkMultiBlockDataSet* output,
int& blockNo
)
{
partInfo& selector = partInfoPointSets_;
selector.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
const fvMesh& mesh = *meshPtr_;
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::convertMeshPointSets" << endl;
printMemory();
}
for (int partId = selector.start(); partId < selector.end(); ++partId)
{
word partName = getPartName(partId);
if (!partStatus_[partId])
{
continue;
}
if (debug)
{
Info<< "Creating VTK mesh for pointSet=" << partName << endl;
}
const pointSet pSet(mesh, partName);
vtkPolyData* vtkmesh = pointSetVTKMesh(mesh, pSet);
if (vtkmesh)
{
AddToBlock(output, vtkmesh, selector, datasetNo, partName);
vtkmesh->Delete();
partDataset_[partId] = datasetNo++;
}
}
// anything added?
if (datasetNo)
{
++blockNo;
}
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::convertMeshPointSets" << endl;
printMemory();
}
}
// ************************************************************************* //

View file

@ -1,99 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "vtkPV4Foam.H"
// Foam includes
#include "polyPatch.H"
#include "primitivePatch.H"
#include "vtkPV4FoamPoints.H"
// VTK includes
#include "vtkCellArray.h"
#include "vtkPoints.h"
#include "vtkPolyData.h"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
vtkPolyData* Foam::vtkPV4Foam::patchVTKMesh
(
const polyPatch& p
)
{
vtkPolyData* vtkmesh = vtkPolyData::New();
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::patchVTKMesh - " << p.name() << endl;
printMemory();
}
// Convert Foam mesh vertices to VTK
const Foam::pointField& points = p.localPoints();
vtkPoints *vtkpoints = vtkPoints::New();
vtkpoints->Allocate( points.size() );
forAll(points, i)
{
vtkPV4FoamInsertNextPoint(vtkpoints, points[i]);
}
vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete();
// Add faces as polygons
const faceList& faces = p.localFaces();
vtkCellArray* vtkcells = vtkCellArray::New();
vtkcells->Allocate( faces.size() );
forAll(faces, faceI)
{
const face& f = faces[faceI];
vtkIdType nodeIds[f.size()];
forAll(f, fp)
{
nodeIds[fp] = f[fp];
}
vtkcells->InsertNextCell(f.size(), nodeIds);
}
vtkmesh->SetPolys(vtkcells);
vtkcells->Delete();
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::patchVTKMesh - " << p.name() << endl;
printMemory();
}
return vtkmesh;
}
// ************************************************************************* //

View file

@ -1,354 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "vtkPV4Foam.H"
// Foam includes
#include "fvMesh.H"
#include "cellModeller.H"
#include "vtkPV4FoamPoints.H"
// VTK includes
#include "vtkCellArray.h"
#include "vtkUnstructuredGrid.h"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
vtkUnstructuredGrid* Foam::vtkPV4Foam::volumeVTKMesh
(
const fvMesh& mesh,
polyDecomp& decompInfo
)
{
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::volumeVTKMesh" << endl;
printMemory();
}
// Number of additional points needed by the decomposition of polyhedra
label nAddPoints = 0;
// Number of additional cells generated by the decomposition of polyhedra
label nAddCells = 0;
labelList& superCells = decompInfo.superCells();
labelList& addPointCellLabels = decompInfo.addPointCellLabels();
const cellModel& tet = *(cellModeller::lookup("tet"));
const cellModel& pyr = *(cellModeller::lookup("pyr"));
const cellModel& prism = *(cellModeller::lookup("prism"));
const cellModel& wedge = *(cellModeller::lookup("wedge"));
const cellModel& tetWedge = *(cellModeller::lookup("tetWedge"));
const cellModel& hex = *(cellModeller::lookup("hex"));
// Scan for cells which need to be decomposed and count additional points
// and cells
if (debug)
{
Info<< "... building cell-shapes" << endl;
}
const cellShapeList& cellShapes = mesh.cellShapes();
if (debug)
{
Info<< "... scanning" << endl;
}
forAll(cellShapes, cellI)
{
const cellModel& model = cellShapes[cellI].model();
if
(
model != hex
&& model != wedge
&& model != prism
&& model != pyr
&& model != tet
&& model != tetWedge
)
{
const cell& cFaces = mesh.cells()[cellI];
forAll(cFaces, cFaceI)
{
const face& f = mesh.faces()[cFaces[cFaceI]];
label nFacePoints = f.size();
label nQuads = (nFacePoints - 2)/2;
label nTris = (nFacePoints - 2)%2;
nAddCells += nQuads + nTris;
}
nAddCells--;
nAddPoints++;
}
}
// Set size of additional point addressing array
// (from added point to original cell)
addPointCellLabels.setSize(nAddPoints);
// Set size of additional cells mapping array
// (from added cell to original cell)
if (debug)
{
Info<<" mesh nCells = " << mesh.nCells() << nl
<<" nPoints = " << mesh.nPoints() << nl
<<" nAddCells = " << nAddCells << nl
<<" nAddPoints = " << nAddPoints << endl;
}
superCells.setSize(mesh.nCells() + nAddCells);
if (debug)
{
Info<< "... converting points" << endl;
}
// Convert Foam mesh vertices to VTK
vtkPoints *vtkpoints = vtkPoints::New();
vtkpoints->Allocate( mesh.nPoints() + nAddPoints );
const Foam::pointField& points = mesh.points();
forAll(points, i)
{
vtkPV4FoamInsertNextPoint(vtkpoints, points[i]);
}
if (debug)
{
Info<< "... converting cells" << endl;
}
vtkmesh->Allocate( mesh.nCells() + nAddCells );
// Set counters for additional points and additional cells
label addPointI = 0, addCellI = 0;
// Create storage for points - needed for mapping from Foam to VTK
// data types - max 'order' = hex = 8 points
vtkIdType nodeIds[8];
forAll(cellShapes, cellI)
{
const cellShape& cellShape = cellShapes[cellI];
const cellModel& cellModel = cellShape.model();
superCells[addCellI++] = cellI;
if (cellModel == tet)
{
for (int j = 0; j < 4; j++)
{
nodeIds[j] = cellShape[j];
}
vtkmesh->InsertNextCell
(
VTK_TETRA,
4,
nodeIds
);
}
else if (cellModel == pyr)
{
for (int j = 0; j < 5; j++)
{
nodeIds[j] = cellShape[j];
}
vtkmesh->InsertNextCell
(
VTK_PYRAMID,
5,
nodeIds
);
}
else if (cellModel == prism)
{
for (int j = 0; j < 6; j++)
{
nodeIds[j] = cellShape[j];
}
vtkmesh->InsertNextCell
(
VTK_WEDGE,
6,
nodeIds
);
}
else if (cellModel == tetWedge)
{
// Treat as squeezed prism
nodeIds[0] = cellShape[0];
nodeIds[1] = cellShape[2];
nodeIds[2] = cellShape[1];
nodeIds[3] = cellShape[3];
nodeIds[4] = cellShape[4];
nodeIds[5] = cellShape[4];
vtkmesh->InsertNextCell
(
VTK_WEDGE,
6,
nodeIds
);
}
else if (cellModel == wedge)
{
// Treat as squeezed hex
nodeIds[0] = cellShape[0];
nodeIds[1] = cellShape[1];
nodeIds[2] = cellShape[2];
nodeIds[3] = cellShape[2];
nodeIds[4] = cellShape[3];
nodeIds[5] = cellShape[4];
nodeIds[6] = cellShape[5];
nodeIds[7] = cellShape[6];
vtkmesh->InsertNextCell
(
VTK_HEXAHEDRON,
8,
nodeIds
);
}
else if (cellModel == hex)
{
for (int j = 0; j < 8; j++)
{
nodeIds[j] = cellShape[j];
}
vtkmesh->InsertNextCell
(
VTK_HEXAHEDRON,
8,
nodeIds
);
}
else
{
// Polyhedral cell. Decompose into tets + prisms.
// Mapping from additional point to cell
addPointCellLabels[addPointI] = cellI;
// Insert the new vertex from the cell-centre
label newVertexLabel = mesh.nPoints() + addPointI;
vtkPV4FoamInsertNextPoint(vtkpoints, mesh.C()[cellI]);
// Whether to insert cell in place of original or not.
bool substituteCell = true;
const labelList& cFaces = mesh.cells()[cellI];
forAll(cFaces, cFaceI)
{
const face& f = mesh.faces()[cFaces[cFaceI]];
label nFacePoints = f.size();
label nQuads = (nFacePoints - 2)/2;
label nTris = (nFacePoints - 2)%2;
label qpi = 0;
for (label quadi=0; quadi<nQuads; quadi++)
{
if (substituteCell)
{
substituteCell = false;
}
else
{
superCells[addCellI++] = cellI;
}
nodeIds[0] = f[0];
nodeIds[1] = f[qpi + 1];
nodeIds[2] = f[qpi + 2];
nodeIds[3] = f[qpi + 3];
nodeIds[4] = newVertexLabel;
vtkmesh->InsertNextCell
(
VTK_PYRAMID,
5,
nodeIds
);
qpi += 2;
}
if (nTris)
{
if (substituteCell)
{
substituteCell = false;
}
else
{
superCells[addCellI++] = cellI;
}
nodeIds[0] = f[0];
nodeIds[1] = f[qpi + 1];
nodeIds[2] = f[qpi + 2];
nodeIds[3] = newVertexLabel;
vtkmesh->InsertNextCell
(
VTK_TETRA,
4,
nodeIds
);
}
}
addPointI++;
}
}
vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete();
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::volumeVTKMesh" << endl;
printMemory();
}
return vtkmesh;
}
// ************************************************************************* //

View file

@ -1,173 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "vtkPV4Foam.H"
// Foam includes
#include "vtkPV4FoamPoints.H"
// VTK includes
#include "vtkPoints.h"
#include "vtkPolyData.h"
#include "vtkCellArray.h"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
vtkPolyData* Foam::vtkPV4Foam::faceZoneVTKMesh
(
const fvMesh& mesh,
const labelList& faceLabels
)
{
vtkPolyData* vtkmesh = vtkPolyData::New();
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::faceZoneVTKMesh" << endl;
printMemory();
}
// Construct primitivePatch of faces in faceZone
const faceList& meshFaces = mesh.allFaces();
faceList patchFaces(faceLabels.size());
label npf = 0;
// Filter faces that are not in live mesh
// Bug fix. HJ, 21/Mar/2011
forAll(faceLabels, faceI)
{
if (faceLabels[faceI] < mesh.nFaces())
{
patchFaces[npf] = meshFaces[faceLabels[faceI]];
npf++;
}
}
patchFaces.setSize(npf);
primitiveFacePatch p(patchFaces, mesh.points());
// The balance of this routine should be identical to patchVTKMesh
// Convert Foam mesh vertices to VTK
const pointField& points = p.localPoints();
vtkPoints* vtkpoints = vtkPoints::New();
vtkpoints->Allocate(points.size());
forAll(points, i)
{
vtkPV4FoamInsertNextPoint(vtkpoints, points[i]);
}
vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete();
// Add faces as polygons
const faceList& faces = p.localFaces();
vtkCellArray* vtkcells = vtkCellArray::New();
vtkcells->Allocate( faces.size() );
forAll(faces, faceI)
{
const face& f = faces[faceI];
vtkIdType nodeIds[f.size()];
forAll(f, fp)
{
nodeIds[fp] = f[fp];
}
vtkcells->InsertNextCell(f.size(), nodeIds);
}
vtkmesh->SetPolys(vtkcells);
vtkcells->Delete();
if (debug)
{
Info<< "<end> Foam::vtkPV4Foam::faceZoneVTKMesh" << endl;
printMemory();
}
return vtkmesh;
}
vtkPolyData* Foam::vtkPV4Foam::pointZoneVTKMesh
(
const fvMesh& mesh,
const labelList& pointLabels
)
{
vtkPolyData* vtkmesh = vtkPolyData::New();
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::pointZoneVTKMesh" << endl;
printMemory();
}
const pointField& meshPoints = mesh.allPoints();
// Filter point labels to include only live points
labelList pl(pointLabels.size());
label npl = 0;
forAll (pointLabels, pointI)
{
if (pointLabels[pointI] < mesh.nPoints())
{
pl[npl] = pointLabels[pointI];
npl++;
}
}
pl.setSize(npl);
vtkPoints *vtkpoints = vtkPoints::New();
vtkpoints->Allocate( pl.size());
forAll(pointLabels, pointI)
{
vtkPV4FoamInsertNextPoint(vtkpoints, meshPoints[pl[pointI]]);
}
vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete();
if (debug)
{
Info<< "<beg> Foam::vtkPV4Foam::pointZoneVTKMesh" << endl;
printMemory();
}
return vtkmesh;
}
// ************************************************************************* //

View file

@ -1,21 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
then
case "$ParaView_VERSION" in
2*)
wmake libso vtkFoam
(
cd PVFoamReader
mkdir -p Make/$WM_OPTIONS > /dev/null 2>&1
cd Make/$WM_OPTIONS
cmake ../..
make
)
;;
esac
fi
# ----------------------------------------------------------------- end-of-file

View file

@ -1,79 +0,0 @@
# Set the project/library name here. Classes should be declared as
# "class VTK_FoamReader_EXPORT vtkFoo", where PVFoamReader is the name of the
# project set here.
PROJECT(PVFoamReader)
# Set your list of sources here. Do not change the name of the
# PVFoamReader_SRCS variable.
SET(PVFoamReader_SRCS
vtkFoamReader.cxx
vtkFoamData.cxx
)
# List the kits from VTK that are needed by this project. Do not
# change the name of the PVFoamReader_LIBS variable.
SET(PVFoamReader_LIBS
vtkGraphics
)
INCLUDE_DIRECTORIES(
$ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude
$ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude
$ENV{ParaView_INST_DIR}/include
../vtkFoam/lnInclude
)
ADD_DEFINITIONS(-DWM_$ENV{WM_PRECISION_OPTION})
#-----------------------------------------------------------------------------
# Most users should not need to change anything below this line.
# Need to include class headers and the configuration header.
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
# Import ParaView build settings.
FIND_PACKAGE(ParaView)
IF(NOT ParaView_FOUND)
MESSAGE(FATAL_ERROR "ParaView is required. Set ParaView_DIR.")
ENDIF(NOT ParaView_FOUND)
IF(NOT PARAVIEW_BUILD_SHARED_LIBS)
MESSAGE(FATAL_ERROR "ParaView must be built with BUILD_SHARED_LIBS ON.")
ENDIF(NOT PARAVIEW_BUILD_SHARED_LIBS)
INCLUDE(${PARAVIEW_USE_FILE})
# Configure output directories.
SET (LIBRARY_OUTPUT_PATH $ENV{FOAM_LIBBIN} CACHE INTERNAL
"Single output directory for building all libraries.")
SET (EXECUTABLE_OUTPUT_PATH $ENV{FOAM_APPBIN} CACHE INTERNAL
"Single output directory for building all executables.")
# Create the configuration header.
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PVFoamReaderConfigure.h.in
${PROJECT_BINARY_DIR}/vtk${PROJECT_NAME}Configure.h
@ONLY IMMEDIATE)
# Must be defined before ADD_LIBRARY for cmake version 2.3.4-20060317
LINK_DIRECTORIES($ENV{FOAM_LIBBIN})
LINK_DIRECTORIES($ENV{FOAM_USER_LIBBIN})
# Create vtk client/server wrappers for the classes.
VTK_WRAP_ClientServer(${PROJECT_NAME} PVFoamReaderCS_SRCS "${PVFoamReader_SRCS}")
# Build the package as a plugin for ParaView.
ADD_LIBRARY(${PROJECT_NAME} MODULE ${PVFoamReader_SRCS} ${PVFoamReaderCS_SRCS})
LINK_DIRECTORIES($ENV{ParaView_INST_DIR}/lib)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} vtkClientServer)
FOREACH(c ${PVFoamReader_LIBS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${c}CS)
ENDFOREACH(c)
# Place the package configuration file into the build tree.
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PVFoamReader.xml.in
${PROJECT_BINARY_DIR}/../${PROJECT_NAME}.xml @ONLY IMMEDIATE)
# Place the package configuration file into the build tree.
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PVFoamReader.pvsm.in
${PROJECT_BINARY_DIR}/../${PROJECT_NAME}.pvsm @ONLY IMMEDIATE)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} OpenFOAM finiteVolume vtkFoam)
#-----------------------------------------------------------------------------

View file

@ -1,154 +0,0 @@
<ServerManagerConfiguration>
<ProxyGroup name="sources">
<SourceProxy
name="FoamReader"
class="vtkFoamReader">
<StringVectorProperty
name="FileName"
command="SetFileName"
number_of_elements="1">
<StringListDomain name="files"/>
</StringVectorProperty>
<IntVectorProperty
name="UpdateGUI"
command="SetUpdateGUI"
number_of_elements="1"
default_values="0">
<BooleanDomain name="bool"/>
</IntVectorProperty>
<IntVectorProperty
name="CacheMesh"
command="SetCacheMesh"
number_of_elements="1"
default_values="1">
<BooleanDomain name="bool"/>
</IntVectorProperty>
<IntVectorProperty
name="TimeStepRangeInfo"
command="GetTimeStepRange"
information_only="1">
<SimpleIntInformationHelper/>
</IntVectorProperty>
<IntVectorProperty
name="TimeStep"
command="SetTimeStep"
number_of_elements="1"
animateable="1"
default_values="0">
<IntRangeDomain name="range">
<RequiredProperties>
<Property name="TimeStepRangeInfo" function="Range"/>
</RequiredProperties>
</IntRangeDomain>
</IntVectorProperty>
<IntVectorProperty
name="TimeStepLimitsInfo"
command="GetTimeStepLimits"
information_only="1">
<SimpleIntInformationHelper/>
</IntVectorProperty>
<IntVectorProperty
name="TimeStepLimits"
command="SetTimeStepLimits"
number_of_elements="2"
default_values="2 5" >
<IntRangeDomain name="range">
<RequiredProperties>
<Property name="TimeStepLimitsInfo" function="Range"/>
</RequiredProperties>
</IntRangeDomain>
</IntVectorProperty>
<StringVectorProperty
name="TimeArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="Time"/>
</StringVectorProperty>
<StringVectorProperty
name="TimeStatus"
command="SetTimeArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="TimeArrayInfo">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="TimeArrayInfo"
function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<StringVectorProperty
name="RegionArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="Region"/>
</StringVectorProperty>
<StringVectorProperty
name="RegionStatus"
command="SetRegionArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="RegionArrayInfo">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="RegionArrayInfo"
function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<StringVectorProperty
name="VolFieldArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="VolField"/>
</StringVectorProperty>
<StringVectorProperty
name="VolFieldStatus"
command="SetVolFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="VolFieldArrayInfo">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="VolFieldArrayInfo"
function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<StringVectorProperty
name="PointFieldArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="PointField"/>
</StringVectorProperty>
<StringVectorProperty
name="PointFieldStatus"
command="SetPointFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="PointFieldArrayInfo">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="PointFieldArrayInfo"
function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>

View file

@ -1,71 +0,0 @@
<ModuleInterfaces>
<Library name="PVFoamReader"/>
<ServerManagerFile name="PVFoamReader.pvsm"/>
<Module name="FoamReader"
class="vtkPVAdvancedReaderModule"
root_name="Foam"
output="vtkDataSet"
module_type="Reader"
extensions=".foam"
file_description="Foam case">
<Source class="vtkFoamReader"/>
<LabeledToggle
label="Update GUI"
trace_name="UpdateGUI"
property="UpdateGUI"
help="To update GUI without execution toggle this Accept and Reset."/>
<LabeledToggle
label="Cache Mesh"
trace_name="CacheMesh"
property="CacheMesh"
help="Cache the FOAM mesh between GUI selection changes."/>
<Scale
property="TimeStep"
trace_name="TimeStep"
label="Time step"
display_entry="0"
display_value="1"
entry_and_label_on_top="0"
help="Select a time step."
keeps_timesteps="1"
range_source="TimeStepRange"/>
<VectorEntry
property="TimeStepLimits"
type="int"
trace_name="TimeStepLimits"
length="2"
label="Lower and Upper Times"
help="Maximum lower and upper number of time steps displayed in the selection list."/>
<ArraySelection
label_text="Time"
property="TimeStatus"
trace_name="TimeArrays"/>
<ArraySelection
label_text="Region"
property="RegionStatus"
trace_name="RegionArrays"/>
<ArraySelection
label_text="Vol Field"
property="VolFieldStatus"
trace_name="CellArrays"/>
<ArraySelection
label_text="Point Field"
property="PointFieldStatus"
trace_name="PointArrays"/>
<Documentation>
ParaView Foam reader module
</Documentation>
</Module>
</ModuleInterfaces>

View file

@ -1,154 +0,0 @@
<ServerManagerConfiguration>
<ProxyGroup name="sources">
<SourceProxy
name="FoamReader"
class="vtkFoamReader">
<StringVectorProperty
name="FileName"
command="SetFileName"
number_of_elements="1">
<StringListDomain name="files"/>
</StringVectorProperty>
<IntVectorProperty
name="UpdateGUI"
command="SetUpdateGUI"
number_of_elements="1"
default_values="0">
<BooleanDomain name="bool"/>
</IntVectorProperty>
<IntVectorProperty
name="CacheMesh"
command="SetCacheMesh"
number_of_elements="1"
default_values="1">
<BooleanDomain name="bool"/>
</IntVectorProperty>
<IntVectorProperty
name="TimeStepRangeInfo"
command="GetTimeStepRange"
information_only="1">
<SimpleIntInformationHelper/>
</IntVectorProperty>
<IntVectorProperty
name="TimeStep"
command="SetTimeStep"
number_of_elements="1"
animateable="1"
default_values="0">
<IntRangeDomain name="range">
<RequiredProperties>
<Property name="TimeStepRangeInfo" function="Range"/>
</RequiredProperties>
</IntRangeDomain>
</IntVectorProperty>
<IntVectorProperty
name="TimeStepLimitsInfo"
command="GetTimeStepLimits"
information_only="1">
<SimpleIntInformationHelper/>
</IntVectorProperty>
<IntVectorProperty
name="TimeStepLimits"
command="SetTimeStepLimits"
number_of_elements="2"
default_values="2 5" >
<IntRangeDomain name="range">
<RequiredProperties>
<Property name="TimeStepLimitsInfo" function="Range"/>
</RequiredProperties>
</IntRangeDomain>
</IntVectorProperty>
<StringVectorProperty
name="TimeArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="Time"/>
</StringVectorProperty>
<StringVectorProperty
name="TimeStatus"
command="SetTimeArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="TimeArrayInfo">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="TimeArrayInfo"
function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<StringVectorProperty
name="RegionArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="Region"/>
</StringVectorProperty>
<StringVectorProperty
name="RegionStatus"
command="SetRegionArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="RegionArrayInfo">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="RegionArrayInfo"
function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<StringVectorProperty
name="VolFieldArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="VolField"/>
</StringVectorProperty>
<StringVectorProperty
name="VolFieldStatus"
command="SetVolFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="VolFieldArrayInfo">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="VolFieldArrayInfo"
function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<StringVectorProperty
name="PointFieldArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="PointField"/>
</StringVectorProperty>
<StringVectorProperty
name="PointFieldStatus"
command="SetPointFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="PointFieldArrayInfo">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="PointFieldArrayInfo"
function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>

View file

@ -1,71 +0,0 @@
<ModuleInterfaces>
<Library name="@PROJECT_NAME@"/>
<ServerManagerFile name="@PROJECT_NAME@.pvsm"/>
<Module name="FoamReader"
class="vtkPVAdvancedReaderModule"
root_name="Foam"
output="vtkDataSet"
module_type="Reader"
extensions=".foam"
file_description="Foam case">
<Source class="vtkFoamReader"/>
<LabeledToggle
label="Update GUI"
trace_name="UpdateGUI"
property="UpdateGUI"
help="To update GUI without execution toggle this Accept and Reset."/>
<LabeledToggle
label="Cache Mesh"
trace_name="CacheMesh"
property="CacheMesh"
help="Cache the FOAM mesh between GUI selection changes."/>
<Scale
property="TimeStep"
trace_name="TimeStep"
label="Time step"
display_entry="0"
display_value="1"
entry_and_label_on_top="0"
help="Select a time step."
keeps_timesteps="1"
range_source="TimeStepRange"/>
<VectorEntry
property="TimeStepLimits"
type="int"
trace_name="TimeStepLimits"
length="2"
label="Lower and Upper Times"
help="Maximum lower and upper number of time steps displayed in the selection list."/>
<ArraySelection
label_text="Time"
property="TimeStatus"
trace_name="TimeArrays"/>
<ArraySelection
label_text="Region"
property="RegionStatus"
trace_name="RegionArrays"/>
<ArraySelection
label_text="Vol Field"
property="VolFieldStatus"
trace_name="CellArrays"/>
<ArraySelection
label_text="Point Field"
property="PointFieldStatus"
trace_name="PointArrays"/>
<Documentation>
ParaView Foam reader module
</Documentation>
</Module>
</ModuleInterfaces>

View file

@ -1,18 +0,0 @@
/*=========================================================================
This source has no copyright. It is intended to be copied by users
wishing to create their own ParaView plugin classes locally.
=========================================================================*/
#ifndef __vtk@PROJECT_NAME@_h
#define __vtk@PROJECT_NAME@_h
#if defined(_WIN32)
# if defined(@PROJECT_NAME@_EXPORTS)
# define VTK_@PROJECT_NAME@_EXPORT __declspec(dllexport)
# else
# define VTK_@PROJECT_NAME@_EXPORT __declspec(dllimport)
# endif
#else
# define VTK_@PROJECT_NAME@_EXPORT
#endif
#endif

View file

@ -1,48 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include <ctype.h>
#include "vtkFoamData.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkFoamData, "$Revision: 1.20 $");
vtkStandardNewMacro(vtkFoamData);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
vtkFoamData::vtkFoamData()
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
vtkFoamData::~vtkFoamData()
{}
// ************************************************************************* //

View file

@ -1,69 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
vtkFoamData
Description
SourceFiles
vtkFoamData.cxx
\*---------------------------------------------------------------------------*/
#ifndef vtkFoamData_h
#define vtkFoamData_h
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "vtkDataSetSource.h"
/*---------------------------------------------------------------------------*\
Class vtkFoamData Declaration
\*---------------------------------------------------------------------------*/
class VTK_IO_EXPORT vtkFoamData
:
public vtkDataSetSource
{
public:
static vtkFoamData *New();
vtkTypeRevisionMacro(vtkFoamData,vtkDataSetSource);
vtkFoamData();
~vtkFoamData();
void SetNthOutput(int num, vtkDataObject *output)
{
vtkDataSetSource::SetNthOutput(num, output);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,410 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include <ctype.h>
#include "vtkFoamReader.h"
#include "vtkCallbackCommand.h"
#include "vtkDataArraySelection.h"
#include "vtkDataArrayCollection.h"
#include "vtkObjectFactory.h"
#include "vtkDataSet.h"
#include "vtkErrorCode.h"
#include "vtkUnstructuredGrid.h"
#include "vtkFoam.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
vtkCxxRevisionMacro(vtkFoamReader, "$Revision: 1.20 $");
vtkStandardNewMacro(vtkFoamReader);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
vtkFoamReader::vtkFoamReader()
{
StoredOutputs = NULL;
FileName = NULL;
foamData_ = NULL;
CacheMesh = 0;
UpdateGUI = 1;
UpdateGUIOld = 1;
TimeStep = 0;
TimeStepRange[0] = 0;
TimeStepRange[1] = 0;
TimeStepLimits[0] = 2;
TimeStepLimits[1] = 5;
TimeSelection = vtkDataArraySelection::New();
RegionSelection = vtkDataArraySelection::New();
VolFieldSelection = vtkDataArraySelection::New();
PointFieldSelection = vtkDataArraySelection::New();
// Setup the selection callback to modify this object when an array
// selection is changed.
SelectionObserver = vtkCallbackCommand::New();
SelectionObserver->SetCallback(&vtkFoamReader::SelectionModifiedCallback);
SelectionObserver->SetClientData(this);
TimeSelection->AddObserver
(
vtkCommand::ModifiedEvent,
this->SelectionObserver
);
RegionSelection->AddObserver
(
vtkCommand::ModifiedEvent,
this->SelectionObserver
);
VolFieldSelection->AddObserver
(
vtkCommand::ModifiedEvent,
this->SelectionObserver
);
PointFieldSelection->AddObserver
(
vtkCommand::ModifiedEvent,
this->SelectionObserver
);
// This is needed by ParaView 2.?.?
this->SetNumberOfOutputPorts(0);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
vtkFoamReader::~vtkFoamReader()
{
if (foamData_)
{
delete foamData_;
}
if (StoredOutputs)
{
StoredOutputs->Delete();
}
if (FileName)
{
delete [] FileName;
}
TimeSelection->RemoveObserver(this->SelectionObserver);
RegionSelection->RemoveObserver(this->SelectionObserver);
VolFieldSelection->RemoveObserver(this->SelectionObserver);
PointFieldSelection->RemoveObserver(this->SelectionObserver);
SelectionObserver->Delete();
TimeSelection->Delete();
RegionSelection->Delete();
VolFieldSelection->Delete();
PointFieldSelection->Delete();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void vtkFoamReader::ExecuteInformation()
{
if (!foamData_)
{
vtkDebugMacro( << "Reading Foam case" << FileName);
foamData_ = new Foam::vtkFoam(FileName, this);
}
else
{
foamData_->UpdateInformation();
}
vtkDebugMacro( << "end of ExecuteInformation\n");
}
void vtkFoamReader::Execute()
{
if (!StoredOutputs)
{
foamData_->Update();
StoredOutputs = vtkFoamData::New();
for (int i = 0; i < GetNumberOfOutputs(); i++)
{
vtkDataObject* tmp = GetOutput(i);
vtkDataObject* output = tmp->NewInstance();
output->ShallowCopy(tmp);
StoredOutputs->SetNthOutput(i, output);
output->Delete();
}
}
else
{
for (int i = 0; i < GetNumberOfOutputs(); i++)
{
vtkDataObject* output = GetOutput(i);
int tempExtent[6];
output->GetUpdateExtent(tempExtent);
output->ShallowCopy(StoredOutputs->GetOutput(i));
output->SetUpdateExtent(tempExtent);
}
if (UpdateGUIOld == GetUpdateGUI())
{
foamData_->Update();
for (int i = 0; i < GetNumberOfOutputs(); i++)
{
vtkDataObject* tmp = GetOutput(i);
vtkDataObject* output = tmp->NewInstance();
output->ShallowCopy(tmp);
StoredOutputs->SetNthOutput(i, output);
output->Delete();
}
}
}
UpdateGUIOld = GetUpdateGUI();
}
void vtkFoamReader::SetFileName(const char *name)
{
if (name && !FileName || (FileName && !strcmp(FileName,name)))
{
if (!FileName)
{
FileName = new char[strlen(name) + 1];
strcpy(FileName, name);
}
}
else
{
vtkErrorMacro("Changing case is not currently supported.\nPlease delete reader and create a new one for the new case.");
return;
}
/*
if ( FileName && name && (!strcmp(FileName,name)))
{
return;
}
if (!name && !FileName)
{
return;
}
if (FileName)
{
delete [] FileName;
}
FileName = new char[strlen(name) + 1];
strcpy(FileName, name);
if (foamData_)
{
delete foamData_;
foamData_ = NULL;
if (StoredOutputs)
{
StoredOutputs->Delete();
StoredOutputs = NULL;
}
}
Modified();
*/
}
void vtkFoamReader::PrintSelf(ostream& os, vtkIndent indent)
{
Superclass::PrintSelf(os,indent);
os << indent << "File Name: "
<< (FileName ? FileName : "(none)") << "\n";
}
vtkDataArraySelection* vtkFoamReader::GetTimeSelection()
{
return TimeSelection;
}
int vtkFoamReader::GetNumberOfTimeArrays()
{
return TimeSelection->GetNumberOfArrays();
}
const char* vtkFoamReader::GetTimeArrayName(int index)
{
return TimeSelection->GetArrayName(index);
}
int vtkFoamReader::GetTimeArrayStatus(const char* name)
{
return TimeSelection->ArrayIsEnabled(name);
}
void vtkFoamReader::SetTimeArrayStatus(const char* name, int status)
{
if(status)
{
TimeSelection->EnableArray(name);
}
else
{
TimeSelection->DisableArray(name);
}
}
vtkDataArraySelection* vtkFoamReader::GetRegionSelection()
{
return RegionSelection;
}
int vtkFoamReader::GetNumberOfRegionArrays()
{
return RegionSelection->GetNumberOfArrays();
}
const char* vtkFoamReader::GetRegionArrayName(int index)
{
return RegionSelection->GetArrayName(index);
}
int vtkFoamReader::GetRegionArrayStatus(const char* name)
{
return RegionSelection->ArrayIsEnabled(name);
}
void vtkFoamReader::SetRegionArrayStatus(const char* name, int status)
{
if(status)
{
RegionSelection->EnableArray(name);
}
else
{
RegionSelection->DisableArray(name);
}
}
vtkDataArraySelection* vtkFoamReader::GetVolFieldSelection()
{
return VolFieldSelection;
}
int vtkFoamReader::GetNumberOfVolFieldArrays()
{
return VolFieldSelection->GetNumberOfArrays();
}
const char* vtkFoamReader::GetVolFieldArrayName(int index)
{
return VolFieldSelection->GetArrayName(index);
}
int vtkFoamReader::GetVolFieldArrayStatus(const char* name)
{
return VolFieldSelection->ArrayIsEnabled(name);
}
void vtkFoamReader::SetVolFieldArrayStatus(const char* name, int status)
{
if(status)
{
VolFieldSelection->EnableArray(name);
}
else
{
VolFieldSelection->DisableArray(name);
}
}
vtkDataArraySelection* vtkFoamReader::GetPointFieldSelection()
{
return PointFieldSelection;
}
int vtkFoamReader::GetNumberOfPointFieldArrays()
{
return PointFieldSelection->GetNumberOfArrays();
}
const char* vtkFoamReader::GetPointFieldArrayName(int index)
{
return PointFieldSelection->GetArrayName(index);
}
int vtkFoamReader::GetPointFieldArrayStatus(const char* name)
{
return PointFieldSelection->ArrayIsEnabled(name);
}
void vtkFoamReader::SetPointFieldArrayStatus(const char* name, int status)
{
if(status)
{
PointFieldSelection->EnableArray(name);
}
else
{
PointFieldSelection->DisableArray(name);
}
}
void vtkFoamReader::SelectionModifiedCallback
(
vtkObject*,
unsigned long,
void* clientdata,
void*
)
{
static_cast<vtkFoamReader*>(clientdata)->SelectionModified();
}
void vtkFoamReader::SelectionModified()
{
Modified();
}
// ************************************************************************* //

View file

@ -1,199 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
vtkFoamReader
Description
SourceFiles
vtkFoamReader.cxx
\*---------------------------------------------------------------------------*/
#ifndef vtkFoamReader_h
#define vtkFoamReader_h
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "vtkDataSetSource.h"
#include "vtkFoamData.h"
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
namespace Foam
{
class vtkFoam;
}
class vtkPoints;
class vtkDataArraySelection;
class vtkDataArrayCollection;
class vtkCallbackCommand;
/*---------------------------------------------------------------------------*\
Class vtkFoamReader Declaration
\*---------------------------------------------------------------------------*/
class VTK_IO_EXPORT vtkFoamReader
:
public vtkDataSetSource
{
public:
//- Standard VTK class creation function
static vtkFoamReader *New();
//- Standard VTK class type and revision declaration macro
vtkTypeRevisionMacro(vtkFoamReader,vtkDataSetSource);
//- Standard VTK class print function
void PrintSelf(ostream& os, vtkIndent indent);
// File name of FOAM datafile to read
void SetFileName(const char *);
//vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
// GUI update control
vtkSetMacro(UpdateGUI, int);
vtkGetMacro(UpdateGUI, int);
// FOAM mesh caching control
vtkSetMacro(CacheMesh, int);
vtkGetMacro(CacheMesh, int);
// Time-step slider control
vtkSetMacro(TimeStep, int);
vtkGetMacro(TimeStep, int);
vtkSetVector2Macro(TimeStepRange, int);
vtkGetVector2Macro(TimeStepRange, int);
// Control of the upper and lower limits on the number of times
// displayed in the selection list
vtkSetVector2Macro(TimeStepLimits, int);
vtkGetVector2Macro(TimeStepLimits, int);
// Time selection list control
vtkDataArraySelection* GetTimeSelection();
int GetNumberOfTimeArrays();
const char* GetTimeArrayName(int index);
int GetTimeArrayStatus(const char* name);
void SetTimeArrayStatus(const char* name, int status);
// Region selection list control
vtkDataArraySelection* GetRegionSelection();
int GetNumberOfRegionArrays();
const char* GetRegionArrayName(int index);
int GetRegionArrayStatus(const char* name);
void SetRegionArrayStatus(const char* name, int status);
// volField selection list control
vtkDataArraySelection* GetVolFieldSelection();
int GetNumberOfVolFieldArrays();
const char* GetVolFieldArrayName(int index);
int GetVolFieldArrayStatus(const char* name);
void SetVolFieldArrayStatus(const char* name, int status);
// pointField selection list control
vtkDataArraySelection* GetPointFieldSelection();
int GetNumberOfPointFieldArrays();
const char* GetPointFieldArrayName(int index);
int GetPointFieldArrayStatus(const char* name);
void SetPointFieldArrayStatus(const char* name, int status);
// SetNthOutput provided so that vtkFoam can access it
void SetNthOutput(int num, vtkDataObject *output)
{
vtkDataSetSource::SetNthOutput(num, output);
}
// Standard VTK ExecuteInformation function overriding the base-class.
// Called by ParaView before GUI is displayed.
virtual void ExecuteInformation();
// Callback registered with the SelectionObserver
// for all the selection lists
static void SelectionModifiedCallback
(
vtkObject* caller,
unsigned long eid,
void* clientdata,
void* calldata
);
void SelectionModified();
protected:
vtkFoamReader();
~vtkFoamReader();
// Standard VTK execute function overriding the base-class.
// Called by ParaView when Accept is pressed.
void Execute();
// Cache for the outputs. These are stored before the end of Execute()
// and re-instated at the beginning because the Outputs would disappear
// otherwise.
vtkFoamData* StoredOutputs;
// FOAM file name (*.foam)
char *FileName;
//BTX
Foam::vtkFoam* foamData_;
//ETX
int CacheMesh;
int UpdateGUI;
int UpdateGUIOld;
int TimeStep;
int TimeStepRange[2];
int TimeStepLimits[2];
vtkDataArraySelection* TimeSelection;
vtkDataArraySelection* RegionSelection;
vtkDataArraySelection* VolFieldSelection;
vtkDataArraySelection* PointFieldSelection;
// The observer to modify this object when the array selections are modified
vtkCallbackCommand* SelectionObserver;
private:
vtkFoamReader(const vtkFoamReader&); // Not implemented.
void operator=(const vtkFoamReader&); // Not implemented.
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,531 +0,0 @@
/*=========================================================================
Program: ParaView
Module: $RCSfile: vtkPVFoamSelectTimeSet.cxx,v $
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkPVFoamSelectTimeSet.h"
#include "vtkDataArrayCollection.h"
#include "vtkFloatArray.h"
#include "vtkKWFrame.h"
#include "vtkKWLabel.h"
#include "vtkKWLabeledFrame.h"
#include "vtkKWMenu.h"
#include "vtkObjectFactory.h"
#include "vtkPVAnimationInterfaceEntry.h"
#include "vtkPVApplication.h"
#include "vtkPVProcessModule.h"
#include "vtkPVScalarListWidgetProperty.h"
#include "vtkPVSource.h"
#include "vtkPVXMLElement.h"
#include <vtkstd/string>
//-----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPVFoamSelectTimeSet);
vtkCxxRevisionMacro(vtkPVFoamSelectTimeSet, "$Revision: 1.39 $");
//-----------------------------------------------------------------------------
int vtkDataArrayCollectionCommand(ClientData cd, Tcl_Interp *interp,
int argc, char *argv[]);
//-----------------------------------------------------------------------------
vtkPVFoamSelectTimeSet::vtkPVFoamSelectTimeSet()
{
this->LabeledFrame = vtkKWLabeledFrame::New();
this->LabeledFrame->SetParent(this);
this->TimeLabel = vtkKWLabel::New();
this->TimeLabel->SetParent(this->LabeledFrame->GetFrame());
this->TreeFrame = vtkKWWidget::New();
this->TreeFrame->SetParent(this->LabeledFrame->GetFrame());
this->Tree = vtkKWWidget::New();
this->Tree->SetParent(this->TreeFrame);
this->TimeValue = 0.0;
this->FrameLabel = 0;
this->TimeSets = vtkDataArrayCollection::New();
this->Property = 0;
this->SetCommand = 0;
this->ServerSideID.ID = 0;
}
//-----------------------------------------------------------------------------
vtkPVFoamSelectTimeSet::~vtkPVFoamSelectTimeSet()
{
this->LabeledFrame->Delete();
this->Tree->Delete();
this->TreeFrame->Delete();
this->TimeLabel->Delete();
this->SetFrameLabel(0);
this->TimeSets->Delete();
this->SetSetCommand(0);
if(this->ServerSideID.ID)
{
vtkPVProcessModule* pm = this->GetPVApplication()->GetProcessModule();
pm->DeleteStreamObject(this->ServerSideID);
pm->SendStream(vtkProcessModule::DATA_SERVER);
}
}
//-----------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::SetLabel(const char* label)
{
this->SetFrameLabel(label);
if (this->GetApplication())
{
this->LabeledFrame->SetLabel(label);
}
}
//-----------------------------------------------------------------------------
const char* vtkPVFoamSelectTimeSet::GetLabel()
{
return this->GetFrameLabel();
}
//-----------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::Create(vtkKWApplication *pvApp)
{
// Call the superclass to create the widget and set the appropriate flags
if (!this->vtkKWWidget::Create(pvApp, "frame", "-bd 2 -relief flat"))
{
vtkErrorMacro("Failed creating widget " << this->GetClassName());
return;
}
// For getting the widget in a script.
if ((this->TraceNameState == vtkPVWidget::Uninitialized ||
this->TraceNameState == vtkPVWidget::Default) )
{
this->SetTraceName("FoamSelectTimeSet");
this->SetTraceNameState(vtkPVWidget::SelfInitialized);
}
this->LabeledFrame->Create(this->GetApplication(), 0);
if (this->FrameLabel)
{
this->LabeledFrame->SetLabel(this->FrameLabel);
}
this->TimeLabel->Create(this->GetApplication(), "");
char label[32];
sprintf(label, "Time value: %12.5e", 0.0);
this->TimeLabel->SetLabel(label);
this->Script("pack %s", this->TimeLabel->GetWidgetName());
this->TreeFrame->Create(this->GetApplication(), "ScrolledWindow",
"-relief sunken -bd 2");
this->Tree->Create(this->GetApplication(), "Tree",
"-background white -bd 0 -width 15 -padx 2 "
"-redraw 1 -relief flat -selectbackground red");
this->Script("%s bindText <ButtonPress-1> {%s SetTimeValueCallback}",
this->Tree->GetWidgetName(), this->GetTclName());
this->Script("%s setwidget %s", this->TreeFrame->GetWidgetName(),
this->Tree->GetWidgetName());
this->Script("pack %s -expand t -fill x", this->TreeFrame->GetWidgetName());
this->Script("pack %s -side top -expand t -fill x",
this->LabeledFrame->GetWidgetName());
}
//-----------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::SetTimeValue(float time)
{
if (this->TimeValue != time ||
!this->TimeLabel->GetLabel() ||
!strcmp(this->TimeLabel->GetLabel(), "No timesets available."))
{
this->TimeValue = time;
char label[32];
sprintf(label, "Time value: %12.5e", time);
this->TimeLabel->SetLabel(label);
this->Modified();
}
}
//-----------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::SetTimeValueCallback(const char* item)
{
if (this->TimeSets->GetNumberOfItems() == 0)
{
return;
}
if ( strncmp(item, "timeset", strlen("timeset")) == 0 )
{
this->Script("if [%s itemcget %s -open] "
"{%s closetree %s} else {%s opentree %s}",
this->Tree->GetWidgetName(), item,
this->Tree->GetWidgetName(), item,
this->Tree->GetWidgetName(), item);
return;
}
this->Script("%s selection set %s", this->Tree->GetWidgetName(),
item);
this->Script("%s itemcget %s -data", this->Tree->GetWidgetName(),
item);
const char* result = this->GetApplication()->GetMainInterp()->result;
if (result[0] == '\0')
{
return;
}
int index[2];
sscanf(result, "%d %d", &(index[0]), &(index[1]));
this->SetTimeSetsFromReader();
this->SetTimeValue(this->TimeSets->GetItem(index[0])->GetTuple1(index[1]));
this->ModifiedCallback();
}
//-----------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::AddRootNode(const char* name, const char* text)
{
if (!this->GetApplication())
{
return;
}
this->Script("%s insert end root %s -text {%s}", this->Tree->GetWidgetName(),
name, text);
}
//-----------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::AddChildNode(const char* parent, const char* name,
const char* text, const char* data)
{
if (!this->GetApplication())
{
return;
}
this->Script("%s insert end %s %s -text {%s} -data %s",
this->Tree->GetWidgetName(), parent, name, text, data);
}
//-----------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::SaveInBatchScript(ofstream *file)
{
*file << " [$pvTemp" << this->PVSource->GetVTKSourceID(0)
<< " GetProperty " << this->SetCommand << "] SetElements1 "
<< this->Property->GetScalar(0) << endl;
}
//-----------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::AcceptInternal(vtkClientServerID sourceID)
{
if (this->ModifiedFlag)
{
this->Script("%s selection get", this->Tree->GetWidgetName());
this->AddTraceEntry("$kw(%s) SetTimeValueCallback {%s}",
this->GetTclName(),
this->GetApplication()->GetMainInterp()->result);
}
this->Property->SetVTKSourceID(sourceID);
this->Property->SetScalars(1, &this->TimeValue);
this->Property->AcceptInternal();
this->ModifiedFlag = 0;
}
//---------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::Trace(ofstream *file)
{
if ( ! this->InitializeTrace(file))
{
return;
}
this->Script("%s selection get", this->Tree->GetWidgetName());
*file << "$kw(" << this->GetTclName() << ") SetTimeValueCallback {"
<< this->GetApplication()->GetMainInterp()->result << "}" << endl;
}
//-----------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::ResetInternal()
{
if ( ! this->ModifiedFlag)
{
return;
}
// Command to update the UI.
if (!this->Tree)
{
return;
}
this->Script("%s delete [%s nodes root]", this->Tree->GetWidgetName(),
this->Tree->GetWidgetName());
this->SetTimeSetsFromReader();
int timeSetId=0;
char timeSetName[32];
char timeSetText[32];
char timeValueName[32];
char timeValueText[32];
char indices[32];
float actualTimeValue = this->Property->GetScalar(0);
int matchFound = 0;
this->ModifiedFlag = 0;
if (this->TimeSets->GetNumberOfItems() == 0)
{
this->Script("pack forget %s", this->TreeFrame->GetWidgetName());
this->TimeLabel->SetLabel("No timesets available.");
return;
}
else
{
this->SetTimeValue(actualTimeValue);
this->Script("pack %s -expand t -fill x", this->TreeFrame->GetWidgetName());
}
this->TimeSets->InitTraversal();
vtkDataArray* da;
while( (da=this->TimeSets->GetNextItem()) )
{
timeSetId++;
sprintf(timeSetName,"timeset%d", timeSetId);
sprintf(timeSetText,"Time Set %d", timeSetId);
this->AddRootNode(timeSetName, timeSetText);
vtkIdType tuple;
for(tuple=0; tuple<da->GetNumberOfTuples(); tuple++)
{
float timeValue = da->GetTuple1(tuple);
sprintf(timeValueName, "time%d_%-12.5e", timeSetId, timeValue);
sprintf(timeValueText, "%-12.5e", timeValue);
ostrstream str;
str << "{" << timeSetId-1 << " " << tuple << "}" << ends;
sprintf(indices, "%s", str.str());
str.rdbuf()->freeze(0);
this->AddChildNode(timeSetName, timeValueName, timeValueText, indices);
if (actualTimeValue == timeValue && !matchFound)
{
matchFound=1;
this->Script("%s selection set %s", this->Tree->GetWidgetName(),
timeValueName);
}
}
if (timeSetId == 1)
{
this->Script("%s opentree %s", this->Tree->GetWidgetName(),
timeSetName);
}
}
this->SetTimeValue(actualTimeValue);
}
//-----------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::AddAnimationScriptsToMenu(vtkKWMenu *menu,
vtkPVAnimationInterfaceEntry *ai)
{
char methodAndArgs[500];
sprintf(methodAndArgs, "AnimationMenuCallback %s", ai->GetTclName());
// I do not under stand why the trace name is used for the
// menu entry, but Berk must know.
menu->AddCommand(this->GetTraceName(), this, methodAndArgs, 0, "");
}
//-----------------------------------------------------------------------------
// What a pain. I need this method for tracing.
// Maybe the animation should call PVwidget methods and not vtk object methods.
void vtkPVFoamSelectTimeSet::AnimationMenuCallback(vtkPVAnimationInterfaceEntry *ai)
{
if (ai->InitializeTrace(NULL))
{
this->AddTraceEntry("$kw(%s) AnimationMenuCallback $kw(%s)",
this->GetTclName(), ai->GetTclName());
}
// I do not under stand why the trace name is used for the
// menu entry, but Berk must know.
ai->SetLabelAndScript(this->GetTraceName(), NULL, this->GetTraceName());
ai->SetCurrentProperty(this->Property);
ai->Update();
}
//-----------------------------------------------------------------------------
vtkPVFoamSelectTimeSet* vtkPVFoamSelectTimeSet::ClonePrototype(vtkPVSource* pvSource,
vtkArrayMap<vtkPVWidget*, vtkPVWidget*>* map)
{
vtkPVWidget* clone = this->ClonePrototypeInternal(pvSource, map);
return vtkPVFoamSelectTimeSet::SafeDownCast(clone);
}
//-----------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::CopyProperties(vtkPVWidget* clone,
vtkPVSource* pvSource,
vtkArrayMap<vtkPVWidget*, vtkPVWidget*>* map)
{
this->Superclass::CopyProperties(clone, pvSource, map);
vtkPVFoamSelectTimeSet* pvts = vtkPVFoamSelectTimeSet::SafeDownCast(clone);
if (pvts)
{
pvts->SetLabel(this->FrameLabel);
pvts->SetSetCommand(this->SetCommand);
}
else
{
vtkErrorMacro(
"Internal error. Could not downcast clone to PVFoamSelectTimeSet.");
}
}
//-----------------------------------------------------------------------------
int vtkPVFoamSelectTimeSet::ReadXMLAttributes(vtkPVXMLElement* element,
vtkPVXMLPackageParser* parser)
{
if(!this->Superclass::ReadXMLAttributes(element, parser)) { return 0; }
// Setup the Label.
const char* label = element->GetAttribute("label");
if(label)
{
this->SetLabel(label);
}
this->SetSetCommand(element->GetAttribute("set_command"));
return 1;
}
//-----------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::SetTimeSetsFromReader()
{
vtkPVProcessModule* pm = this->GetPVApplication()->GetProcessModule();
this->TimeSets->RemoveAllItems();
// Create the server-side helper if necessary.
if(!this->ServerSideID.ID)
{
this->ServerSideID = pm->NewStreamObject("vtkPVFoamServerSelectTimeSet");
pm->SendStream(vtkProcessModule::DATA_SERVER);
}
// Get the time sets from the reader on the server.
// Reader -> VTKSourceID (0). We assume that there is 1 VTKSource.
pm->GetStream() << vtkClientServerStream::Invoke
<< this->ServerSideID << "GetTimeSets"
<< this->PVSource->GetVTKSourceID(0)
<< vtkClientServerStream::End;
pm->SendStream(vtkProcessModule::DATA_SERVER_ROOT);
vtkClientServerStream timeSets;
if(!pm->GetLastServerResult().GetArgument(0, 0, &timeSets))
{
vtkErrorMacro("Error getting time sets from server.");
return;
}
// There is one time set per message.
for(int m=0; m < timeSets.GetNumberOfMessages(); ++m)
{
// Each argument in the message is a time set entry.
vtkFloatArray* timeSet = vtkFloatArray::New();
int n = timeSets.GetNumberOfArguments(m);
timeSet->SetNumberOfTuples(n);
for(int i=0; i < n; ++i)
{
float value;
if(!timeSets.GetArgument(m, i, &value))
{
vtkErrorMacro("Error reading time set value.");
timeSet->Delete();
return;
}
timeSet->SetTuple1(i, value);
}
this->TimeSets->AddItem(timeSet);
timeSet->Delete();
}
if (this->Property->GetNumberOfScalars() == 0 &&
this->TimeSets->GetNumberOfItems() > 0)
{
vtkFloatArray *ts =
vtkFloatArray::SafeDownCast(this->TimeSets->GetItem(0));
this->Property->SetScalars(1, ts->GetPointer(0));
}
}
//----------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::SaveInBatchScriptForPart(ofstream *file,
vtkClientServerID sourceID)
{
if (sourceID.ID == 0)
{
vtkErrorMacro(<< this->GetClassName()
<< " must not have SaveInBatchScript method.");
return;
}
*file << "\t" << "pvTemp" << sourceID
<< " SetTimeValue " << this->GetTimeValue()
<< endl;;
}
//-----------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::SetProperty(vtkPVWidgetProperty *prop)
{
this->Property = vtkPVScalarListWidgetProperty::SafeDownCast(prop);
if (this->Property)
{
int numScalars = 1;
this->Property->SetVTKCommands(1, &this->SetCommand, &numScalars);
}
}
//-----------------------------------------------------------------------------
vtkPVWidgetProperty* vtkPVFoamSelectTimeSet::GetProperty()
{
return this->Property;
}
//-----------------------------------------------------------------------------
vtkPVWidgetProperty* vtkPVFoamSelectTimeSet::CreateAppropriateProperty()
{
return vtkPVScalarListWidgetProperty::New();
}
//-----------------------------------------------------------------------------
void vtkPVFoamSelectTimeSet::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "TimeValue: " << this->TimeValue << endl;
os << indent << "LabeledFrame: " << this->LabeledFrame << endl;
os << indent << "SetCommand: "
<< (this->SetCommand ? this->SetCommand : "(none)") << endl;
}

View file

@ -1,164 +0,0 @@
/*=========================================================================
Program: ParaView
Module: $RCSfile: vtkPVFoamSelectTimeSet.h,v $
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkPVFoamSelectTimeSet - Special time selection widget used by PVFoamReaderModule
// .SECTION Description
// This is a PVWidget specially designed to be used with PVFoamReaderModule.
// It provides support for multiple sets. The time value selected by
// the user is passed to the Foam reader with a SetTimeValue() call.
#ifndef __vtkPVFoamSelectTimeSet_h
#define __vtkPVFoamSelectTimeSet_h
#include "vtkPVWidget.h"
class vtkKWLabel;
class vtkKWMenu;
class vtkKWLabeledFrame;
class vtkDataArrayCollection;
class vtkPVScalarListWidgetProperty;
class VTK_EXPORT vtkPVFoamSelectTimeSet : public vtkPVWidget
{
public:
static vtkPVFoamSelectTimeSet* New();
vtkTypeRevisionMacro(vtkPVFoamSelectTimeSet, vtkPVWidget);
void PrintSelf(ostream& os, vtkIndent indent);
virtual void Create(vtkKWApplication *pvApp);
//BTX
// Description:
// Called when accept button is pushed.
// Sets objects variable to the widgets value.
// Adds a trace entry. Side effect is to turn modified flag off.
virtual void AcceptInternal(vtkClientServerID);
//ETX
// Description:
// Called when the reset button is pushed.
// Sets widget's value to the object-variable's value.
// Side effect is to turn the modified flag off.
virtual void ResetInternal();
// Description:
// Adds a script to the menu of the animation interface.
virtual void AddAnimationScriptsToMenu(vtkKWMenu *menu,
vtkPVAnimationInterfaceEntry *ai);
// Description:
// Called whenthe animation method menu item is selected.
// Needed for proper tracing.
// It would be nice if the menu and cascade menus would trace
// invokation of items (?relying of enumeration of menu items or label?)
void AnimationMenuCallback(vtkPVAnimationInterfaceEntry *ai);
// Description:
// This is the labeled frame around the timeset tree.
vtkGetObjectMacro(LabeledFrame, vtkKWLabeledFrame);
// Description:
// Label displayed on the labeled frame.
void SetLabel(const char* label);
const char* GetLabel();
// Description:
// Updates the time value label and the time ivar.
void SetTimeValue(float time);
vtkGetMacro(TimeValue, float);
// Description:
// Calls this->SetTimeValue () and Reader->SetTimeValue()
// with currently selected time value.
void SetTimeValueCallback(const char* item);
//BTX
// Description:
// Creates and returns a copy of this widget. It will create
// a new instance of the same type as the current object
// using NewInstance() and then copy some necessary state
// parameters.
vtkPVFoamSelectTimeSet* ClonePrototype(vtkPVSource* pvSource,
vtkArrayMap<vtkPVWidget*, vtkPVWidget*>* map);
//ETX
// Description:
// This serves a dual purpose. For tracing and for saving state.
virtual void Trace(ofstream *file);
// Description:
// Set/get the property to use with this widget.
virtual void SetProperty(vtkPVWidgetProperty *prop);
virtual vtkPVWidgetProperty* GetProperty();
// Description:
// Create the right property for use with this widget.
virtual vtkPVWidgetProperty* CreateAppropriateProperty();
// Description:
// Set/get the command to pass the value to VTK.
vtkSetStringMacro(SetCommand);
vtkGetStringMacro(SetCommand);
// Description:
// Save this widget to a file.
virtual void SaveInBatchScript(ofstream *file);
protected:
vtkPVFoamSelectTimeSet();
~vtkPVFoamSelectTimeSet();
vtkPVFoamSelectTimeSet(const vtkPVFoamSelectTimeSet&); // Not implemented
void operator=(const vtkPVFoamSelectTimeSet&); // Not implemented
vtkPVScalarListWidgetProperty *Property;
char *SetCommand;
vtkSetStringMacro(FrameLabel);
vtkGetStringMacro(FrameLabel);
vtkKWWidget* Tree;
vtkKWWidget* TreeFrame;
vtkKWLabel* TimeLabel;
vtkKWLabeledFrame* LabeledFrame;
void AddRootNode(const char* name, const char* text);
void AddChildNode(const char* parent, const char* name,
const char* text, const char* data);
float TimeValue;
char* FrameLabel;
vtkDataArrayCollection* TimeSets;
vtkClientServerID ServerSideID;
// Fill the TimeSets collection with that from the actual reader.
void SetTimeSetsFromReader();
//BTX
virtual void CopyProperties(vtkPVWidget* clone, vtkPVSource* pvSource,
vtkArrayMap<vtkPVWidget*, vtkPVWidget*>* map);
//ETX
int ReadXMLAttributes(vtkPVXMLElement* element,
vtkPVXMLPackageParser* parser);
// Description:
// An interface for saving a widget into a script.
virtual void SaveInBatchScriptForPart(ofstream *file, vtkClientServerID);
};
#endif

View file

@ -1,85 +0,0 @@
/*=========================================================================
Program: ParaView
Module: $RCSfile: vtkPVFoamServerSelectTimeSet.cxx,v $
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkPVFoamServerSelectTimeSet.h"
#include "vtkClientServerInterpreter.h"
#include "vtkObjectFactory.h"
#include "vtkPVProcessModule.h"
#include "vtkFoamReader.h"
#include "vtkDataArrayCollection.h"
#include "vtkDataArrayCollectionIterator.h"
#include "vtkClientServerStream.h"
#include <vtkstd/string>
//----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPVFoamServerSelectTimeSet);
vtkCxxRevisionMacro(vtkPVFoamServerSelectTimeSet, "$Revision: 1.4 $");
//----------------------------------------------------------------------------
class vtkPVFoamServerSelectTimeSetInternals
{
public:
vtkClientServerStream Result;
};
//----------------------------------------------------------------------------
vtkPVFoamServerSelectTimeSet::vtkPVFoamServerSelectTimeSet()
{
this->Internal = new vtkPVFoamServerSelectTimeSetInternals;
}
//----------------------------------------------------------------------------
vtkPVFoamServerSelectTimeSet::~vtkPVFoamServerSelectTimeSet()
{
delete this->Internal;
}
//----------------------------------------------------------------------------
void vtkPVFoamServerSelectTimeSet::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
}
//----------------------------------------------------------------------------
const vtkClientServerStream&
vtkPVFoamServerSelectTimeSet::GetTimeSets(vtkFoamReader* reader)
{
// Reset the stream for a new list of time sets.
this->Internal->Result.Reset();
// Get the time sets from the reader.
vtkDataArrayCollection* timeSets = reader->GetTimeSets();
// Iterate through the time sets.
vtkDataArrayCollectionIterator* iter = vtkDataArrayCollectionIterator::New();
iter->SetCollection(timeSets);
for(iter->GoToFirstItem(); !iter->IsDoneWithTraversal();
iter->GoToNextItem())
{
// Each time set is stored in one message.
this->Internal->Result << vtkClientServerStream::Reply;
vtkDataArray* da = iter->GetDataArray();
for(int i=0; i < da->GetNumberOfTuples(); ++i)
{
this->Internal->Result << da->GetTuple1(i);
}
this->Internal->Result << vtkClientServerStream::End;
}
iter->Delete();
// Return the stream.
return this->Internal->Result;
}

View file

@ -1,49 +0,0 @@
/*=========================================================================
Program: ParaView
Module: $RCSfile: vtkPVFoamServerSelectTimeSet.h,v $
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkPVFoamServerSelectTimeSet - Server-side helper for vtkPVFoamSelectTimeSet.
// .SECTION Description
#ifndef __vtkPVFoamServerSelectTimeSet_h
#define __vtkPVFoamServerSelectTimeSet_h
#include "vtkPVServerObject.h"
class vtkClientServerStream;
class vtkPVFoamServerSelectTimeSetInternals;
class vtkFoamReader;
class VTK_EXPORT vtkPVFoamServerSelectTimeSet : public vtkPVServerObject
{
public:
static vtkPVFoamServerSelectTimeSet* New();
vtkTypeRevisionMacro(vtkPVFoamServerSelectTimeSet, vtkPVServerObject);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Get a list the time sets provided by the given reader.
const vtkClientServerStream& GetTimeSets(vtkFoamReader*);
protected:
vtkPVFoamServerSelectTimeSet();
~vtkPVFoamServerSelectTimeSet();
// Internal implementation details.
vtkPVFoamServerSelectTimeSetInternals* Internal;
private:
vtkPVFoamServerSelectTimeSet(const vtkPVFoamServerSelectTimeSet&); // Not implemented
void operator=(const vtkPVFoamServerSelectTimeSet&); // Not implemented
};
#endif

View file

@ -1,5 +0,0 @@
vtkFoam.C
vtkFoamAddInternalMesh.C
vtkFoamAddPatch.C
LIB = $(FOAM_LIBBIN)/libvtkFoam

View file

@ -1,8 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(ParaView_INST_DIR)/include \
-I../PVFoamReader
LIB_LIBS = \
-lfiniteVolume \
$(GLIBS)

View file

@ -1,661 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "vtkFoam.H"
#include "argList.H"
#include "foamTime.H"
#include "polyBoundaryMeshEntries.H"
#include "IOobjectList.H"
#include "wordList.H"
#include "fvMesh.H"
#include "volFields.H"
#include "pointMesh.H"
#include "volPointInterpolation.H"
#include "vtkFoamReader.h"
#include "vtkDataArraySelection.h"
#include "vtkUnstructuredGrid.h"
#include "vtkPointData.h"
#include "vtkCellData.h"
#include "vtkFloatArray.h"
#include "vtkCharArray.h"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::vtkFoam, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
#include "vtkFoamConvertFields.H"
void Foam::vtkFoam::SetName
(
vtkUnstructuredGrid* vtkMesh,
const char* name
)
{
vtkCharArray* nmArray = vtkCharArray::New();
nmArray->SetName("Name");
size_t len = strlen(name);
nmArray->SetNumberOfTuples(static_cast<vtkIdType>(len)+1);
char* copy = nmArray->GetPointer(0);
memcpy(copy, name, len);
copy[len] = '\0';
vtkMesh->GetFieldData()->AddArray(nmArray);
nmArray->Delete();
}
Foam::string Foam::vtkFoam::padTimeString(const string& ts)
{
return ts + string(" ", max(label(12 - ts.size()), 0));
}
// Pad the patch name string in order to account for dynamic changes
// in patch names during topological changes
Foam::string Foam::vtkFoam::padPatchString(const string& ps)
{
label n = max(label(50 - ps.size()), 0);
return ps + string(" ", n);
}
void Foam::vtkFoam::setSelectedTime
(
Time& runTime,
vtkFoamReader* reader
)
{
// Get times list
instantList Times = runTime.times();
int timeIndex = min(max(reader->GetTimeStep() + 1, 0), Times.size()-1);
// If this is the first call timeIndex will be 0 ("constant")
// so reset to the first time step if one exists and deselect every
// element of the selection array
if (timeIndex == 0)
{
timeIndex = min(1, Times.size()-1);
reader->GetTimeSelection()->DisableAllArrays();
}
label selectedTimeIndex = -1;
label nSelectedTimes = reader->GetTimeSelection()->GetNumberOfArrays();
for (label i=nSelectedTimes-1; i>=0; i--)
{
if(reader->GetTimeSelection()->GetArraySetting(i))
{
word timeName = string::validate<word>
(
reader->GetTimeSelection()->GetArrayName(i)
);
forAll(Times, j)
{
if (Times[j].name() == timeName)
{
selectedTimeIndex = j;
break;
}
}
break;
}
}
if (selectedTimeIndex != -1)
{
timeIndex = min(selectedTimeIndex, Times.size()-1);
}
if (debug)
{
Info<< "Selecting time " << Times[timeIndex].name() << endl;
}
runTime.setTime(Times[timeIndex], timeIndex);
Times = runTime.times();
reader->SetTimeStepRange(0, max(Times.size()-2, 0));
// reset the time steps ...
reader->GetTimeSelection()->RemoveAllArrays();
int* TimeStepLimits = reader->GetTimeStepLimits();
label maxStartTimes = min(Times.size(), TimeStepLimits[0]);
label maxNTimes = min(Times.size() - maxStartTimes, TimeStepLimits[1]);
for (label i=0; i<maxStartTimes; i++)
{
reader->GetTimeSelection()
->AddArray(padTimeString(Times[i].name()).c_str());
}
if (Times.size() > TimeStepLimits[0] + TimeStepLimits[1])
{
reader->GetTimeSelection()->AddArray(padTimeString("...").c_str());
}
for (label i=Times.size() - maxNTimes; i<Times.size(); i++)
{
reader->GetTimeSelection()
->AddArray(padTimeString(Times[i].name()).c_str());
}
// Disable all the time selections (which are all selected by default) ...
reader->GetTimeSelection()->DisableAllArrays();
// But maintain the selections made previously
if (selectedTimeIndex != -1 && selectedTimeIndex < Times.size())
{
reader->GetTimeSelection()->EnableArray
(padTimeString(Times[selectedTimeIndex].name()).c_str());
}
}
void Foam::vtkFoam::updateSelectedRegions()
{
if (debug)
{
Info<< "Foam::vtkFoam::updateSelectedRegions()" << endl;
}
label nRegions = reader_->GetRegionSelection()->GetNumberOfArrays();
selectedRegions_.setSize(nRegions);
// Read the selected patches and add to the region list
for (int i=0; i<nRegions; i++)
{
selectedRegions_[i] =
reader_->GetRegionSelection()->GetArraySetting(i);
}
}
void Foam::vtkFoam::convertMesh()
{
if (debug)
{
Info<< "Foam::vtkFoam::convertMesh()" << endl;
}
const fvMesh& mesh = *meshPtr_;
// Read the internal mesh as region 0 if selected
if (reader_->GetRegionSelection()->GetArraySetting(0))
{
selectedRegions_[0] = true;
addInternalMesh
(
mesh,
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(0))
);
}
else
{
selectedRegions_[0] = false;
vtkUnstructuredGrid *vtkMesh =
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(0));
vtkMesh->Initialize();
SetName(vtkMesh, "(Internal Mesh)");
}
// Read the selected patches and add to the region list
polyBoundaryMeshEntries patchEntries
(
IOobject
(
"boundary",
dbPtr_().findInstance(polyMesh::meshSubDir, "boundary"),
polyMesh::meshSubDir,
dbPtr_(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
label regioni = 0;
label regioniLast = 0;
// Read in the number Outputs (patch regions) currently being used
label currNOutputs = reader_->GetNumberOfOutputs();
// Cycle through all the patches in the boundary file for the relevant
// time step
forAll(patchEntries, entryi)
{
// Number of faces in the current patch (Used to detect dummy patches
// of size zero)
label nFaces(readLabel(patchEntries[entryi].dict().lookup("nFaces")));
// Check to see if the patch is currently a part of the displayed list
if
(
reader_->GetRegionSelection()->ArrayExists
(
padPatchString(patchEntries[entryi].keyword()).c_str()
)
)
{
if (!nFaces)
{
// Remove patch if it is only a dummy patch in the current
// time step with zero faces
reader_->GetRegionSelection()->RemoveArrayByName
(
padPatchString(patchEntries[entryi].keyword()).c_str()
);
}
else
{
// A patch already existent in the list and which
// continues to exist found
regioni++;
}
}
else
{
// A new patch so far not yet included into the list has been found
if (nFaces)
{
regioni++;
// Add a new entry to the list of regions
reader_->GetRegionSelection()->AddArray
(
padPatchString(patchEntries[entryi].keyword()).c_str()
);
// AddArray automatically enables a new array... disable
// it manually
reader_->GetRegionSelection()->DisableArray
(
padPatchString(patchEntries[entryi].keyword()).c_str()
);
}
}
// Avoid Initialization of the same Output twice
if (regioni != regioniLast)
{
// Only setup an Output if it has not been setup before
if(regioni >= currNOutputs)
{
vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::New();
reader_->SetNthOutput(regioni,ugrid);
ugrid->Delete();
}
// Initialize -> Delete memory used, and reset to zero state
reader_->GetOutput(regioni)->Initialize();
regioniLast = regioni;
}
}
// Initialize (reset to zero and free) any outputs which are not used
// anymore
if (regioni < currNOutputs)
{
for(label i = (regioni+1); i < currNOutputs;i++)
{
reader_->GetOutput(i)->Initialize();
}
}
selectedRegions_.setSize(regioni + 1);
regioni = 0;
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAll (patches, patchi)
{
if (patches[patchi].size())
{
regioni++;
if (reader_->GetRegionSelection()->GetArraySetting(regioni))
{
selectedRegions_[regioni] = true;
addPatch
(
patches[patchi],
vtkUnstructuredGrid::SafeDownCast
(
reader_->GetOutput(regioni)
)
);
}
else
{
selectedRegions_[regioni] = false;
vtkUnstructuredGrid *vtkMesh =
vtkUnstructuredGrid::SafeDownCast
(
reader_->GetOutput(regioni)
);
vtkMesh->Initialize();
SetName
(
vtkMesh,
('(' + padPatchString(patches[patchi].name()) + ')').c_str()
);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::vtkFoam::vtkFoam(const char* const FileName, vtkFoamReader* reader)
:
reader_(reader),
argsPtr_(NULL),
dbPtr_(NULL),
meshPtr_(NULL)
{
fileName fullCasePath(fileName(FileName).path());
if (!isDir(fullCasePath))
{
return;
}
char* argvStrings[3];
argvStrings[0] = new char[9];
strcpy(argvStrings[0], "/vtkFoam");
argvStrings[1] = new char[6];
strcpy(argvStrings[1], "-case");
argvStrings[2] = new char[fullCasePath.size()+1];
strcpy(argvStrings[2], fullCasePath.c_str());
int argc = 3;
char** argv = &argvStrings[0];
argsPtr_.reset(new argList(argc, argv));
for(int i = 0; i < argc; i++)
{
delete[] argvStrings[i];
}
dbPtr_.reset
(
new Time
(
Time::controlDictName,
argsPtr_().rootPath(),
argsPtr_().caseName()
)
);
dbPtr_().functionObjects().off();
setSelectedTime(dbPtr_(), reader_);
if (debug)
{
Info<< "vtkFoam::ExecuteInformation: Initialising outputs" << endl;
}
reader_->GetRegionSelection()->AddArray("Internal Mesh");
vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::New();
reader_->SetNthOutput(0, ugrid);
ugrid->Delete();
reader_->GetOutput(0)->Initialize();
polyBoundaryMeshEntries patchEntries
(
IOobject
(
"boundary",
dbPtr_().findInstance(polyMesh::meshSubDir, "boundary"),
polyMesh::meshSubDir,
dbPtr_(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
label regioni = 0;
forAll(patchEntries, entryi)
{
label nFaces(readLabel(patchEntries[entryi].dict().lookup("nFaces")));
if (nFaces)
{
regioni++;
reader_->GetRegionSelection()->AddArray
(
padPatchString(patchEntries[entryi].keyword()).c_str()
);
vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::New();
reader_->SetNthOutput(regioni, ugrid);
ugrid->Delete();
reader_->GetOutput(regioni)->Initialize();
}
}
selectedRegions_.setSize(regioni + 1);
selectedRegions_ = true;
UpdateInformation();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::vtkFoam::~vtkFoam()
{
// Do NOT delete meshPtr_ since still referenced somehow.
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
#include "vtkFoamAddFields.H"
void Foam::vtkFoam::UpdateInformation()
{
if (debug)
{
Info<< "TimeStep = " << reader_->GetTimeStep() << endl;
}
setSelectedTime(dbPtr_(), reader_);
// Search for list of objects for this time
IOobjectList objects(dbPtr_(), dbPtr_().timeName());
addFields<volScalarField>(reader_->GetVolFieldSelection(), objects);
addFields<volVectorField>(reader_->GetVolFieldSelection(), objects);
addFields<volSphericalTensorField>(reader_->GetVolFieldSelection(), objects);
addFields<volSymmTensorField>(reader_->GetVolFieldSelection(), objects);
addFields<volTensorField>(reader_->GetVolFieldSelection(), objects);
addFields<pointScalarField>(reader_->GetPointFieldSelection(), objects);
addFields<pointVectorField>(reader_->GetPointFieldSelection(), objects);
addFields<pointSphericalTensorField>(reader_->GetPointFieldSelection(), objects);
addFields<pointSymmTensorField>(reader_->GetPointFieldSelection(), objects);
addFields<pointTensorField>(reader_->GetPointFieldSelection(), objects);
}
void Foam::vtkFoam::Update()
{
if
(
!reader_->GetCacheMesh()
|| reader_->GetTimeSelection()->GetArraySetting(0)
)
{
meshPtr_= NULL;
}
// Clear the current set of selected fields
for (label i=0; i<reader_->GetNumberOfOutputs(); i++)
{
vtkUnstructuredGrid *vtkMesh =
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(i));
vtkCellData* cellData = vtkMesh->GetCellData();
int numberOfCellArrays = cellData->GetNumberOfArrays();
wordList cellFieldNames(numberOfCellArrays);
for (int j=0; j<numberOfCellArrays; j++)
{
cellFieldNames[j] = cellData->GetArrayName(j);
}
for (int j=0; j<numberOfCellArrays; j++)
{
cellData->RemoveArray(cellFieldNames[j].c_str());
}
vtkPointData* pointData = vtkMesh->GetPointData();
int numberOfPointArrays = pointData->GetNumberOfArrays();
wordList pointFieldNames(numberOfPointArrays);
for (int j=0; j<numberOfPointArrays; j++)
{
pointFieldNames[j] = pointData->GetArrayName(j);
}
for (int j=0; j<numberOfPointArrays; j++)
{
pointData->RemoveArray(pointFieldNames[j].c_str());
}
}
// Check to see if the mesh has been created
if (!meshPtr_)
{
if (debug)
{
Info<< "Reading Mesh" << endl;
}
meshPtr_ =
new fvMesh
(
IOobject
(
fvMesh::defaultRegion,
dbPtr_().timeName(),
dbPtr_()
)
);
convertMesh();
}
else
{
boolList oldSelectedRegions = selectedRegions_;
updateSelectedRegions();
if
(
meshPtr_->readUpdate() != fvMesh::UNCHANGED
|| oldSelectedRegions != selectedRegions_
)
{
convertMesh();
}
}
if (debug)
{
Info<< "converting fields" << endl;
}
const fvMesh& mesh = *meshPtr_;
Foam::volPointInterpolation pInterp(mesh);
// Search for list of objects for this time
Foam::IOobjectList objects(mesh, dbPtr_().timeName());
convertVolFields<Foam::scalar>
(
mesh, pInterp, objects, reader_->GetVolFieldSelection()
);
convertVolFields<Foam::vector>
(
mesh, pInterp, objects, reader_->GetVolFieldSelection()
);
convertVolFields<Foam::sphericalTensor>
(
mesh, pInterp, objects, reader_->GetVolFieldSelection()
);
convertVolFields<Foam::symmTensor>
(
mesh, pInterp, objects, reader_->GetVolFieldSelection()
);
convertVolFields<Foam::tensor>
(
mesh, pInterp, objects, reader_->GetVolFieldSelection()
);
convertPointFields<Foam::scalar>
(
mesh, objects, reader_->GetPointFieldSelection()
);
convertPointFields<Foam::vector>
(
mesh, objects, reader_->GetPointFieldSelection()
);
convertPointFields<Foam::sphericalTensor>
(
mesh, objects, reader_->GetPointFieldSelection()
);
convertPointFields<Foam::symmTensor>
(
mesh, objects, reader_->GetPointFieldSelection()
);
convertPointFields<Foam::tensor>
(
mesh, objects, reader_->GetPointFieldSelection()
);
if (debug)
{
Info<< "done" << endl;
}
}
// ************************************************************************* //

View file

@ -1,255 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::vtkFoam
Description
SourceFiles
vtkFoam.C
vtkFoamInsertNextPoint.H
vtkFoamAddFields.H
vtkFoamAddInternalMesh.H
vtkFoamConvertFields.H
vtkFoamConvertVolField.H
vtkFoamConvertPatchFaceField.H
vtkFoamConvertPointField.H
vtkFoamConvertPatchPointField.H
\*---------------------------------------------------------------------------*/
#ifndef vtkFoam_H
#define vtkFoam_H
#include "className.H"
#include "fileName.H"
#include "volPointInterpolation.H"
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
// VTK class forward declarations
class vtkFoamReader;
class vtkUnstructuredGrid;
class vtkPoints;
class vtkDataArraySelection;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Foam class forward declarations
class argList;
class Time;
class fvMesh;
class IOobjectList;
class polyPatch;
/*---------------------------------------------------------------------------*\
Class vtkFoam Declaration
\*---------------------------------------------------------------------------*/
class vtkFoam
{
// Private data
//- Access to the controlling vtkFoamReader
vtkFoamReader *reader_;
autoPtr<argList> argsPtr_;
autoPtr<Time> dbPtr_;
fvMesh* meshPtr_;
//- Selected regions, [0] = internal mesh, [1-nPatches] = patches
boolList selectedRegions_;
//- Lables of cell-centres used as additional points when decomposing
// polyhedra
labelList addPointCellLabels_;
//- Label of original cell the decomposed cells are split from
labelList superCells_;
// Private Member Functions
//- Pad-out the time name to avoid bug in the GUI redraw
static string padTimeString(const string&);
//- Pad-out the patch name
static string padPatchString(const string&);
//- Find and set the selected time from all the methods of selection
static void setSelectedTime
(
Time& runTime,
vtkFoamReader* reader
);
//- Update the selected regions
void updateSelectedRegions();
//- Convert the mesh according to the list of selected regions
void convertMesh();
//- Add the internal mesh to the set of Outputs if selected
void addInternalMesh(const fvMesh&, vtkUnstructuredGrid*);
//- Add the internal patch to the set of Outputs if selected
void addPatch(const polyPatch&, vtkUnstructuredGrid*);
//- Add the fields in th selested time directory to the selection lists
template<class GeoField>
void addFields
(
vtkDataArraySelection *fieldSelection,
const IOobjectList& objects
);
//- Convert the selected volFields
template<class Type>
void convertVolFields
(
const fvMesh& mesh,
const volPointInterpolation& pInterp,
const IOobjectList& objects,
vtkDataArraySelection *fieldSelection
);
template<class Type>
void convertVolField
(
const GeometricField<Type, fvPatchField, volMesh>& tf
);
template<class Type>
void convertPatchFaceField
(
const word& name,
const Field<Type>& tf,
const label regioni
);
//- Convert the selected pointFields
template<class Type>
void convertPointFields
(
const fvMesh& mesh,
const IOobjectList& objects,
vtkDataArraySelection *fieldSelection
);
template<class Type>
void convertPointField
(
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
const GeometricField<Type, fvPatchField, volMesh>& tf
);
template<class Type>
void convertPatchPointField
(
const word& name,
const Field<Type>& tf,
const label regioni
);
//- Set the name of the Output vtkUnstructuredGrid
void SetName(vtkUnstructuredGrid *vtkMesh, const char* name);
//- Disallow default bitwise copy construct
vtkFoam(const vtkFoam&);
//- Disallow default bitwise assignment
void operator=(const vtkFoam&);
public:
// Static data members
ClassName("vtkFoam");
// Constructors
//- Construct from components
vtkFoam(const char* const FileName, vtkFoamReader* reader);
// Destructor
~vtkFoam();
// Member Functions
void UpdateInformation();
void Update();
};
// * * * * * * * * * * * * * Template Specialisations * * * * * * * * * * * //
template<>
void vtkFoam::convertVolField
(
const GeometricField<scalar, fvPatchField, volMesh>& sf
);
template<>
void vtkFoam::convertPatchFaceField
(
const word& name,
const Field<scalar>& sf,
const label regioni
);
template<>
void vtkFoam::convertPointField
(
const GeometricField<scalar, pointPatchField, pointMesh>& psf,
const GeometricField<scalar, fvPatchField, volMesh>& sf
);
template<>
void vtkFoam::convertPatchPointField
(
const word& name,
const Field<scalar>& sf,
const label regioni
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,59 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::vtkFoam
\*---------------------------------------------------------------------------*/
#ifndef vtkFoamAddFields_H
#define vtkFoamAddFields_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class GeoField>
void Foam::vtkFoam::addFields
(
vtkDataArraySelection *fieldSelection,
const IOobjectList& objects
)
{
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
for
(
IOobjectList::iterator iter = fieldObjects.begin();
iter != fieldObjects.end();
++iter
)
{
fieldSelection->AddArray(iter()->name().c_str());
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,298 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "vtkFoam.H"
#include "fvMesh.H"
#include "cellModeller.H"
#include "vtkUnstructuredGrid.h"
#include "vtkCellArray.h"
#include "vtkFoamInsertNextPoint.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::vtkFoam::addInternalMesh
(
const fvMesh& mesh,
vtkUnstructuredGrid* vtkMesh
)
{
SetName(vtkMesh, "Internal Mesh");
// Number of additional points needed by the decomposition of polyhedra
label nAddPoints = 0;
// Number of additional cells generated by the decomposition of polyhedra
label nAddCells = 0;
const cellModel& tet = *(cellModeller::lookup("tet"));
const cellModel& pyr = *(cellModeller::lookup("pyr"));
const cellModel& prism = *(cellModeller::lookup("prism"));
const cellModel& wedge = *(cellModeller::lookup("wedge"));
const cellModel& tetWedge = *(cellModeller::lookup("tetWedge"));
const cellModel& hex = *(cellModeller::lookup("hex"));
// Scan for cells which need to be decomposed and count additional points
// and cells
if (debug)
{
Info<< "building cell-shapes" << endl;
}
const cellShapeList& cellShapes = mesh.cellShapes();
if (debug)
{
Info<< "scanning" << endl;
}
forAll(cellShapes, cellI)
{
const cellModel& model = cellShapes[cellI].model();
if
(
model != hex
&& model != wedge
&& model != prism
&& model != pyr
&& model != tet
&& model != tetWedge
)
{
const cell& cFaces = mesh.cells()[cellI];
forAll(cFaces, cFaceI)
{
const face& f = mesh.faces()[cFaces[cFaceI]];
label nFacePoints = f.size();
label nQuads = (nFacePoints - 2)/2;
label nTris = (nFacePoints - 2)%2;
nAddCells += nQuads + nTris;
}
nAddCells--;
nAddPoints++;
}
}
// Set size of additional point addressing array
// (from added point to original cell)
addPointCellLabels_.setSize(nAddPoints);
// Set size of additional cells mapping array
// (from added cell to original cell)
superCells_.setSize(mesh.nCells() + nAddCells);
if (debug)
{
Info<< "converting points" << endl;
}
// Convert Foam mesh vertices to VTK
vtkPoints *vtkpoints = vtkPoints::New();
vtkpoints->Allocate(mesh.nPoints() + nAddPoints);
const Foam::pointField& points = mesh.points();
forAll(points, i)
{
vtkFoamInsertNextPoint(vtkpoints, points[i]);
}
if (debug)
{
Info<< "converting cells" << endl;
}
vtkMesh->Allocate(mesh.nCells() + nAddCells);
// Set counters for additional points and additional cells
label api = 0, aci = 0;
forAll(cellShapes, celli)
{
const cellShape& cellShape = cellShapes[celli];
const cellModel& cellModel = cellShape.model();
superCells_[aci++] = celli;
if (cellModel == tet)
{
vtkMesh->InsertNextCell
(
VTK_TETRA,
4,
const_cast<int*>(cellShape.begin())
);
}
else if (cellModel == pyr)
{
vtkMesh->InsertNextCell
(
VTK_PYRAMID,
5,
const_cast<int*>(cellShape.begin())
);
}
else if (cellModel == prism)
{
vtkMesh->InsertNextCell
(
VTK_WEDGE,
6,
const_cast<int*>(cellShape.begin())
);
}
else if (cellModel == tetWedge)
{
// Treat as squeezed prism
int vtkVerts[6];
vtkVerts[0] = cellShape[0];
vtkVerts[1] = cellShape[2];
vtkVerts[2] = cellShape[1];
vtkVerts[3] = cellShape[3];
vtkVerts[4] = cellShape[4];
vtkVerts[5] = cellShape[4];
vtkMesh->InsertNextCell(VTK_WEDGE, 6, vtkVerts);
}
else if (cellModel == wedge)
{
// Treat as squeezed hex
int vtkVerts[8];
vtkVerts[0] = cellShape[0];
vtkVerts[1] = cellShape[1];
vtkVerts[2] = cellShape[2];
vtkVerts[3] = cellShape[2];
vtkVerts[4] = cellShape[3];
vtkVerts[5] = cellShape[4];
vtkVerts[6] = cellShape[5];
vtkVerts[7] = cellShape[6];
vtkMesh->InsertNextCell(VTK_HEXAHEDRON, 8, vtkVerts);
}
else if (cellModel == hex)
{
vtkMesh->InsertNextCell
(
VTK_HEXAHEDRON,
8,
const_cast<int*>(cellShape.begin())
);
}
else
{
// Polyhedral cell. Decompose into tets + prisms.
// Mapping from additional point to cell
addPointCellLabels_[api] = celli;
// Insert the new vertex from the cell-centre
label newVertexLabel = mesh.nPoints() + api;
vtkFoamInsertNextPoint(vtkpoints, mesh.C()[celli]);
// Whether to insert cell in place of original or not.
bool substituteCell = true;
const labelList& cFaces = mesh.cells()[celli];
forAll(cFaces, cFaceI)
{
const face& f = mesh.faces()[cFaces[cFaceI]];
label nFacePoints = f.size();
label nQuads = (nFacePoints - 2)/2;
label nTris = (nFacePoints - 2)%2;
label qpi = 0;
for (label quadi=0; quadi<nQuads; quadi++)
{
label thisCellI = -1;
if (substituteCell)
{
thisCellI = celli;
substituteCell = false;
}
else
{
thisCellI = mesh.nCells() + aci;
superCells_[aci++] = celli;
}
int addVtkVerts[5];
addVtkVerts[0] = f[0];
addVtkVerts[1] = f[qpi + 1];
addVtkVerts[2] = f[qpi + 2];
addVtkVerts[3] = f[qpi + 3];
addVtkVerts[4] = newVertexLabel;
vtkMesh->InsertNextCell(VTK_PYRAMID, 5, addVtkVerts);
qpi += 2;
}
if (nTris)
{
label thisCellI = -1;
if (substituteCell)
{
thisCellI = celli;
substituteCell = false;
}
else
{
thisCellI = mesh.nCells() + aci;
superCells_[aci++] = celli;
}
int addVtkVerts[4];
addVtkVerts[0] = f[0];
addVtkVerts[1] = f[qpi + 1];
addVtkVerts[2] = f[qpi + 2];
addVtkVerts[3] = newVertexLabel;
vtkMesh->InsertNextCell(VTK_TETRA, 4, addVtkVerts);
}
}
api++;
}
}
vtkMesh->SetPoints(vtkpoints);
vtkpoints->Delete();
}
// ************************************************************************* //

View file

@ -1,114 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "vtkFoam.H"
#include "polyPatch.H"
#include "vtkUnstructuredGrid.h"
#include "vtkCellArray.h"
#include "vtkFoamInsertNextPoint.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::vtkFoam::addPatch
(
const polyPatch& p,
vtkUnstructuredGrid *vtkPatch
)
{
if (debug)
{
Info<< "Adding patch " << p.name() << endl;
}
SetName(vtkPatch, p.name().c_str());
if (debug)
{
Info<< "converting points" << endl;
}
const Foam::pointField& points = p.localPoints();
// Convert Foam mesh vertices to VTK
vtkPoints *vtkpoints = vtkPoints::New();
vtkpoints->Allocate(points.size());
forAll(points, i)
{
vtkFoamInsertNextPoint(vtkpoints, points[i]);
}
if (debug)
{
Info<< "converting faces" << endl;
}
const faceList& faces = p.localFaces();
vtkPatch->Allocate(faces.size());
forAll(faces, facei)
{
const face& f = faces[facei];
if (f.size() == 3)
{
vtkPatch->InsertNextCell
(
VTK_TRIANGLE,
3,
const_cast<int*>(f.begin())
);
}
else if (f.size() == 4)
{
vtkPatch->InsertNextCell
(
VTK_QUAD,
4,
const_cast<int*>(f.begin())
);
}
else
{
vtkPatch->InsertNextCell
(
VTK_POLYGON,
f.size(),
const_cast<int*>(f.begin())
);
}
}
vtkPatch->SetPoints(vtkpoints);
vtkpoints->Delete();
}
// ************************************************************************* //

View file

@ -1,234 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::vtkFoam
\*---------------------------------------------------------------------------*/
#ifndef vtkFoamConvertFields_H
#define vtkFoamConvertFields_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "vtkFoamConvertVolField.H"
#include "vtkFoamConvertPointField.H"
#include "vtkFoamConvertPatchFaceField.H"
#include "vtkFoamConvertPatchPointField.H"
#include "emptyFvPatchField.H"
template<class Type>
void Foam::vtkFoam::convertVolFields
(
const fvMesh& mesh,
const volPointInterpolation& pInterp,
const IOobjectList& objects,
vtkDataArraySelection *fieldSelection
)
{
IOobjectList fieldObjects
(
objects.lookupClass
(
GeometricField<Type, fvPatchField, volMesh>::typeName
)
);
label nSelectedFields = fieldSelection->GetNumberOfArrays();
for (label i=0; i<nSelectedFields; i++)
{
if(fieldSelection->GetArraySetting(i))
{
word fieldName = fieldSelection->GetArrayName(i);
if (fieldObjects.found(fieldName))
{
GeometricField<Type, fvPatchField, volMesh> tf
(
IOobject
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ
),
mesh
);
tmp<GeometricField<Type, pointPatchField, pointMesh> > tptf
(
pInterp.interpolate(tf)
);
if (selectedRegions_[0])
{
convertVolField(tf);
convertPointField(tptf(), tf);
}
label regioni = 0;
forAll (mesh.boundaryMesh(), patchi)
{
if (mesh.boundaryMesh()[patchi].size())
{
regioni++;
if (selectedRegions_[regioni])
{
const fvPatchField<Type>& ptf
(
tf.boundaryField()[patchi]
);
if (!isType<emptyFvPatchField<Type> >(ptf))
{
convertPatchFaceField
(
tf.name(),
ptf,
regioni
);
convertPatchPointField
(
tptf().name(),
tptf().boundaryField()[patchi]
.patchInternalField()(),
regioni
);
}
else
{
fvPatch p
(
ptf.patch().patch(),
tf.mesh().boundary()
);
convertPatchFaceField
(
tf.name(),
fvPatchField<Type>(p, tf)
.patchInternalField()(),
regioni
);
convertPatchPointField
(
tptf().name(),
tptf().boundaryField()[patchi]
.patchInternalField()(),
regioni
);
}
}
}
}
}
}
}
}
template<class Type>
void Foam::vtkFoam::convertPointFields
(
const fvMesh& mesh,
const IOobjectList& objects,
vtkDataArraySelection *fieldSelection
)
{
IOobjectList fieldObjects
(
objects.lookupClass
(
GeometricField<Type, pointPatchField, pointMesh>::typeName
)
);
label nSelectedFields = fieldSelection->GetNumberOfArrays();
for (label i=0; i<nSelectedFields; i++)
{
if(fieldSelection->GetArraySetting(i))
{
word fieldName = fieldSelection->GetArrayName(i);
if (fieldObjects.found(fieldName))
{
pointMesh pMesh(mesh);
GeometricField<Type, pointPatchField, pointMesh> ptf
(
IOobject
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ
),
pMesh
);
if (selectedRegions_[0])
{
convertPointField
(
ptf,
GeometricField<Type, fvPatchField, volMesh>::null()
);
}
label regioni = 0;
forAll (mesh.boundaryMesh(), patchi)
{
if (mesh.boundaryMesh()[patchi].size())
{
regioni++;
if (selectedRegions_[regioni])
{
convertPatchPointField
(
ptf.name(),
ptf.boundaryField()[patchi]
.patchInternalField()(),
regioni
);
}
}
}
}
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,105 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::vtkFoam
\*---------------------------------------------------------------------------*/
#ifndef vtkFoamConvertPatchFaceField_H
#define vtkFoamConvertPatchFaceField_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void Foam::vtkFoam::convertPatchFaceField
(
const word& name,
const Field<Type>& ptf,
const label regioni
)
{
vtkUnstructuredGrid *vtkMesh =
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(regioni));
vtkFloatArray *cellTypes = vtkFloatArray::New();
cellTypes->SetNumberOfTuples(ptf.size());
cellTypes->SetNumberOfComponents(Type::nComponents);
cellTypes->Allocate(Type::nComponents*ptf.size());
cellTypes->SetName(name.c_str());
float vec[Type::nComponents];
forAll(ptf, i)
{
const Type& t = ptf[i];
for (direction d=0; d<Type::nComponents; d++)
{
vec[d] = t[d];
}
cellTypes->InsertTuple(i, vec);
}
vtkMesh->GetCellData()->AddArray(cellTypes);
cellTypes->Delete();
}
template<>
void Foam::vtkFoam::convertPatchFaceField
(
const word& name,
const Field<scalar>& psf,
const label regioni
)
{
vtkUnstructuredGrid *vtkMesh =
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(regioni));
vtkFloatArray *cellScalars = vtkFloatArray::New();
cellScalars->SetNumberOfTuples(psf.size());
cellScalars->SetNumberOfComponents(1);
cellScalars->Allocate(psf.size());
cellScalars->SetName(name.c_str());
forAll(psf, i)
{
cellScalars->InsertComponent(i, 0, psf[i]);
}
vtkMesh->GetCellData()->AddArray(cellScalars);
if (!vtkMesh->GetCellData()->GetScalars())
{
vtkMesh->GetCellData()->SetScalars(cellScalars);
}
cellScalars->Delete();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,104 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::vtkFoam
\*---------------------------------------------------------------------------*/
#ifndef vtkFoamConvertPatchPointField_H
#define vtkFoamConvertPatchPointField_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void Foam::vtkFoam::convertPatchPointField
(
const word& name,
const Field<Type>& pptf,
const label regioni
)
{
vtkUnstructuredGrid *vtkMesh =
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(regioni));
vtkFloatArray *pointTypes = vtkFloatArray::New();
pointTypes->SetNumberOfTuples(pptf.size());
pointTypes->SetNumberOfComponents(Type::nComponents);
pointTypes->Allocate(Type::nComponents*pptf.size());
pointTypes->SetName(name.c_str());
float vec[Type::nComponents];
forAll(pptf, i)
{
for (direction d=0; d<Type::nComponents; d++)
{
vec[d] = pptf[i][d];
}
pointTypes->InsertTuple(i, vec);
}
vtkMesh->GetPointData()->AddArray(pointTypes);
pointTypes->Delete();
}
template<>
void Foam::vtkFoam::convertPatchPointField
(
const word& name,
const Field<scalar>& ppsf,
const label regioni
)
{
vtkUnstructuredGrid *vtkMesh =
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(regioni));
vtkFloatArray *pointScalars = vtkFloatArray::New();
pointScalars->SetNumberOfTuples(ppsf.size());
pointScalars->SetNumberOfComponents(1);
pointScalars->Allocate(ppsf.size());
pointScalars->SetName(name.c_str());
for (int i=0; i<ppsf.size(); i++)
{
pointScalars->InsertComponent(i, 0, ppsf[i]);
}
vtkMesh->GetPointData()->AddArray(pointScalars);
if (!vtkMesh->GetPointData()->GetScalars())
{
vtkMesh->GetPointData()->SetScalars(pointScalars);
}
pointScalars->Delete();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,162 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::vtkFoam
\*---------------------------------------------------------------------------*/
#ifndef vtkFoamConvertPointField_H
#define vtkFoamConvertPointField_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "interpolatePointToCell.H"
template<class Type>
void Foam::vtkFoam::convertPointField
(
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
const GeometricField<Type, fvPatchField, volMesh>& tf
)
{
vtkUnstructuredGrid *vtkMesh =
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(0));
vtkFloatArray *pointTypes = vtkFloatArray::New();
pointTypes->SetNumberOfTuples(ptf.size() + addPointCellLabels_.size());
pointTypes->SetNumberOfComponents(Type::nComponents);
pointTypes->Allocate(Type::nComponents*ptf.size());
pointTypes->SetName(ptf.name().c_str());
float vec[Type::nComponents];
forAll(ptf, i)
{
for (direction d=0; d<Type::nComponents; d++)
{
vec[d] = ptf[i][d];
}
pointTypes->InsertTuple(i, vec);
}
label i = ptf.size();
if (&tf != &GeometricField<Type, fvPatchField, volMesh>::null())
{
forAll(addPointCellLabels_, api)
{
Type t = tf[addPointCellLabels_[api]];
for (direction d=0; d<Type::nComponents; d++)
{
vec[d] = t[d];
}
pointTypes->InsertTuple(i++, vec);
}
}
else
{
forAll(addPointCellLabels_, api)
{
Type t = interpolatePointToCell(ptf, addPointCellLabels_[api]);
for (direction d=0; d<Type::nComponents; d++)
{
vec[d] = t[d];
}
pointTypes->InsertTuple(i++, vec);
}
}
vtkMesh->GetPointData()->AddArray(pointTypes);
pointTypes->Delete();
}
template<>
void Foam::vtkFoam::convertPointField
(
const GeometricField<scalar, pointPatchField, pointMesh>& psf,
const GeometricField<scalar, fvPatchField, volMesh>& sf
)
{
vtkUnstructuredGrid *vtkMesh =
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(0));
vtkFloatArray *pointScalars = vtkFloatArray::New();
pointScalars->SetNumberOfTuples(psf.size() + addPointCellLabels_.size());
pointScalars->SetNumberOfComponents(1);
pointScalars->Allocate(psf.size());
pointScalars->SetName(psf.name().c_str());
for (int i=0; i<psf.size(); i++)
{
pointScalars->InsertComponent(i, 0, psf[i]);
}
label i = psf.size();
if (&sf != &GeometricField<scalar, fvPatchField, volMesh>::null())
{
forAll(addPointCellLabels_, api)
{
pointScalars->InsertComponent
(
i++,
0,
sf[addPointCellLabels_[api]]
);
}
}
else
{
forAll(addPointCellLabels_, api)
{
pointScalars->InsertComponent
(
i++,
0,
interpolatePointToCell(psf, addPointCellLabels_[api])
);
}
}
vtkMesh->GetPointData()->AddArray(pointScalars);
if (!vtkMesh->GetPointData()->GetScalars())
{
vtkMesh->GetPointData()->SetScalars(pointScalars);
}
pointScalars->Delete();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,101 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::vtkFoam
\*---------------------------------------------------------------------------*/
#ifndef vtkFoamConvertVolField_H
#define vtkFoamConvertVolField_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void Foam::vtkFoam::convertVolField
(
const GeometricField<Type, fvPatchField, volMesh>& tf
)
{
vtkUnstructuredGrid *vtkMesh =
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(0));
vtkFloatArray *cellTypes = vtkFloatArray::New();
cellTypes->SetNumberOfTuples(superCells_.size());
cellTypes->SetNumberOfComponents(Type::nComponents);
cellTypes->Allocate(Type::nComponents*tf.size());
cellTypes->SetName(tf.name().c_str());
float vec[Type::nComponents];
forAll(superCells_, sci)
{
const Type& t = tf[superCells_[sci]];
for (direction d=0; d<Type::nComponents; d++)
{
vec[d] = t[d];
}
cellTypes->InsertTuple(sci, vec);
}
vtkMesh->GetCellData()->AddArray(cellTypes);
cellTypes->Delete();
}
template<>
void Foam::vtkFoam::convertVolField
(
const GeometricField<scalar, fvPatchField, volMesh>& sf
)
{
vtkUnstructuredGrid *vtkMesh =
vtkUnstructuredGrid::SafeDownCast(reader_->GetOutput(0));
vtkFloatArray *cellScalars = vtkFloatArray::New();
cellScalars->SetNumberOfTuples(superCells_.size());
cellScalars->SetNumberOfComponents(1);
cellScalars->Allocate(sf.size());
cellScalars->SetName(sf.name().c_str());
forAll(superCells_, sci)
{
cellScalars->InsertComponent(sci, 0, sf[superCells_[sci]]);
}
vtkMesh->GetCellData()->AddArray(cellScalars);
if (!vtkMesh->GetCellData()->GetScalars())
{
vtkMesh->GetCellData()->SetScalars(cellScalars);
}
cellScalars->Delete();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,48 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::vtkFoam
\*---------------------------------------------------------------------------*/
#ifndef vtkFoamInsertNextPoint_H
#define vtkFoamInsertNextPoint_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline void vtkFoamInsertNextPoint
(
vtkPoints *points,
const Foam::point& p
)
{
points->InsertNextPoint(p.x(), p.y(), p.z());
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
wclean libso vtkPVFoam
[ ! -z "$FOAM_LIBBIN" ] && rm -f "$FOAM_LIBBIN/libvtkPVFoam"* 2>/dev/null
[ ! -z "$PV_PLUGIN_PATH" ] && rm -f "$PV_PLUGIN_PATH/libPVFoamReader_SM"* 2>/dev/null
rm -rf PVFoamReader/Make
#------------------------------------------------------------------------------

View file

@ -0,0 +1,41 @@
#!/bin/bash
cd ${0%/*} || exit 1 # Run from this directory
if [ -d "$PARAVIEW_DIR" -a -r "$PARAVIEW_DIR" ]; then
case "$PARAVIEW_VERSION" in
4* | 5*)
[ -n "$PV_PLUGIN_PATH" ] || {
echo "$0 : PV_PLUGIN_PATH not valid - it is unset"
exit 1
}
# ensure CMake gets the correct C/C++ compilers
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
# store major version for usage in vtkPVFoam/Make/options
export PARAVIEW_MAJOR_VERSION="${PARAVIEW_VERSION:0:1}"
wmake libso vtkPVFoam
# clear major version
unset PARAVIEW_MAJOR_VERSION
(
cd PVFoamReader
mkdir -p Make/$WM_OPTIONS > /dev/null 2>&1
cd Make/$WM_OPTIONS
cmake ../..
if [ "$WM_ARCH_BASE" == "darwin" ]
then
sed -i bak -e 's/-dynamiclib /& -undefined dynamic_lookup /' CMakeFiles/PVFoamReader.dir/link.txt
sed -i bak -e 's/-dynamiclib /& -undefined dynamic_lookup /' CMakeFiles/PVFoamReader_SM.dir/link.txt
fi
make
)
;;
esac
fi
#------------------------------------------------------------------------------

View file

@ -23,10 +23,11 @@ LINK_DIRECTORIES(
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
$ENV{WM_PROJECT_DIR}/src/foam/lnInclude $ENV{WM_PROJECT_DIR}/src/foam/lnInclude
$ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude $ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude
${PROJECT_SOURCE_DIR}/../vtkPV4Foam ${PROJECT_SOURCE_DIR}/../vtkPVFoam
) )
ADD_DEFINITIONS( ADD_DEFINITIONS(
-std=c++11
-DWM_$ENV{WM_PRECISION_OPTION} -DWM_$ENV{WM_PRECISION_OPTION}
) )
@ -39,16 +40,16 @@ SET(
# Build the server-side plugin # Build the server-side plugin
ADD_PARAVIEW_PLUGIN( ADD_PARAVIEW_PLUGIN(
PV4FoamReader_SM "1.0" PVFoamReader_SM "1.0"
SERVER_MANAGER_XML PV4FoamReader_SM.xml SERVER_MANAGER_XML PVFoamReader_SM.xml
SERVER_MANAGER_SOURCES vtkPV4FoamReader.cxx SERVER_MANAGER_SOURCES vtkPVFoamReader.cxx
) )
TARGET_LINK_LIBRARIES( TARGET_LINK_LIBRARIES(
PV4FoamReader_SM PVFoamReader_SM
foam foam
finiteVolume finiteVolume
vtkPV4Foam vtkPVFoam
pqCore pqCore
) )
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------

View file

@ -1,8 +1,8 @@
<ServerManagerConfiguration> <ServerManagerConfiguration>
<ProxyGroup name="sources"> <ProxyGroup name="sources">
<SourceProxy <SourceProxy
name="PV4FoamReader" name="PVFoamReader"
class="vtkPV4FoamReader"> class="vtkPVFoamReader">
<!-- File extension section for paraview 4.3+ --> <!-- File extension section for paraview 4.3+ -->
@ -104,6 +104,21 @@
</Documentation> </Documentation>
</IntVectorProperty> </IntVectorProperty>
<!-- Use VTK Polyhedron check-box -->
<IntVectorProperty
name="UiUseVTKPolyhedron"
command="SetUseVTKPolyhedron"
label="Use VTK Polyhedron"
number_of_elements="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Represent cells as general polyhedra instead of decomposing
them into simpler shapes
</Documentation>
</IntVectorProperty>
<!-- Update GUI check box --> <!-- Update GUI check box -->
<IntVectorProperty <IntVectorProperty

View file

@ -1,7 +1,7 @@
/*========================================================================= /*=========================================================================
Program: Visualization Toolkit Program: Visualization Toolkit
Module: $RCSfile: vtkPV4FoamReader.cxx,v $ Module: $RCSfile: vtkPVFoamReader.cxx,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved. All rights reserved.
@ -13,7 +13,7 @@
=========================================================================*/ =========================================================================*/
#include "vtkPV4FoamReader.h" #include "vtkPVFoamReader.h"
#include "pqApplicationCore.h" #include "pqApplicationCore.h"
#include "pqRenderView.h" #include "pqRenderView.h"
@ -31,13 +31,13 @@
#include "vtkStringArray.h" #include "vtkStringArray.h"
// Foam includes // Foam includes
#include "vtkPV4Foam.H" #include "vtkPVFoam.H"
vtkStandardNewMacro(vtkPV4FoamReader); vtkStandardNewMacro(vtkPVFoamReader);
#undef EXPERIMENTAL_TIME_CACHING #undef EXPERIMENTAL_TIME_CACHING
vtkPV4FoamReader::vtkPV4FoamReader() vtkPVFoamReader::vtkPVFoamReader()
{ {
Debug = 0; Debug = 0;
vtkDebugMacro(<<"Constructor"); vtkDebugMacro(<<"Constructor");
@ -49,7 +49,7 @@ vtkPV4FoamReader::vtkPV4FoamReader()
output0_ = NULL; output0_ = NULL;
#ifdef VTKPV4FOAM_DUALPORT #ifdef VTKPVFOAM_DUALPORT
// Add second output for the Lagrangian // Add second output for the Lagrangian
this->SetNumberOfOutputPorts(2); this->SetNumberOfOutputPorts(2);
vtkMultiBlockDataSet *lagrangian = vtkMultiBlockDataSet::New(); vtkMultiBlockDataSet *lagrangian = vtkMultiBlockDataSet::New();
@ -65,6 +65,7 @@ vtkPV4FoamReader::vtkPV4FoamReader()
CacheMesh = 1; CacheMesh = 1;
ExtrapolatePatches = 0; ExtrapolatePatches = 0;
UseVTKPolyhedron = 0;
IncludeSets = 0; IncludeSets = 0;
IncludeZones = 0; IncludeZones = 0;
ShowPatchNames = 0; ShowPatchNames = 0;
@ -81,7 +82,7 @@ vtkPV4FoamReader::vtkPV4FoamReader()
SelectionObserver = vtkCallbackCommand::New(); SelectionObserver = vtkCallbackCommand::New();
SelectionObserver->SetCallback SelectionObserver->SetCallback
( (
&vtkPV4FoamReader::SelectionModifiedCallback &vtkPVFoamReader::SelectionModifiedCallback
); );
SelectionObserver->SetClientData(this); SelectionObserver->SetClientData(this);
@ -108,7 +109,7 @@ vtkPV4FoamReader::vtkPV4FoamReader()
} }
vtkPV4FoamReader::~vtkPV4FoamReader() vtkPVFoamReader::~vtkPVFoamReader()
{ {
vtkDebugMacro(<<"Deconstructor"); vtkDebugMacro(<<"Deconstructor");
@ -140,7 +141,7 @@ vtkPV4FoamReader::~vtkPV4FoamReader()
// Do everything except set the output info // Do everything except set the output info
int vtkPV4FoamReader::RequestInformation int vtkPVFoamReader::RequestInformation
( (
vtkInformation* vtkNotUsed(request), vtkInformation* vtkNotUsed(request),
vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector** vtkNotUsed(inputVector),
@ -149,7 +150,7 @@ int vtkPV4FoamReader::RequestInformation
{ {
vtkDebugMacro(<<"RequestInformation"); vtkDebugMacro(<<"RequestInformation");
if (Foam::vtkPV4Foam::debug) if (Foam::vtkPVFoam::debug)
{ {
cout<<"REQUEST_INFORMATION\n"; cout<<"REQUEST_INFORMATION\n";
} }
@ -162,7 +163,7 @@ int vtkPV4FoamReader::RequestInformation
int nInfo = outputVector->GetNumberOfInformationObjects(); int nInfo = outputVector->GetNumberOfInformationObjects();
if (Foam::vtkPV4Foam::debug) if (Foam::vtkPVFoam::debug)
{ {
cout<<"RequestInformation with " << nInfo << " item(s)\n"; cout<<"RequestInformation with " << nInfo << " item(s)\n";
for (int infoI = 0; infoI < nInfo; ++infoI) for (int infoI = 0; infoI < nInfo; ++infoI)
@ -173,7 +174,7 @@ int vtkPV4FoamReader::RequestInformation
if (!foamData_) if (!foamData_)
{ {
foamData_ = new Foam::vtkPV4Foam(FileName, this); foamData_ = new Foam::vtkPVFoam(FileName, this);
} }
else else
{ {
@ -210,7 +211,7 @@ int vtkPV4FoamReader::RequestInformation
timeRange[0] = timeSteps[0]; timeRange[0] = timeSteps[0];
timeRange[1] = timeSteps[nTimeSteps-1]; timeRange[1] = timeSteps[nTimeSteps-1];
if (Foam::vtkPV4Foam::debug > 1) if (Foam::vtkPVFoam::debug > 1)
{ {
cout<<"nTimeSteps " << nTimeSteps << "\n" cout<<"nTimeSteps " << nTimeSteps << "\n"
<<"timeRange " << timeRange[0] << " to " << timeRange[1] <<"timeRange " << timeRange[0] << " to " << timeRange[1]
@ -240,7 +241,7 @@ int vtkPV4FoamReader::RequestInformation
// Set the output info // Set the output info
int vtkPV4FoamReader::RequestData int vtkPVFoamReader::RequestData
( (
vtkInformation* vtkNotUsed(request), vtkInformation* vtkNotUsed(request),
vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector** vtkNotUsed(inputVector),
@ -264,7 +265,7 @@ int vtkPV4FoamReader::RequestData
int nInfo = outputVector->GetNumberOfInformationObjects(); int nInfo = outputVector->GetNumberOfInformationObjects();
if (Foam::vtkPV4Foam::debug) if (Foam::vtkPVFoam::debug)
{ {
cout<<"RequestData with " << nInfo << " item(s)\n"; cout<<"RequestData with " << nInfo << " item(s)\n";
for (int infoI = 0; infoI < nInfo; ++infoI) for (int infoI = 0; infoI < nInfo; ++infoI)
@ -282,7 +283,7 @@ int vtkPV4FoamReader::RequestData
// taking port0 as the lead for other outputs would be nice, but fails when // taking port0 as the lead for other outputs would be nice, but fails when
// a filter is added - we need to check everything // a filter is added - we need to check everything
// but since PREVIOUS_UPDATE_TIME_STEPS() is protected, relay the logic // but since PREVIOUS_UPDATE_TIME_STEPS() is protected, relay the logic
// to the vtkPV4Foam::setTime() method // to the vtkPVFoam::setTime() method
for (int infoI = 0; infoI < nInfo; ++infoI) for (int infoI = 0; infoI < nInfo; ++infoI)
{ {
vtkInformation *outInfo = outputVector->GetInformationObject(infoI); vtkInformation *outInfo = outputVector->GetInformationObject(infoI);
@ -314,7 +315,7 @@ int vtkPV4FoamReader::RequestData
) )
); );
if (Foam::vtkPV4Foam::debug) if (Foam::vtkPVFoam::debug)
{ {
cout<< "update output with " cout<< "update output with "
<< output->GetNumberOfBlocks() << " blocks\n"; << output->GetNumberOfBlocks() << " blocks\n";
@ -342,7 +343,7 @@ int vtkPV4FoamReader::RequestData
output->ShallowCopy(output0_); output->ShallowCopy(output0_);
} }
if (Foam::vtkPV4Foam::debug) if (Foam::vtkPVFoam::debug)
{ {
if (needsUpdate) if (needsUpdate)
{ {
@ -362,7 +363,7 @@ int vtkPV4FoamReader::RequestData
#else #else
#ifdef VTKPV4FOAM_DUALPORT #ifdef VTKPVFOAM_DUALPORT
foamData_->Update foamData_->Update
( (
output, output,
@ -396,7 +397,7 @@ int vtkPV4FoamReader::RequestData
} }
void vtkPV4FoamReader::addPatchNamesToView() void vtkPVFoamReader::addPatchNamesToView()
{ {
pqApplicationCore* appCore = pqApplicationCore::instance(); pqApplicationCore* appCore = pqApplicationCore::instance();
@ -416,7 +417,7 @@ void vtkPV4FoamReader::addPatchNamesToView()
} }
void vtkPV4FoamReader::removePatchNamesFromView() void vtkPVFoamReader::removePatchNamesFromView()
{ {
pqApplicationCore* appCore = pqApplicationCore::instance(); pqApplicationCore* appCore = pqApplicationCore::instance();
@ -436,7 +437,7 @@ void vtkPV4FoamReader::removePatchNamesFromView()
} }
void vtkPV4FoamReader::PrintSelf(ostream& os, vtkIndent indent) void vtkPVFoamReader::PrintSelf(ostream& os, vtkIndent indent)
{ {
vtkDebugMacro(<<"PrintSelf"); vtkDebugMacro(<<"PrintSelf");
@ -453,7 +454,7 @@ void vtkPV4FoamReader::PrintSelf(ostream& os, vtkIndent indent)
} }
int vtkPV4FoamReader::GetTimeStep() int vtkPVFoamReader::GetTimeStep()
{ {
return foamData_ ? foamData_->timeIndex() : -1; return foamData_ ? foamData_->timeIndex() : -1;
} }
@ -462,35 +463,35 @@ int vtkPV4FoamReader::GetTimeStep()
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// Parts selection list control // Parts selection list control
vtkDataArraySelection* vtkPV4FoamReader::GetPartSelection() vtkDataArraySelection* vtkPVFoamReader::GetPartSelection()
{ {
vtkDebugMacro(<<"GetPartSelection"); vtkDebugMacro(<<"GetPartSelection");
return PartSelection; return PartSelection;
} }
int vtkPV4FoamReader::GetNumberOfPartArrays() int vtkPVFoamReader::GetNumberOfPartArrays()
{ {
vtkDebugMacro(<<"GetNumberOfPartArrays"); vtkDebugMacro(<<"GetNumberOfPartArrays");
return PartSelection->GetNumberOfArrays(); return PartSelection->GetNumberOfArrays();
} }
const char* vtkPV4FoamReader::GetPartArrayName(int index) const char* vtkPVFoamReader::GetPartArrayName(int index)
{ {
vtkDebugMacro(<<"GetPartArrayName"); vtkDebugMacro(<<"GetPartArrayName");
return PartSelection->GetArrayName(index); return PartSelection->GetArrayName(index);
} }
int vtkPV4FoamReader::GetPartArrayStatus(const char* name) int vtkPVFoamReader::GetPartArrayStatus(const char* name)
{ {
vtkDebugMacro(<<"GetPartArrayStatus"); vtkDebugMacro(<<"GetPartArrayStatus");
return PartSelection->ArrayIsEnabled(name); return PartSelection->ArrayIsEnabled(name);
} }
void vtkPV4FoamReader::SetPartArrayStatus(const char* name, int status) void vtkPVFoamReader::SetPartArrayStatus(const char* name, int status)
{ {
vtkDebugMacro(<<"SetPartArrayStatus"); vtkDebugMacro(<<"SetPartArrayStatus");
if (status) if (status)
@ -507,35 +508,35 @@ void vtkPV4FoamReader::SetPartArrayStatus(const char* name, int status)
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// volField selection list control // volField selection list control
vtkDataArraySelection* vtkPV4FoamReader::GetVolFieldSelection() vtkDataArraySelection* vtkPVFoamReader::GetVolFieldSelection()
{ {
vtkDebugMacro(<<"GetVolFieldSelection"); vtkDebugMacro(<<"GetVolFieldSelection");
return VolFieldSelection; return VolFieldSelection;
} }
int vtkPV4FoamReader::GetNumberOfVolFieldArrays() int vtkPVFoamReader::GetNumberOfVolFieldArrays()
{ {
vtkDebugMacro(<<"GetNumberOfVolFieldArrays"); vtkDebugMacro(<<"GetNumberOfVolFieldArrays");
return VolFieldSelection->GetNumberOfArrays(); return VolFieldSelection->GetNumberOfArrays();
} }
const char* vtkPV4FoamReader::GetVolFieldArrayName(int index) const char* vtkPVFoamReader::GetVolFieldArrayName(int index)
{ {
vtkDebugMacro(<<"GetVolFieldArrayName"); vtkDebugMacro(<<"GetVolFieldArrayName");
return VolFieldSelection->GetArrayName(index); return VolFieldSelection->GetArrayName(index);
} }
int vtkPV4FoamReader::GetVolFieldArrayStatus(const char* name) int vtkPVFoamReader::GetVolFieldArrayStatus(const char* name)
{ {
vtkDebugMacro(<<"GetVolFieldArrayStatus"); vtkDebugMacro(<<"GetVolFieldArrayStatus");
return VolFieldSelection->ArrayIsEnabled(name); return VolFieldSelection->ArrayIsEnabled(name);
} }
void vtkPV4FoamReader::SetVolFieldArrayStatus(const char* name, int status) void vtkPVFoamReader::SetVolFieldArrayStatus(const char* name, int status)
{ {
vtkDebugMacro(<<"SetVolFieldArrayStatus"); vtkDebugMacro(<<"SetVolFieldArrayStatus");
if (status) if (status)
@ -552,35 +553,35 @@ void vtkPV4FoamReader::SetVolFieldArrayStatus(const char* name, int status)
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// pointField selection list control // pointField selection list control
vtkDataArraySelection* vtkPV4FoamReader::GetPointFieldSelection() vtkDataArraySelection* vtkPVFoamReader::GetPointFieldSelection()
{ {
vtkDebugMacro(<<"GetPointFieldSelection"); vtkDebugMacro(<<"GetPointFieldSelection");
return PointFieldSelection; return PointFieldSelection;
} }
int vtkPV4FoamReader::GetNumberOfPointFieldArrays() int vtkPVFoamReader::GetNumberOfPointFieldArrays()
{ {
vtkDebugMacro(<<"GetNumberOfPointFieldArrays"); vtkDebugMacro(<<"GetNumberOfPointFieldArrays");
return PointFieldSelection->GetNumberOfArrays(); return PointFieldSelection->GetNumberOfArrays();
} }
const char* vtkPV4FoamReader::GetPointFieldArrayName(int index) const char* vtkPVFoamReader::GetPointFieldArrayName(int index)
{ {
vtkDebugMacro(<<"GetPointFieldArrayName"); vtkDebugMacro(<<"GetPointFieldArrayName");
return PointFieldSelection->GetArrayName(index); return PointFieldSelection->GetArrayName(index);
} }
int vtkPV4FoamReader::GetPointFieldArrayStatus(const char* name) int vtkPVFoamReader::GetPointFieldArrayStatus(const char* name)
{ {
vtkDebugMacro(<<"GetPointFieldArrayStatus"); vtkDebugMacro(<<"GetPointFieldArrayStatus");
return PointFieldSelection->ArrayIsEnabled(name); return PointFieldSelection->ArrayIsEnabled(name);
} }
void vtkPV4FoamReader::SetPointFieldArrayStatus(const char* name, int status) void vtkPVFoamReader::SetPointFieldArrayStatus(const char* name, int status)
{ {
vtkDebugMacro(<<"SetPointFieldArrayStatus"); vtkDebugMacro(<<"SetPointFieldArrayStatus");
if (status) if (status)
@ -597,35 +598,35 @@ void vtkPV4FoamReader::SetPointFieldArrayStatus(const char* name, int status)
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// lagrangianField selection list control // lagrangianField selection list control
vtkDataArraySelection* vtkPV4FoamReader::GetLagrangianFieldSelection() vtkDataArraySelection* vtkPVFoamReader::GetLagrangianFieldSelection()
{ {
vtkDebugMacro(<<"GetLagrangianFieldSelection"); vtkDebugMacro(<<"GetLagrangianFieldSelection");
return LagrangianFieldSelection; return LagrangianFieldSelection;
} }
int vtkPV4FoamReader::GetNumberOfLagrangianFieldArrays() int vtkPVFoamReader::GetNumberOfLagrangianFieldArrays()
{ {
vtkDebugMacro(<<"GetNumberOfLagrangianFieldArrays"); vtkDebugMacro(<<"GetNumberOfLagrangianFieldArrays");
return LagrangianFieldSelection->GetNumberOfArrays(); return LagrangianFieldSelection->GetNumberOfArrays();
} }
const char* vtkPV4FoamReader::GetLagrangianFieldArrayName(int index) const char* vtkPVFoamReader::GetLagrangianFieldArrayName(int index)
{ {
vtkDebugMacro(<<"GetLagrangianFieldArrayName"); vtkDebugMacro(<<"GetLagrangianFieldArrayName");
return LagrangianFieldSelection->GetArrayName(index); return LagrangianFieldSelection->GetArrayName(index);
} }
int vtkPV4FoamReader::GetLagrangianFieldArrayStatus(const char* name) int vtkPVFoamReader::GetLagrangianFieldArrayStatus(const char* name)
{ {
vtkDebugMacro(<<"GetLagrangianFieldArrayStatus"); vtkDebugMacro(<<"GetLagrangianFieldArrayStatus");
return LagrangianFieldSelection->ArrayIsEnabled(name); return LagrangianFieldSelection->ArrayIsEnabled(name);
} }
void vtkPV4FoamReader::SetLagrangianFieldArrayStatus void vtkPVFoamReader::SetLagrangianFieldArrayStatus
( (
const char* name, const char* name,
int status int status
@ -645,7 +646,7 @@ void vtkPV4FoamReader::SetLagrangianFieldArrayStatus
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
void vtkPV4FoamReader::SelectionModifiedCallback void vtkPVFoamReader::SelectionModifiedCallback
( (
vtkObject*, vtkObject*,
unsigned long, unsigned long,
@ -653,18 +654,18 @@ void vtkPV4FoamReader::SelectionModifiedCallback
void* void*
) )
{ {
static_cast<vtkPV4FoamReader*>(clientdata)->SelectionModified(); static_cast<vtkPVFoamReader*>(clientdata)->SelectionModified();
} }
void vtkPV4FoamReader::SelectionModified() void vtkPVFoamReader::SelectionModified()
{ {
vtkDebugMacro(<<"SelectionModified"); vtkDebugMacro(<<"SelectionModified");
Modified(); Modified();
} }
int vtkPV4FoamReader::FillOutputPortInformation int vtkPVFoamReader::FillOutputPortInformation
( (
int port, int port,
vtkInformation* info vtkInformation* info

View file

@ -1,7 +1,7 @@
/*========================================================================= /*=========================================================================
Program: Visualization Toolkit Program: Visualization Toolkit
Module: $RCSfile: vtkPV4FoamReader.h,v $ Module: $RCSfile: vtkPVFoamReader.h,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved. All rights reserved.
@ -12,19 +12,19 @@
PURPOSE. See the above copyright notice for more information. PURPOSE. See the above copyright notice for more information.
=========================================================================*/ =========================================================================*/
// .NAME vtkPV4FoamReader - reads a dataset in OpenFOAM format // .NAME vtkPVFoamReader - reads a dataset in OpenFOAM format
// .SECTION Description // .SECTION Description
// vtkPV4FoamReader creates an multiblock dataset. // vtkPVFoamReader creates an multiblock dataset.
// It uses the OpenFOAM infrastructure (fvMesh, etc) to // It uses the OpenFOAM infrastructure (fvMesh, etc) to
// handle mesh and field data. // handle mesh and field data.
#ifndef __vtkPV4FoamReader_h #ifndef __vtkPVFoamReader_h
#define __vtkPV4FoamReader_h #define __vtkPVFoamReader_h
// Foam forward declarations // Foam forward declarations
namespace Foam namespace Foam
{ {
class vtkPV4Foam; class vtkPVFoam;
} }
// VTK includes // VTK includes
@ -37,18 +37,18 @@ class vtkCallbackCommand;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class vtkPV4FoamReader Declaration Class vtkPVFoamReader Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class vtkPV4FoamReader class vtkPVFoamReader
: :
public vtkMultiBlockDataSetAlgorithm public vtkMultiBlockDataSetAlgorithm
{ {
public: public:
vtkTypeMacro(vtkPV4FoamReader, vtkMultiBlockDataSetAlgorithm); vtkTypeMacro(vtkPVFoamReader, vtkMultiBlockDataSetAlgorithm);
void PrintSelf(ostream&, vtkIndent); void PrintSelf(ostream&, vtkIndent);
static vtkPV4FoamReader* New(); static vtkPVFoamReader* New();
// Description: // Description:
// Get the current timestep and the timestep range. // Get the current timestep and the timestep range.
@ -74,6 +74,11 @@ public:
vtkSetMacro(ExtrapolatePatches, int); vtkSetMacro(ExtrapolatePatches, int);
vtkGetMacro(ExtrapolatePatches, int); vtkGetMacro(ExtrapolatePatches, int);
// Description:
// FOAM use vtkPolyhedron instead of decomposing polyhedra
vtkSetMacro(UseVTKPolyhedron, int);
vtkGetMacro(UseVTKPolyhedron, int);
// FOAM read sets control // FOAM read sets control
vtkSetMacro(IncludeSets, int); vtkSetMacro(IncludeSets, int);
vtkGetMacro(IncludeSets, int); vtkGetMacro(IncludeSets, int);
@ -141,10 +146,10 @@ public:
protected: protected:
//- Construct null //- Construct null
vtkPV4FoamReader(); vtkPVFoamReader();
//- Destructor //- Destructor
~vtkPV4FoamReader(); ~vtkPVFoamReader();
//- Return information about mesh, times, etc without loading anything //- Return information about mesh, times, etc without loading anything
virtual int RequestInformation virtual int RequestInformation
@ -174,10 +179,10 @@ protected:
private: private:
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
vtkPV4FoamReader(const vtkPV4FoamReader&); vtkPVFoamReader(const vtkPVFoamReader&);
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const vtkPV4FoamReader&); void operator=(const vtkPVFoamReader&);
//- Add patch names to the view //- Add patch names to the view
void addPatchNamesToView(); void addPatchNamesToView();
@ -189,6 +194,7 @@ private:
int CacheMesh; int CacheMesh;
int ExtrapolatePatches; int ExtrapolatePatches;
int UseVTKPolyhedron;
int IncludeSets; int IncludeSets;
int IncludeZones; int IncludeZones;
int ShowPatchNames; int ShowPatchNames;
@ -205,7 +211,7 @@ private:
vtkMultiBlockDataSet* output0_; vtkMultiBlockDataSet* output0_;
//BTX //BTX
Foam::vtkPV4Foam* foamData_; Foam::vtkPVFoam* foamData_;
//ETX //ETX
}; };

View file

@ -0,0 +1,12 @@
vtkPVFoam.C
vtkPVFoamFields.C
vtkPVFoamMesh.C
vtkPVFoamMeshLagrangian.C
vtkPVFoamMeshPatch.C
vtkPVFoamMeshSet.C
vtkPVFoamMeshVolume.C
vtkPVFoamMeshZone.C
vtkPVFoamUpdateInfo.C
vtkPVFoamUtilities.C
LIB = $(FOAM_LIBBIN)/libvtkPVFoam

View file

@ -0,0 +1,21 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(PARAVIEW_INCLUDE_DIR) \
-I$(PARAVIEW_INCLUDE_DIR)/vtkkwiml \
-I../PVFoamReader \
$(shell \
test -f $(PARAVIEW_INCLUDE_DIR)/vtkPolyhedron.h && \
echo "-DHAS_VTK_POLYHEDRON" || echo "-UHAS_VTK_POLYHEDRON" \
) \
$(shell \
[ $(PARAVIEW_MAJOR_VERSION) = '5' ] && echo "-std=c++11" \
)
LIB_LIBS = \
-l$(WM_PROJECT) \
-lfiniteVolume \
-llagrangian \
-lmeshTools \
$(GLIBS)

View file

@ -22,7 +22,7 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>. along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass InClass
vtkPV4Foam vtkPVFoam
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View file

@ -23,8 +23,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vtkPV3Foam.H" #include "vtkPVFoam.H"
#include "vtkPV3FoamReader.h" #include "vtkPVFoamReader.h"
// Foam includes // Foam includes
#include "fvMesh.H" #include "fvMesh.H"
@ -40,14 +40,14 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::vtkPV3Foam, 0); defineTypeNameAndDebug(Foam::vtkPVFoam, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
#include "vtkPV3FoamAddToSelection.H" #include "vtkPVFoamAddToSelection.H"
#include "vtkPV3FoamUpdateInfoFields.H" #include "vtkPVFoamUpdateInfoFields.H"
void Foam::vtkPV3Foam::resetCounters() void Foam::vtkPVFoam::resetCounters()
{ {
// Reset mesh part ids and sizes // Reset mesh part ids and sizes
partInfoVolume_.reset(); partInfoVolume_.reset();
@ -62,7 +62,7 @@ void Foam::vtkPV3Foam::resetCounters()
} }
void Foam::vtkPV3Foam::reduceMemory() void Foam::vtkPVFoam::reduceMemory()
{ {
forAll(regionPolyDecomp_, i) forAll(regionPolyDecomp_, i)
{ {
@ -89,11 +89,11 @@ void Foam::vtkPV3Foam::reduceMemory()
int Foam::vtkPV3Foam::setTime(int nRequest, const double requestTimes[]) int Foam::vtkPVFoam::setTime(int nRequest, const double requestTimes[])
{ {
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::setTime("; Info<< "<beg> Foam::vtkPVFoam::setTime(";
for (int requestI = 0; requestI < nRequest; ++requestI) for (int requestI = 0; requestI < nRequest; ++requestI)
{ {
if (requestI) if (requestI)
@ -157,7 +157,7 @@ int Foam::vtkPV3Foam::setTime(int nRequest, const double requestTimes[])
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::setTime() - selectedTime=" Info<< "<end> Foam::vtkPVFoam::setTime() - selectedTime="
<< Times[nearestIndex].name() << " index=" << timeIndex_ << Times[nearestIndex].name() << " index=" << timeIndex_
<< "/" << Times.size() << "/" << Times.size()
<< " meshChanged=" << Switch(meshChanged_) << " meshChanged=" << Switch(meshChanged_)
@ -168,11 +168,11 @@ int Foam::vtkPV3Foam::setTime(int nRequest, const double requestTimes[])
} }
void Foam::vtkPV3Foam::updateMeshPartsStatus() void Foam::vtkPVFoam::updateMeshPartsStatus()
{ {
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::updateMeshPartsStatus" << endl; Info<< "<beg> Foam::vtkPVFoam::updateMeshPartsStatus" << endl;
} }
vtkDataArraySelection* selection = reader_->GetPartSelection(); vtkDataArraySelection* selection = reader_->GetPartSelection();
@ -209,16 +209,16 @@ void Foam::vtkPV3Foam::updateMeshPartsStatus()
} }
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::updateMeshPartsStatus" << endl; Info<< "<end> Foam::vtkPVFoam::updateMeshPartsStatus" << endl;
} }
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::vtkPV3Foam::vtkPV3Foam Foam::vtkPVFoam::vtkPVFoam
( (
const char* const FileName, const char* const FileName,
vtkPV3FoamReader* reader vtkPVFoamReader* reader
) )
: :
reader_(reader), reader_(reader),
@ -241,7 +241,7 @@ Foam::vtkPV3Foam::vtkPV3Foam
{ {
if (debug) if (debug)
{ {
Info<< "Foam::vtkPV3Foam::vtkPV3Foam - " << FileName << endl; Info<< "Foam::vtkPVFoam::vtkPVFoam - " << FileName << endl;
printMemory(); printMemory();
} }
@ -325,11 +325,11 @@ Foam::vtkPV3Foam::vtkPV3Foam
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::vtkPV3Foam::~vtkPV3Foam() Foam::vtkPVFoam::~vtkPVFoam()
{ {
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::~vtkPV3Foam" << endl; Info<< "<end> Foam::vtkPVFoam::~vtkPVFoam" << endl;
} }
delete meshPtr_; delete meshPtr_;
@ -338,11 +338,11 @@ Foam::vtkPV3Foam::~vtkPV3Foam()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::vtkPV3Foam::updateInfo() void Foam::vtkPVFoam::updateInfo()
{ {
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::updateInfo" Info<< "<beg> Foam::vtkPVFoam::updateInfo"
<< " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] timeIndex=" << " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] timeIndex="
<< timeIndex_ << endl; << timeIndex_ << endl;
} }
@ -395,17 +395,17 @@ void Foam::vtkPV3Foam::updateInfo()
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::updateInfo" << endl; Info<< "<end> Foam::vtkPVFoam::updateInfo" << endl;
} }
} }
void Foam::vtkPV3Foam::updateFoamMesh() void Foam::vtkPVFoam::updateFoamMesh()
{ {
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::updateFoamMesh" << endl; Info<< "<beg> Foam::vtkPVFoam::updateFoamMesh" << endl;
printMemory(); printMemory();
} }
@ -449,13 +449,13 @@ void Foam::vtkPV3Foam::updateFoamMesh()
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::updateFoamMesh" << endl; Info<< "<end> Foam::vtkPVFoam::updateFoamMesh" << endl;
printMemory(); printMemory();
} }
} }
void Foam::vtkPV3Foam::Update void Foam::vtkPVFoam::Update
( (
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
vtkMultiBlockDataSet* lagrangianOutput vtkMultiBlockDataSet* lagrangianOutput
@ -463,7 +463,7 @@ void Foam::vtkPV3Foam::Update
{ {
if (debug) if (debug)
{ {
cout<< "<beg> Foam::vtkPV3Foam::Update - output with " cout<< "<beg> Foam::vtkPVFoam::Update - output with "
<< output->GetNumberOfBlocks() << " and " << output->GetNumberOfBlocks() << " and "
<< lagrangianOutput->GetNumberOfBlocks() << " blocks\n"; << lagrangianOutput->GetNumberOfBlocks() << " blocks\n";
output->Print(cout); output->Print(cout);
@ -504,7 +504,7 @@ void Foam::vtkPV3Foam::Update
reader_->UpdateProgress(0.7); reader_->UpdateProgress(0.7);
} }
#ifdef VTKPV3FOAM_DUALPORT #ifdef VTKPVFOAM_DUALPORT
// restart port1 at block=0 // restart port1 at block=0
blockNo = 0; blockNo = 0;
#endif #endif
@ -522,7 +522,7 @@ void Foam::vtkPV3Foam::Update
} }
void Foam::vtkPV3Foam::CleanUp() void Foam::vtkPVFoam::CleanUp()
{ {
// reclaim some memory // reclaim some memory
reduceMemory(); reduceMemory();
@ -530,7 +530,7 @@ void Foam::vtkPV3Foam::CleanUp()
} }
double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps) double* Foam::vtkPVFoam::findTimes(int& nTimeSteps)
{ {
int nTimes = 0; int nTimes = 0;
double* tsteps = NULL; double* tsteps = NULL;
@ -589,7 +589,7 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps)
} }
void Foam::vtkPV3Foam::addPatchNames(vtkRenderer* renderer) void Foam::vtkPVFoam::addPatchNames(vtkRenderer* renderer)
{ {
// Remove any patch names previously added to the renderer // Remove any patch names previously added to the renderer
removePatchNames(renderer); removePatchNames(renderer);
@ -608,7 +608,7 @@ void Foam::vtkPV3Foam::addPatchNames(vtkRenderer* renderer)
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::addPatchNames" << nl Info<< "<beg> Foam::vtkPVFoam::addPatchNames" << nl
<<"... add patches: " << selectedPatches << endl; <<"... add patches: " << selectedPatches << endl;
} }
@ -787,12 +787,12 @@ void Foam::vtkPV3Foam::addPatchNames(vtkRenderer* renderer)
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::addPatchNames" << endl; Info<< "<end> Foam::vtkPVFoam::addPatchNames" << endl;
} }
} }
void Foam::vtkPV3Foam::removePatchNames(vtkRenderer* renderer) void Foam::vtkPVFoam::removePatchNames(vtkRenderer* renderer)
{ {
forAll(patchTextActorsPtrs_, patchI) forAll(patchTextActorsPtrs_, patchI)
{ {
@ -803,7 +803,7 @@ void Foam::vtkPV3Foam::removePatchNames(vtkRenderer* renderer)
} }
void Foam::vtkPV3Foam::PrintSelf(ostream& os, vtkIndent indent) const void Foam::vtkPVFoam::PrintSelf(ostream& os, vtkIndent indent) const
{ {
os << indent << "Number of nodes: " os << indent << "Number of nodes: "
<< (meshPtr_ ? meshPtr_->nPoints() : 0) << "\n"; << (meshPtr_ ? meshPtr_->nPoints() : 0) << "\n";

View file

@ -22,40 +22,40 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>. along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::vtkPV4Foam Foam::vtkPVFoam
Description Description
Provides a reader interface for FOAM to VTK interaction. Provides a reader interface for FOAM to VTK interaction.
SourceFiles SourceFiles
vtkPV4Foam.C vtkPVFoam.C
vtkPV4Foam.H vtkPVFoam.H
vtkPV4FoamI.H vtkPVFoamI.H
vtkPV4FoamFields.C vtkPVFoamFields.C
vtkPV4FoamMesh.C vtkPVFoamMesh.C
vtkPV4FoamMeshLagrangian.C vtkPVFoamMeshLagrangian.C
vtkPV4FoamMeshPatch.C vtkPVFoamMeshPatch.C
vtkPV4FoamMeshSet.C vtkPVFoamMeshSet.C
vtkPV4FoamMeshVolume.C vtkPVFoamMeshVolume.C
vtkPV4FoamMeshZone.C vtkPVFoamMeshZone.C
vtkPV4FoamFaceField.H vtkPVFoamFaceField.H
vtkPV4FoamLagrangianFields.H vtkPVFoamLagrangianFields.H
vtkPV4FoamPatchField.H vtkPVFoamPatchField.H
vtkPV4FoamPointFields.H vtkPVFoamPointFields.H
vtkPV4FoamPoints.H vtkPVFoamPoints.H
vtkPV4FoamUpdateInfo.C vtkPVFoamUpdateInfo.C
vtkPV4FoamUpdateInfoFields.H vtkPVFoamUpdateInfoFields.H
vtkPV4FoamUtilities.C vtkPVFoamUtilities.C
vtkPV4FoamVolFields.H vtkPVFoamVolFields.H
vtkPV4FoamAddToSelection.H vtkPVFoamAddToSelection.H
// Needed by VTK: // Needed by VTK:
vtkDataArrayTemplateImplicit.txx vtkDataArrayTemplateImplicit.txx
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef vtkPV4Foam_H #ifndef vtkPVFoam_H
#define vtkPV4Foam_H #define vtkPVFoam_H
// do not include legacy strstream headers // do not include legacy strstream headers
#ifndef VTK_EXCLUDE_STRSTREAM_HEADERS #ifndef VTK_EXCLUDE_STRSTREAM_HEADERS
@ -70,14 +70,14 @@ SourceFiles
#include "PrimitivePatchInterpolationTemplate.H" #include "PrimitivePatchInterpolationTemplate.H"
#include "volPointInterpolation.H" #include "volPointInterpolation.H"
#undef VTKPV4FOAM_DUALPORT #undef VTKPVFOAM_DUALPORT
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * // // * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
class vtkDataArraySelection; class vtkDataArraySelection;
class vtkDataSet; class vtkDataSet;
class vtkPoints; class vtkPoints;
class vtkPV4FoamReader; class vtkPVFoamReader;
class vtkRenderer; class vtkRenderer;
class vtkTextActor; class vtkTextActor;
class vtkMultiBlockDataSet; class vtkMultiBlockDataSet;
@ -103,10 +103,10 @@ template<class Type> class IOField;
template<class Type> class List; template<class Type> class List;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class vtkPV4Foam Declaration Class vtkPVFoam Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class vtkPV4Foam class vtkPVFoam
{ {
// Private classes // Private classes
@ -249,8 +249,8 @@ class vtkPV4Foam
// Private Data // Private Data
//- Access to the controlling vtkPV4FoamReader //- Access to the controlling vtkPVFoamReader
vtkPV4FoamReader* reader_; vtkPVFoamReader* reader_;
//- Foam time control //- Foam time control
autoPtr<Time> dbPtr_; autoPtr<Time> dbPtr_;
@ -668,32 +668,32 @@ class vtkPV4Foam
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
vtkPV4Foam(const vtkPV4Foam&); vtkPVFoam(const vtkPVFoam&);
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const vtkPV4Foam&); void operator=(const vtkPVFoam&);
public: public:
//- Static data members //- Static data members
ClassName("vtkPV4Foam"); ClassName("vtkPVFoam");
// Constructors // Constructors
//- Construct from components //- Construct from components
vtkPV4Foam vtkPVFoam
( (
const char* const FileName, const char* const FileName,
vtkPV4FoamReader* reader vtkPVFoamReader* reader
); );
//- Destructor //- Destructor
~vtkPV4Foam(); ~vtkPVFoam();
// Member Functions // Member Functions
@ -750,7 +750,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
# include "vtkPV4FoamI.H" # include "vtkPVFoamI.H"
#endif #endif

View file

@ -23,8 +23,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef vtkPV4FoamAddToSelection_H #ifndef vtkPVFoamAddToSelection_H
#define vtkPV4FoamAddToSelection_H #define vtkPVFoamAddToSelection_H
// FOAM includes // FOAM includes
#include "IOobjectList.H" #include "IOobjectList.H"
@ -36,7 +36,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::label Foam::vtkPV4Foam::addToSelection Foam::label Foam::vtkPVFoam::addToSelection
( (
vtkDataArraySelection *select, vtkDataArraySelection *select,
const IOobjectList& objectLst, const IOobjectList& objectLst,

View file

@ -22,12 +22,12 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>. along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass InClass
vtkPV4Foam vtkPVFoam
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef vtkPV4FoamFaceField_H #ifndef vtkPVFoamFaceField_H
#define vtkPV4FoamFaceField_H #define vtkPVFoamFaceField_H
// VTK includes // VTK includes
#include "vtkCellData.h" #include "vtkCellData.h"
@ -40,7 +40,7 @@ InClass
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
void Foam::vtkPV4Foam::convertFaceField void Foam::vtkPVFoam::convertFaceField
( (
const GeometricField<Type, fvPatchField, volMesh>& tf, const GeometricField<Type, fvPatchField, volMesh>& tf,
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
@ -121,7 +121,7 @@ void Foam::vtkPV4Foam::convertFaceField
template<class Type> template<class Type>
void Foam::vtkPV4Foam::convertFaceField void Foam::vtkPVFoam::convertFaceField
( (
const GeometricField<Type, fvPatchField, volMesh>& tf, const GeometricField<Type, fvPatchField, volMesh>& tf,
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,

View file

@ -25,11 +25,11 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vtkPV4Foam.H" #include "vtkPVFoam.H"
// Foam includes // Foam includes
#include "IOobjectList.H" #include "IOobjectList.H"
#include "vtkPV4FoamReader.h" #include "vtkPVFoamReader.h"
// VTK includes // VTK includes
#include "vtkDataArraySelection.h" #include "vtkDataArraySelection.h"
@ -38,12 +38,12 @@ Description
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
#include "vtkPV4FoamVolFields.H" #include "vtkPVFoamVolFields.H"
#include "vtkPV4FoamPointFields.H" #include "vtkPVFoamPointFields.H"
#include "vtkPV4FoamLagrangianFields.H" #include "vtkPVFoamLagrangianFields.H"
void Foam::vtkPV4Foam::pruneObjectList void Foam::vtkPVFoam::pruneObjectList
( (
IOobjectList& objects, IOobjectList& objects,
const wordHashSet& selected const wordHashSet& selected
@ -66,7 +66,7 @@ void Foam::vtkPV4Foam::pruneObjectList
} }
void Foam::vtkPV4Foam::convertVolFields void Foam::vtkPVFoam::convertVolFields
( (
vtkMultiBlockDataSet* output vtkMultiBlockDataSet* output
) )
@ -95,7 +95,7 @@ void Foam::vtkPV4Foam::convertVolFields
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV4Foam::convertVolFields" << nl Info<< "<beg> Foam::vtkPVFoam::convertVolFields" << nl
<< "converting Foam volume fields" << endl; << "converting Foam volume fields" << endl;
forAllConstIter(IOobjectList, objects, iter) forAllConstIter(IOobjectList, objects, iter)
{ {
@ -145,13 +145,13 @@ void Foam::vtkPV4Foam::convertVolFields
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV4Foam::convertVolFields" << endl; Info<< "<end> Foam::vtkPVFoam::convertVolFields" << endl;
printMemory(); printMemory();
} }
} }
void Foam::vtkPV4Foam::convertPointFields void Foam::vtkPVFoam::convertPointFields
( (
vtkMultiBlockDataSet* output vtkMultiBlockDataSet* output
) )
@ -180,7 +180,7 @@ void Foam::vtkPV4Foam::convertPointFields
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV4Foam::convertPointFields" << nl Info<< "<beg> Foam::vtkPVFoam::convertPointFields" << nl
<< "converting Foam volume fields" << endl; << "converting Foam volume fields" << endl;
forAllConstIter(IOobjectList, objects, iter) forAllConstIter(IOobjectList, objects, iter)
{ {
@ -221,13 +221,13 @@ void Foam::vtkPV4Foam::convertPointFields
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV4Foam::convertPointFields" << endl; Info<< "<end> Foam::vtkPVFoam::convertPointFields" << endl;
printMemory(); printMemory();
} }
} }
void Foam::vtkPV4Foam::convertLagrangianFields void Foam::vtkPVFoam::convertLagrangianFields
( (
vtkMultiBlockDataSet* output vtkMultiBlockDataSet* output
) )
@ -247,7 +247,7 @@ void Foam::vtkPV4Foam::convertLagrangianFields
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV4Foam::convertLagrangianFields" << endl; Info<< "<beg> Foam::vtkPVFoam::convertLagrangianFields" << endl;
printMemory(); printMemory();
} }
@ -316,7 +316,7 @@ void Foam::vtkPV4Foam::convertLagrangianFields
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV4Foam::convertLagrangianFields" << endl; Info<< "<end> Foam::vtkPVFoam::convertLagrangianFields" << endl;
printMemory(); printMemory();
} }
} }

View file

@ -27,7 +27,7 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline Foam::word Foam::vtkPV4Foam::getFirstWord(const char* str) inline Foam::word Foam::vtkPVFoam::getFirstWord(const char* str)
{ {
if (str) if (str)
{ {

View file

@ -22,12 +22,12 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>. along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass InClass
vtkPV4Foam vtkPVFoam
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef vtkPV4FoamLagrangianFields_H #ifndef vtkPVFoamLagrangianFields_H
#define vtkPV4FoamLagrangianFields_H #define vtkPVFoamLagrangianFields_H
#include "CloudTemplate.H" #include "CloudTemplate.H"
@ -36,7 +36,7 @@ InClass
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
void Foam::vtkPV4Foam::convertLagrangianFields void Foam::vtkPVFoam::convertLagrangianFields
( (
const IOobjectList& objects, const IOobjectList& objects,
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
@ -58,7 +58,7 @@ void Foam::vtkPV4Foam::convertLagrangianFields
template<class Type> template<class Type>
void Foam::vtkPV4Foam::convertLagrangianField void Foam::vtkPVFoam::convertLagrangianField
( (
const IOField<Type>& tf, const IOField<Type>& tf,
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,

View file

@ -25,14 +25,14 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vtkPV3Foam.H" #include "vtkPVFoam.H"
// Foam includes // Foam includes
#include "cellSet.H" #include "cellSet.H"
#include "faceSet.H" #include "faceSet.H"
#include "pointSet.H" #include "pointSet.H"
#include "fvMeshSubset.H" #include "fvMeshSubset.H"
#include "vtkPV3FoamReader.h" #include "vtkPVFoamReader.h"
// VTK includes // VTK includes
#include "vtkDataArraySelection.h" #include "vtkDataArraySelection.h"
@ -42,7 +42,7 @@ Description
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::vtkPV3Foam::convertMeshVolume void Foam::vtkPVFoam::convertMeshVolume
( (
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
int& blockNo int& blockNo
@ -58,7 +58,7 @@ void Foam::vtkPV3Foam::convertMeshVolume
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::convertMeshVolume" << endl; Info<< "<beg> Foam::vtkPVFoam::convertMeshVolume" << endl;
printMemory(); printMemory();
} }
@ -96,13 +96,13 @@ void Foam::vtkPV3Foam::convertMeshVolume
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::convertMeshVolume" << endl; Info<< "<end> Foam::vtkPVFoam::convertMeshVolume" << endl;
printMemory(); printMemory();
} }
} }
void Foam::vtkPV3Foam::convertMeshLagrangian void Foam::vtkPVFoam::convertMeshLagrangian
( (
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
int& blockNo int& blockNo
@ -115,7 +115,7 @@ void Foam::vtkPV3Foam::convertMeshLagrangian
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::convertMeshLagrangian" << endl; Info<< "<beg> Foam::vtkPVFoam::convertMeshLagrangian" << endl;
printMemory(); printMemory();
} }
@ -147,13 +147,13 @@ void Foam::vtkPV3Foam::convertMeshLagrangian
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::convertMeshLagrangian" << endl; Info<< "<end> Foam::vtkPVFoam::convertMeshLagrangian" << endl;
printMemory(); printMemory();
} }
} }
void Foam::vtkPV3Foam::convertMeshPatches void Foam::vtkPVFoam::convertMeshPatches
( (
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
int& blockNo int& blockNo
@ -167,7 +167,7 @@ void Foam::vtkPV3Foam::convertMeshPatches
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::convertMeshPatches" << endl; Info<< "<beg> Foam::vtkPVFoam::convertMeshPatches" << endl;
printMemory(); printMemory();
} }
@ -206,13 +206,13 @@ void Foam::vtkPV3Foam::convertMeshPatches
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::convertMeshPatches" << endl; Info<< "<end> Foam::vtkPVFoam::convertMeshPatches" << endl;
printMemory(); printMemory();
} }
} }
void Foam::vtkPV3Foam::convertMeshCellZones void Foam::vtkPVFoam::convertMeshCellZones
( (
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
int& blockNo int& blockNo
@ -233,7 +233,7 @@ void Foam::vtkPV3Foam::convertMeshCellZones
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::convertMeshCellZones" << endl; Info<< "<beg> Foam::vtkPVFoam::convertMeshCellZones" << endl;
printMemory(); printMemory();
} }
@ -307,13 +307,13 @@ void Foam::vtkPV3Foam::convertMeshCellZones
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::convertMeshCellZones" << endl; Info<< "<end> Foam::vtkPVFoam::convertMeshCellZones" << endl;
printMemory(); printMemory();
} }
} }
void Foam::vtkPV3Foam::convertMeshCellSets void Foam::vtkPVFoam::convertMeshCellSets
( (
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
int& blockNo int& blockNo
@ -329,7 +329,7 @@ void Foam::vtkPV3Foam::convertMeshCellSets
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::convertMeshCellSets" << endl; Info<< "<beg> Foam::vtkPVFoam::convertMeshCellSets" << endl;
printMemory(); printMemory();
} }
@ -402,13 +402,13 @@ void Foam::vtkPV3Foam::convertMeshCellSets
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::convertMeshCellSets" << endl; Info<< "<end> Foam::vtkPVFoam::convertMeshCellSets" << endl;
printMemory(); printMemory();
} }
} }
void Foam::vtkPV3Foam::convertMeshFaceZones void Foam::vtkPVFoam::convertMeshFaceZones
( (
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
int& blockNo int& blockNo
@ -426,7 +426,7 @@ void Foam::vtkPV3Foam::convertMeshFaceZones
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::convertMeshFaceZones" << endl; Info<< "<beg> Foam::vtkPVFoam::convertMeshFaceZones" << endl;
printMemory(); printMemory();
} }
@ -465,13 +465,13 @@ void Foam::vtkPV3Foam::convertMeshFaceZones
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::convertMeshFaceZones" << endl; Info<< "<end> Foam::vtkPVFoam::convertMeshFaceZones" << endl;
printMemory(); printMemory();
} }
} }
void Foam::vtkPV3Foam::convertMeshFaceSets void Foam::vtkPVFoam::convertMeshFaceSets
( (
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
int& blockNo int& blockNo
@ -484,7 +484,7 @@ void Foam::vtkPV3Foam::convertMeshFaceSets
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::convertMeshFaceSets" << endl; Info<< "<beg> Foam::vtkPVFoam::convertMeshFaceSets" << endl;
printMemory(); printMemory();
} }
@ -522,13 +522,13 @@ void Foam::vtkPV3Foam::convertMeshFaceSets
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::convertMeshFaceSets" << endl; Info<< "<end> Foam::vtkPVFoam::convertMeshFaceSets" << endl;
printMemory(); printMemory();
} }
} }
void Foam::vtkPV3Foam::convertMeshPointZones void Foam::vtkPVFoam::convertMeshPointZones
( (
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
int& blockNo int& blockNo
@ -541,7 +541,7 @@ void Foam::vtkPV3Foam::convertMeshPointZones
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::convertMeshPointZones" << endl; Info<< "<beg> Foam::vtkPVFoam::convertMeshPointZones" << endl;
printMemory(); printMemory();
} }
@ -577,14 +577,14 @@ void Foam::vtkPV3Foam::convertMeshPointZones
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::convertMeshPointZones" << endl; Info<< "<end> Foam::vtkPVFoam::convertMeshPointZones" << endl;
printMemory(); printMemory();
} }
} }
void Foam::vtkPV3Foam::convertMeshPointSets void Foam::vtkPVFoam::convertMeshPointSets
( (
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
int& blockNo int& blockNo
@ -597,7 +597,7 @@ void Foam::vtkPV3Foam::convertMeshPointSets
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::convertMeshPointSets" << endl; Info<< "<beg> Foam::vtkPVFoam::convertMeshPointSets" << endl;
printMemory(); printMemory();
} }
@ -635,7 +635,7 @@ void Foam::vtkPV3Foam::convertMeshPointSets
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::convertMeshPointSets" << endl; Info<< "<end> Foam::vtkPVFoam::convertMeshPointSets" << endl;
printMemory(); printMemory();
} }
} }

View file

@ -25,14 +25,14 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vtkPV4Foam.H" #include "vtkPVFoam.H"
// Foam includes // Foam includes
#include "CloudTemplate.H" #include "CloudTemplate.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "IOobjectList.H" #include "IOobjectList.H"
#include "passiveParticle.H" #include "passiveParticle.H"
#include "vtkPV4FoamPoints.H" #include "vtkPVFoamPoints.H"
// VTK includes // VTK includes
#include "vtkCellArray.h" #include "vtkCellArray.h"
@ -41,7 +41,7 @@ Description
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
vtkPolyData* Foam::vtkPV4Foam::lagrangianVTKMesh vtkPolyData* Foam::vtkPVFoam::lagrangianVTKMesh
( (
const fvMesh& mesh, const fvMesh& mesh,
const word& cloudName const word& cloudName
@ -51,7 +51,7 @@ vtkPolyData* Foam::vtkPV4Foam::lagrangianVTKMesh
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV4Foam::lagrangianVTKMesh - timePath " Info<< "<beg> Foam::vtkPVFoam::lagrangianVTKMesh - timePath "
<< mesh.time().timePath()/cloud::prefix/cloudName << endl; << mesh.time().timePath()/cloud::prefix/cloudName << endl;
printMemory(); printMemory();
} }
@ -85,7 +85,7 @@ vtkPolyData* Foam::vtkPV4Foam::lagrangianVTKMesh
vtkIdType particleId = 0; vtkIdType particleId = 0;
forAllConstIter(Cloud<passiveParticle>, parcels, iter) forAllConstIter(Cloud<passiveParticle>, parcels, iter)
{ {
vtkPV4FoamInsertNextPoint(vtkpoints, iter().position()); vtkPVFoamInsertNextPoint(vtkpoints, iter().position());
vtkcells->InsertNextCell(1, &particleId); vtkcells->InsertNextCell(1, &particleId);
particleId++; particleId++;
@ -100,7 +100,7 @@ vtkPolyData* Foam::vtkPV4Foam::lagrangianVTKMesh
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV4Foam::lagrangianVTKMesh" << endl; Info<< "<end> Foam::vtkPVFoam::lagrangianVTKMesh" << endl;
printMemory(); printMemory();
} }

View file

@ -25,12 +25,12 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vtkPV3Foam.H" #include "vtkPVFoam.H"
// Foam includes // Foam includes
#include "polyPatch.H" #include "polyPatch.H"
#include "primitivePatch.H" #include "primitivePatch.H"
#include "vtkPV3FoamPoints.H" #include "vtkPVFoamPoints.H"
// VTK includes // VTK includes
#include "vtkCellArray.h" #include "vtkCellArray.h"
@ -39,7 +39,7 @@ Description
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh vtkPolyData* Foam::vtkPVFoam::patchVTKMesh
( (
const polyPatch& p const polyPatch& p
) )
@ -48,7 +48,7 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::patchVTKMesh - " << p.name() << endl; Info<< "<beg> Foam::vtkPVFoam::patchVTKMesh - " << p.name() << endl;
printMemory(); printMemory();
} }
@ -59,7 +59,7 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh
vtkpoints->Allocate( points.size() ); vtkpoints->Allocate( points.size() );
forAll(points, i) forAll(points, i)
{ {
vtkPV3FoamInsertNextPoint(vtkpoints, points[i]); vtkPVFoamInsertNextPoint(vtkpoints, points[i]);
} }
vtkmesh->SetPoints(vtkpoints); vtkmesh->SetPoints(vtkpoints);
@ -88,7 +88,7 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::patchVTKMesh - " << p.name() << endl; Info<< "<end> Foam::vtkPVFoam::patchVTKMesh - " << p.name() << endl;
printMemory(); printMemory();
} }

View file

@ -25,12 +25,12 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vtkPV4Foam.H" #include "vtkPVFoam.H"
// Foam includes // Foam includes
#include "faceSet.H" #include "faceSet.H"
#include "pointSet.H" #include "pointSet.H"
#include "vtkPV4FoamPoints.H" #include "vtkPVFoamPoints.H"
// VTK includes // VTK includes
#include "vtkPoints.h" #include "vtkPoints.h"
@ -39,7 +39,7 @@ Description
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
vtkPolyData* Foam::vtkPV4Foam::faceSetVTKMesh vtkPolyData* Foam::vtkPVFoam::faceSetVTKMesh
( (
const fvMesh& mesh, const fvMesh& mesh,
const faceSet& fSet const faceSet& fSet
@ -49,7 +49,7 @@ vtkPolyData* Foam::vtkPV4Foam::faceSetVTKMesh
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV4Foam::faceSetVTKMesh" << endl; Info<< "<beg> Foam::vtkPVFoam::faceSetVTKMesh" << endl;
printMemory(); printMemory();
} }
@ -74,7 +74,7 @@ vtkPolyData* Foam::vtkPV4Foam::faceSetVTKMesh
vtkpoints->Allocate( points.size() ); vtkpoints->Allocate( points.size() );
forAll(points, i) forAll(points, i)
{ {
vtkPV4FoamInsertNextPoint(vtkpoints, points[i]); vtkPVFoamInsertNextPoint(vtkpoints, points[i]);
} }
vtkmesh->SetPoints(vtkpoints); vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete(); vtkpoints->Delete();
@ -102,7 +102,7 @@ vtkPolyData* Foam::vtkPV4Foam::faceSetVTKMesh
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV4Foam::faceSetVTKMesh" << endl; Info<< "<end> Foam::vtkPVFoam::faceSetVTKMesh" << endl;
printMemory(); printMemory();
} }
@ -110,7 +110,7 @@ vtkPolyData* Foam::vtkPV4Foam::faceSetVTKMesh
} }
vtkPolyData* Foam::vtkPV4Foam::pointSetVTKMesh vtkPolyData* Foam::vtkPVFoam::pointSetVTKMesh
( (
const fvMesh& mesh, const fvMesh& mesh,
const pointSet& pSet const pointSet& pSet
@ -120,7 +120,7 @@ vtkPolyData* Foam::vtkPV4Foam::pointSetVTKMesh
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV4Foam::pointSetVTKMesh" << endl; Info<< "<beg> Foam::vtkPVFoam::pointSetVTKMesh" << endl;
printMemory(); printMemory();
} }
@ -131,7 +131,7 @@ vtkPolyData* Foam::vtkPV4Foam::pointSetVTKMesh
forAllConstIter(pointSet, pSet, iter) forAllConstIter(pointSet, pSet, iter)
{ {
vtkPV4FoamInsertNextPoint(vtkpoints, meshPoints[iter.key()]); vtkPVFoamInsertNextPoint(vtkpoints, meshPoints[iter.key()]);
} }
vtkmesh->SetPoints(vtkpoints); vtkmesh->SetPoints(vtkpoints);
@ -139,7 +139,7 @@ vtkPolyData* Foam::vtkPV4Foam::pointSetVTKMesh
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV4Foam::pointSetVTKMesh" << endl; Info<< "<end> Foam::vtkPVFoam::pointSetVTKMesh" << endl;
printMemory(); printMemory();
} }

View file

@ -0,0 +1,455 @@
#include "vtkPVFoam.H"
#include "vtkPVFoamReader.h"
// FOAM includes
#include "fvMesh.H"
#include "cellModeller.H"
#include "vtkPVFoamPoints.H"
#include "Swap.H"
// VTK includes
#include "vtkCellArray.h"
#include "vtkIdTypeArray.h"
#include "vtkUnstructuredGrid.h"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
vtkUnstructuredGrid* Foam::vtkPVFoam::volumeVTKMesh
(
const fvMesh& mesh,
polyDecomp& decompInfo
)
{
const cellModel& tet = *(cellModeller::lookup("tet"));
const cellModel& pyr = *(cellModeller::lookup("pyr"));
const cellModel& prism = *(cellModeller::lookup("prism"));
const cellModel& wedge = *(cellModeller::lookup("wedge"));
const cellModel& tetWedge = *(cellModeller::lookup("tetWedge"));
const cellModel& hex = *(cellModeller::lookup("hex"));
vtkUnstructuredGrid* vtkmesh = vtkUnstructuredGrid::New();
if (debug)
{
Info<< "<beg> Foam::vtkPVFoam::volumeVTKMesh" << endl;
printMemory();
}
const cellShapeList& cellShapes = mesh.cellShapes();
// Number of additional points needed by the decomposition of polyhedra
label nAddPoints = 0;
// Number of additional cells generated by the decomposition of polyhedra
label nAddCells = 0;
// face owner is needed to determine the face orientation
const labelList& owner = mesh.faceOwner();
labelList& superCells = decompInfo.superCells();
labelList& addPointCellLabels = decompInfo.addPointCellLabels();
// Scan for cells which need to be decomposed and count additional points
// and cells
if (!reader_->GetUseVTKPolyhedron())
{
if (debug)
{
Info<< "... scanning for polyhedra" << endl;
}
forAll(cellShapes, celli)
{
const cellModel& model = cellShapes[celli].model();
if
(
model != hex
&& model != wedge
&& model != prism
&& model != pyr
&& model != tet
&& model != tetWedge
)
{
const cell& cFaces = mesh.cells()[celli];
forAll(cFaces, cFacei)
{
const face& f = mesh.faces()[cFaces[cFacei]];
label nQuads = 0;
label nTris = 0;
f.nTrianglesQuads(mesh.points(), nTris, nQuads);
nAddCells += nQuads + nTris;
}
nAddCells--;
nAddPoints++;
}
}
}
// Set size of additional point addressing array
// (from added point to original cell)
addPointCellLabels.setSize(nAddPoints);
// Set size of additional cells mapping array
// (from added cell to original cell)
if (debug)
{
Info<<" mesh nCells = " << mesh.nCells() << nl
<<" nPoints = " << mesh.nPoints() << nl
<<" nAddCells = " << nAddCells << nl
<<" nAddPoints = " << nAddPoints << endl;
}
superCells.setSize(mesh.nCells() + nAddCells);
if (debug)
{
Info<< "... converting points" << endl;
}
// Convert OpenFOAM mesh vertices to VTK
vtkPoints* vtkpoints = vtkPoints::New();
vtkpoints->Allocate(mesh.nPoints() + nAddPoints);
const Foam::pointField& points = mesh.points();
forAll(points, i)
{
vtkPVFoamInsertNextPoint(vtkpoints, points[i]);
}
if (debug)
{
Info<< "... converting cells" << endl;
}
vtkmesh->Allocate(mesh.nCells() + nAddCells);
// Set counters for additional points and additional cells
label addPointi = 0, addCelli = 0;
// Create storage for points - needed for mapping from OpenFOAM to VTK
// data types - max 'order' = hex = 8 points
vtkIdType nodeIds[8];
// face-stream for a polyhedral cell
// [numFace0Pts, id1, id2, id3, numFace1Pts, id1, id2, id3, ...]
DynamicList<vtkIdType> faceStream(256);
forAll(cellShapes, celli)
{
const cellShape& cellShape = cellShapes[celli];
const cellModel& cellModel = cellShape.model();
superCells[addCelli++] = celli;
if (cellModel == tet)
{
for (int j = 0; j < 4; j++)
{
nodeIds[j] = cellShape[j];
}
vtkmesh->InsertNextCell
(
VTK_TETRA,
4,
nodeIds
);
}
else if (cellModel == pyr)
{
for (int j = 0; j < 5; j++)
{
nodeIds[j] = cellShape[j];
}
vtkmesh->InsertNextCell
(
VTK_PYRAMID,
5,
nodeIds
);
}
else if (cellModel == prism)
{
// VTK has a different node order for VTK_WEDGE
// their triangles point outwards!
nodeIds[0] = cellShape[0];
nodeIds[1] = cellShape[2];
nodeIds[2] = cellShape[1];
nodeIds[3] = cellShape[3];
nodeIds[4] = cellShape[5];
nodeIds[5] = cellShape[4];
vtkmesh->InsertNextCell
(
VTK_WEDGE,
6,
nodeIds
);
}
else if (cellModel == tetWedge && !reader_->GetUseVTKPolyhedron())
{
// Treat as squeezed prism (VTK_WEDGE)
nodeIds[0] = cellShape[0];
nodeIds[1] = cellShape[2];
nodeIds[2] = cellShape[1];
nodeIds[3] = cellShape[3];
nodeIds[4] = cellShape[4];
nodeIds[5] = cellShape[3];
vtkmesh->InsertNextCell
(
VTK_WEDGE,
6,
nodeIds
);
}
else if (cellModel == wedge)
{
// Treat as squeezed hex
nodeIds[0] = cellShape[0];
nodeIds[1] = cellShape[1];
nodeIds[2] = cellShape[2];
nodeIds[3] = cellShape[2];
nodeIds[4] = cellShape[3];
nodeIds[5] = cellShape[4];
nodeIds[6] = cellShape[5];
nodeIds[7] = cellShape[6];
vtkmesh->InsertNextCell
(
VTK_HEXAHEDRON,
8,
nodeIds
);
}
else if (cellModel == hex)
{
for (int j = 0; j < 8; j++)
{
nodeIds[j] = cellShape[j];
}
vtkmesh->InsertNextCell
(
VTK_HEXAHEDRON,
8,
nodeIds
);
}
else if (reader_->GetUseVTKPolyhedron())
{
// Polyhedral cell - use VTK_POLYHEDRON
const labelList& cFaces = mesh.cells()[celli];
#ifdef HAS_VTK_POLYHEDRON
vtkIdType nFaces = cFaces.size();
vtkIdType nLabels = nFaces;
// count size for face stream
forAll(cFaces, cFacei)
{
const face& f = mesh.faces()[cFaces[cFacei]];
nLabels += f.size();
}
// build face-stream
// [numFace0Pts, id1, id2, id3, numFace1Pts, id1, id2, id3, ...]
// point Ids are global
faceStream.clear();
faceStream.reserve(nLabels + nFaces);
forAll(cFaces, cFacei)
{
const face& f = mesh.faces()[cFaces[cFacei]];
const bool isOwner = (owner[cFaces[cFacei]] == celli);
const label nFacePoints = f.size();
// number of labels for this face
faceStream.append(nFacePoints);
if (isOwner)
{
forAll(f, fp)
{
faceStream.append(f[fp]);
}
}
else
{
// fairly immaterial if we reverse the list
// or use face::reverseFace()
forAllReverse(f, fp)
{
faceStream.append(f[fp]);
}
}
}
vtkmesh->InsertNextCell(VTK_POLYHEDRON, nFaces, faceStream.data());
#else
// this is a horrible substitute
// but avoids crashes when there is no vtkPolyhedron support
// establish unique node ids used
HashSet<vtkIdType, Hash<label>> hashUniqId(2*256);
forAll(cFaces, cFacei)
{
const face& f = mesh.faces()[cFaces[cFacei]];
forAll(f, fp)
{
hashUniqId.insert(f[fp]);
}
}
// use face stream to store unique node ids:
faceStream = hashUniqId.sortedToc();
vtkmesh->InsertNextCell
(
VTK_CONVEX_POINT_SET,
vtkIdType(faceStream.size()),
faceStream.data()
);
#endif
}
else
{
// Polyhedral cell. Decompose into tets + prisms.
// Mapping from additional point to cell
addPointCellLabels[addPointi] = celli;
// The new vertex from the cell-centre
const label newVertexLabel = mesh.nPoints() + addPointi;
vtkPVFoamInsertNextPoint(vtkpoints, mesh.C()[celli]);
// Whether to insert cell in place of original or not.
bool substituteCell = true;
const labelList& cFaces = mesh.cells()[celli];
forAll(cFaces, cFacei)
{
const face& f = mesh.faces()[cFaces[cFacei]];
const bool isOwner = (owner[cFaces[cFacei]] == celli);
// Number of triangles and quads in decomposition
label nTris = 0;
label nQuads = 0;
f.nTrianglesQuads(mesh.points(), nTris, nQuads);
// Do actual decomposition into triFcs and quadFcs.
faceList triFcs(nTris);
faceList quadFcs(nQuads);
label trii = 0;
label quadi = 0;
f.trianglesQuads(mesh.points(), trii, quadi, triFcs, quadFcs);
forAll(quadFcs, quadI)
{
if (substituteCell)
{
substituteCell = false;
}
else
{
superCells[addCelli++] = celli;
}
const face& quad = quadFcs[quadI];
// Ensure we have the correct orientation for the
// base of the primitive cell shape.
// If the cell is face owner, the orientation needs to be
// flipped.
// At the moment, VTK doesn't actually seem to care if
// negative cells are defined, but we'll do it anyhow
// (for safety).
if (isOwner)
{
nodeIds[0] = quad[3];
nodeIds[1] = quad[2];
nodeIds[2] = quad[1];
nodeIds[3] = quad[0];
}
else
{
nodeIds[0] = quad[0];
nodeIds[1] = quad[1];
nodeIds[2] = quad[2];
nodeIds[3] = quad[3];
}
nodeIds[4] = newVertexLabel;
vtkmesh->InsertNextCell
(
VTK_PYRAMID,
5,
nodeIds
);
}
forAll(triFcs, triI)
{
if (substituteCell)
{
substituteCell = false;
}
else
{
superCells[addCelli++] = celli;
}
const face& tri = triFcs[triI];
// See note above about the orientation.
if (isOwner)
{
nodeIds[0] = tri[2];
nodeIds[1] = tri[1];
nodeIds[2] = tri[0];
}
else
{
nodeIds[0] = tri[0];
nodeIds[1] = tri[1];
nodeIds[2] = tri[2];
}
nodeIds[3] = newVertexLabel;
vtkmesh->InsertNextCell
(
VTK_TETRA,
4,
nodeIds
);
}
}
addPointi++;
}
}
vtkmesh->SetPoints(vtkpoints);
vtkpoints->Delete();
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::volumeVTKMesh" << endl;
printMemory();
}
return vtkmesh;
}
// ************************************************************************* //

View file

@ -25,10 +25,10 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vtkPV3Foam.H" #include "vtkPVFoam.H"
// Foam includes // Foam includes
#include "vtkPV3FoamPoints.H" #include "vtkPVFoamPoints.H"
// VTK includes // VTK includes
#include "vtkPoints.h" #include "vtkPoints.h"
@ -37,7 +37,7 @@ Description
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh vtkPolyData* Foam::vtkPVFoam::faceZoneVTKMesh
( (
const fvMesh& mesh, const fvMesh& mesh,
const labelList& faceLabels const labelList& faceLabels
@ -47,7 +47,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::faceZoneVTKMesh" << endl; Info<< "<beg> Foam::vtkPVFoam::faceZoneVTKMesh" << endl;
printMemory(); printMemory();
} }
@ -81,7 +81,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh
vtkpoints->Allocate(points.size()); vtkpoints->Allocate(points.size());
forAll(points, i) forAll(points, i)
{ {
vtkPV3FoamInsertNextPoint(vtkpoints, points[i]); vtkPVFoamInsertNextPoint(vtkpoints, points[i]);
} }
vtkmesh->SetPoints(vtkpoints); vtkmesh->SetPoints(vtkpoints);
@ -111,7 +111,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh
if (debug) if (debug)
{ {
Info<< "<end> Foam::vtkPV3Foam::faceZoneVTKMesh" << endl; Info<< "<end> Foam::vtkPVFoam::faceZoneVTKMesh" << endl;
printMemory(); printMemory();
} }
@ -119,7 +119,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh
} }
vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh vtkPolyData* Foam::vtkPVFoam::pointZoneVTKMesh
( (
const fvMesh& mesh, const fvMesh& mesh,
const labelList& pointLabels const labelList& pointLabels
@ -129,7 +129,7 @@ vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::pointZoneVTKMesh" << endl; Info<< "<beg> Foam::vtkPVFoam::pointZoneVTKMesh" << endl;
printMemory(); printMemory();
} }
@ -154,7 +154,7 @@ vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh
forAll(pointLabels, pointI) forAll(pointLabels, pointI)
{ {
vtkPV3FoamInsertNextPoint(vtkpoints, meshPoints[pl[pointI]]); vtkPVFoamInsertNextPoint(vtkpoints, meshPoints[pl[pointI]]);
} }
vtkmesh->SetPoints(vtkpoints); vtkmesh->SetPoints(vtkpoints);
@ -162,7 +162,7 @@ vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh
if (debug) if (debug)
{ {
Info<< "<beg> Foam::vtkPV3Foam::pointZoneVTKMesh" << endl; Info<< "<beg> Foam::vtkPVFoam::pointZoneVTKMesh" << endl;
printMemory(); printMemory();
} }

View file

@ -22,12 +22,12 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>. along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass InClass
vtkPV4Foam vtkPVFoam
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef vtkPV4FoamPatchField_H #ifndef vtkPVFoamPatchField_H
#define vtkPV4FoamPatchField_H #define vtkPVFoamPatchField_H
// VTK includes // VTK includes
#include "vtkCellData.h" #include "vtkCellData.h"
@ -41,7 +41,7 @@ InClass
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
void Foam::vtkPV4Foam::convertPatchField void Foam::vtkPVFoam::convertPatchField
( (
const word& name, const word& name,
const Field<Type>& ptf, const Field<Type>& ptf,
@ -83,7 +83,7 @@ void Foam::vtkPV4Foam::convertPatchField
// as above, but with PointData() // as above, but with PointData()
template<class Type> template<class Type>
void Foam::vtkPV4Foam::convertPatchPointField void Foam::vtkPVFoam::convertPatchPointField
( (
const word& name, const word& name,
const Field<Type>& pptf, const Field<Type>& pptf,

View file

@ -22,12 +22,12 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>. along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
InClass InClass
vtkPV4Foam vtkPVFoam
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef vtkPV4FoamPointFields_H #ifndef vtkPVFoamPointFields_H
#define vtkPV4FoamPointFields_H #define vtkPVFoamPointFields_H
// Foam includes // Foam includes
#include "interpolatePointToCell.H" #include "interpolatePointToCell.H"
@ -37,7 +37,7 @@ InClass
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
void Foam::vtkPV4Foam::convertPointFields void Foam::vtkPVFoam::convertPointFields
( (
const fvMesh& mesh, const fvMesh& mesh,
const pointMesh& pMesh, const pointMesh& pMesh,
@ -62,7 +62,7 @@ void Foam::vtkPV4Foam::convertPointFields
if (debug) if (debug)
{ {
Info<< "Foam::vtkPV4Foam::convertPointFields : " Info<< "Foam::vtkPVFoam::convertPointFields : "
<< fieldName << endl; << fieldName << endl;
} }
@ -134,7 +134,7 @@ void Foam::vtkPV4Foam::convertPointFields
template<class Type> template<class Type>
void Foam::vtkPV4Foam::convertPointFieldBlock void Foam::vtkPVFoam::convertPointFieldBlock
( (
const GeometricField<Type, pointPatchField, pointMesh>& ptf, const GeometricField<Type, pointPatchField, pointMesh>& ptf,
vtkMultiBlockDataSet* output, vtkMultiBlockDataSet* output,
@ -163,7 +163,7 @@ void Foam::vtkPV4Foam::convertPointFieldBlock
template<class Type> template<class Type>
void Foam::vtkPV4Foam::convertPointField void Foam::vtkPVFoam::convertPointField
( (
const GeometricField<Type, pointPatchField, pointMesh>& ptf, const GeometricField<Type, pointPatchField, pointMesh>& ptf,
const GeometricField<Type, fvPatchField, volMesh>& tf, const GeometricField<Type, fvPatchField, volMesh>& tf,

Some files were not shown because too many files have changed in this diff Show more