diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/Allwclean b/applications/utilities/postProcessing/graphics/PV3Readers/Allwclean deleted file mode 100755 index 47add82a98..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/Allwclean +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -cd ${0%/*} || exit 1 # Run from this directory -set -x - -wclean libso vtkPV3Readers -PV3blockMeshReader/Allwclean -PV3FoamReader/Allwclean - -#------------------------------------------------------------------------------ diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake b/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake deleted file mode 100755 index c65150e0ed..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh -cd ${0%/*} || exit 1 # Run from this directory - -# Optional unit: continue-on-error -export WM_CONTINUE_ON_ERROR=true - -# Parse arguments for library compilation -. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments - -# -# There are several prerequisites for building a plugin -# -#set -x -canBuildPlugin() -{ - [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] || { - echo - echo "WARNING: cannot build ParaView plugin(s) without paraview directory" - echo " ParaView_DIR=$ParaView_DIR" - echo - return 1 - } - - [ -n "$PV_PLUGIN_PATH" ] || { - echo - echo "${PWD##*/} : invalid PV_PLUGIN_PATH for building ParaView plugin(s)" - echo " PV_PLUGIN_PATH=${PV_PLUGIN_PATH:-unset}" - echo - return 1 - } - - type cmake > /dev/null 2>&1 || { - echo - echo "WARNING: cannot build ParaView plugin(s) without cmake" - echo - return 1 - } - - return 0 # success -} - - -# ----------------------------------------------------------------------------- -# major version as per paraview include directory: -# Eg, "PREFIX/include/paraview-3.4" -> "3.4" -major="${ParaView_INCLUDE_DIR##*-}" - -case "$major" in -3.[0-9]*) - if canBuildPlugin - then - ( - wmake $targetType vtkPV3Readers - PV3blockMeshReader/Allwmake $targetType $* - PV3FoamReader/Allwmake $targetType $* - ) - fi - ;; -*) - echo - echo "NOTE: skipping build of ParaView V3 plugin(s)" - echo " include directory was for paraview major version '${major:-none}'" - echo - ;; -esac - - -#------------------------------------------------------------------------------ diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/Allwclean b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/Allwclean deleted file mode 100755 index 7d374ba5ec..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/Allwclean +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -cd ${0%/*} || exit 1 # Run from this directory -set -x - -# deal with client/server vs combined plugins -rm -f $FOAM_LIBBIN/libPV3FoamReader* 2>/dev/null - -rm -rf PV3FoamReader/Make -wclean libso vtkPV3Foam - -#------------------------------------------------------------------------------ diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/Allwmake b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/Allwmake deleted file mode 100755 index 05d46f149e..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/Allwmake +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -cd ${0%/*} || exit 1 # Run from this directory - -# Parse arguments for library compilation -. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments -set -x - -if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] -then - wmake $targetType vtkPV3Foam - - if [ "$targetType" != "objects" ] - then - ( - cd PV3FoamReader - mkdir -p Make/$WM_OPTIONS > /dev/null 2>&1 - cd Make/$WM_OPTIONS - cmake ../.. - make - ) - fi -fi - -#------------------------------------------------------------------------------ diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt deleted file mode 100644 index 4b37871f58..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt +++ /dev/null @@ -1,86 +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.6) - -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}/../vtkPV3Foam -) - -ADD_DEFINITIONS( - -DWM_$ENV{WM_PRECISION_OPTION} - -DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE} -) - -# Set output library destination to plugin directory -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 pqPV3FoamReaderPanel.h) - -ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS - CLASS_NAME pqPV3FoamReaderPanel - XML_NAME PV3FoamReader # name of SourceProxy in *SM.xml - XML_GROUP sources -) - -ADD_PARAVIEW_PLUGIN( - PV3FoamReader_SM "1.0" - SERVER_MANAGER_XML PV3FoamReader_SM.xml - SERVER_MANAGER_SOURCES vtkPV3FoamReader.cxx - GUI_INTERFACES ${IFACES} - GUI_SOURCES pqPV3FoamReaderPanel.cxx - ${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS} - GUI_RESOURCE_FILES PV3FoamReader.xml -) - -# # -# # Define the server-side portion of the reader plugin -# # -# ADD_PARAVIEW_PLUGIN( -# PV3FoamReader_SM "1.0" -# SERVER_MANAGER_XML PV3FoamReader_SM.xml -# SERVER_MANAGER_SOURCES vtkPV3FoamReader.cxx -# ) -# # -# # Define the client-side portion of the reader plugin -# # -# ADD_PARAVIEW_PLUGIN( -# PV3FoamReader "1.0" -# GUI_RESOURCES PV3FoamReader.qrc -# ) -# - -TARGET_LINK_LIBRARIES( - PV3FoamReader_SM - OpenFOAM - finiteVolume - vtkPV3Foam -) -#----------------------------------------------------------------------------- diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader.qrc b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader.qrc deleted file mode 100644 index 7394bb80df..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - PV3FoamReader.xml - - diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader.xml b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader.xml deleted file mode 100644 index 123c736f54..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml deleted file mode 100644 index a798530ce8..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - - - - 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/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.cxx b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.cxx deleted file mode 100644 index 3b111ff59f..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.cxx +++ /dev/null @@ -1,464 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 "pqPV3FoamReaderPanel.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 * * * * * * * * * * * * * * // - -pqPV3FoamReaderPanel::pqPV3FoamReaderPanel -( - 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 pqPV3FoamReaderPanel::CacheMeshToggled() -{ - vtkSMIntVectorProperty::SafeDownCast - ( - this->proxy()->GetProperty("UiCacheMesh") - )->SetElement(0, CacheMesh_->isChecked()); -} - - -void pqPV3FoamReaderPanel::RefreshPressed() -{ - // update everything - vtkSMIntVectorProperty::SafeDownCast - ( - this->proxy()->GetProperty("UiRefresh") - )->Modified(); - - vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline(); - - // render all views - pqApplicationCore::instance()->render(); -} - - -void pqPV3FoamReaderPanel::ZeroTimeToggled() -{ - vtkSMIntVectorProperty::SafeDownCast - ( - this->proxy()->GetProperty("UiZeroTime") - )->SetElement(0, ZeroTime_->isChecked()); - - this->setModified(); -} - - -void pqPV3FoamReaderPanel::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 pqPV3FoamReaderPanel::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 pqPV3FoamReaderPanel::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 pqPV3FoamReaderPanel::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 pqPV3FoamReaderPanel::ExtrapolatePatchesToggled() -{ - vtkSMIntVectorProperty::SafeDownCast - ( - this->proxy()->GetProperty("UiExtrapolatePatches") - )->SetElement(0, ExtrapolatePatches_->isChecked()); - - this->setModified(); -} - - -void pqPV3FoamReaderPanel::InterpolateVolFieldsToggled() -{ - vtkSMIntVectorProperty::SafeDownCast - ( - this->proxy()->GetProperty("UiInterpolateVolFields") - )->SetElement(0, InterpolateVolFields_->isChecked()); - - this->setModified(); -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.h b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.h deleted file mode 100644 index c4594c257e..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.h +++ /dev/null @@ -1,120 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 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 - pqPV3FoamReaderPanel - -Description - GUI modifications for the ParaView reader panel - - A custom panel for the PV3FoamReader. - -SourceFiles - pqPV3FoamReaderPanel.cxx - -\*---------------------------------------------------------------------------*/ -#ifndef pqPV3FoamReaderPanel_h -#define pqPV3FoamReaderPanel_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 pqPV3FoamReaderPanel Declaration -\*---------------------------------------------------------------------------*/ - -class pqPV3FoamReaderPanel -: - 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 - pqPV3FoamReaderPanel(pqProxy*, QWidget*); - - - //- Destructor - // virtual ~pqPV3FoamReaderPanel(); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx deleted file mode 100644 index 163b637854..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx +++ /dev/null @@ -1,757 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 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 "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" - -// OpenFOAM includes -#include "vtkPV3Foam.H" - -#undef EXPERIMENTAL_TIME_CACHING - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -vtkStandardNewMacro(vtkPV3FoamReader); - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -vtkPV3FoamReader::vtkPV3FoamReader() -{ - Debug = 0; - vtkDebugMacro(<<"Constructor"); - - SetNumberOfInputPorts(0); - - FileName = nullptr; - foamData_ = nullptr; - - output0_ = nullptr; - -#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; - 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 - ( - &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 - ); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -vtkPV3FoamReader::~vtkPV3FoamReader() -{ - 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 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_ = nullptr; - 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 - - updatePatchNamesView(ShowPatchNames); - -#endif - - // Do any cleanup on the OpenFOAM side - foamData_->CleanUp(); - - return 1; -} - - -void vtkPV3FoamReader::SetRefresh(int val) -{ - Modified(); -} - - -void vtkPV3FoamReader::SetIncludeSets(int val) -{ - if (IncludeSets != val) - { - IncludeSets = val; - if (foamData_) - { - foamData_->updateInfo(); - } - } -} - - -void vtkPV3FoamReader::SetIncludeZones(int val) -{ - if (IncludeZones != val) - { - IncludeZones = val; - if (foamData_) - { - foamData_->updateInfo(); - } - } -} - - -void vtkPV3FoamReader::SetShowPatchNames(int val) -{ - if (ShowPatchNames != val) - { - ShowPatchNames = val; - updatePatchNamesView(ShowPatchNames); - } -} - - -void vtkPV3FoamReader::SetShowGroupsOnly(int val) -{ - if (ShowGroupsOnly != val) - { - ShowGroupsOnly = val; - if (foamData_) - { - foamData_->updateInfo(); - } - } -} - - -void vtkPV3FoamReader::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 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" - << 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("Set mesh part \"" << name << "\" status to: " << status); - - 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(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; -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h deleted file mode 100644 index aa4bec44b6..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h +++ /dev/null @@ -1,262 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 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 - vtkPV3FoamReader - -Description - reads a dataset in OpenFOAM format - - vtkPV3blockMeshReader creates an multiblock dataset. - It uses the OpenFOAM infrastructure (fvMesh, etc) to handle mesh and - field data. - -SourceFiles - vtkPV3blockMeshReader.cxx - -\*---------------------------------------------------------------------------*/ -#ifndef vtkPV3FoamReader_h -#define vtkPV3FoamReader_h - -// VTK includes -#include "vtkMultiBlockDataSetAlgorithm.h" - -// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * // - -// VTK forward declarations -class vtkDataArraySelection; -class vtkCallbackCommand; - -// OpenFOAM forward declarations -namespace Foam -{ - class vtkPV3Foam; -} - - -/*---------------------------------------------------------------------------*\ - Class vtkPV3FoamReader Declaration -\*---------------------------------------------------------------------------*/ - -class VTK_IO_EXPORT vtkPV3FoamReader -: - public vtkMultiBlockDataSetAlgorithm -{ -public: - vtkTypeMacro(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: - // 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 - 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 - 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 - vtkPV3FoamReader(const vtkPV3FoamReader&); - - //- Disallow default bitwise assignment - void operator=(const vtkPV3FoamReader&); - - //- 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::vtkPV3Foam* foamData_; - //ETX -}; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/files b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/files deleted file mode 100644 index 685ea2e8a0..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/files +++ /dev/null @@ -1,11 +0,0 @@ -vtkPV3Foam.C -vtkPV3FoamFields.C -vtkPV3FoamMesh.C -vtkPV3FoamMeshLagrangian.C -vtkPV3FoamMeshSet.C -vtkPV3FoamMeshVolume.C -vtkPV3FoamMeshZone.C -vtkPV3FoamUpdateInfo.C -vtkPV3FoamUtils.C - -LIB = $(FOAM_LIBBIN)/libvtkPV3Foam diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/options b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/options deleted file mode 100644 index 2e5018852f..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/options +++ /dev/null @@ -1,21 +0,0 @@ -/* Note: enable vtkPolyhedron when available */ - -EXE_INC = \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/lagrangian/basic/lnInclude \ - -I../../vtkPV3Readers/lnInclude \ - -I../PV3FoamReader \ - -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) -lvtkPV3Readers \ - $(GLIBS) diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMPoints.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMPoints.H deleted file mode 100644 index 9f51c757e4..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMPoints.H +++ /dev/null @@ -1,79 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 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 - vtkPV3Foam - -\*---------------------------------------------------------------------------*/ - -#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/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMTupleRemap.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMTupleRemap.H deleted file mode 100644 index 79f3ab3127..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkOpenFOAMTupleRemap.H +++ /dev/null @@ -1,59 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 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 - vtkPV3Foam - -\*---------------------------------------------------------------------------*/ - -#ifndef vtkOpenFOAMTupleRemap_H -#define vtkOpenFOAMTupleRemap_H - -// OpenFOAM includes -#include "Swap.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template -inline void vtkOpenFOAMTupleRemap(float vec[]); - - -// 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/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C deleted file mode 100644 index 812a8ef6b7..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ /dev/null @@ -1,839 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 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 "vtkPV3Foam.H" -#include "vtkPV3FoamReader.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(vtkPV3Foam, 0); -} - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -#include "vtkPV3FoamAddToSelection.H" -#include "vtkPV3FoamUpdateInfoFields.H" - -void Foam::vtkPV3Foam::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::vtkPV3Foam::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_ = nullptr; - } -} - - -int Foam::vtkPV3Foam::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::vtkPV3Foam::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::vtkPV3Foam::setTime() - selectedTime=" - << Times[nearestIndex].name() << " index=" << timeIndex_ - << "/" << Times.size() - << " meshChanged=" << Switch(meshChanged_) - << " fieldsChanged=" << Switch(fieldsChanged_) << endl; - } - - return nearestIndex; -} - - -void Foam::vtkPV3Foam::updateMeshPartsStatus() -{ - if (debug) - { - Info<< " Foam::vtkPV3Foam::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::vtkPV3Foam::updateMeshPartsStatus" << endl; - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::vtkPV3Foam::vtkPV3Foam -( - const char* const FileName, - vtkPV3FoamReader* reader -) -: - reader_(reader), - dbPtr_(nullptr), - meshPtr_(nullptr), - 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::vtkPV3Foam::vtkPV3Foam - " << 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::vtkPV3Foam::~vtkPV3Foam() -{ - if (debug) - { - Info<< " Foam::vtkPV3Foam::~vtkPV3Foam" << endl; - } - - delete meshPtr_; -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::vtkPV3Foam::updateInfo() -{ - if (debug) - { - Info<< " Foam::vtkPV3Foam::updateInfo" - << " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "] 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::vtkPV3Foam::updateInfo" << endl; - } - -} - - -void Foam::vtkPV3Foam::updateFoamMesh() -{ - if (debug) - { - Info<< " Foam::vtkPV3Foam::updateFoamMesh" << endl; - printMemory(); - } - - if (!reader_->GetCacheMesh()) - { - delete meshPtr_; - meshPtr_ = nullptr; - } - - // 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::vtkPV3Foam::updateFoamMesh" << endl; - printMemory(); - } -} - - -void Foam::vtkPV3Foam::Update -( - vtkMultiBlockDataSet* output, - vtkMultiBlockDataSet* lagrangianOutput -) -{ - if (debug) - { - cout<< " Foam::vtkPV3Foam::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 VTKPV3FOAM_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::vtkPV3Foam::CleanUp() -{ - // reclaim some memory - reduceMemory(); - reader_->UpdateProgress(1.0); -} - - -double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps) -{ - int nTimes = 0; - double* tsteps = nullptr; - - 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 - ).typeHeaderOk(true) - ) - { - 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::vtkPV3Foam::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(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::vtkPV3Foam::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/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H deleted file mode 100644 index ab6dc05c83..0000000000 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ /dev/null @@ -1,741 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 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::vtkPV3Foam - -Description - Provides a reader interface for OpenFOAM to VTK interaction. - -SourceFiles - vtkPV3Foam.C - vtkPV3Foam.H - vtkPV3FoamFields.C - vtkPV3FoamMesh.C - vtkPV3FoamMeshLagrangian.C - vtkPV3FoamTemplates.C - vtkPV3FoamMeshSet.C - vtkPV3FoamMeshVolume.C - vtkPV3FoamMeshZone.C - vtkPV3FoamFaceField.H - vtkPV3FoamLagrangianFields.H - vtkPV3FoamPatchField.H - vtkPV3FoamPointFields.H - vtkPV3FoamPoints.H - vtkPV3FoamUpdateInfo.C - vtkPV3FoamUpdateInfoFields.H - vtkPV3FoamUtils.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 -{ - -// 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 vtkPV3Foam Declaration -\*---------------------------------------------------------------------------*/ - -class vtkPV3Foam -{ - // 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 vtkPV3FoamReader - vtkPV3FoamReader* reader_; - - //- OpenFOAM time control - autoPtr