From 83cee1cb68ec0391402bf540719ca116c20ec170 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 23 Oct 2009 00:33:42 +0200 Subject: [PATCH] First useful Qt modifications to the PV3blockMeshReader, PV3FoamReader - Show Point Numbers as is_internal="1" and hook directly into a QT-checkbox and thus bypass modifying the reader state. - Same for Cache Mesh and Show Patch Names --- .../PV3FoamReader/CMakeLists.txt | 5 +- .../PV3FoamReader/PV3FoamReader_SM.xml | 42 +++--- .../PV3FoamReader/pqPV3FoamReaderPanel.cxx | 126 ++++++++++++++++++ .../PV3FoamReader/pqPV3FoamReaderPanel.h | 102 +++++++++++--- .../PV3FoamReader/vtkPV3FoamReader.cxx | 58 ++++++-- .../PV3FoamReader/vtkPV3FoamReader.h | 82 ++++++++---- .../PV3blockMeshReader/CMakeLists.txt | 7 +- .../PV3blockMeshReader_SM.xml | 11 +- .../pqPV3blockMeshReaderPanel.cxx | 100 ++++++++++++++ .../pqPV3blockMeshReaderPanel.h | 98 +++++++++++--- .../vtkPV3blockMeshReader.cxx | 60 +++++++-- .../vtkPV3blockMeshReader.h | 77 +++++++---- .../vtkPV3blockMesh/vtkOpenFOAMPoints.H | 2 +- .../vtkPV3blockMesh/vtkPV3blockMesh.C | 2 +- .../vtkPV3blockMesh/vtkPV3blockMesh.H | 2 +- .../vtkPV3blockMesh/vtkPV3blockMeshConvert.C | 2 +- .../vtkPV3blockMesh/vtkPV3blockMeshUtils.C | 2 +- 17 files changed, 629 insertions(+), 149 deletions(-) create mode 100644 applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.cxx create mode 100644 applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/pqPV3blockMeshReaderPanel.cxx diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt index 7702f58039..ea50923e6a 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/CMakeLists.txt @@ -43,7 +43,7 @@ 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_NAME PV3FoamReader # name of SourceProxy in *SM.xml XML_GROUP sources ) @@ -52,7 +52,8 @@ ADD_PARAVIEW_PLUGIN( SERVER_MANAGER_XML PV3FoamReader_SM.xml SERVER_MANAGER_SOURCES vtkPV3FoamReader.cxx GUI_INTERFACES ${IFACES} - GUI_SOURCES ${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS} + GUI_SOURCES pqPV3FoamReaderPanel.cxx + ${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS} GUI_RESOURCE_FILES PV3FoamReader.xml ) diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml index a78bceb7d5..8506772e5c 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml @@ -16,6 +16,21 @@ + + + + + Cache the fvMesh in memory. + + + + @@ -83,21 +99,7 @@ - - - - - Cache the fvMesh in memory. - - - - - + + + + + + + + + diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.cxx b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.cxx new file mode 100644 index 0000000000..cfede9002c --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.cxx @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "pqPV3FoamReaderPanel.h" + +// QT +#include +#include +#include +#include +#include +#include + +// Paraview<->QT UI +#include "pqAnimationScene.h" +#include "pqApplicationCore.h" +#include "pqPipelineRepresentation.h" +#include "pqServerManagerModel.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), + sourceProxy_(vtkSMSourceProxy::SafeDownCast(this->proxy())) +{ + // create first sublayout (at top of the panel) + QGridLayout *sect1 = new QGridLayout(); + this->PanelLayout->addLayout(sect1, 0, 0, 1, -1); + + + // checkbox for caching mesh + CacheMesh_ = new QCheckBox("Cache Mesh"); + CacheMesh_->setChecked(true); + + // checkbox for caching mesh + ShowPatchNames_ = new QCheckBox("Show Patch Names"); + ShowPatchNames_->setChecked(false); + + connect + ( + CacheMesh_, + SIGNAL(stateChanged(int)), + this, + SLOT(CacheMeshToggled()) + ); + + connect + ( + ShowPatchNames_, + SIGNAL(stateChanged(int)), + this, + SLOT(ShowPatchNamesToggled()) + ); + + sect1->addWidget(CacheMesh_); + sect1->addWidget(ShowPatchNames_); + + + // immediate update on the Server Manager side + vtkSMIntVectorProperty::SafeDownCast + ( + sourceProxy_->GetProperty("UiCacheMesh") + )->SetImmediateUpdate(true); + vtkSMIntVectorProperty::SafeDownCast + ( + sourceProxy_->GetProperty("UiShowPatchNames") + )->SetImmediateUpdate(true); +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void pqPV3FoamReaderPanel::CacheMeshToggled() +{ + vtkSMIntVectorProperty::SafeDownCast + ( + sourceProxy_->GetProperty("UiCacheMesh") + )->SetElement(0, CacheMesh_->isChecked()); +} + + +void pqPV3FoamReaderPanel::ShowPatchNamesToggled() +{ + vtkSMIntVectorProperty::SafeDownCast + ( + sourceProxy_->GetProperty("UiShowPatchNames") + )->SetElement(0, ShowPatchNames_->isChecked()); +} + + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.h b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.h index 3c97b52dfd..fc4f5f9ada 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.h +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.h @@ -1,34 +1,98 @@ -#ifndef __pqPV3FoamReaderPanel_h -#define __pqPV3FoamReaderPanel_h +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +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" -#include -#include -// -// Custom panel for PV3FoamReader source. -// +// 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; + //- Server Manager Source Proxy + vtkSMSourceProxy* sourceProxy_; + + //- CacheMesh checkbox + QCheckBox* CacheMesh_; + + //- Show Patch Names checkbox + QCheckBox* ShowPatchNames_; + +protected slots: + + void CacheMeshToggled(); + void ShowPatchNamesToggled(); + + public: - pqPV3FoamReaderPanel(pqProxy *proxy, QWidget *p) - : - pqAutoGeneratedObjectPanel(proxy, p) - { - this->layout()->addWidget - ( - new QLabel("Plugin for reading OpenFOAM meshes/results", this) - ); - } - //virtual ~pqPV3FoamReaderPanel(); + // Constructors + + //- Construct from components + pqPV3FoamReaderPanel(pqProxy*, QWidget*); + + + //- Destructor + // virtual ~pqPV3FoamReaderPanel(); -protected: }; -#endif //__pqPV3FoamReaderPanel_h + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx index 0b5c65dc78..32b01eb795 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx @@ -1,18 +1,28 @@ -/*========================================================================= +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. - Program: Visualization Toolkit - Module: $RCSfile: vtkPV3FoamReader.cxx,v $ + 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 2 of the License, or (at your + option) any later version. - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + 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. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +\*---------------------------------------------------------------------------*/ #include "vtkPV3FoamReader.h" #include "pqApplicationCore.h" @@ -33,10 +43,15 @@ // Foam includes #include "vtkPV3Foam.H" +#undef EXPERIMENTAL_TIME_CACHING + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + vtkCxxRevisionMacro(vtkPV3FoamReader, "$Revision: 1.5$"); vtkStandardNewMacro(vtkPV3FoamReader); -#undef EXPERIMENTAL_TIME_CACHING + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // vtkPV3FoamReader::vtkPV3FoamReader() { @@ -109,6 +124,8 @@ vtkPV3FoamReader::vtkPV3FoamReader() } +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + vtkPV3FoamReader::~vtkPV3FoamReader() { vtkDebugMacro(<<"Deconstructor"); @@ -145,6 +162,8 @@ vtkPV3FoamReader::~vtkPV3FoamReader() } +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + // Do everything except set the output info int vtkPV3FoamReader::RequestInformation ( @@ -401,6 +420,17 @@ int vtkPV3FoamReader::RequestData } +void vtkPV3FoamReader::SetShowPatchNames(const int val) +{ + if (ShowPatchNames != val) + { + ShowPatchNames = val; + updatePatchNamesView(ShowPatchNames); + } +} + + + void vtkPV3FoamReader::updatePatchNamesView(const bool show) { pqApplicationCore* appCore = pqApplicationCore::instance(); @@ -414,7 +444,7 @@ void vtkPV3FoamReader::updatePatchNamesView(const bool show) // Server manager model for querying items in the server manager pqServerManagerModel* smModel = appCore->getServerManagerModel(); - if (!smModel) + if (!smModel || !foamData_) { return; } @@ -430,6 +460,8 @@ void vtkPV3FoamReader::updatePatchNamesView(const bool show) show ); } + + // use refresh here? } diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h index 4a6eb3723e..df73979205 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h @@ -1,25 +1,52 @@ -/*========================================================================= +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. - Program: Visualization Toolkit - Module: $RCSfile: vtkPV3FoamReader.h,v $ + 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 2 of the License, or (at your + option) any later version. - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + 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. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -=========================================================================*/ -// .NAME vtkPV3FoamReader - reads a dataset in OpenFOAM format -// .SECTION Description -// vtkPV3FoamReader creates an multiblock dataset. -// It uses the OpenFOAM infrastructure (fvMesh, etc) to -// handle mesh and field data. +Class + vtkPV3FoamReader -#ifndef __vtkPV3FoamReader_h -#define __vtkPV3FoamReader_h +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; // Foam forward declarations namespace Foam @@ -27,13 +54,10 @@ namespace Foam class vtkPV3Foam; } -// VTK includes -#include "vtkMultiBlockDataSetAlgorithm.h" - -// VTK forward declarations -class vtkDataArraySelection; -class vtkCallbackCommand; +/*---------------------------------------------------------------------------*\ + Class vtkPV3FoamReader Declaration +\*---------------------------------------------------------------------------*/ class VTK_IO_EXPORT vtkPV3FoamReader : @@ -54,16 +78,16 @@ public: vtkSetStringMacro(FileName); vtkGetStringMacro(FileName); - // Description: - // GUI update control - vtkSetMacro(UpdateGUI, int); - vtkGetMacro(UpdateGUI, int); - // Description: // FOAM mesh caching control vtkSetMacro(CacheMesh, int); vtkGetMacro(CacheMesh, int); + // Description: + // GUI update control + vtkSetMacro(UpdateGUI, int); + vtkGetMacro(UpdateGUI, int); + // Description: // FOAM extrapolate internal values onto the patches vtkSetMacro(ExtrapolatePatches, int); @@ -80,7 +104,7 @@ public: // Description: // FOAM display patch names control - vtkSetMacro(ShowPatchNames, int); + virtual void SetShowPatchNames(int); vtkGetMacro(ShowPatchNames, int); // Description: diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/CMakeLists.txt index c5b911f615..3376fa0d91 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/CMakeLists.txt +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/CMakeLists.txt @@ -41,16 +41,17 @@ QT4_WRAP_CPP(MOC_SRCS pqPV3blockMeshReaderPanel.h) ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS CLASS_NAME pqPV3blockMeshReaderPanel - XML_NAME PV3blockMeshReader # name of SourceProxy in *SM.xml + XML_NAME PV3blockMeshReader # name of SourceProxy in *SM.xml XML_GROUP sources ) ADD_PARAVIEW_PLUGIN( PV3blockMeshReader_SM "1.0" SERVER_MANAGER_XML PV3blockMeshReader_SM.xml - SERVER_MANAGER_SOURCES vtkPV3blockMeshReader.cxx + SERVER_MANAGER_SOURCES vtkPV3blockMeshReader.cxx GUI_INTERFACES ${IFACES} - GUI_SOURCES ${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS} + GUI_SOURCES pqPV3blockMeshReaderPanel.cxx + ${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS} GUI_RESOURCE_FILES PV3blockMeshReader.xml ) diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader_SM.xml b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader_SM.xml index 5eea03fe2b..2ac4774ff0 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader_SM.xml +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/PV3blockMeshReader_SM.xml @@ -16,14 +16,13 @@ - - @@ -44,7 +43,6 @@ - @@ -93,6 +91,11 @@ + + + + + diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/pqPV3blockMeshReaderPanel.cxx b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/pqPV3blockMeshReaderPanel.cxx new file mode 100644 index 0000000000..45bdb661fc --- /dev/null +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/pqPV3blockMeshReaderPanel.cxx @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "pqPV3blockMeshReaderPanel.h" + +// QT +#include +#include +#include +#include +#include +#include + +// Paraview<->QT UI +#include "pqAnimationScene.h" +#include "pqApplicationCore.h" +#include "pqPipelineRepresentation.h" +#include "pqServerManagerModel.h" + +// Paraview Server Manager +#include "vtkSMDoubleVectorProperty.h" +#include "vtkSMIntVectorProperty.h" +#include "vtkSMProperty.h" +#include "vtkSMSourceProxy.h" + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +pqPV3blockMeshReaderPanel::pqPV3blockMeshReaderPanel +( + pqProxy *proxy, + QWidget *p +) +: + pqAutoGeneratedObjectPanel(proxy, p), + sourceProxy_(vtkSMSourceProxy::SafeDownCast(this->proxy())) +{ + // create first sublayout (at top of the panel) + QGridLayout *sect1 = new QGridLayout(); + this->PanelLayout->addLayout(sect1, 0, 0, 1, -1); + + + // checkbox for showing point numbers + ShowPointNumbers_ = new QCheckBox("Show Point Numbers"); + ShowPointNumbers_->setChecked(true); + + connect + ( + ShowPointNumbers_, + SIGNAL(stateChanged(int)), + this, + SLOT(ShowPointNumbersToggled()) + ); + + sect1->addWidget(ShowPointNumbers_); + + + // immediate update on the Server Manager side + vtkSMIntVectorProperty::SafeDownCast + ( + sourceProxy_->GetProperty("UiShowPointNumbers") + )->SetImmediateUpdate(true); + +} + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void pqPV3blockMeshReaderPanel::ShowPointNumbersToggled() +{ + vtkSMIntVectorProperty::SafeDownCast + ( + sourceProxy_->GetProperty("UiShowPointNumbers") + )->SetElement(0, ShowPointNumbers_->isChecked()); +} + + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/pqPV3blockMeshReaderPanel.h b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/pqPV3blockMeshReaderPanel.h index 1f3c2ba9b2..8096338315 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/pqPV3blockMeshReaderPanel.h +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/pqPV3blockMeshReaderPanel.h @@ -1,34 +1,94 @@ -#ifndef __pqPV3blockMeshReaderPanel_h -#define __pqPV3blockMeshReaderPanel_h +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + pqPV3blockMeshReaderPanel + +Description + GUI modifications for the ParaView reader panel + + A custom panel for the PV3blockMeshReader. + +SourceFiles + pqPV3blockMeshReaderPanel.cxx + +\*---------------------------------------------------------------------------*/ +#ifndef pqPV3blockMeshReaderPanel_h +#define pqPV3blockMeshReaderPanel_h #include "pqAutoGeneratedObjectPanel.h" -#include -#include -// -// Custom panel for PV3blockMeshReader source. -// +// Forward declaration of QT classes + +class QCheckBox; +class QLineEdit; +class QTimer; +class QToolButton; + +// Forward declaration of ParaView classes +class vtkSMSourceProxy; + + +/*---------------------------------------------------------------------------*\ + Class pqPV3blockMeshReaderPanel Declaration +\*---------------------------------------------------------------------------*/ + class pqPV3blockMeshReaderPanel : public pqAutoGeneratedObjectPanel { + // Private data Q_OBJECT; typedef pqAutoGeneratedObjectPanel Superclass; + //- Server Manager Source Proxy + vtkSMSourceProxy* sourceProxy_; + + //- Show Point Numbers checkbox + QCheckBox* ShowPointNumbers_; + +protected slots: + + void ShowPointNumbersToggled(); + + public: - pqPV3blockMeshReaderPanel(pqProxy *proxy, QWidget *p) - : - pqAutoGeneratedObjectPanel(proxy, p) - { - this->layout()->addWidget - ( - new QLabel("Plugin for reading OpenFOAM blockMesh files", this) - ); - } - //virtual ~pqPV3blockMeshReaderPanel(); + // Constructors + + //- Construct from components + pqPV3blockMeshReaderPanel(pqProxy*, QWidget*); + + + //- Destructor + // virtual ~pqPV3blockMeshReaderPanel(); -protected: }; -#endif //__pqPV3blockMeshReaderPanel_h + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.cxx b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.cxx index 383deeeccc..bf17a60ca3 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.cxx +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.cxx @@ -1,18 +1,28 @@ -/*========================================================================= +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. - Program: Visualization Toolkit - Module: $RCSfile: vtkPV3blockMeshReader.cxx,v $ + 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 2 of the License, or (at your + option) any later version. - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + 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. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +\*---------------------------------------------------------------------------*/ #include "vtkPV3blockMeshReader.h" #include "pqApplicationCore.h" @@ -33,9 +43,14 @@ // Foam includes #include "vtkPV3blockMesh.H" -vtkCxxRevisionMacro(vtkPV3blockMeshReader, "$Revision: 1.5$"); +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +vtkCxxRevisionMacro(vtkPV3blockMeshReader, "$Revision:$"); vtkStandardNewMacro(vtkPV3blockMeshReader); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + vtkPV3blockMeshReader::vtkPV3blockMeshReader() { Debug = 0; @@ -76,6 +91,8 @@ vtkPV3blockMeshReader::vtkPV3blockMeshReader() } +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + vtkPV3blockMeshReader::~vtkPV3blockMeshReader() { vtkDebugMacro(<<"Deconstructor"); @@ -100,6 +117,8 @@ vtkPV3blockMeshReader::~vtkPV3blockMeshReader() } +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + // Do everything except set the output info int vtkPV3blockMeshReader::RequestInformation ( @@ -216,6 +235,17 @@ int vtkPV3blockMeshReader::RequestData } + +void vtkPV3blockMeshReader::SetShowPointNumbers(const int val) +{ + if (ShowPointNumbers != val) + { + ShowPointNumbers = val; + updatePointNumbersView(ShowPointNumbers); + } +} + + void vtkPV3blockMeshReader::updatePointNumbersView(const bool show) { pqApplicationCore* appCore = pqApplicationCore::instance(); @@ -228,14 +258,14 @@ void vtkPV3blockMeshReader::updatePointNumbersView(const bool show) // Server manager model for querying items in the server manager pqServerManagerModel* smModel = appCore->getServerManagerModel(); - if (!smModel) + if (!smModel || !foamData_) { return; } + // Get all the pqRenderView instances QList renderViews = smModel->findItems(); - for (int viewI=0; viewIrenderPointNumbers @@ -244,6 +274,8 @@ void vtkPV3blockMeshReader::updatePointNumbersView(const bool show) show ); } + + // use refresh here? } diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.h b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.h index b26cde357d..ae704d4a3b 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.h +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/PV3blockMeshReader/vtkPV3blockMeshReader.h @@ -1,38 +1,61 @@ -/*========================================================================= +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. - Program: Visualization Toolkit - Module: $RCSfile: vtkPV3blockMeshReader.h,v $ + 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 2 of the License, or (at your + option) any later version. - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + 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. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -=========================================================================*/ -// .NAME vtkPV3blockMeshReader - reads a dataset in OpenFOAM bockMesh format -// .SECTION Description -// vtkPV3blockMeshReader creates an multiblock dataset. -// It uses the OpenFOAM infrastructure (blockMesh). +Class + vtkPV3blockMeshReader -#ifndef __vtkPV3blockMeshReader_h -#define __vtkPV3blockMeshReader_h +Description + reads a dataset in OpenFOAM bockMesh format -// Foam forward declarations -namespace Foam -{ - class vtkPV3blockMesh; -} + vtkPV3blockMeshReader creates an multiblock dataset. + It uses the OpenFOAM infrastructure (blockMesh). + +SourceFiles + vtkPV3blockMeshReader.cxx + +\*---------------------------------------------------------------------------*/ + +#ifndef vtkPV3blockMeshReader_h +#define vtkPV3blockMeshReader_h // VTK includes #include "vtkMultiBlockDataSetAlgorithm.h" +// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * // + // VTK forward declarations class vtkDataArraySelection; class vtkCallbackCommand; +namespace Foam +{ + class vtkPV3blockMesh; +} + +/*---------------------------------------------------------------------------*\ + Class vtkPV3blockMeshReader Declaration +\*---------------------------------------------------------------------------*/ class VTK_IO_EXPORT vtkPV3blockMeshReader : @@ -49,15 +72,16 @@ public: vtkSetStringMacro(FileName); vtkGetStringMacro(FileName); + // Description: + // Display corner point labels + virtual void SetShowPointNumbers(int); + vtkGetMacro(ShowPointNumbers, int); + // Description: // GUI update control vtkSetMacro(UpdateGUI, int); vtkGetMacro(UpdateGUI, int); - // Description: - // FOAM display patch names control - vtkSetMacro(ShowPointNumbers, int); - vtkGetMacro(ShowPointNumbers, int); // Description: // Parts (blocks) selection list control @@ -121,6 +145,7 @@ protected: char* FileName; + private: //- Disallow default bitwise copy construct @@ -132,6 +157,8 @@ private: //- Add/remove point numbers to/from the view void updatePointNumbersView(const bool show); + + //- Show Point Numbers int ShowPointNumbers; //- Dummy variable/switch to invoke a reader update diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkOpenFOAMPoints.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkOpenFOAMPoints.H index a8ce36e144..85ddd163b9 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkOpenFOAMPoints.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkOpenFOAMPoints.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C index 91424d3b57..e9d36ec91e 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.H index 6001267ef8..a159b3cba5 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C index 5ad588bb30..4f76f5ebf2 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshUtils.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshUtils.C index b948c5e979..bde724d9a7 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshUtils.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshUtils.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License