From 63087b46f6006e0b356f705c28b70cfe549a116b Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 5 Apr 2013 15:28:36 +0100 Subject: [PATCH] ENH: Added PV readers for version 3.98.1 --- src/paraview-plugins/PV398Readers/Allwclean | 9 + src/paraview-plugins/PV398Readers/Allwmake | 22 + .../PV398Readers/PV398FoamReader/Allwclean | 11 + .../PV398Readers/PV398FoamReader/Allwmake | 17 + .../PV398FoamReader/CMakeLists.txt | 85 ++ .../PV398FoamReader/PV398FoamReader.qrc | 5 + .../PV398FoamReader/PV398FoamReader.xml | 6 + .../PV398FoamReader/PV398FoamReader_SM.xml | 306 +++++++ .../pqPV398FoamReaderPanel.cxx | 468 ++++++++++ .../PV398FoamReader/pqPV398FoamReaderPanel.h | 120 +++ .../PV398FoamReader/vtkPV398FoamReader.cxx | 752 ++++++++++++++++ .../PV398FoamReader/vtkPV398FoamReader.h | 262 ++++++ .../PV398FoamReader/vtkPV398Foam/Make/files | 11 + .../PV398FoamReader/vtkPV398Foam/Make/options | 21 + .../vtkDataArrayTemplateImplicit.txx | 0 .../vtkPV398Foam/vtkOpenFOAMPoints.H | 79 ++ .../vtkPV398Foam/vtkOpenFOAMTupleRemap.H | 71 ++ .../vtkPV398Foam/vtkPV398Foam.C | 837 ++++++++++++++++++ .../vtkPV398Foam/vtkPV398Foam.H | 737 +++++++++++++++ .../vtkPV398Foam/vtkPV398FoamAddToSelection.H | 74 ++ .../vtkPV398Foam/vtkPV398FoamFaceField.H | 117 +++ .../vtkPV398Foam/vtkPV398FoamFields.C | 325 +++++++ .../vtkPV398FoamLagrangianFields.H | 113 +++ .../vtkPV398Foam/vtkPV398FoamMesh.C | 648 ++++++++++++++ .../vtkPV398Foam/vtkPV398FoamMeshLagrangian.C | 109 +++ .../vtkPV398Foam/vtkPV398FoamMeshSet.C | 148 ++++ .../vtkPV398Foam/vtkPV398FoamMeshVolume.C | 481 ++++++++++ .../vtkPV398Foam/vtkPV398FoamMeshZone.C | 75 ++ .../vtkPV398Foam/vtkPV398FoamPatchField.H | 129 +++ .../vtkPV398Foam/vtkPV398FoamPointFields.H | 331 +++++++ .../vtkPV398Foam/vtkPV398FoamTemplates.C | 99 +++ .../vtkPV398Foam/vtkPV398FoamUpdateInfo.C | 724 +++++++++++++++ .../vtkPV398FoamUpdateInfoFields.H | 115 +++ .../vtkPV398Foam/vtkPV398FoamUtils.C | 340 +++++++ .../vtkPV398Foam/vtkPV398FoamVolFields.H | 380 ++++++++ .../PV398blockMeshReader/Allwclean | 11 + .../PV398blockMeshReader/Allwmake | 17 + .../PV398blockMeshReader/CMakeLists.txt | 86 ++ .../PV398blockMeshReader.qrc | 5 + .../PV398blockMeshReader.xml | 6 + .../PV398blockMeshReader_SM.xml | 110 +++ .../pqPV398blockMeshReaderPanel.cxx | 110 +++ .../pqPV398blockMeshReaderPanel.h | 89 ++ .../vtkPV398blockMeshReader.cxx | 419 +++++++++ .../vtkPV398blockMeshReader.h | 177 ++++ .../vtkPV398blockMesh/Make/files | 5 + .../vtkPV398blockMesh/Make/options | 12 + .../vtkDataArrayTemplateImplicit.txx | 0 .../vtkPV398blockMesh/vtkOpenFOAMPoints.H | 65 ++ .../vtkPV398blockMesh/vtkPV398blockMesh.C | 473 ++++++++++ .../vtkPV398blockMesh/vtkPV398blockMesh.H | 351 ++++++++ .../vtkPV398blockMeshConvert.C | 319 +++++++ .../vtkPV398blockMeshUtils.C | 357 ++++++++ .../PV398Readers/vtkPV398Readers/Make/files | 3 + .../PV398Readers/vtkPV398Readers/Make/options | 5 + .../vtkPV398Readers/vtkPV398Readers.C | 333 +++++++ .../vtkPV398Readers/vtkPV398Readers.H | 228 +++++ 57 files changed, 11208 insertions(+) create mode 100755 src/paraview-plugins/PV398Readers/Allwclean create mode 100755 src/paraview-plugins/PV398Readers/Allwmake create mode 100755 src/paraview-plugins/PV398Readers/PV398FoamReader/Allwclean create mode 100755 src/paraview-plugins/PV398Readers/PV398FoamReader/Allwmake create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/CMakeLists.txt create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/PV398FoamReader.qrc create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/PV398FoamReader.xml create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/PV398FoamReader_SM.xml create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/pqPV398FoamReaderPanel.cxx create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/pqPV398FoamReaderPanel.h create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/vtkPV398FoamReader.cxx create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/vtkPV398FoamReader.h create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/Make/files create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/Make/options create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkDataArrayTemplateImplicit.txx create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkOpenFOAMPoints.H create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkOpenFOAMTupleRemap.H create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398Foam.C create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398Foam.H create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamAddToSelection.H create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamFaceField.H create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamFields.C create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamLagrangianFields.H create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMesh.C create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMeshLagrangian.C create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMeshSet.C create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMeshVolume.C create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMeshZone.C create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamPatchField.H create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamPointFields.H create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamTemplates.C create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamUpdateInfo.C create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamUpdateInfoFields.H create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamUtils.C create mode 100644 src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamVolFields.H create mode 100755 src/paraview-plugins/PV398Readers/PV398blockMeshReader/Allwclean create mode 100755 src/paraview-plugins/PV398Readers/PV398blockMeshReader/Allwmake create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/PV398blockMeshReader/CMakeLists.txt create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/PV398blockMeshReader/PV398blockMeshReader.qrc create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/PV398blockMeshReader/PV398blockMeshReader.xml create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/PV398blockMeshReader/PV398blockMeshReader_SM.xml create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/PV398blockMeshReader/pqPV398blockMeshReaderPanel.cxx create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/PV398blockMeshReader/pqPV398blockMeshReaderPanel.h create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/PV398blockMeshReader/vtkPV398blockMeshReader.cxx create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/PV398blockMeshReader/vtkPV398blockMeshReader.h create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/vtkPV398blockMesh/Make/files create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/vtkPV398blockMesh/Make/options create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/vtkPV398blockMesh/vtkDataArrayTemplateImplicit.txx create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/vtkPV398blockMesh/vtkOpenFOAMPoints.H create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/vtkPV398blockMesh/vtkPV398blockMesh.C create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/vtkPV398blockMesh/vtkPV398blockMesh.H create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/vtkPV398blockMesh/vtkPV398blockMeshConvert.C create mode 100644 src/paraview-plugins/PV398Readers/PV398blockMeshReader/vtkPV398blockMesh/vtkPV398blockMeshUtils.C create mode 100644 src/paraview-plugins/PV398Readers/vtkPV398Readers/Make/files create mode 100644 src/paraview-plugins/PV398Readers/vtkPV398Readers/Make/options create mode 100644 src/paraview-plugins/PV398Readers/vtkPV398Readers/vtkPV398Readers.C create mode 100644 src/paraview-plugins/PV398Readers/vtkPV398Readers/vtkPV398Readers.H diff --git a/src/paraview-plugins/PV398Readers/Allwclean b/src/paraview-plugins/PV398Readers/Allwclean new file mode 100755 index 0000000..ba4eb0a --- /dev/null +++ b/src/paraview-plugins/PV398Readers/Allwclean @@ -0,0 +1,9 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wclean libso vtkPV398Readers +PV398blockMeshReader/Allwclean +PV398FoamReader/Allwclean + +# ----------------------------------------------------------------- end-of-file diff --git a/src/paraview-plugins/PV398Readers/Allwmake b/src/paraview-plugins/PV398Readers/Allwmake new file mode 100755 index 0000000..33d6bd1 --- /dev/null +++ b/src/paraview-plugins/PV398Readers/Allwmake @@ -0,0 +1,22 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +#set -x + +if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] +then + [ -n "$PV_PLUGIN_PATH" ] || { + echo "$0 : PV_PLUGIN_PATH not valid - it is unset" + exit 1 + } + + # ensure CMake gets the correct C++ compiler + [ -n "$WM_CXX" ] && export CXX="$WM_CXX" + + wmake libso vtkPV398Readers + PV398blockMeshReader/Allwmake + PV398FoamReader/Allwmake +else + echo "ERROR: ParaView not found in $ParaView_DIR" +fi + +# ----------------------------------------------------------------- end-of-file diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/Allwclean b/src/paraview-plugins/PV398Readers/PV398FoamReader/Allwclean new file mode 100755 index 0000000..eda9ee5 --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/Allwclean @@ -0,0 +1,11 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +# deal with client/server vs combined plugins +rm -f $FOAM_LIBBIN/libPV398FoamReader* 2>/dev/null + +rm -rf PV398FoamReader/Make +wclean libso vtkPV398Foam + +# ----------------------------------------------------------------- end-of-file diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/Allwmake b/src/paraview-plugins/PV398Readers/PV398FoamReader/Allwmake new file mode 100755 index 0000000..77786eb --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/Allwmake @@ -0,0 +1,17 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] +then + wmake libso vtkPV398Foam + ( + cd PV398FoamReader + mkdir -p Make/$WM_OPTIONS > /dev/null 2>&1 + cd Make/$WM_OPTIONS + cmake ../.. + make + ) +fi + +# ----------------------------------------------------------------- end-of-file diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/CMakeLists.txt b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/CMakeLists.txt new file mode 100644 index 0000000..be5c218 --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/CMakeLists.txt @@ -0,0 +1,85 @@ +# 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.8) + +FIND_PACKAGE(ParaView REQUIRED) +INCLUDE(${PARAVIEW_USE_FILE}) + +LINK_DIRECTORIES( + $ENV{FOAM_LIBBIN} + $ENV{FOAM_EXT_LIBBIN} +) + +INCLUDE_DIRECTORIES( + $ENV{WM_PROJECT_DIR}/src/OpenFOAM/lnInclude + $ENV{WM_PROJECT_DIR}/src/OSspecific/$ENV{WM_OSTYPE}/lnInclude + $ENV{WM_PROJECT_DIR}/src/finiteVolume/lnInclude + ${PROJECT_SOURCE_DIR}/../vtkPV398Foam +) + +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." +) + + +# +# Defined combined plugin +# + +# Extend the auto-generated panel +QT4_WRAP_CPP(MOC_SRCS pqPV398FoamReaderPanel.h) + +ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS + CLASS_NAME pqPV398FoamReaderPanel + XML_NAME PV398FoamReader # name of SourceProxy in *SM.xml + XML_GROUP sources +) + +ADD_PARAVIEW_PLUGIN( + PV398FoamReader_SM "1.0" + SERVER_MANAGER_XML PV398FoamReader_SM.xml + SERVER_MANAGER_SOURCES vtkPV398FoamReader.cxx + GUI_INTERFACES ${IFACES} + GUI_SOURCES pqPV398FoamReaderPanel.cxx + ${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS} + GUI_RESOURCE_FILES PV398FoamReader.xml +) + +# # +# # Define the server-side portion of the reader plugin +# # +# ADD_PARAVIEW_PLUGIN( +# PV398FoamReader_SM "1.0" +# SERVER_MANAGER_XML PV398FoamReader_SM.xml +# SERVER_MANAGER_SOURCES vtkPV398FoamReader.cxx +# ) +# # +# # Define the client-side portion of the reader plugin +# # +# ADD_PARAVIEW_PLUGIN( +# PV398FoamReader "1.0" +# GUI_RESOURCES PV3FoamReader.qrc +# ) +# + +TARGET_LINK_LIBRARIES( + PV398FoamReader_SM + OpenFOAM + finiteVolume + vtkPV398Foam +) +#----------------------------------------------------------------------------- diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/PV398FoamReader.qrc b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/PV398FoamReader.qrc new file mode 100644 index 0000000..8f22c85 --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/PV398FoamReader.qrc @@ -0,0 +1,5 @@ + + + PV398FoamReader.xml + + diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/PV398FoamReader.xml b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/PV398FoamReader.xml new file mode 100644 index 0000000..866ef55 --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/PV398FoamReader.xml @@ -0,0 +1,6 @@ + + + + diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/PV398FoamReader_SM.xml b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/PV398FoamReader_SM.xml new file mode 100644 index 0000000..73849a7 --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/PV398FoamReader_SM.xml @@ -0,0 +1,306 @@ + + + + + + + + + Specifies the filename for the OpenFOAM Reader. + + + + + + + + Available timestep values. + + + + + + + + Cache the fvMesh in memory. + + + + + + + + Rescan for updated timesteps/fields. + + + + + + + + Skip including the 0/ time directory + + + + + + + + Interpolate volume fields into point fields + + + + + + + + Extrapolate internalField to non-constraint patches + + + + + + + + Use vtkPolyhedron instead of decomposing polyhedra. + + + + + + + Search the polyMesh/sets/ directory + + + + + + + + ZoneMesh information is used to find {cell,face,point}Zones. + The polyMesh/ directory is only checked on startup. + + + + + + + + + Show patch names in render window + + + + + + + + Show groups only + + + + + + + + A simple way to cause a reader GUI modification. + + + + + + + + + + + + + + + + + This property contains a list of the mesh parts + (patches, groups, sets, zones). + + + + + + + + + + + + + + + This property contains a list of the volume fields + + + + + + + + + + + + + + + This property contains a list of the lagrangian fields + + + + + + + + + + + + + + + This property contains a list of the point fields + + + + + + + + + + + + + + + + + + diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/pqPV398FoamReaderPanel.cxx b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/pqPV398FoamReaderPanel.cxx new file mode 100644 index 0000000..7583601 --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/pqPV398FoamReaderPanel.cxx @@ -0,0 +1,468 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "pqPV398FoamReaderPanel.h" + +// QT +#include +#include +#include +#include +#include +#include +#include + +// Paraview <-> QT UI +#include "pqAnimationScene.h" +#include "pqApplicationCore.h" +#include "pqPipelineRepresentation.h" +#include "pqServerManagerModel.h" +#include "pqView.h" + +// Paraview Server Manager +#include "vtkSMDoubleVectorProperty.h" +#include "vtkSMIntVectorProperty.h" +#include "vtkSMProperty.h" +#include "vtkSMSourceProxy.h" + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +pqPV398FoamReaderPanel::pqPV398FoamReaderPanel +( + pqProxy *proxy, + QWidget *p +) +: + pqAutoGeneratedObjectPanel(proxy, p) +{ + // create first sublayout (at top of the panel) + QGridLayout* form = new QGridLayout(); + this->PanelLayout->addLayout(form, 0, 0, 1, -1); + + // ROW 0 + // ~~~~~ + + vtkSMProperty* prop = 0; + + // refresh button for updating times/fields + if ((prop = this->proxy()->GetProperty("UiRefresh")) != 0) + { + prop->SetImmediateUpdate(1); + QPushButton *refresh = new QPushButton("Refresh Times"); + refresh->setToolTip("Rescan for updated times/fields."); + + form->addWidget(refresh, 0, 0, Qt::AlignLeft); + QObject::connect + ( + refresh, + SIGNAL(clicked()), + this, + SLOT(RefreshPressed()) + ); + } + + // checkbox for skip zeroTime + if ((prop = this->proxy()->GetProperty("UiZeroTime")) != 0) + { + // immediate update on the Server Manager side + prop->SetImmediateUpdate(true); + + ZeroTime_ = new QCheckBox("Skip Zero Time"); + ZeroTime_->setChecked + ( + vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0) + ); + ZeroTime_->setToolTip + ( + "Skip including the 0/ time directory." + ); + + form->addWidget(ZeroTime_, 0, 1, Qt::AlignLeft); + connect + ( + ZeroTime_, + SIGNAL(stateChanged(int)), + this, + SLOT(ZeroTimeToggled()) + ); + } + + // ROW 1 + // ~~~~~ + + QFrame* hline1 = new QFrame(this); + hline1->setFrameStyle(QFrame::HLine | QFrame::Sunken); + form->addWidget(hline1, 1, 0, 1, 3); + + // ROW 2 + // ~~~~~ + + // checkbox for caching mesh + if ((prop = this->proxy()->GetProperty("UiCacheMesh")) != 0) + { + // immediate update on the Server Manager side + prop->SetImmediateUpdate(true); + + CacheMesh_ = new QCheckBox("Cache Mesh"); + CacheMesh_->setChecked + ( + vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0) + ); + CacheMesh_->setToolTip + ( + "Cache the fvMesh in memory." + ); + + form->addWidget(CacheMesh_, 2, 0, Qt::AlignLeft); + connect + ( + CacheMesh_, + SIGNAL(stateChanged(int)), + this, + SLOT(CacheMeshToggled()) + ); + } + + // cell 2,1 empty + + // ROW 3 + // ~~~~~ + + // checkbox for include sets + if ((prop = this->proxy()->GetProperty("UiIncludeSets")) != 0) + { + // immediate update on the Server Manager side + prop->SetImmediateUpdate(true); + + IncludeSets_ = new QCheckBox("Include Sets"); + IncludeSets_->setChecked + ( + vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0) + ); + IncludeSets_->setToolTip + ( + "Search the polyMesh/sets/ directory." + ); + + // row/col 1,0 + form->addWidget(IncludeSets_, 3, 0, Qt::AlignLeft); + connect + ( + IncludeSets_, + SIGNAL(stateChanged(int)), + this, + SLOT(IncludeSetsToggled()) + ); + } + + // checkbox for Groups Only + if ((prop = this->proxy()->GetProperty("UiShowGroupsOnly")) != 0) + { + // immediate update on the Server Manager side + prop->SetImmediateUpdate(true); + + ShowGroupsOnly_ = new QCheckBox("Groups Only"); + ShowGroupsOnly_->setChecked + ( + vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0) + ); + ShowGroupsOnly_->setToolTip + ( + "Show patchGroups only." + ); + + // row/col 2, 2 + form->addWidget(ShowGroupsOnly_, 3, 1, Qt::AlignLeft); + connect + ( + ShowGroupsOnly_, + SIGNAL(stateChanged(int)), + this, + SLOT(ShowGroupsOnlyToggled()) + ); + } + + + // ROW 4 + // ~~~~~ + + // checkbox for include zones + if ((prop = this->proxy()->GetProperty("UiIncludeZones")) != 0) + { + // immediate update on the Server Manager side + prop->SetImmediateUpdate(true); + + IncludeZones_ = new QCheckBox("Include Zones"); + IncludeZones_->setChecked + ( + vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0) + ); + IncludeZones_->setToolTip + ( + "ZoneMesh information is used to find {cell,face,point}Zones. " + "The polyMesh/ directory is only checked on startup." + ); + + // row/col 1,1 + form->addWidget(IncludeZones_, 4, 0, Qt::AlignLeft); + connect + ( + IncludeZones_, + SIGNAL(stateChanged(int)), + this, + SLOT(IncludeZonesToggled()) + ); + } + + // checkbox for patch names + if ((prop = this->proxy()->GetProperty("UiShowPatchNames")) != 0) + { + // immediate update on the Server Manager side + prop->SetImmediateUpdate(true); + + ShowPatchNames_ = new QCheckBox("Patch Names"); + ShowPatchNames_->setChecked + ( + vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0) + ); + ShowPatchNames_->setToolTip + ( + "Show patch names in render window." + ); + + // row/col 0,1 + form->addWidget(ShowPatchNames_, 4, 1, Qt::AlignLeft); + connect + ( + ShowPatchNames_, + SIGNAL(stateChanged(int)), + this, + SLOT(ShowPatchNamesToggled()) + ); + } + + // ROW 5 + // ~~~~~ + + QFrame* hline2 = new QFrame(this); + hline2->setFrameStyle(QFrame::HLine | QFrame::Sunken); + form->addWidget(hline2, 5, 0, 1, 3); + + // ROW 6 + // ~~~~~ + + // checkbox for vol field interpolation + if ((prop = this->proxy()->GetProperty("UiInterpolateVolFields")) != 0) + { + // immediate update on the Server Manager side + prop->SetImmediateUpdate(true); + + InterpolateVolFields_ = new QCheckBox("Interpolate volFields"); + InterpolateVolFields_->setChecked + ( + vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0) + ); + InterpolateVolFields_->setToolTip + ( + "Interpolate volFields into pointFields" + ); + + // row/col 1,1 + form->addWidget(InterpolateVolFields_, 6, 0, Qt::AlignLeft); + connect + ( + InterpolateVolFields_, + SIGNAL(stateChanged(int)), + this, + SLOT(InterpolateVolFieldsToggled()) + ); + } + + // checkbox for extrapolate patches + if ((prop = this->proxy()->GetProperty("UiExtrapolatePatches")) != 0) + { + // immediate update on the Server Manager side + prop->SetImmediateUpdate(true); + + ExtrapolatePatches_ = new QCheckBox("Extrapolate Patches"); + ExtrapolatePatches_->setChecked + ( + vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0) + ); + ExtrapolatePatches_->setToolTip + ( + "Extrapolate internalField to non-constraint patches" + ); + + // row/col 1,1 + form->addWidget(ExtrapolatePatches_, 6, 1, Qt::AlignLeft); + connect + ( + ExtrapolatePatches_, + SIGNAL(stateChanged(int)), + this, + SLOT(ExtrapolatePatchesToggled()) + ); + } + + // ROW 7 + // ~~~~~ + + QFrame* hline3 = new QFrame(this); + hline3->setFrameStyle(QFrame::HLine | QFrame::Sunken); + form->addWidget(hline3, 7, 0, 1, 3); +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void pqPV398FoamReaderPanel::CacheMeshToggled() +{ + vtkSMIntVectorProperty::SafeDownCast + ( + this->proxy()->GetProperty("UiCacheMesh") + )->SetElement(0, CacheMesh_->isChecked()); +} + + +void pqPV398FoamReaderPanel::RefreshPressed() +{ + // update everything + vtkSMIntVectorProperty::SafeDownCast + ( + this->proxy()->GetProperty("UiRefresh") + )->Modified(); + + vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline(); + + // render all views + pqApplicationCore::instance()->render(); +} + + +void pqPV398FoamReaderPanel::ZeroTimeToggled() +{ + vtkSMIntVectorProperty::SafeDownCast + ( + this->proxy()->GetProperty("UiZeroTime") + )->SetElement(0, ZeroTime_->isChecked()); + + this->setModified(); +} + + +void pqPV398FoamReaderPanel::ShowPatchNamesToggled() +{ + vtkSMIntVectorProperty::SafeDownCast + ( + this->proxy()->GetProperty("UiShowPatchNames") + )->SetElement(0, ShowPatchNames_->isChecked()); + + // update the active view + if (this->view()) + { + this->view()->render(); + } + // OR: update all views + // pqApplicationCore::instance()->render(); +} + + +void pqPV398FoamReaderPanel::ShowGroupsOnlyToggled() +{ + vtkSMProperty* prop; + + vtkSMIntVectorProperty::SafeDownCast + ( + this->proxy()->GetProperty("UiShowGroupsOnly") + )->SetElement(0, ShowGroupsOnly_->isChecked()); + + if ((prop = this->proxy()->GetProperty("PartArrayStatus")) != 0) + { + this->proxy()->UpdatePropertyInformation(prop); + } +} + + +void pqPV398FoamReaderPanel::IncludeSetsToggled() +{ + vtkSMProperty* prop; + + vtkSMIntVectorProperty::SafeDownCast + ( + this->proxy()->GetProperty("UiIncludeSets") + )->SetElement(0, IncludeSets_->isChecked()); + + if ((prop = this->proxy()->GetProperty("PartArrayStatus")) != 0) + { + this->proxy()->UpdatePropertyInformation(prop); + } +} + + +void pqPV398FoamReaderPanel::IncludeZonesToggled() +{ + vtkSMProperty* prop; + + vtkSMIntVectorProperty::SafeDownCast + ( + this->proxy()->GetProperty("UiIncludeZones") + )->SetElement(0, IncludeZones_->isChecked()); + + if ((prop = this->proxy()->GetProperty("PartArrayStatus")) != 0) + { + this->proxy()->UpdatePropertyInformation(prop); + } +} + + +void pqPV398FoamReaderPanel::ExtrapolatePatchesToggled() +{ + vtkSMProperty* prop; + + vtkSMIntVectorProperty::SafeDownCast + ( + this->proxy()->GetProperty("UiExtrapolatePatches") + )->SetElement(0, ExtrapolatePatches_->isChecked()); + + this->setModified(); +} + + +void pqPV398FoamReaderPanel::InterpolateVolFieldsToggled() +{ + vtkSMProperty* prop; + + vtkSMIntVectorProperty::SafeDownCast + ( + this->proxy()->GetProperty("UiInterpolateVolFields") + )->SetElement(0, InterpolateVolFields_->isChecked()); + + this->setModified(); +} + + +// ************************************************************************* // diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/pqPV398FoamReaderPanel.h b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/pqPV398FoamReaderPanel.h new file mode 100644 index 0000000..17c1b88 --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/pqPV398FoamReaderPanel.h @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +Class + pqPV398FoamReaderPanel + +Description + GUI modifications for the ParaView reader panel + + A custom panel for the PV398FoamReader. + +SourceFiles + pqPV398FoamReaderPanel.cxx + +\*---------------------------------------------------------------------------*/ +#ifndef pqPV398FoamReaderPanel_h +#define pqPV398FoamReaderPanel_h + + +#include "pqAutoGeneratedObjectPanel.h" + +// Forward declaration of QT classes + +class QCheckBox; +class QLineEdit; +class QTimer; +class QToolButton; + +// Forward declaration of ParaView classes +class vtkSMSourceProxy; + + +/*---------------------------------------------------------------------------*\ + Class pqPV398FoamReaderPanel Declaration +\*---------------------------------------------------------------------------*/ + +class pqPV398FoamReaderPanel +: + public pqAutoGeneratedObjectPanel +{ + // Private data + Q_OBJECT; + typedef pqAutoGeneratedObjectPanel Superclass; + + //- ZeroTime checkbox + QCheckBox* ZeroTime_; + + //- CacheMesh checkbox + QCheckBox* CacheMesh_; + + //- Show Patch Names checkbox + QCheckBox* ShowPatchNames_; + + //- Show Groups Only checkbox + QCheckBox* ShowGroupsOnly_; + + //- IncludeSets checkbox + QCheckBox* IncludeSets_; + + //- IncludeZones checkbox + QCheckBox* IncludeZones_; + + //- InterpolateVolFields checkbox + QCheckBox* InterpolateVolFields_; + + //- ExtrapolatePatches checkbox + QCheckBox* ExtrapolatePatches_; + + +protected slots: + + void CacheMeshToggled(); + void ZeroTimeToggled(); + void RefreshPressed(); + void ShowPatchNamesToggled(); + void ShowGroupsOnlyToggled(); + void IncludeSetsToggled(); + void IncludeZonesToggled(); + void InterpolateVolFieldsToggled(); + void ExtrapolatePatchesToggled(); + + +public: + + // Constructors + + //- Construct from components + pqPV398FoamReaderPanel(pqProxy*, QWidget*); + + + //- Destructor + // virtual ~pqPV398FoamReaderPanel(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/vtkPV398FoamReader.cxx b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/vtkPV398FoamReader.cxx new file mode 100644 index 0000000..435e5d5 --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/vtkPV398FoamReader.cxx @@ -0,0 +1,752 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ +#include "vtkPV398FoamReader.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" + +// OpenFOAM includes +#include "vtkPV398Foam.H" + +#undef EXPERIMENTAL_TIME_CACHING + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +vtkStandardNewMacro(vtkPV398FoamReader); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +vtkPV398FoamReader::vtkPV398FoamReader() +{ + Debug = 0; + vtkDebugMacro(<<"Constructor"); + + SetNumberOfInputPorts(0); + + FileName = NULL; + foamData_ = NULL; + + output0_ = NULL; + +#ifdef VTKPV398FOAM_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; + Refresh = 0; + + SkipZeroTime = 0; + ExtrapolatePatches = 0; + UseVTKPolyhedron = 0; + IncludeSets = 0; + IncludeZones = 0; + ShowPatchNames = 0; + ShowGroupsOnly = 0; + InterpolateVolFields = 1; + + 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 + ( + &vtkPV398FoamReader::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 + ); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +vtkPV398FoamReader::~vtkPV398FoamReader() +{ + vtkDebugMacro(<<"Deconstructor"); + + if (foamData_) + { + // remove patch names + updatePatchNamesView(false); + 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(); +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +// Do everything except set the output info +int vtkPV398FoamReader::RequestInformation +( + vtkInformation* vtkNotUsed(request), + vtkInformationVector** vtkNotUsed(inputVector), + vtkInformationVector* outputVector +) +{ + vtkDebugMacro(<<"RequestInformation"); + + if (Foam::vtkPV398Foam::debug) + { + cout<<"REQUEST_INFORMATION\n"; + } + + if (!FileName) + { + vtkErrorMacro("FileName has to be specified!"); + return 0; + } + + int nInfo = outputVector->GetNumberOfInformationObjects(); + + if (Foam::vtkPV398Foam::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::vtkPV398Foam(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::vtkPV398Foam::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 vtkPV398FoamReader::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::vtkPV398Foam::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 vtkPV398Foam::setTime() method + for (int infoI = 0; infoI < nInfo; ++infoI) + { + vtkInformation *outInfo = outputVector->GetInformationObject(infoI); + + if + ( + outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()) + && outInfo->Length(vtkStreamingDemandDrivenPipeline::TIME_STEPS()) > 0 + ) + { + requestTime[nRequestTime++] = + outInfo->Get + ( + vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP() + ); + } + } + + if (nRequestTime) + { + foamData_->setTime(nRequestTime, requestTime); + } + + vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast + ( + outputVector->GetInformationObject(0)->Get + ( + vtkMultiBlockDataSet::DATA_OBJECT() + ) + ); + + if (Foam::vtkPV398Foam::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::vtkPV398Foam::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 VTKPV398FOAM_DUALPORT + foamData_->Update + ( + output, + vtkMultiBlockDataSet::SafeDownCast + ( + outputVector->GetInformationObject(1)->Get + ( + vtkMultiBlockDataSet::DATA_OBJECT() + ) + ); + ); +#else + foamData_->Update(output, output); +#endif + + updatePatchNamesView(ShowPatchNames); + +#endif + + // Do any cleanup on the OpenFOAM side + foamData_->CleanUp(); + + return 1; +} + + +void vtkPV398FoamReader::SetRefresh(int val) +{ + Modified(); +} + + +void vtkPV398FoamReader::SetIncludeSets(int val) +{ + if (IncludeSets != val) + { + IncludeSets = val; + if (foamData_) + { + foamData_->updateInfo(); + } + } +} + + +void vtkPV398FoamReader::SetIncludeZones(int val) +{ + if (IncludeZones != val) + { + IncludeZones = val; + if (foamData_) + { + foamData_->updateInfo(); + } + } +} + + +void vtkPV398FoamReader::SetShowPatchNames(int val) +{ + if (ShowPatchNames != val) + { + ShowPatchNames = val; + updatePatchNamesView(ShowPatchNames); + } +} + + +void vtkPV398FoamReader::SetShowGroupsOnly(int val) +{ + if (ShowGroupsOnly != val) + { + ShowGroupsOnly = val; + if (foamData_) + { + foamData_->updateInfo(); + } + } +} + + +void vtkPV398FoamReader::updatePatchNamesView(const bool show) +{ + pqApplicationCore* appCore = pqApplicationCore::instance(); + + // need to check this, since our destructor calls this + if (!appCore) + { + return; + } + + // Server manager model for querying items in the server manager + pqServerManagerModel* smModel = appCore->getServerManagerModel(); + + if (!smModel || !foamData_) + { + return; + } + + // Get all the pqRenderView instances + QList renderViews = smModel->findItems(); + + for (int viewI=0; viewI < renderViews.size(); ++viewI) + { + foamData_->renderPatchNames + ( + renderViews[viewI]->getRenderViewProxy()->GetRenderer(), + show + ); + } + + // use refresh here? +} + + +void vtkPV398FoamReader::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" + << indent << "Time step: " << this->GetTimeStep() << endl; +} + + +int vtkPV398FoamReader::GetTimeStep() +{ + return foamData_ ? foamData_->timeIndex() : -1; +} + + +// ---------------------------------------------------------------------- +// Parts selection list control + +vtkDataArraySelection* vtkPV398FoamReader::GetPartSelection() +{ + vtkDebugMacro(<<"GetPartSelection"); + return PartSelection; +} + + +int vtkPV398FoamReader::GetNumberOfPartArrays() +{ + vtkDebugMacro(<<"GetNumberOfPartArrays"); + return PartSelection->GetNumberOfArrays(); +} + + +const char* vtkPV398FoamReader::GetPartArrayName(int index) +{ + vtkDebugMacro(<<"GetPartArrayName"); + return PartSelection->GetArrayName(index); +} + + +int vtkPV398FoamReader::GetPartArrayStatus(const char* name) +{ + vtkDebugMacro(<<"GetPartArrayStatus"); + return PartSelection->ArrayIsEnabled(name); +} + + +void vtkPV398FoamReader::SetPartArrayStatus(const char* name, int status) +{ + vtkDebugMacro("Set mesh part \"" << name << "\" status to: " << status); + + if (status) + { + PartSelection->EnableArray(name); + } + else + { + PartSelection->DisableArray(name); + } +} + + +// ---------------------------------------------------------------------- +// volField selection list control + +vtkDataArraySelection* vtkPV398FoamReader::GetVolFieldSelection() +{ + vtkDebugMacro(<<"GetVolFieldSelection"); + return VolFieldSelection; +} + + +int vtkPV398FoamReader::GetNumberOfVolFieldArrays() +{ + vtkDebugMacro(<<"GetNumberOfVolFieldArrays"); + return VolFieldSelection->GetNumberOfArrays(); +} + + +const char* vtkPV398FoamReader::GetVolFieldArrayName(int index) +{ + vtkDebugMacro(<<"GetVolFieldArrayName"); + return VolFieldSelection->GetArrayName(index); +} + + +int vtkPV398FoamReader::GetVolFieldArrayStatus(const char* name) +{ + vtkDebugMacro(<<"GetVolFieldArrayStatus"); + return VolFieldSelection->ArrayIsEnabled(name); +} + + +void vtkPV398FoamReader::SetVolFieldArrayStatus(const char* name, int status) +{ + vtkDebugMacro(<<"SetVolFieldArrayStatus"); + if (status) + { + VolFieldSelection->EnableArray(name); + } + else + { + VolFieldSelection->DisableArray(name); + } +} + + +// ---------------------------------------------------------------------- +// pointField selection list control + +vtkDataArraySelection* vtkPV398FoamReader::GetPointFieldSelection() +{ + vtkDebugMacro(<<"GetPointFieldSelection"); + return PointFieldSelection; +} + + +int vtkPV398FoamReader::GetNumberOfPointFieldArrays() +{ + vtkDebugMacro(<<"GetNumberOfPointFieldArrays"); + return PointFieldSelection->GetNumberOfArrays(); +} + + +const char* vtkPV398FoamReader::GetPointFieldArrayName(int index) +{ + vtkDebugMacro(<<"GetPointFieldArrayName"); + return PointFieldSelection->GetArrayName(index); +} + + +int vtkPV398FoamReader::GetPointFieldArrayStatus(const char* name) +{ + vtkDebugMacro(<<"GetPointFieldArrayStatus"); + return PointFieldSelection->ArrayIsEnabled(name); +} + + +void vtkPV398FoamReader::SetPointFieldArrayStatus(const char* name, int status) +{ + vtkDebugMacro(<<"SetPointFieldArrayStatus"); + if (status) + { + PointFieldSelection->EnableArray(name); + } + else + { + PointFieldSelection->DisableArray(name); + } +} + + +// ---------------------------------------------------------------------- +// lagrangianField selection list control + +vtkDataArraySelection* vtkPV398FoamReader::GetLagrangianFieldSelection() +{ + vtkDebugMacro(<<"GetLagrangianFieldSelection"); + return LagrangianFieldSelection; +} + + +int vtkPV398FoamReader::GetNumberOfLagrangianFieldArrays() +{ + vtkDebugMacro(<<"GetNumberOfLagrangianFieldArrays"); + return LagrangianFieldSelection->GetNumberOfArrays(); +} + + +const char* vtkPV398FoamReader::GetLagrangianFieldArrayName(int index) +{ + vtkDebugMacro(<<"GetLagrangianFieldArrayName"); + return LagrangianFieldSelection->GetArrayName(index); +} + + +int vtkPV398FoamReader::GetLagrangianFieldArrayStatus(const char* name) +{ + vtkDebugMacro(<<"GetLagrangianFieldArrayStatus"); + return LagrangianFieldSelection->ArrayIsEnabled(name); +} + + +void vtkPV398FoamReader::SetLagrangianFieldArrayStatus +( + const char* name, + int status +) +{ + vtkDebugMacro(<<"SetLagrangianFieldArrayStatus"); + if (status) + { + LagrangianFieldSelection->EnableArray(name); + } + else + { + LagrangianFieldSelection->DisableArray(name); + } +} + + +// ---------------------------------------------------------------------- + +void vtkPV398FoamReader::SelectionModifiedCallback +( + vtkObject*, + unsigned long, + void* clientdata, + void* +) +{ + static_cast(clientdata)->SelectionModified(); +} + + +void vtkPV398FoamReader::SelectionModified() +{ + vtkDebugMacro(<<"SelectionModified"); + Modified(); +} + + +int vtkPV398FoamReader::FillOutputPortInformation +( + int port, + vtkInformation* info +) +{ + if (port == 0) + { + return this->Superclass::FillOutputPortInformation(port, info); + } + info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkMultiBlockDataSet"); + return 1; +} + + +// ************************************************************************* // diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/vtkPV398FoamReader.h b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/vtkPV398FoamReader.h new file mode 100644 index 0000000..21415bc --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/PV398FoamReader/vtkPV398FoamReader.h @@ -0,0 +1,262 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +Class + vtkPV398FoamReader + +Description + reads a dataset in OpenFOAM format + + vtkPV398blockMeshReader creates an multiblock dataset. + It uses the OpenFOAM infrastructure (fvMesh, etc) to handle mesh and + field data. + +SourceFiles + vtkPV398blockMeshReader.cxx + +\*---------------------------------------------------------------------------*/ +#ifndef vtkPV398FoamReader_h +#define vtkPV398FoamReader_h + +// VTK includes +#include "vtkMultiBlockDataSetAlgorithm.h" + +// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * // + +// VTK forward declarations +class vtkDataArraySelection; +class vtkCallbackCommand; + +// OpenFOAM forward declarations +namespace Foam +{ + class vtkPV398Foam; +} + + +/*---------------------------------------------------------------------------*\ + Class vtkPV398FoamReader Declaration +\*---------------------------------------------------------------------------*/ + +class vtkPV398FoamReader +: + public vtkMultiBlockDataSetAlgorithm +{ +public: + vtkTypeMacro(vtkPV398FoamReader, vtkMultiBlockDataSetAlgorithm); + void PrintSelf(ostream&, vtkIndent); + + static vtkPV398FoamReader* New(); + + // Description: + // Get the current timestep and the timestep range. + vtkGetVector2Macro(TimeStepRange, int); + + // Description: + // Set/Get the filename. + vtkSetStringMacro(FileName); + vtkGetStringMacro(FileName); + + // Description: + // OpenFOAM mesh caching control + vtkSetMacro(CacheMesh, int); + vtkGetMacro(CacheMesh, int); + + // Description: + // OpenFOAM refresh times/fields + virtual void SetRefresh(int); + + // Description: + // OpenFOAM skip/include the 0/ time directory + vtkSetMacro(SkipZeroTime, int); + vtkGetMacro(SkipZeroTime, int); + + // Description: + // GUI update control + vtkSetMacro(UpdateGUI, int); + vtkGetMacro(UpdateGUI, int); + + // Description: + // OpenFOAM extrapolate internal values onto the patches + vtkSetMacro(ExtrapolatePatches, int); + vtkGetMacro(ExtrapolatePatches, int); + + // Description: + // OpenFOAM use vtkPolyhedron instead of decomposing polyhedra + vtkSetMacro(UseVTKPolyhedron, int); + vtkGetMacro(UseVTKPolyhedron, int); + + // Description: + // OpenFOAM read sets control + virtual void SetIncludeSets(int); + vtkGetMacro(IncludeSets, int); + + // Description: + // OpenFOAM read zones control + virtual void SetIncludeZones(int); + vtkGetMacro(IncludeZones, int); + + // Description: + // OpenFOAM display patch names control + virtual void SetShowPatchNames(int); + vtkGetMacro(ShowPatchNames, int); + + // Description: + // OpenFOAM display patchGroups + virtual void SetShowGroupsOnly(int); + vtkGetMacro(ShowGroupsOnly, int); + + // Description: + // OpenFOAM volField interpolation + vtkSetMacro(InterpolateVolFields, int); + vtkGetMacro(InterpolateVolFields, int); + + // Description: + // Get the current timestep + int GetTimeStep(); + + // Description: + // Parts selection list control + virtual 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 + virtual 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 + virtual 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 + virtual 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 + vtkPV398FoamReader(); + + //- Destructor + ~vtkPV398FoamReader(); + + //- Return information about mesh, times, etc without loading anything + virtual int RequestInformation + ( + vtkInformation*, + vtkInformationVector**, + vtkInformationVector* + ); + + //- Get the mesh/fields for a particular time + 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; + + //- The file name for this case + char* FileName; + + +private: + + //- Disallow default bitwise copy construct + vtkPV398FoamReader(const vtkPV398FoamReader&); + + //- Disallow default bitwise assignment + void operator=(const vtkPV398FoamReader&); + + //- Add/remove patch names to/from the view + void updatePatchNamesView(const bool show); + + int TimeStepRange[2]; + int Refresh; + int CacheMesh; + int SkipZeroTime; + + int ExtrapolatePatches; + int UseVTKPolyhedron; + int IncludeSets; + int IncludeZones; + int ShowPatchNames; + int ShowGroupsOnly; + int InterpolateVolFields; + + //- Dummy variable/switch to invoke a reader update + int UpdateGUI; + + vtkDataArraySelection* PartSelection; + vtkDataArraySelection* VolFieldSelection; + vtkDataArraySelection* PointFieldSelection; + vtkDataArraySelection* LagrangianFieldSelection; + + //- Cached data for output port0 (experimental!) + vtkMultiBlockDataSet* output0_; + + //BTX + Foam::vtkPV398Foam* foamData_; + //ETX +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/Make/files b/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/Make/files new file mode 100644 index 0000000..df6c4a0 --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/Make/files @@ -0,0 +1,11 @@ +vtkPV398Foam.C +vtkPV398FoamFields.C +vtkPV398FoamMesh.C +vtkPV398FoamMeshLagrangian.C +vtkPV398FoamMeshSet.C +vtkPV398FoamMeshVolume.C +vtkPV398FoamMeshZone.C +vtkPV398FoamUpdateInfo.C +vtkPV398FoamUtils.C + +LIB = $(FOAM_LIBBIN)/libvtkPV398Foam diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/Make/options b/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/Make/options new file mode 100644 index 0000000..3b0bb17 --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/Make/options @@ -0,0 +1,21 @@ +/* Note: enable vtkPolyhedron when available */ + +EXE_INC = \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I../../vtkPV398Readers/lnInclude \ + -I../PV398FoamReader \ + -I$(ParaView_INCLUDE_DIR) \ + $(shell \ + test -f $(ParaView_INCLUDE_DIR)/vtkPolyhedron.h && \ + echo "-DHAS_VTK_POLYHEDRON" || echo "-UHAS_VTK_POLYHEDRON" \ + ) + +LIB_LIBS = \ + -lmeshTools \ + -lfiniteVolume \ + -lgenericPatchFields \ + -llagrangian \ + -L$(FOAM_LIBBIN) -lvtkPV398Readers \ + $(GLIBS) diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkDataArrayTemplateImplicit.txx b/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkDataArrayTemplateImplicit.txx new file mode 100644 index 0000000..e69de29 diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkOpenFOAMPoints.H b/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkOpenFOAMPoints.H new file mode 100644 index 0000000..aa03914 --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkOpenFOAMPoints.H @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +InClass + vtkPV398Foam + +\*---------------------------------------------------------------------------*/ + +#ifndef vtkOpenFOAMPoints_H +#define vtkOpenFOAMPoints_H + +// VTK includes +#include "vtkPoints.h" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline void vtkInsertNextOpenFOAMPoint +( + 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 vtkSetOpenFOAMPoint +( + vtkPoints *points, + const Foam::label id, + const Foam::point& p +) +{ + points->SetPoint(id, p.x(), p.y(), p.z()); +} + + +// Convert OpenFOAM mesh vertices to VTK +inline vtkPoints* vtkSetOpenFOAMPoints(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 + +// ************************************************************************* // diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkOpenFOAMTupleRemap.H b/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkOpenFOAMTupleRemap.H new file mode 100644 index 0000000..f505735 --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkOpenFOAMTupleRemap.H @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +InClass + vtkPV398Foam + +\*---------------------------------------------------------------------------*/ + +#ifndef vtkOpenFOAMTupleRemap_H +#define vtkOpenFOAMTupleRemap_H + +// OpenFOAM includes +#include "StaticAssert.H" +#include "Swap.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +inline void vtkOpenFOAMTupleRemap(float vec[]); + + +// a symmTensor specialization to remap OpenFOAM -> ParaView naming order +// Qt/Core/pqScalarBarRepresentation.cxx defines this order +// { "XX", "YY", "ZZ", "XY", "YZ", "XZ" } +// in pqScalarBarRepresentation::getDefaultComponentLabel() +// whereas OpenFOAM 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 vtkOpenFOAMTupleRemap(float vec[]) +{ + Foam::Swap(vec[1], vec[3]); // swap XY <-> YY + Foam::Swap(vec[2], vec[5]); // swap XZ <-> ZZ +} + + +template +inline void vtkOpenFOAMTupleRemap(float vec[]) +{} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398Foam.C b/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398Foam.C new file mode 100644 index 0000000..54848cc --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398Foam.C @@ -0,0 +1,837 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "vtkPV398Foam.H" +#include "vtkPV398FoamReader.h" + +// OpenFOAM includes +#include "fvMesh.H" +#include "Time.H" +#include "patchZones.H" + +// VTK includes +#include "vtkDataArraySelection.h" +#include "vtkMultiBlockDataSet.h" +#include "vtkRenderer.h" +#include "vtkTextActor.h" +#include "vtkTextProperty.h" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +defineTypeNameAndDebug(vtkPV398Foam, 0); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +#include "vtkPV398FoamAddToSelection.H" +#include "vtkPV398FoamUpdateInfoFields.H" + +void Foam::vtkPV398Foam::resetCounters() +{ + // Reset array range information (ids and sizes) + arrayRangeVolume_.reset(); + arrayRangePatches_.reset(); + arrayRangeLagrangian_.reset(); + arrayRangeCellZones_.reset(); + arrayRangeFaceZones_.reset(); + arrayRangePointZones_.reset(); + arrayRangeCellSets_.reset(); + arrayRangeFaceSets_.reset(); + arrayRangePointSets_.reset(); +} + + +void Foam::vtkPV398Foam::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::vtkPV398Foam::setTime(int nRequest, const double requestTimes[]) +{ + 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; + } + + if (debug) + { + Info<< " Foam::vtkPV398Foam::setTime("; + for (int requestI = 0; requestI < nRequest; ++requestI) + { + if (requestI) + { + Info<< ", "; + } + + Info<< requestTimes[requestI]; + } + Info<< ") - previousIndex = " << timeIndex_ + << ", nearestIndex = " << nearestIndex << endl; + } + + + // 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<< " Foam::vtkPV398Foam::setTime() - selectedTime=" + << Times[nearestIndex].name() << " index=" << timeIndex_ + << "/" << Times.size() + << " meshChanged=" << Switch(meshChanged_) + << " fieldsChanged=" << Switch(fieldsChanged_) << endl; + } + + return nearestIndex; +} + + +void Foam::vtkPV398Foam::updateMeshPartsStatus() +{ + if (debug) + { + Info<< " Foam::vtkPV398Foam::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<< " Foam::vtkPV398Foam::updateMeshPartsStatus" << endl; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::vtkPV398Foam::vtkPV398Foam +( + const char* const FileName, + vtkPV398FoamReader* reader +) +: + reader_(reader), + dbPtr_(NULL), + meshPtr_(NULL), + meshRegion_(polyMesh::defaultRegion), + meshDir_(polyMesh::meshSubDir), + timeIndex_(-1), + meshChanged_(true), + fieldsChanged_(true), + arrayRangeVolume_("unzoned"), + arrayRangePatches_("patches"), + arrayRangeLagrangian_("lagrangian"), + arrayRangeCellZones_("cellZone"), + arrayRangeFaceZones_("faceZone"), + arrayRangePointZones_("pointZone"), + arrayRangeCellSets_("cellSet"), + arrayRangeFaceSets_("faceSet"), + arrayRangePointSets_("pointSet") +{ + if (debug) + { + Info<< "Foam::vtkPV398Foam::vtkPV398Foam - " << 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}.OpenFOAM' + // 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_.empty()) + { + 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::vtkPV398Foam::~vtkPV398Foam() +{ + if (debug) + { + Info<< " Foam::vtkPV398Foam::~vtkPV398Foam" << endl; + } + + delete meshPtr_; +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::vtkPV398Foam::updateInfo() +{ + if (debug) + { + Info<< " Foam::vtkPV398Foam::updateInfo" + << " [meshPtr=" << (meshPtr_ ? "set" : "NULL") << "] timeIndex=" + << timeIndex_ << endl; + } + + resetCounters(); + + vtkDataArraySelection* partSelection = reader_->GetPartSelection(); + + // there are two ways to ensure we have the correct list of parts: + // 1. remove everything and then set particular entries 'on' + // 2. build a 'char **' list and call SetArraysWithDefault() + // + // Nr. 2 has the potential advantage of not touching the modification + // time of the vtkDataArraySelection, but the qt/paraview proxy + // layer doesn't care about that anyhow. + + // 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(partSelection); + updateInfoPatches(partSelection, enabledEntries); + updateInfoSets(partSelection); + updateInfoZones(partSelection); + updateInfoLagrangian(partSelection); + + // restore the enabled selections + setSelectedArrayEntries(partSelection, enabledEntries); + + if (meshChanged_) + { + fieldsChanged_ = true; + } + + // Update volume, point and lagrangian fields + updateInfoFields + ( + reader_->GetVolFieldSelection() + ); + updateInfoFields + ( + reader_->GetPointFieldSelection() + ); + updateInfoLagrangianFields(); + + if (debug) + { + // just for debug info + getSelectedArrayEntries(partSelection); + Info<< " Foam::vtkPV398Foam::updateInfo" << endl; + } + +} + + +void Foam::vtkPV398Foam::updateFoamMesh() +{ + if (debug) + { + Info<< " Foam::vtkPV398Foam::updateFoamMesh" << endl; + printMemory(); + } + + if (!reader_->GetCacheMesh()) + { + delete meshPtr_; + meshPtr_ = NULL; + } + + // Check to see if the OpenFOAM mesh has been created + if (!meshPtr_) + { + if (debug) + { + Info<< "Creating OpenFOAM 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 OpenFOAM mesh" << endl; + } + } + + if (debug) + { + Info<< " Foam::vtkPV398Foam::updateFoamMesh" << endl; + printMemory(); + } +} + + +void Foam::vtkPV398Foam::Update +( + vtkMultiBlockDataSet* output, + vtkMultiBlockDataSet* lagrangianOutput +) +{ + if (debug) + { + cout<< " Foam::vtkPV398Foam::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 OpenFOAM 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 VTKPV398FOAM_DUALPORT + // restart port1 at block=0 + blockNo = 0; +#endif + convertMeshLagrangian(lagrangianOutput, blockNo); + + reader_->UpdateProgress(0.8); + + // Update fields + convertVolFields(output); + convertPointFields(output); + convertLagrangianFields(lagrangianOutput); + if (debug) + { + Info<< "done reader part" << endl; + } + reader_->UpdateProgress(0.95); + + meshChanged_ = fieldsChanged_ = false; +} + + +void Foam::vtkPV398Foam::CleanUp() +{ + // reclaim some memory + reduceMemory(); + reader_->UpdateProgress(1.0); +} + + +double* Foam::vtkPV398Foam::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; + + // skip "constant" time whenever possible + if (timeI == 0 && nTimes > 1) + { + if (timeLst[timeI].name() == runTime.constant()) + { + ++timeI; + --nTimes; + } + } + + + // skip "0/" time if requested and possible + if (nTimes > 1 && reader_->GetSkipZeroTime()) + { + if (mag(timeLst[timeI].value()) < SMALL) + { + ++timeI; + --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::vtkPV398Foam::renderPatchNames +( + vtkRenderer* renderer, + const bool show +) +{ + if (!meshPtr_) + { + return; + } + + // always remove old actors first + + forAll(patchTextActorsPtrs_, patchI) + { + renderer->RemoveViewProp(patchTextActorsPtrs_[patchI]); + patchTextActorsPtrs_[patchI]->Delete(); + } + patchTextActorsPtrs_.clear(); + + if (show) + { + // get the display patches, strip off any suffix + wordHashSet selectedPatches = getSelected + ( + reader_->GetPartSelection(), + arrayRangePatches_ + ); + + if (selectedPatches.empty()) + { + return; + } + + 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 + List > zoneCentre(pbMesh.size()); + + + // 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); + + // Create storage for additional zone centres + forAll(zoneNFaces, zoneI) + { + zoneCentre[patchI].append(vector::zero); + } + + // Do averaging per individual zone + forAll(pp, faceI) + { + label zoneI = pZones[faceI]; + zoneCentre[patchI][zoneI] += pp[faceI].centre(pp.points()); + zoneNFaces[zoneI]++; + } + + forAll(zoneCentre[patchI], zoneI) + { + zoneCentre[patchI][zoneI] /= zoneNFaces[zoneI]; + } + } + + // 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]); + } + + if (debug) + { + Info<< "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; + + forAll(pbMesh, patchI) + { + const polyPatch& pp = pbMesh[patchI]; + + label globalZoneI = 0; + + // 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[patchI][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[patchI][globalZoneI].x(), + zoneCentre[patchI][globalZoneI].y(), + zoneCentre[patchI][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); + } +} + + +void Foam::vtkPV398Foam::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) << "\n"; + + os << indent << "mesh region: " << meshRegion_ << "\n"; +} + + +// ************************************************************************* // diff --git a/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398Foam.H b/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398Foam.H new file mode 100644 index 0000000..e8e56b5 --- /dev/null +++ b/src/paraview-plugins/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398Foam.H @@ -0,0 +1,737 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +Class + Foam::vtkPV398Foam + +Description + Provides a reader interface for OpenFOAM to VTK interaction. + +SourceFiles + vtkPV398Foam.C + vtkPV398Foam.H + vtkPV398FoamFields.C + vtkPV398FoamMesh.C + vtkPV398FoamMeshLagrangian.C + vtkPV398FoamTemplates.C + vtkPV398FoamMeshSet.C + vtkPV398FoamMeshVolume.C + vtkPV398FoamMeshZone.C + vtkPV398FoamFaceField.H + vtkPV398FoamLagrangianFields.H + vtkPV398FoamPatchField.H + vtkPV398FoamPointFields.H + vtkPV398FoamPoints.H + vtkPV398FoamUpdateInfo.C + vtkPV398FoamUpdateInfoFields.H + vtkPV398FoamUtils.C + vtkPV398FoamVolFields.H + vtkPV398FoamAddToSelection.H + + // Needed by VTK: + vtkDataArrayTemplateImplicit.txx + +\*---------------------------------------------------------------------------*/ + +#ifndef vtkPV398Foam_H +#define vtkPV398Foam_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 VTKPV398FOAM_DUALPORT + +// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * // + +class vtkDataArraySelection; +class vtkDataSet; +class vtkPoints; +class vtkPV398FoamReader; +class vtkRenderer; +class vtkTextActor; +class vtkMultiBlockDataSet; +class vtkPolyData; +class vtkUnstructuredGrid; +class vtkIndent; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// OpenFOAM class forward declarations +class argList; +class Time; +class fvMesh; +class IOobjectList; +class polyPatch; +class faceSet; +class pointSet; + +template class IOField; +template class List; + +/*---------------------------------------------------------------------------*\ + Class vtkPV398Foam Declaration +\*---------------------------------------------------------------------------*/ + +class vtkPV398Foam +{ + // Private classes + + //- Bookkeeping for GUI checklists and the multi-block organization + class arrayRange + { + const char *name_; + int block_; + int start_; + int size_; + + public: + + arrayRange(const char *name, const int blockNo=0) + : + name_(name), + block_(blockNo), + start_(0), + 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; + } + + //- Return block name + const char* name() const + { + return name_; + } + + //- Return array start index + int start() const + { + return start_; + } + + //- Return array end index + int end() const + { + return start_ + size_; + } + + //- Return sublist size + int size() const + { + return size_; + } + + bool empty() const + { + return !size_; + } + + //- Reset the size to zero and optionally assign a new start + void reset(const int startAt = 0) + { + start_ = startAt; + 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 vtkPV398FoamReader + vtkPV398FoamReader* reader_; + + //- OpenFOAM time control + autoPtr