Commit 45f195bb authored by Mark Olesen's avatar Mark Olesen
Browse files

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
parent 27bf7f96
......@@ -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
)
......
......@@ -16,6 +16,21 @@
</Documentation>
</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 -->
<DoubleVectorProperty
name="TimestepValues"
......@@ -72,10 +87,11 @@
<!-- Show Patch Names check-box -->
<IntVectorProperty
name="ShowPatchNames"
name="UiShowPatchNames"
command="SetShowPatchNames"
number_of_elements="1"
default_values="0"
is_internal="1"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
......@@ -83,21 +99,7 @@
</Documentation>
</IntVectorProperty>
<!-- Cache Mesh check-box -->
<IntVectorProperty
name="CacheMesh"
command="SetCacheMesh"
number_of_elements="1"
default_values="1"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Cache the fvMesh in memory.
</Documentation>
</IntVectorProperty>
<!-- Update GUI check box -->
<!-- Force GUI update check box -->
<IntVectorProperty
name="UpdateGUI"
command="SetUpdateGUI"
......@@ -204,6 +206,14 @@
</RequiredProperties>
</ArraySelectionDomain>
</StringVectorProperty>
<Hints>
<Property name="FileName" show="0"/>
<Property name="UiCacheMesh" show="0"/>
<Property name="UiShowPatchNames" show="0"/>
</Hints>
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>
/*---------------------------------------------------------------------------*\
========= |
\\ / 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());
}
// ************************************************************************* //
#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 <QLabel>
#include <QLayout>
//
// 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();
protected:
// Constructors
//- Construct from components
pqPV3FoamReaderPanel(pqProxy*, QWidget*);
//- Destructor
// virtual ~pqPV3FoamReaderPanel();
};
#endif //__pqPV3FoamReaderPanel_h
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*=========================================================================
Program: Visualization Toolkit
Module: $RCSfile: vtkPV3FoamReader.cxx,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*---------------------------------------------------------------------------*\
========= |
\\ / 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.
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 "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?
}
......
/*=========================================================================
/*---------------------------------------------------------------------------*\
========= |
\\ / 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.
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
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
Program: Visualization Toolkit
Module: $RCSfile: vtkPV3FoamReader.h,v $
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
// VTK includes
#include "vtkMultiBlockDataSetAlgorithm.h"
=========================================================================*/
// .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.
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
#ifndef __vtkPV3FoamReader_h
#define __vtkPV3FoamReader_h
// 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:
......
......@@ -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
)
......
......@@ -16,14 +16,13 @@
</Documentation>
</StringVectorProperty>
<!-- Global settings -->
<!-- Show Point Numbers check-box -->
<IntVectorProperty