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
This commit is contained in:
Mark Olesen
2009-10-23 00:33:42 +02:00
parent 3c788010fb
commit 83cee1cb68
17 changed files with 629 additions and 149 deletions

View File

@ -52,7 +52,8 @@ ADD_PARAVIEW_PLUGIN(
SERVER_MANAGER_XML PV3FoamReader_SM.xml SERVER_MANAGER_XML PV3FoamReader_SM.xml
SERVER_MANAGER_SOURCES vtkPV3FoamReader.cxx SERVER_MANAGER_SOURCES vtkPV3FoamReader.cxx
GUI_INTERFACES ${IFACES} 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 GUI_RESOURCE_FILES PV3FoamReader.xml
) )

View File

@ -16,6 +16,21 @@
</Documentation> </Documentation>
</StringVectorProperty> </StringVectorProperty>
<!-- Cache Mesh check-box -->
<IntVectorProperty
name="UiCacheMesh"
command="SetCacheMesh"
number_of_elements="1"
is_internal="1"
default_values="1"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Cache the fvMesh in memory.
</Documentation>
</IntVectorProperty>
<!-- Send discrete time info to the animation panel --> <!-- Send discrete time info to the animation panel -->
<DoubleVectorProperty <DoubleVectorProperty
name="TimestepValues" name="TimestepValues"
@ -72,10 +87,11 @@
<!-- Show Patch Names check-box --> <!-- Show Patch Names check-box -->
<IntVectorProperty <IntVectorProperty
name="ShowPatchNames" name="UiShowPatchNames"
command="SetShowPatchNames" command="SetShowPatchNames"
number_of_elements="1" number_of_elements="1"
default_values="0" default_values="0"
is_internal="1"
animateable="0"> animateable="0">
<BooleanDomain name="bool"/> <BooleanDomain name="bool"/>
<Documentation> <Documentation>
@ -83,21 +99,7 @@
</Documentation> </Documentation>
</IntVectorProperty> </IntVectorProperty>
<!-- Cache Mesh check-box --> <!-- Force GUI update check box -->
<IntVectorProperty
name="CacheMesh"
command="SetCacheMesh"
number_of_elements="1"
default_values="1"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Cache the fvMesh in memory.
</Documentation>
</IntVectorProperty>
<!-- Update GUI check box -->
<IntVectorProperty <IntVectorProperty
name="UpdateGUI" name="UpdateGUI"
command="SetUpdateGUI" command="SetUpdateGUI"
@ -204,6 +206,14 @@
</RequiredProperties> </RequiredProperties>
</ArraySelectionDomain> </ArraySelectionDomain>
</StringVectorProperty> </StringVectorProperty>
<Hints>
<Property name="FileName" show="0"/>
<Property name="UiCacheMesh" show="0"/>
<Property name="UiShowPatchNames" show="0"/>
</Hints>
</SourceProxy> </SourceProxy>
</ProxyGroup> </ProxyGroup>
</ServerManagerConfiguration> </ServerManagerConfiguration>

View File

@ -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 <QGridLayout>
#include <QCheckBox>
#include <QLabel>
#include <QLayout>
#include <QString>
#include <QtDebug>
// 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());
}
// ************************************************************************* //

View File

@ -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 "pqAutoGeneratedObjectPanel.h"
#include <QLabel>
#include <QLayout>
// // Forward declaration of QT classes
// Custom panel for PV3FoamReader source.
// class QCheckBox;
class QLineEdit;
class QTimer;
class QToolButton;
// Forward declaration of ParaView classes
class vtkSMSourceProxy;
/*---------------------------------------------------------------------------*\
Class pqPV3FoamReaderPanel Declaration
\*---------------------------------------------------------------------------*/
class pqPV3FoamReaderPanel class pqPV3FoamReaderPanel
: :
public pqAutoGeneratedObjectPanel public pqAutoGeneratedObjectPanel
{ {
// Private data
Q_OBJECT; Q_OBJECT;
typedef pqAutoGeneratedObjectPanel Superclass; typedef pqAutoGeneratedObjectPanel Superclass;
public: //- Server Manager Source Proxy
pqPV3FoamReaderPanel(pqProxy *proxy, QWidget *p) vtkSMSourceProxy* sourceProxy_;
:
pqAutoGeneratedObjectPanel(proxy, p)
{
this->layout()->addWidget
(
new QLabel("Plugin for reading OpenFOAM meshes/results", this)
);
}
//- CacheMesh checkbox
QCheckBox* CacheMesh_;
//- Show Patch Names checkbox
QCheckBox* ShowPatchNames_;
protected slots:
void CacheMeshToggled();
void ShowPatchNamesToggled();
public:
// Constructors
//- Construct from components
pqPV3FoamReaderPanel(pqProxy*, QWidget*);
//- Destructor
// virtual ~pqPV3FoamReaderPanel(); // virtual ~pqPV3FoamReaderPanel();
protected:
}; };
#endif //__pqPV3FoamReaderPanel_h
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -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 OpenFOAM is free software; you can redistribute it and/or modify it
Module: $RCSfile: vtkPV3FoamReader.cxx,v $ 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 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
All rights reserved. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
See Copyright.txt or http://www.kitware.com/Copyright.htm for details. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
This software is distributed WITHOUT ANY WARRANTY; without even You should have received a copy of the GNU General Public License
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR along with OpenFOAM; if not, write to the Free Software Foundation,
PURPOSE. See the above copyright notice for more information. Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================*/
\*---------------------------------------------------------------------------*/
#include "vtkPV3FoamReader.h" #include "vtkPV3FoamReader.h"
#include "pqApplicationCore.h" #include "pqApplicationCore.h"
@ -33,10 +43,15 @@
// Foam includes // Foam includes
#include "vtkPV3Foam.H" #include "vtkPV3Foam.H"
#undef EXPERIMENTAL_TIME_CACHING
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
vtkCxxRevisionMacro(vtkPV3FoamReader, "$Revision: 1.5$"); vtkCxxRevisionMacro(vtkPV3FoamReader, "$Revision: 1.5$");
vtkStandardNewMacro(vtkPV3FoamReader); vtkStandardNewMacro(vtkPV3FoamReader);
#undef EXPERIMENTAL_TIME_CACHING
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
vtkPV3FoamReader::vtkPV3FoamReader() vtkPV3FoamReader::vtkPV3FoamReader()
{ {
@ -109,6 +124,8 @@ vtkPV3FoamReader::vtkPV3FoamReader()
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
vtkPV3FoamReader::~vtkPV3FoamReader() vtkPV3FoamReader::~vtkPV3FoamReader()
{ {
vtkDebugMacro(<<"Deconstructor"); vtkDebugMacro(<<"Deconstructor");
@ -145,6 +162,8 @@ vtkPV3FoamReader::~vtkPV3FoamReader()
} }
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
// Do everything except set the output info // Do everything except set the output info
int vtkPV3FoamReader::RequestInformation 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) void vtkPV3FoamReader::updatePatchNamesView(const bool show)
{ {
pqApplicationCore* appCore = pqApplicationCore::instance(); pqApplicationCore* appCore = pqApplicationCore::instance();
@ -414,7 +444,7 @@ void vtkPV3FoamReader::updatePatchNamesView(const bool show)
// Server manager model for querying items in the server manager // Server manager model for querying items in the server manager
pqServerManagerModel* smModel = appCore->getServerManagerModel(); pqServerManagerModel* smModel = appCore->getServerManagerModel();
if (!smModel) if (!smModel || !foamData_)
{ {
return; return;
} }
@ -430,6 +460,8 @@ void vtkPV3FoamReader::updatePatchNamesView(const bool show)
show show
); );
} }
// use refresh here?
} }

View File

@ -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 OpenFOAM is free software; you can redistribute it and/or modify it
Module: $RCSfile: vtkPV3FoamReader.h,v $ 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 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
All rights reserved. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
See Copyright.txt or http://www.kitware.com/Copyright.htm for details. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
This software is distributed WITHOUT ANY WARRANTY; without even You should have received a copy of the GNU General Public License
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR along with OpenFOAM; if not, write to the Free Software Foundation,
PURPOSE. See the above copyright notice for more information. Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================*/ Class
// .NAME vtkPV3FoamReader - reads a dataset in OpenFOAM format vtkPV3FoamReader
// .SECTION Description
// vtkPV3FoamReader creates an multiblock dataset.
// It uses the OpenFOAM infrastructure (fvMesh, etc) to
// handle mesh and field data.
#ifndef __vtkPV3FoamReader_h Description
#define __vtkPV3FoamReader_h 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 // Foam forward declarations
namespace Foam namespace Foam
@ -27,13 +54,10 @@ namespace Foam
class vtkPV3Foam; class vtkPV3Foam;
} }
// VTK includes
#include "vtkMultiBlockDataSetAlgorithm.h"
// VTK forward declarations
class vtkDataArraySelection;
class vtkCallbackCommand;
/*---------------------------------------------------------------------------*\
Class vtkPV3FoamReader Declaration
\*---------------------------------------------------------------------------*/
class VTK_IO_EXPORT vtkPV3FoamReader class VTK_IO_EXPORT vtkPV3FoamReader
: :
@ -54,16 +78,16 @@ public:
vtkSetStringMacro(FileName); vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName); vtkGetStringMacro(FileName);
// Description:
// GUI update control
vtkSetMacro(UpdateGUI, int);
vtkGetMacro(UpdateGUI, int);
// Description: // Description:
// FOAM mesh caching control // FOAM mesh caching control
vtkSetMacro(CacheMesh, int); vtkSetMacro(CacheMesh, int);
vtkGetMacro(CacheMesh, int); vtkGetMacro(CacheMesh, int);
// Description:
// GUI update control
vtkSetMacro(UpdateGUI, int);
vtkGetMacro(UpdateGUI, int);
// Description: // Description:
// FOAM extrapolate internal values onto the patches // FOAM extrapolate internal values onto the patches
vtkSetMacro(ExtrapolatePatches, int); vtkSetMacro(ExtrapolatePatches, int);
@ -80,7 +104,7 @@ public:
// Description: // Description:
// FOAM display patch names control // FOAM display patch names control
vtkSetMacro(ShowPatchNames, int); virtual void SetShowPatchNames(int);
vtkGetMacro(ShowPatchNames, int); vtkGetMacro(ShowPatchNames, int);
// Description: // Description:

View File

@ -50,7 +50,8 @@ ADD_PARAVIEW_PLUGIN(
SERVER_MANAGER_XML PV3blockMeshReader_SM.xml SERVER_MANAGER_XML PV3blockMeshReader_SM.xml
SERVER_MANAGER_SOURCES vtkPV3blockMeshReader.cxx SERVER_MANAGER_SOURCES vtkPV3blockMeshReader.cxx
GUI_INTERFACES ${IFACES} 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 GUI_RESOURCE_FILES PV3blockMeshReader.xml
) )

View File

@ -16,14 +16,13 @@
</Documentation> </Documentation>
</StringVectorProperty> </StringVectorProperty>
<!-- Global settings -->
<!-- Show Point Numbers check-box --> <!-- Show Point Numbers check-box -->
<IntVectorProperty <IntVectorProperty
name="ShowPointNumbers" name="UiShowPointNumbers"
command="SetShowPointNumbers" command="SetShowPointNumbers"
number_of_elements="1" number_of_elements="1"
default_values="1" default_values="1"
is_internal="1"
animateable="0"> animateable="0">
<BooleanDomain name="bool"/> <BooleanDomain name="bool"/>
<Documentation> <Documentation>
@ -44,7 +43,6 @@
</Documentation> </Documentation>
</IntVectorProperty> </IntVectorProperty>
<!-- Selections --> <!-- Selections -->
<!-- Available Parts (blocks) array --> <!-- Available Parts (blocks) array -->
@ -93,6 +91,11 @@
</ArraySelectionDomain> </ArraySelectionDomain>
</StringVectorProperty> </StringVectorProperty>
<Hints>
<Property name="FileName" show="0"/>
<Property name="UiShowPointNumbers" show="0"/>
</Hints>
</SourceProxy> </SourceProxy>
</ProxyGroup> </ProxyGroup>
</ServerManagerConfiguration> </ServerManagerConfiguration>

View File

@ -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 <QGridLayout>
#include <QCheckBox>
#include <QLabel>
#include <QLayout>
#include <QString>
#include <QtDebug>
// 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());
}
// ************************************************************************* //

View File

@ -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 "pqAutoGeneratedObjectPanel.h"
#include <QLabel>
#include <QLayout>
// // Forward declaration of QT classes
// Custom panel for PV3blockMeshReader source.
// class QCheckBox;
class QLineEdit;
class QTimer;
class QToolButton;
// Forward declaration of ParaView classes
class vtkSMSourceProxy;
/*---------------------------------------------------------------------------*\
Class pqPV3blockMeshReaderPanel Declaration
\*---------------------------------------------------------------------------*/
class pqPV3blockMeshReaderPanel class pqPV3blockMeshReaderPanel
: :
public pqAutoGeneratedObjectPanel public pqAutoGeneratedObjectPanel
{ {
// Private data
Q_OBJECT; Q_OBJECT;
typedef pqAutoGeneratedObjectPanel Superclass; typedef pqAutoGeneratedObjectPanel Superclass;
public: //- Server Manager Source Proxy
pqPV3blockMeshReaderPanel(pqProxy *proxy, QWidget *p) vtkSMSourceProxy* sourceProxy_;
:
pqAutoGeneratedObjectPanel(proxy, p)
{
this->layout()->addWidget
(
new QLabel("Plugin for reading OpenFOAM blockMesh files", this)
);
}
//- Show Point Numbers checkbox
QCheckBox* ShowPointNumbers_;
protected slots:
void ShowPointNumbersToggled();
public:
// Constructors
//- Construct from components
pqPV3blockMeshReaderPanel(pqProxy*, QWidget*);
//- Destructor
// virtual ~pqPV3blockMeshReaderPanel(); // virtual ~pqPV3blockMeshReaderPanel();
protected:
}; };
#endif //__pqPV3blockMeshReaderPanel_h
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -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 OpenFOAM is free software; you can redistribute it and/or modify it
Module: $RCSfile: vtkPV3blockMeshReader.cxx,v $ 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 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
All rights reserved. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
See Copyright.txt or http://www.kitware.com/Copyright.htm for details. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
This software is distributed WITHOUT ANY WARRANTY; without even You should have received a copy of the GNU General Public License
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR along with OpenFOAM; if not, write to the Free Software Foundation,
PURPOSE. See the above copyright notice for more information. Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================*/
\*---------------------------------------------------------------------------*/
#include "vtkPV3blockMeshReader.h" #include "vtkPV3blockMeshReader.h"
#include "pqApplicationCore.h" #include "pqApplicationCore.h"
@ -33,9 +43,14 @@
// Foam includes // Foam includes
#include "vtkPV3blockMesh.H" #include "vtkPV3blockMesh.H"
vtkCxxRevisionMacro(vtkPV3blockMeshReader, "$Revision: 1.5$"); // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
vtkCxxRevisionMacro(vtkPV3blockMeshReader, "$Revision:$");
vtkStandardNewMacro(vtkPV3blockMeshReader); vtkStandardNewMacro(vtkPV3blockMeshReader);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
vtkPV3blockMeshReader::vtkPV3blockMeshReader() vtkPV3blockMeshReader::vtkPV3blockMeshReader()
{ {
Debug = 0; Debug = 0;
@ -76,6 +91,8 @@ vtkPV3blockMeshReader::vtkPV3blockMeshReader()
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
vtkPV3blockMeshReader::~vtkPV3blockMeshReader() vtkPV3blockMeshReader::~vtkPV3blockMeshReader()
{ {
vtkDebugMacro(<<"Deconstructor"); vtkDebugMacro(<<"Deconstructor");
@ -100,6 +117,8 @@ vtkPV3blockMeshReader::~vtkPV3blockMeshReader()
} }
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
// Do everything except set the output info // Do everything except set the output info
int vtkPV3blockMeshReader::RequestInformation 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) void vtkPV3blockMeshReader::updatePointNumbersView(const bool show)
{ {
pqApplicationCore* appCore = pqApplicationCore::instance(); pqApplicationCore* appCore = pqApplicationCore::instance();
@ -228,14 +258,14 @@ void vtkPV3blockMeshReader::updatePointNumbersView(const bool show)
// Server manager model for querying items in the server manager // Server manager model for querying items in the server manager
pqServerManagerModel* smModel = appCore->getServerManagerModel(); pqServerManagerModel* smModel = appCore->getServerManagerModel();
if (!smModel) if (!smModel || !foamData_)
{ {
return; return;
} }
// Get all the pqRenderView instances // Get all the pqRenderView instances
QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>(); QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
for (int viewI=0; viewI<renderViews.size(); ++viewI) for (int viewI=0; viewI<renderViews.size(); ++viewI)
{ {
foamData_->renderPointNumbers foamData_->renderPointNumbers
@ -244,6 +274,8 @@ void vtkPV3blockMeshReader::updatePointNumbersView(const bool show)
show show
); );
} }
// use refresh here?
} }

View File

@ -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 OpenFOAM is free software; you can redistribute it and/or modify it
Module: $RCSfile: vtkPV3blockMeshReader.h,v $ 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 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
All rights reserved. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
See Copyright.txt or http://www.kitware.com/Copyright.htm for details. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
This software is distributed WITHOUT ANY WARRANTY; without even You should have received a copy of the GNU General Public License
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR along with OpenFOAM; if not, write to the Free Software Foundation,
PURPOSE. See the above copyright notice for more information. Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================*/ Class
// .NAME vtkPV3blockMeshReader - reads a dataset in OpenFOAM bockMesh format vtkPV3blockMeshReader
// .SECTION Description
// vtkPV3blockMeshReader creates an multiblock dataset.
// It uses the OpenFOAM infrastructure (blockMesh).
#ifndef __vtkPV3blockMeshReader_h Description
#define __vtkPV3blockMeshReader_h reads a dataset in OpenFOAM bockMesh format
// Foam forward declarations vtkPV3blockMeshReader creates an multiblock dataset.
namespace Foam It uses the OpenFOAM infrastructure (blockMesh).
{
class vtkPV3blockMesh; SourceFiles
} vtkPV3blockMeshReader.cxx
\*---------------------------------------------------------------------------*/
#ifndef vtkPV3blockMeshReader_h
#define vtkPV3blockMeshReader_h
// VTK includes // VTK includes
#include "vtkMultiBlockDataSetAlgorithm.h" #include "vtkMultiBlockDataSetAlgorithm.h"
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
// VTK forward declarations // VTK forward declarations
class vtkDataArraySelection; class vtkDataArraySelection;
class vtkCallbackCommand; class vtkCallbackCommand;
namespace Foam
{
class vtkPV3blockMesh;
}
/*---------------------------------------------------------------------------*\
Class vtkPV3blockMeshReader Declaration
\*---------------------------------------------------------------------------*/
class VTK_IO_EXPORT vtkPV3blockMeshReader class VTK_IO_EXPORT vtkPV3blockMeshReader
: :
@ -49,15 +72,16 @@ public:
vtkSetStringMacro(FileName); vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName); vtkGetStringMacro(FileName);
// Description:
// Display corner point labels
virtual void SetShowPointNumbers(int);
vtkGetMacro(ShowPointNumbers, int);
// Description: // Description:
// GUI update control // GUI update control
vtkSetMacro(UpdateGUI, int); vtkSetMacro(UpdateGUI, int);
vtkGetMacro(UpdateGUI, int); vtkGetMacro(UpdateGUI, int);
// Description:
// FOAM display patch names control
vtkSetMacro(ShowPointNumbers, int);
vtkGetMacro(ShowPointNumbers, int);
// Description: // Description:
// Parts (blocks) selection list control // Parts (blocks) selection list control
@ -121,6 +145,7 @@ protected:
char* FileName; char* FileName;
private: private:
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
@ -132,6 +157,8 @@ private:
//- Add/remove point numbers to/from the view //- Add/remove point numbers to/from the view
void updatePointNumbersView(const bool show); void updatePointNumbersView(const bool show);
//- Show Point Numbers
int ShowPointNumbers; int ShowPointNumbers;
//- Dummy variable/switch to invoke a reader update //- Dummy variable/switch to invoke a reader update

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License