Commit 81891675 authored by Mark Olesen's avatar Mark Olesen
Browse files

Commit Paraview enhancements - quit working on sets/zones frills

- Include Sets/Zones now scans immediately to refresh the list of available
  mesh parts. Unfortunately, this also causes the object panel to be
  modified, even although the selection doesn't acutally need to change.
  This seems to be due to how the pqNamedWidgets are getting the information
  from the proxy properties. I can't figure if it's possible to acheive what
  I want, but we can probably live with the current implementation.

  After IncludeZones, simply us 'Reset' to undo the spurious GUI changes.
  Works fine - just looks a bit silly.

- Added 'Refresh' button to rescan for new times/fields.  Good for
  post-processing ongoing calculations without exiting the reader.

- Added 'Skip Zero Time' checkbox: many (some) calculations have
  data missing at time=0 (eg, rho, lagrangian, etc). This provides
  a convenient way to skip over this time.

- Future?:
  We could probably pick up favourite default values for these switches from
  ~OpenFOAM/controlDict, from a case system/paraview, or simply by making
  the casename.OpenFOAM also be an OpenFOAM dictionary with the settings.
parent 641a0f1b
......@@ -16,6 +16,17 @@
</Documentation>
</StringVectorProperty>
<!-- Send discrete time info to the animation panel -->
<DoubleVectorProperty
name="TimestepValues"
repeatable="1"
information_only="1">
<TimeStepsInformationHelper/>
<Documentation>
Available timestep values.
</Documentation>
</DoubleVectorProperty>
<!-- Cache Mesh check-box -->
<IntVectorProperty
name="UiCacheMesh"
......@@ -30,20 +41,33 @@
</Documentation>
</IntVectorProperty>
<!-- Send discrete time info to the animation panel -->
<DoubleVectorProperty
name="TimestepValues"
repeatable="1"
information_only="1">
<TimeStepsInformationHelper/>
<!-- Refresh button -->
<IntVectorProperty
name="UiRefresh"
command="SetRefresh"
number_of_elements="1"
is_internal="0"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Available timestep values.
Rescan for updated timesteps/fields.
</Documentation>
</DoubleVectorProperty>
</IntVectorProperty>
<!-- Global settings -->
<!-- Skip Zero Time check-box -->
<IntVectorProperty
name="UiZeroTime"
command="SetSkipZeroTime"
number_of_elements="1"
is_internal="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Skip including the 0/ time directory
</Documentation>
</IntVectorProperty>
<!-- Extrapolate Patches check-box -->
<IntVectorProperty
......@@ -60,22 +84,24 @@
<!-- Include Sets check-box -->
<IntVectorProperty
name="IncludeSets"
name="UiIncludeSets"
command="SetIncludeSets"
number_of_elements="1"
is_internal="1"
default_values="0"
animateable="0">
<Documentation>
Searches the polyMesh/sets/ directory
Search the polyMesh/sets/ directory
</Documentation>
<BooleanDomain name="bool"/>
</IntVectorProperty>
<!-- Include Zones check-box -->
<IntVectorProperty
name="IncludeZones"
name="UiIncludeZones"
command="SetIncludeZones"
number_of_elements="1"
is_internal="1"
default_values="0"
animateable="0">
<Documentation>
......@@ -95,7 +121,7 @@
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Show patch names in render window.
Show patch names in render window
</Documentation>
</IntVectorProperty>
......@@ -112,12 +138,13 @@
</Documentation>
</IntVectorProperty>
<!-- Selections -->
<!--
| Selections
-->
<!-- Available Parts (volume, patches, lagrangian) array -->
<StringVectorProperty
name="PartArrayInfo"
name="PartArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="Part"/>
</StringVectorProperty>
......@@ -129,18 +156,21 @@
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="PartArrayInfo"
information_property="PartArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="PartArrayInfo" function="ArrayList"/>
<Property name="PartArrayStatus" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
This property contains a list of the mesh parts (patches, sets, zones).
</Documentation>
</StringVectorProperty>
<!-- Available volFields array -->
<StringVectorProperty
name="VolFieldArrayInfo"
name="VolFieldArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="VolField"/>
</StringVectorProperty>
......@@ -152,18 +182,21 @@
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="VolFieldArrayInfo"
information_property="VolFieldArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="VolFieldArrayInfo" function="ArrayList"/>
<Property name="VolFieldArrayStatus" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
This property contains a list of the volume fields
</Documentation>
</StringVectorProperty>
<!-- Available Lagrangian fields array -->
<StringVectorProperty
name="LagrangianFieldArrayInfo"
name="LagrangianFieldArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="LagrangianField"/>
</StringVectorProperty>
......@@ -175,18 +208,21 @@
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="LagrangianFieldArrayInfo"
information_property="LagrangianFieldArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="LagrangianFieldArrayInfo" function="ArrayList"/>
<Property name="LagrangianFieldArrayStatus" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
This property contains a list of the lagrangian fields
</Documentation>
</StringVectorProperty>
<!-- Available pointFields array -->
<StringVectorProperty
name="PointFieldArrayInfo"
name="PointFieldArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="PointField"/>
</StringVectorProperty>
......@@ -198,19 +234,26 @@
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="PointFieldArrayInfo"
information_property="PointFieldArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="PointFieldArrayInfo" function="ArrayList"/>
<Property name="PointFieldArrayStatus" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
This property contains a list of the point fields
</Documentation>
</StringVectorProperty>
<Hints>
<Property name="FileName" show="0"/>
<Property name="UiCacheMesh" show="0"/>
<Property name="UiZeroTime" show="0"/>
<Property name="UiRefresh" show="0"/>
<Property name="UiShowPatchNames" show="0"/>
<Property name="UiIncludeSets" show="0"/>
<Property name="UiIncludeZones" show="0"/>
</Hints>
......
......@@ -32,9 +32,10 @@ License
#include <QLabel>
#include <QLayout>
#include <QString>
#include <QPushButton>
#include <QtDebug>
// Paraview<->QT UI
// Paraview <-> QT UI
#include "pqAnimationScene.h"
#include "pqApplicationCore.h"
#include "pqPipelineRepresentation.h"
......@@ -56,51 +57,169 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
QWidget *p
)
:
pqAutoGeneratedObjectPanel(proxy, p),
sourceProxy_(vtkSMSourceProxy::SafeDownCast(this->proxy()))
pqAutoGeneratedObjectPanel(proxy, p)
{
// create first sublayout (at top of the panel)
QGridLayout *sect1 = new QGridLayout();
this->PanelLayout->addLayout(sect1, 0, 0, 1, -1);
QGridLayout *form = new QGridLayout();
this->PanelLayout->addLayout(form, 0, 0, 1, -1);
vtkSMProperty* prop = 0;
// refresh button for updating times/fields
if ((prop = this->proxy()->GetProperty("UiRefresh")) != 0)
{
prop->SetImmediateUpdate(1);
QPushButton *refresh = new QPushButton("Refresh Times");
refresh->setToolTip("Rescan for updated times/fields.");
form->addWidget(refresh, 0, 0, Qt::AlignLeft);
QObject::connect
(
refresh,
SIGNAL(clicked()),
this,
SLOT(RefreshPressed())
);
}
// checkbox for skip zeroTime
if ((prop = this->proxy()->GetProperty("UiZeroTime")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
ZeroTime_ = new QCheckBox("Skip Zero Time");
ZeroTime_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
ZeroTime_->setToolTip
(
"Skip including the 0/ time directory."
);
form->addWidget(ZeroTime_, 0, 1, Qt::AlignLeft);
connect
(
ZeroTime_,
SIGNAL(stateChanged(int)),
this,
SLOT(ZeroTimeToggled())
);
}
// 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);
if ((prop = this->proxy()->GetProperty("UiCacheMesh")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
connect
(
CacheMesh_,
SIGNAL(stateChanged(int)),
this,
SLOT(CacheMeshToggled())
);
CacheMesh_ = new QCheckBox("Cache Mesh");
CacheMesh_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
CacheMesh_->setToolTip
(
"Cache the fvMesh in memory."
);
connect
(
ShowPatchNames_,
SIGNAL(stateChanged(int)),
this,
SLOT(ShowPatchNamesToggled())
);
form->addWidget(CacheMesh_, 1, 0, Qt::AlignLeft);
connect
(
CacheMesh_,
SIGNAL(stateChanged(int)),
this,
SLOT(CacheMeshToggled())
);
}
sect1->addWidget(CacheMesh_);
sect1->addWidget(ShowPatchNames_);
// checkbox for patch names
if ((prop = this->proxy()->GetProperty("UiShowPatchNames")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
ShowPatchNames_ = new QCheckBox("Patch Names");
ShowPatchNames_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
ShowPatchNames_->setToolTip
(
"Show patch names in render window."
);
// row/col 0,1
form->addWidget(ShowPatchNames_, 1, 1, Qt::AlignLeft);
connect
(
ShowPatchNames_,
SIGNAL(stateChanged(int)),
this,
SLOT(ShowPatchNamesToggled())
);
}
// checkbox for include sets
if ((prop = this->proxy()->GetProperty("UiIncludeSets")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
IncludeSets_ = new QCheckBox("Include Sets");
IncludeSets_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
IncludeSets_->setToolTip
(
"Search the polyMesh/sets/ directory."
);
// row/col 1,0
form->addWidget(IncludeSets_, 2, 0, Qt::AlignLeft);
connect
(
IncludeSets_,
SIGNAL(stateChanged(int)),
this,
SLOT(IncludeSetsToggled())
);
}
// checkbox for include zones
if ((prop = this->proxy()->GetProperty("UiIncludeZones")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
IncludeZones_ = new QCheckBox("Include Zones");
IncludeZones_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
IncludeZones_->setToolTip
(
"ZoneMesh information is used to find {cell,face,point}Zones. "
"The polyMesh/ directory is only checked on startup."
);
// row/col 1,1
form->addWidget(IncludeZones_, 2, 1, Qt::AlignLeft);
connect
(
IncludeZones_,
SIGNAL(stateChanged(int)),
this,
SLOT(IncludeZonesToggled())
);
}
// immediate update on the Server Manager side
vtkSMIntVectorProperty::SafeDownCast
(
sourceProxy_->GetProperty("UiCacheMesh")
)->SetImmediateUpdate(true);
vtkSMIntVectorProperty::SafeDownCast
(
sourceProxy_->GetProperty("UiShowPatchNames")
)->SetImmediateUpdate(true);
}
......@@ -110,16 +229,43 @@ void pqPV3FoamReaderPanel::CacheMeshToggled()
{
vtkSMIntVectorProperty::SafeDownCast
(
sourceProxy_->GetProperty("UiCacheMesh")
this->proxy()->GetProperty("UiCacheMesh")
)->SetElement(0, CacheMesh_->isChecked());
}
void pqPV3FoamReaderPanel::RefreshPressed()
{
// update everything
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiRefresh")
)->Modified();
vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline();
// render all views
pqApplicationCore::instance()->render();
}
void pqPV3FoamReaderPanel::ZeroTimeToggled()
{
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiZeroTime")
)->SetElement(0, ZeroTime_->isChecked());
// update everything
RefreshPressed();
}
void pqPV3FoamReaderPanel::ShowPatchNamesToggled()
{
vtkSMIntVectorProperty::SafeDownCast
(
sourceProxy_->GetProperty("UiShowPatchNames")
this->proxy()->GetProperty("UiShowPatchNames")
)->SetElement(0, ShowPatchNames_->isChecked());
// update the active view
......@@ -132,4 +278,37 @@ void pqPV3FoamReaderPanel::ShowPatchNamesToggled()
}
void pqPV3FoamReaderPanel::IncludeSetsToggled()
{
vtkSMProperty* prop;
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiIncludeSets")
)->SetElement(0, IncludeSets_->isChecked());
if ((prop = this->proxy()->GetProperty("PartArrayStatus")) != 0)
{
this->proxy()->UpdatePropertyInformation(prop);
}
}
void pqPV3FoamReaderPanel::IncludeZonesToggled()
{
vtkSMProperty* prop;
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiIncludeZones")
)->SetElement(0, IncludeZones_->isChecked());
if ((prop = this->proxy()->GetProperty("PartArrayStatus")) != 0)
{
this->proxy()->UpdatePropertyInformation(prop);
}
}
// ************************************************************************* //
......@@ -37,6 +37,7 @@ SourceFiles
#ifndef pqPV3FoamReaderPanel_h
#define pqPV3FoamReaderPanel_h
#include "pqAutoGeneratedObjectPanel.h"
// Forward declaration of QT classes
......@@ -62,8 +63,8 @@ class pqPV3FoamReaderPanel
Q_OBJECT;
typedef pqAutoGeneratedObjectPanel Superclass;
//- Server Manager Source Proxy
vtkSMSourceProxy* sourceProxy_;
//- ZeroTime checkbox
QCheckBox* ZeroTime_;
//- CacheMesh checkbox
QCheckBox* CacheMesh_;
......@@ -71,10 +72,20 @@ class pqPV3FoamReaderPanel
//- Show Patch Names checkbox
QCheckBox* ShowPatchNames_;
//- IncludeSets checkbox
QCheckBox* IncludeSets_;
//- IncludeZones checkbox
QCheckBox* IncludeZones_;
protected slots:
void CacheMeshToggled();
void ZeroTimeToggled();
void RefreshPressed();
void ShowPatchNamesToggled();
void IncludeSetsToggled();
void IncludeZonesToggled();
public:
......
......@@ -79,7 +79,9 @@ vtkPV3FoamReader::vtkPV3FoamReader()
TimeStepRange[1] = 0;
CacheMesh = 1;
Refresh = 0;
SkipZeroTime = 0;
ExtrapolatePatches = 0;
IncludeSets = 0;
IncludeZones = 0;
......@@ -336,7 +338,6 @@ int vtkPV3FoamReader::RequestData
foamData_->setTime(nRequestTime, requestTime);
}
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast