paraFoam: Updated ParaView to version 5.4.0

ParaView has been updated to version 5.4.0. The C++ panel has been
deleted and replaced with a panel based on the new(er) XML API. This
reader works for ParaView-4.0.1 and newer. The ParaView 3 reader remains
unchanged.

Update issues have also been fixed. All the time directories are now
scanned for fields and clouds when filling the selection lists. This
stops fields from disappearing when the time is changed. The scan is
only done on startup and when the refresh button is pressed.

The list of available Lagrangian fields also now shows a combined set of
all the clouds. Previously, only fields from the first cloud were shown.
If a field does not apply to all the clouds, ParaView will display it's
name in the dropdown menu with a "(partial)" qualifier.

Some undocumented and incomplete bits of code, which were not being
compiled, have been removed.
This commit is contained in:
Will Bainbridge
2017-07-18 14:42:30 +01:00
parent 1937f7bca2
commit 68089dd574
20 changed files with 510 additions and 1514 deletions

View File

@ -1,12 +1,4 @@
# create a plugin that adds a reader to the ParaView GUI
# it is added in the file dialog when doing opens/saves.
# The qrc file is processed by Qt's resource compiler (rcc)
# the qrc file must have a resource prefix of "/ParaViewResources"
# and ParaView will read anything contained under that prefix
# the pqReader.xml file contains xml defining readers with their
# file extensions and descriptions.
# Set up the environment
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
FIND_PACKAGE(ParaView REQUIRED)
@ -30,6 +22,7 @@ ADD_DEFINITIONS(
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
)
# Set output library destination to plugin directory
SET(
LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH}
@ -37,44 +30,26 @@ SET(
"Single output directory for building all libraries."
)
#
# Defined combined plugin
#
# Extend the auto-generated panel
QT4_WRAP_CPP(MOC_SRCS pqPVFoamReaderPanel.h)
ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
CLASS_NAME pqPVFoamReaderPanel
XML_NAME PVFoamReader # name of SourceProxy in *SM.xml
XML_GROUP sources
)
# Add the plugin. ParaView-4.0.? requires a GUI_RESOURCE_FILES XML file. As of
# version 4.1.? this is no longer needed.
IF("${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}" EQUAL 4.0)
# Special build options, specifically for ParaView 4.0.*
# Because as of 4.1.0, GUI_RESOURCE_FILES is no longer used.
ADD_PARAVIEW_PLUGIN(
PVFoamReader_SM "1.0"
PVFoamReader_SM
"1.0"
SERVER_MANAGER_XML PVFoamReader_SM.xml
SERVER_MANAGER_SOURCES vtkPVFoamReader.cxx
GUI_INTERFACES ${IFACES}
GUI_SOURCES pqPVFoamReaderPanel.cxx
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
GUI_RESOURCE_FILES PVFoamReader.xml
)
ELSE("${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}" EQUAL 4.0)
ELSE()
ADD_PARAVIEW_PLUGIN(
PVFoamReader_SM "1.0"
PVFoamReader_SM
"1.0"
SERVER_MANAGER_XML PVFoamReader_SM.xml
SERVER_MANAGER_SOURCES vtkPVFoamReader.cxx
GUI_INTERFACES ${IFACES}
GUI_SOURCES pqPVFoamReaderPanel.cxx
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
)
ENDIF("${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}" EQUAL 4.0)
ENDIF()
# Build the client-side plugin
TARGET_LINK_LIBRARIES(
PVFoamReader_SM
LINK_PUBLIC

View File

@ -1,5 +0,0 @@
<RCC>
<qresource prefix="/ParaViewResources" >
<file>PVFoamReader.xml</file>
</qresource>
</RCC>

View File

@ -1,309 +1,308 @@
<ServerManagerConfiguration>
<ProxyGroup name="sources">
<SourceProxy
name="PVFoamReader"
class="vtkPVFoamReader">
<ProxyGroup name="sources">
<SourceProxy name="PVFoamReader" class="vtkPVFoamReader">
<!-- File name - compulsory -->
<StringVectorProperty
name="FileName"
command="SetFileName"
number_of_elements="1"
animateable="0">
<FileListDomain name="files"/>
<Documentation>
Specifies the filename for the OpenFOAM Reader.
</Documentation>
</StringVectorProperty>
<!-- Send discrete time info to the animation panel -->
<DoubleVectorProperty
name="TimestepValues"
repeatable="1"
information_only="1">
<TimeStepsInformationHelper/>
<Documentation>
Available times
</Documentation>
</DoubleVectorProperty>
<!-- Send discrete time info to the animation panel -->
<DoubleVectorProperty
name="TimestepValues"
repeatable="1"
information_only="1">
<TimeStepsInformationHelper/>
<Documentation>
Available timestep values.
</Documentation>
</DoubleVectorProperty>
<!-- File name (compulsory) -->
<StringVectorProperty
name="FileName"
command="SetFileName"
number_of_elements="1"
animateable="0">
<FileListDomain name="files"/>
<Documentation>
The file name
</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>
<!-- Refresh button -->
<Property
name="UiRefresh"
command="SetRefresh"
label="Refresh Times"
animateable="0">
<Documentation>
Rescan for updated times and fields
</Documentation>
</Property>
<!-- Refresh button -->
<IntVectorProperty
name="UiRefresh"
command="SetRefresh"
number_of_elements="1"
is_internal="0"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Rescan for updated timesteps/fields.
</Documentation>
</IntVectorProperty>
<!-- Cache Mesh check-box -->
<IntVectorProperty
name="UiCacheMesh"
command="SetCacheMesh"
label="Cache Mesh"
number_of_elements="1"
default_values="1"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Cache the mesh in memory
</Documentation>
</IntVectorProperty>
<!-- 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>
<!-- Use VTK Polyhedron check-box -->
<IntVectorProperty
name="UiUseVTKPolyhedron"
command="SetUseVTKPolyhedron"
label="Use VTK Polyhedron"
number_of_elements="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Represent cells as general polyhedra instead of decomposing
them into simpler shapes
</Documentation>
</IntVectorProperty>
<!-- Interpolate Fields check-box -->
<IntVectorProperty
name="UiInterpolateVolFields"
command="SetInterpolateVolFields"
number_of_elements="1"
is_internal="1"
default_values="1"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Interpolate volume fields into point fields
</Documentation>
</IntVectorProperty>
<!-- Skip Zero Time check-box -->
<IntVectorProperty
name="UiZeroTime"
command="SetSkipZeroTime"
label="Skip Zero Time"
number_of_elements="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Do not load the zero time directory
</Documentation>
</IntVectorProperty>
<!-- Extrapolate Patches check-box -->
<IntVectorProperty
name="UiExtrapolatePatches"
command="SetExtrapolatePatches"
number_of_elements="1"
is_internal="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Extrapolate internalField to non-constraint patches
</Documentation>
</IntVectorProperty>
<!-- Interpolate Fields check-box -->
<IntVectorProperty
name="UiInterpolateVolFields"
command="SetInterpolateVolFields"
label="Interpolate Volume Fields"
number_of_elements="1"
default_values="1"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Interpolate volume fields to the points
</Documentation>
</IntVectorProperty>
<!-- Use VTK Polyhedron check-box -->
<IntVectorProperty
name="UseVTKPolyhedron"
command="SetUseVTKPolyhedron"
number_of_elements="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Use vtkPolyhedron instead of decomposing polyhedra.
</Documentation>
</IntVectorProperty>
<!-- Extrapolate Patches check-box -->
<IntVectorProperty
name="UiExtrapolatePatches"
command="SetExtrapolatePatches"
label="Extrapolate Patches"
number_of_elements="1"
is_internal="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Extrapolate volume fields to non-constraint patches
</Documentation>
</IntVectorProperty>
<!-- Include Sets check-box -->
<IntVectorProperty
name="UiIncludeSets"
command="SetIncludeSets"
number_of_elements="1"
is_internal="1"
default_values="0"
animateable="0">
<Documentation>
Search the polyMesh/sets/ directory
</Documentation>
<BooleanDomain name="bool"/>
</IntVectorProperty>
<!-- Show Patch Names check-box -->
<IntVectorProperty
name="UiShowPatchNames"
command="SetShowPatchNames"
label="Show Patch Names"
number_of_elements="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Show patch names in the visualisation
</Documentation>
</IntVectorProperty>
<!-- Include Zones check-box -->
<IntVectorProperty
name="UiIncludeZones"
command="SetIncludeZones"
number_of_elements="1"
is_internal="1"
default_values="0"
animateable="0">
<Documentation>
ZoneMesh information is used to find {cell,face,point}Zones.
The polyMesh/ directory is only checked on startup.
</Documentation>
<BooleanDomain name="bool"/>
</IntVectorProperty>
<!-- Force GUI update check box
<IntVectorProperty
name="UpdateGUI"
command="SetUpdateGUI"
number_of_elements="1"
is_internal="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
???
</Documentation>
</IntVectorProperty>
-->
<!-- Show Patch Names check-box -->
<IntVectorProperty
name="UiShowPatchNames"
command="SetShowPatchNames"
number_of_elements="1"
default_values="0"
is_internal="1"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Show patch names in render window
</Documentation>
</IntVectorProperty>
<!-- Include Sets check-box -->
<IntVectorProperty
name="UiIncludeSets"
command="SetIncludeSets"
label="Include Sets"
number_of_elements="1"
default_values="0"
animateable="0">
<Documentation>
Allow selection of sets
</Documentation>
<BooleanDomain name="bool"/>
</IntVectorProperty>
<!-- Show Groups Only check-box -->
<IntVectorProperty
name="UiShowGroupsOnly"
command="SetShowGroupsOnly"
number_of_elements="1"
default_values="0"
is_internal="1"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Show groups only
</Documentation>
</IntVectorProperty>
<!-- Include Zones check-box -->
<IntVectorProperty
name="UiIncludeZones"
command="SetIncludeZones"
label="Include Zones"
number_of_elements="1"
default_values="0"
animateable="0">
<Documentation>
Allow selection of zones
</Documentation>
<BooleanDomain name="bool"/>
</IntVectorProperty>
<!-- Force GUI update check box -->
<IntVectorProperty
name="UpdateGUI"
command="SetUpdateGUI"
number_of_elements="1"
is_internal="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
A simple way to cause a reader GUI modification.
</Documentation>
</IntVectorProperty>
<!-- Show Groups Only check-box -->
<IntVectorProperty
name="UiShowGroupsOnly"
command="SetShowGroupsOnly"
label="Groups Only"
number_of_elements="1"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Show only patch groups, not individual patches
</Documentation>
</IntVectorProperty>
<!--
| Selections
-->
<!-- Available Parts (volume, patches, lagrangian) array -->
<StringVectorProperty
name="PartArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="Part"/>
</StringVectorProperty>
<StringVectorProperty
name="PartStatus"
label="Mesh Parts"
command="SetPartArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="PartArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="PartArrayStatus" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
Select the parts of the mesh to load
</Documentation>
</StringVectorProperty>
<!-- Available Parts (volume, patches, lagrangian) array -->
<StringVectorProperty
name="PartArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="Part"/>
</StringVectorProperty>
<StringVectorProperty
name="PartStatus"
label="Mesh Parts"
command="SetPartArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="PartArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="PartArrayStatus" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
This property contains a list of the mesh parts
(patches, groups, sets, zones).
</Documentation>
</StringVectorProperty>
<!-- Available Volume Fields array -->
<StringVectorProperty
name="VolFieldArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="VolField"/>
</StringVectorProperty>
<StringVectorProperty
name="VolFieldStatus"
label="Volume Fields"
command="SetVolFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="VolFieldArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="VolFieldArrayStatus" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
Select volume fields to load
</Documentation>
</StringVectorProperty>
<!-- Available volFields array -->
<StringVectorProperty
name="VolFieldArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="VolField"/>
</StringVectorProperty>
<StringVectorProperty
name="VolFieldStatus"
label="Volume Fields"
command="SetVolFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="VolFieldArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<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="LagrangianFieldArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="LagrangianField"/>
</StringVectorProperty>
<StringVectorProperty
name="LagrangianFieldStatus"
label="Lagrangian Fields"
command="SetLagrangianFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="LagrangianFieldArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="LagrangianFieldArrayStatus" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
Select Lagrangain fields to load
</Documentation>
</StringVectorProperty>
<!-- Available Lagrangian fields array -->
<StringVectorProperty
name="LagrangianFieldArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="LagrangianField"/>
</StringVectorProperty>
<StringVectorProperty
name="LagrangianFieldStatus"
label="Lagrangian Fields"
command="SetLagrangianFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="LagrangianFieldArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="LagrangianFieldArrayStatus" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
This property contains a list of the lagrangian fields
</Documentation>
</StringVectorProperty>
<!-- Available pointFields array -->
<StringVectorProperty
name="PointFieldArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="PointField"/>
</StringVectorProperty>
<StringVectorProperty
name="PointFieldStatus"
label="Point Fields"
command="SetPointFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="PointFieldArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="PointFieldArrayStatus" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
Select point fields to load
</Documentation>
</StringVectorProperty>
<!-- Available pointFields array -->
<StringVectorProperty
name="PointFieldArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="PointField"/>
</StringVectorProperty>
<StringVectorProperty
name="PointFieldStatus"
label="Point Fields"
command="SetPointFieldArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="PointFieldArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="PointFieldArrayStatus" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
This property contains a list of the point fields
</Documentation>
</StringVectorProperty>
<PropertyGroup label="Selection">
<Property name="UiIncludeSets"/>
<Property name="UiIncludeZones"/>
<Property name="UiShowGroupsOnly"/>
<Property name="PartArrayStatus"/>
<Property name="PartStatus"/>
<Property name="VolFieldArrayStatus"/>
<Property name="VolFieldStatus"/>
<Property name="LagrangianFieldArrayStatus"/>
<Property name="LagrangianFieldStatus"/>
<Property name="PointFieldArrayStatus"/>
<Property name="PointFieldStatus"/>
</PropertyGroup>
<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="UiShowGroupsOnly" show="0"/>
<Property name="UiIncludeSets" show="0"/>
<Property name="UiIncludeZones" show="0"/>
<ReaderFactory extensions="OpenFOAM"
file_description="OpenFOAM"/>
</Hints>
<Hints>
<ReaderFactory
extensions="OpenFOAM"
file_description="OpenFOAM"/>
</Hints>
</SourceProxy>
</ProxyGroup>
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>

View File

@ -1,485 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "pqPVFoamReaderPanel.h"
// QT
#include <QGridLayout>
#include <QCheckBox>
#include <QLabel>
#include <QLayout>
#include <QString>
#include <QPushButton>
#include <QtDebug>
// Paraview <-> QT UI
#include "pqAnimationScene.h"
#include "pqApplicationCore.h"
#include "pqPipelineRepresentation.h"
#include "pqServerManagerModel.h"
#include "pqView.h"
// Paraview Server Manager
#include "vtkSMDoubleVectorProperty.h"
#include "vtkSMIntVectorProperty.h"
#include "vtkSMProperty.h"
#include "vtkSMSourceProxy.h"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
pqPVFoamReaderPanel::pqPVFoamReaderPanel
(
pqProxy *proxy,
QWidget *p
)
:
pqAutoGeneratedObjectPanel(proxy, p)
{
// create first sublayout (at top of the panel)
QGridLayout* form = new QGridLayout();
this->PanelLayout->addLayout(form, 0, 0, 1, -1);
// ROW 0
// ~~~~~
vtkSMProperty* prop = 0;
// refresh button for updating times/fields
if ((prop = this->proxy()->GetProperty("UiRefresh")) != 0)
{
prop->SetImmediateUpdate(1);
QPushButton* refresh = new QPushButton("Refresh Times");
refresh->setToolTip("Rescan for updated times/fields.");
form->addWidget(refresh, 0, 0, Qt::AlignLeft);
QObject::connect
(
refresh,
SIGNAL(clicked()),
this,
SLOT(RefreshPressed())
);
}
// checkbox for skip zeroTime
if ((prop = this->proxy()->GetProperty("UiZeroTime")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
ZeroTime_ = new QCheckBox("Skip Zero Time");
ZeroTime_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
ZeroTime_->setToolTip
(
"Skip including the 0/ time directory."
);
form->addWidget(ZeroTime_, 0, 1, Qt::AlignLeft);
connect
(
ZeroTime_,
SIGNAL(stateChanged(int)),
this,
SLOT(ZeroTimeToggled())
);
}
// ROW 1
// ~~~~~
QFrame* hline1 = new QFrame(this);
hline1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
form->addWidget(hline1, 1, 0, 1, 3);
// ROW 2
// ~~~~~
// checkbox for caching mesh
if ((prop = this->proxy()->GetProperty("UiCacheMesh")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
CacheMesh_ = new QCheckBox("Cache Mesh");
CacheMesh_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
CacheMesh_->setToolTip
(
"Cache the fvMesh in memory."
);
form->addWidget(CacheMesh_, 2, 0, Qt::AlignLeft);
connect
(
CacheMesh_,
SIGNAL(stateChanged(int)),
this,
SLOT(CacheMeshToggled())
);
}
// cell 2,1 empty
// ROW 3
// ~~~~~
// checkbox for include sets
if ((prop = this->proxy()->GetProperty("UiIncludeSets")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
IncludeSets_ = new QCheckBox("Include Sets");
IncludeSets_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
IncludeSets_->setToolTip
(
"Search the polyMesh/sets/ directory."
);
// row/col 1,0
form->addWidget(IncludeSets_, 3, 0, Qt::AlignLeft);
connect
(
IncludeSets_,
SIGNAL(stateChanged(int)),
this,
SLOT(IncludeSetsToggled())
);
}
// checkbox for Groups Only
if ((prop = this->proxy()->GetProperty("UiShowGroupsOnly")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
ShowGroupsOnly_ = new QCheckBox("Groups Only");
ShowGroupsOnly_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
ShowGroupsOnly_->setToolTip
(
"Show patchGroups only."
);
// row/col 2, 2
form->addWidget(ShowGroupsOnly_, 3, 1, Qt::AlignLeft);
connect
(
ShowGroupsOnly_,
SIGNAL(stateChanged(int)),
this,
SLOT(ShowGroupsOnlyToggled())
);
}
// ROW 4
// ~~~~~
// checkbox for include zones
if ((prop = this->proxy()->GetProperty("UiIncludeZones")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
IncludeZones_ = new QCheckBox("Include Zones");
IncludeZones_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
IncludeZones_->setToolTip
(
"ZoneMesh information is used to find {cell,face,point}Zones. "
"The polyMesh/ directory is only checked on startup."
);
// row/col 1,1
form->addWidget(IncludeZones_, 4, 0, Qt::AlignLeft);
connect
(
IncludeZones_,
SIGNAL(stateChanged(int)),
this,
SLOT(IncludeZonesToggled())
);
}
// checkbox for patch names
if ((prop = this->proxy()->GetProperty("UiShowPatchNames")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
ShowPatchNames_ = new QCheckBox("Patch Names");
ShowPatchNames_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
ShowPatchNames_->setToolTip
(
"Show patch names in render window."
);
// row/col 0,1
form->addWidget(ShowPatchNames_, 4, 1, Qt::AlignLeft);
connect
(
ShowPatchNames_,
SIGNAL(stateChanged(int)),
this,
SLOT(ShowPatchNamesToggled())
);
}
// ROW 5
// ~~~~~
QFrame* hline2 = new QFrame(this);
hline2->setFrameStyle(QFrame::HLine | QFrame::Sunken);
form->addWidget(hline2, 5, 0, 1, 3);
// ROW 6
// ~~~~~
// checkbox for vol field interpolation
if ((prop = this->proxy()->GetProperty("UiInterpolateVolFields")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
InterpolateVolFields_ = new QCheckBox("Interpolate volFields");
InterpolateVolFields_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
InterpolateVolFields_->setToolTip
(
"Interpolate volFields into pointFields"
);
// row/col 1,1
form->addWidget(InterpolateVolFields_, 6, 0, Qt::AlignLeft);
connect
(
InterpolateVolFields_,
SIGNAL(stateChanged(int)),
this,
SLOT(InterpolateVolFieldsToggled())
);
}
// checkbox for extrapolate patches
if ((prop = this->proxy()->GetProperty("UiExtrapolatePatches")) != 0)
{
// immediate update on the Server Manager side
prop->SetImmediateUpdate(true);
ExtrapolatePatches_ = new QCheckBox("Extrapolate Patches");
ExtrapolatePatches_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
ExtrapolatePatches_->setToolTip
(
"Extrapolate internalField to non-constraint patches"
);
// row/col 1,1
form->addWidget(ExtrapolatePatches_, 6, 1, Qt::AlignLeft);
connect
(
ExtrapolatePatches_,
SIGNAL(stateChanged(int)),
this,
SLOT(ExtrapolatePatchesToggled())
);
}
// ROW 7
// ~~~~~
QFrame* hline3 = new QFrame(this);
hline3->setFrameStyle(QFrame::HLine | QFrame::Sunken);
form->addWidget(hline3, 7, 0, 1, 3);
// update GUI button
if ((prop = this->proxy()->GetProperty("UpdateGUI")) != 0)
{
prop->SetImmediateUpdate(1);
QPushButton* updateGUI = new QPushButton("Update GUI");
updateGUI->setToolTip("Update GUI");
form->addWidget(updateGUI, 8, 0, Qt::AlignLeft);
QObject::connect
(
updateGUI,
SIGNAL(clicked()),
this,
SLOT(setModified())
);
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void pqPVFoamReaderPanel::CacheMeshToggled()
{
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiCacheMesh")
)->SetElement(0, CacheMesh_->isChecked());
}
void pqPVFoamReaderPanel::RefreshPressed()
{
// update everything
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiRefresh")
)->Modified();
vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline();
// render all views
pqApplicationCore::instance()->render();
}
void pqPVFoamReaderPanel::ZeroTimeToggled()
{
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiZeroTime")
)->SetElement(0, ZeroTime_->isChecked());
this->setModified();
}
void pqPVFoamReaderPanel::ShowPatchNamesToggled()
{
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiShowPatchNames")
)->SetElement(0, ShowPatchNames_->isChecked());
// update the active view
if (this->view())
{
this->view()->render();
}
// OR: update all views
// pqApplicationCore::instance()->render();
}
void pqPVFoamReaderPanel::ShowGroupsOnlyToggled()
{
vtkSMProperty* prop;
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiShowGroupsOnly")
)->SetElement(0, ShowGroupsOnly_->isChecked());
if ((prop = this->proxy()->GetProperty("PartArrayStatus")) != 0)
{
this->proxy()->UpdatePropertyInformation(prop);
}
}
void pqPVFoamReaderPanel::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 pqPVFoamReaderPanel::IncludeZonesToggled()
{
vtkSMProperty* prop;
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiIncludeZones")
)->SetElement(0, IncludeZones_->isChecked());
if ((prop = this->proxy()->GetProperty("PartArrayStatus")) != 0)
{
this->proxy()->UpdatePropertyInformation(prop);
}
}
void pqPVFoamReaderPanel::ExtrapolatePatchesToggled()
{
vtkSMProperty* prop;
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiExtrapolatePatches")
)->SetElement(0, ExtrapolatePatches_->isChecked());
this->setModified();
}
void pqPVFoamReaderPanel::InterpolateVolFieldsToggled()
{
vtkSMProperty* prop;
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiInterpolateVolFields")
)->SetElement(0, InterpolateVolFields_->isChecked());
this->setModified();
}
// ************************************************************************* //

View File

@ -1,116 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
pqPVFoamReaderPanel
Description
GUI modifications for the ParaView reader panel
A custom panel for the PVFoamReader.
SourceFiles
pqPVFoamReaderPanel.cxx
\*---------------------------------------------------------------------------*/
#ifndef pqPVFoamReaderPanel_h
#define pqPVFoamReaderPanel_h
#include "pqAutoGeneratedObjectPanel.h"
// Forward declaration of QT classes
class QCheckBox;
class QLineEdit;
class QTimer;
class QToolButton;
// Forward declaration of ParaView classes
class vtkSMSourceProxy;
/*---------------------------------------------------------------------------*\
Class pqPVFoamReaderPanel Declaration
\*---------------------------------------------------------------------------*/
class pqPVFoamReaderPanel
:
public pqAutoGeneratedObjectPanel
{
// Private data
Q_OBJECT;
typedef pqAutoGeneratedObjectPanel Superclass;
//- ZeroTime checkbox
QCheckBox* ZeroTime_;
//- CacheMesh checkbox
QCheckBox* CacheMesh_;
//- Show Patch Names checkbox
QCheckBox* ShowPatchNames_;
//- Show Groups Only checkbox
QCheckBox* ShowGroupsOnly_;
//- IncludeSets checkbox
QCheckBox* IncludeSets_;
//- IncludeZones checkbox
QCheckBox* IncludeZones_;
//- InterpolateVolFields checkbox
QCheckBox* InterpolateVolFields_;
//- ExtrapolatePatches checkbox
QCheckBox* ExtrapolatePatches_;
protected slots:
void CacheMeshToggled();
void ZeroTimeToggled();
void RefreshPressed();
void ShowPatchNamesToggled();
void ShowGroupsOnlyToggled();
void IncludeSetsToggled();
void IncludeZonesToggled();
void InterpolateVolFieldsToggled();
void ExtrapolatePatchesToggled();
public:
// Constructors
//- Construct from components
pqPVFoamReaderPanel(pqProxy*, QWidget*);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -42,8 +42,6 @@ License
// OpenFOAM includes
#include "vtkPVFoam.H"
#undef EXPERIMENTAL_TIME_CACHING
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
vtkStandardNewMacro(vtkPVFoamReader);
@ -63,16 +61,6 @@ vtkPVFoamReader::vtkPVFoamReader()
output0_ = nullptr;
#ifdef VTKPVFOAM_DUALPORT
// Add second output for the Lagrangian
this->SetNumberOfOutputPorts(2);
vtkMultiBlockDataSet *lagrangian = vtkMultiBlockDataSet::New();
lagrangian->ReleaseData();
this->GetExecutive()->SetOutputData(1, lagrangian);
lagrangian->Delete();
#endif
TimeStepRange[0] = 0;
TimeStepRange[1] = 0;
@ -88,8 +76,6 @@ vtkPVFoamReader::vtkPVFoamReader()
ShowGroupsOnly = 0;
InterpolateVolFields = 1;
UpdateGUI = 0;
PartSelection = vtkDataArraySelection::New();
VolFieldSelection = vtkDataArraySelection::New();
PointFieldSelection = vtkDataArraySelection::New();
@ -283,7 +269,6 @@ int vtkPVFoamReader::RequestData
return 0;
}
// catch previous error
if (!foamData_)
{
vtkErrorMacro("Reader failed - perhaps no mesh?");
@ -315,17 +300,22 @@ int vtkPVFoamReader::RequestData
{
vtkInformation *outInfo = outputVector->GetInformationObject(infoI);
if
(
outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP())
&& outInfo->Length(vtkStreamingDemandDrivenPipeline::TIME_STEPS()) > 0
)
if (outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()))
{
int nTimes =
outInfo->Length(vtkStreamingDemandDrivenPipeline::TIME_STEPS());
requestTime[nRequestTime++] =
outInfo->Get
nTimes == 1
? outInfo->Get
(
vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()
);
vtkStreamingDemandDrivenPipeline::TIME_STEPS(),
0
)
: outInfo->Get
(
vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()
);
}
}
@ -348,68 +338,10 @@ int vtkPVFoamReader::RequestData
<< output->GetNumberOfBlocks() << " blocks\n";
}
#ifdef EXPERIMENTAL_TIME_CACHING
bool needsUpdate = false;
if (!output0_)
{
output0_ = vtkMultiBlockDataSet::New();
needsUpdate = true;
}
// This experimental bit of code seems to work for the geometry,
// but trashes the fields and still triggers the GeometryFilter
if (needsUpdate)
{
foamData_->Update(output);
output0_->ShallowCopy(output);
}
else
{
output->ShallowCopy(output0_);
}
if (Foam::vtkPVFoam::debug)
{
if (needsUpdate)
{
cout<< "full UPDATE ---------\n";
}
else
{
cout<< "cached UPDATE ---------\n";
}
cout<< "UPDATED output: ";
output->Print(cout);
cout<< "UPDATED output0_: ";
output0_->Print(cout);
}
#else
#ifdef VTKPVFOAM_DUALPORT
foamData_->Update
(
output,
vtkMultiBlockDataSet::SafeDownCast
(
outputVector->GetInformationObject(1)->Get
(
vtkMultiBlockDataSet::DATA_OBJECT()
)
);
);
#else
foamData_->Update(output, output);
#endif
updatePatchNamesView(ShowPatchNames);
#endif
// Do any cleanup on the OpenFOAM side
foamData_->CleanUp();
@ -417,7 +349,7 @@ int vtkPVFoamReader::RequestData
}
void vtkPVFoamReader::SetRefresh(int val)
void vtkPVFoamReader::SetRefresh()
{
Modified();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -84,18 +84,13 @@ public:
// Description:
// OpenFOAM refresh times/fields
virtual void SetRefresh(int);
virtual void SetRefresh();
// Description:
// OpenFOAM skip/include the 0/ time directory
vtkSetMacro(SkipZeroTime, int);
vtkGetMacro(SkipZeroTime, int);
// Description:
// GUI update control
vtkSetMacro(UpdateGUI, int);
vtkGetMacro(UpdateGUI, int);
// Description:
// OpenFOAM extrapolate internal values onto the patches
vtkSetMacro(ExtrapolatePatches, int);
@ -239,9 +234,6 @@ private:
int ShowGroupsOnly;
int InterpolateVolFields;
//- Dummy variable/switch to invoke a reader update
int UpdateGUI;
vtkDataArraySelection* PartSelection;
vtkDataArraySelection* VolFieldSelection;
vtkDataArraySelection* PointFieldSelection;

View File

@ -152,11 +152,6 @@ int Foam::vtkPVFoam::setTime(int nRequest, const double requestTimes[])
{
meshChanged_ = true;
}
reader_->UpdateProgress(0.05);
// this seems to be needed for catching Lagrangian fields
updateInfo();
}
if (debug)
@ -525,10 +520,6 @@ void Foam::vtkPVFoam::Update
reader_->UpdateProgress(0.7);
}
#ifdef VTKPVFOAM_DUALPORT
// restart port1 at block=0
blockNo = 0;
#endif
convertMeshLagrangian(lagrangianOutput, blockNo);
reader_->UpdateProgress(0.8);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -69,8 +69,6 @@ SourceFiles
#include "PrimitivePatchInterpolation.H"
#include "volPointInterpolation.H"
#undef VTKPVFOAM_DUALPORT
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
class vtkDataArraySelection;

View File

@ -188,26 +188,30 @@ void Foam::vtkPVFoam::updateInfoLagrangian
lagrangianPrefix = meshRegion_/cloud::prefix;
}
// Search for list of lagrangian objects for this time
fileNameList cloudDirs
(
readDir(dbPtr_->timePath()/lagrangianPrefix, fileName::DIRECTORY)
);
arrayRangeLagrangian_.reset(arraySelection->GetNumberOfArrays());
int nClouds = 0;
forAll(cloudDirs, cloudI)
// Generate a list of lagrangian clouds across all times
HashSet<fileName> cloudDirs;
instantList times = dbPtr_().times();
forAll(times, timei)
{
cloudDirs +=
readDir
(
dbPtr_->path()/times[timei].name()/lagrangianPrefix,
fileName::DIRECTORY
);
}
forAllConstIter(HashSet<fileName>, cloudDirs, cloudIter)
{
// Add cloud to GUI list
arraySelection->AddArray
(
(cloudDirs[cloudI] + " - lagrangian").c_str()
(cloudIter.key() + " - lagrangian").c_str()
);
++nClouds;
}
arrayRangeLagrangian_ += nClouds;
arrayRangeLagrangian_ += cloudDirs.size();
if (debug)
{
@ -650,19 +654,6 @@ void Foam::vtkPVFoam::updateInfoLagrangianFields()
stringList enabledEntries = getSelectedArrayEntries(fieldSelection);
fieldSelection->RemoveAllArrays();
// TODO - currently only get fields from ONE cloud
// have to decide if the second set of fields get mixed in
// or dealt with separately
const arrayRange& range = arrayRangeLagrangian_;
if (range.empty())
{
return;
}
int partId = range.start();
word cloudName = getPartName(partId);
// use the db directly since this might be called without a mesh,
// but the region must get added back in
fileName lagrangianPrefix(cloud::prefix);
@ -671,52 +662,38 @@ void Foam::vtkPVFoam::updateInfoLagrangianFields()
lagrangianPrefix = meshRegion_/cloud::prefix;
}
IOobjectList objects
(
dbPtr_(),
dbPtr_().timeName(),
lagrangianPrefix/cloudName
);
// Add the available fields from all clouds and all time directories.
// Differing sets of fields from multiple clouds get combined into a single
// set. ParaView will display "(partial)" after field names that only apply
// to some of the clouds.
const arrayRange& range = arrayRangeLagrangian_;
for (label partId = range.start(); partId < range.end(); ++ partId)
{
const instantList times = dbPtr_().times();
forAll(times, timei)
{
IOobjectList objects
(
dbPtr_(),
times[timei].name(),
lagrangianPrefix/getPartName(partId)
);
addToSelection<IOField<label>>
(
fieldSelection,
objects
);
addToSelection<IOField<scalar>>
(
fieldSelection,
objects
);
addToSelection<IOField<vector>>
(
fieldSelection,
objects
);
addToSelection<IOField<sphericalTensor>>
(
fieldSelection,
objects
);
addToSelection<IOField<symmTensor>>
(
fieldSelection,
objects
);
addToSelection<IOField<tensor>>
(
fieldSelection,
objects
);
addToSelection<IOField<label>>(fieldSelection, objects);
addToSelection<IOField<scalar>>(fieldSelection, objects);
addToSelection<IOField<vector>>(fieldSelection, objects);
addToSelection<IOField<sphericalTensor>>(fieldSelection, objects);
addToSelection<IOField<symmTensor>>(fieldSelection, objects);
addToSelection<IOField<tensor>>(fieldSelection, objects);
}
}
// restore the enabled selections
setSelectedArrayEntries(fieldSelection, enabledEntries);
if (debug)
{
Info<< "<end> Foam::vtkPVFoam::updateInfoLagrangianFields - "
<< "lagrangian objects.size() = " << objects.size() << endl;
Info<< "<end> Foam::vtkPVFoam::updateInfoLagrangianFields" << endl;
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -69,35 +69,39 @@ void Foam::vtkPVFoam::updateInfoFields
regionPrefix = meshRegion_;
}
// Search for list of objects for this time and mesh region
IOobjectList objects(dbPtr_(), dbPtr_().timeName(), regionPrefix);
instantList times = dbPtr_().times();
forAll(times, timei)
{
// Search for list of objects for this time and mesh region
IOobjectList objects(dbPtr_(), times[timei].name(), regionPrefix);
//- Add volume fields to GUI
addToSelection<GeometricField<scalar, patchType, meshType>>
(
select,
objects
);
addToSelection<GeometricField<vector, patchType, meshType>>
(
select,
objects
);
addToSelection<GeometricField<sphericalTensor, patchType, meshType>>
(
select,
objects
);
addToSelection<GeometricField<symmTensor, patchType, meshType>>
(
select,
objects
);
addToSelection<GeometricField<tensor, patchType, meshType>>
(
select,
objects
);
//- Add volume fields to GUI
addToSelection<GeometricField<scalar, patchType, meshType>>
(
select,
objects
);
addToSelection<GeometricField<vector, patchType, meshType>>
(
select,
objects
);
addToSelection<GeometricField<sphericalTensor, patchType, meshType>>
(
select,
objects
);
addToSelection<GeometricField<symmTensor, patchType, meshType>>
(
select,
objects
);
addToSelection<GeometricField<tensor, patchType, meshType>>
(
select,
objects
);
}
// restore the enabled selections
setSelectedArrayEntries(select, enabledEntries);

View File

@ -1,12 +1,4 @@
# create a plugin that adds a reader to the ParaView GUI
# it is added in the file dialog when doing opens/saves.
# The qrc file is processed by Qt's resource compiler (rcc)
# the qrc file must have a resource prefix of "/ParaViewResources"
# and ParaView will read anything contained under that prefix
# the pqReader.xml file contains xml defining readers with their
# file extensions and descriptions.
# Set up the environment
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
FIND_PACKAGE(ParaView REQUIRED)
@ -30,52 +22,33 @@ ADD_DEFINITIONS(
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
)
# Set output library destination to plugin directory
# Set the output library destination to the plugin directory
SET(
LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH}
CACHE INTERNAL
"Single output directory for building all libraries."
)
#
# Define combined plugin
#
# Extend the auto-generated panel
QT4_WRAP_CPP(MOC_SRCS pqPVblockMeshReaderPanel.h)
ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
CLASS_NAME pqPVblockMeshReaderPanel
XML_NAME PVblockMeshReader # name of SourceProxy in *SM.xml
XML_GROUP sources
)
# Add the plugin. ParaView-4.0.? requires a GUI_RESOURCE_FILES XML file. As of
# version 4.1.? this is no longer needed.
IF("${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}" EQUAL 4.0)
# Special build options, specifically for ParaView 4.0.*
# Because as of 4.1.0, GUI_RESOURCE_FILES is no longer used.
ADD_PARAVIEW_PLUGIN(
PVblockMeshReader_SM "1.0"
PVblockMeshReader_SM
"1.0"
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
GUI_INTERFACES ${IFACES}
GUI_SOURCES pqPVblockMeshReaderPanel.cxx
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
GUI_RESOURCE_FILES PVblockMeshReader.xml
)
ELSE("${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}" EQUAL 4.0)
)
ELSE()
ADD_PARAVIEW_PLUGIN(
PVblockMeshReader_SM "1.0"
PVblockMeshReader_SM
"1.0"
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
GUI_INTERFACES ${IFACES}
GUI_SOURCES pqPVblockMeshReaderPanel.cxx
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
)
ENDIF("${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}" EQUAL 4.0)
ENDIF()
# Build the client-side plugin
TARGET_LINK_LIBRARIES(
PVblockMeshReader_SM
LINK_PUBLIC
@ -83,5 +56,3 @@ TARGET_LINK_LIBRARIES(
blockMesh
OpenFOAM
)
#-----------------------------------------------------------------------------

View File

@ -1,5 +0,0 @@
<RCC>
<qresource prefix="/ParaViewResources" >
<file>PVblockMeshReader.xml</file>
</qresource>
</RCC>

View File

@ -1,114 +1,109 @@
<ServerManagerConfiguration>
<ProxyGroup name="sources">
<SourceProxy
name="PVblockMeshReader"
class="vtkPVblockMeshReader">
<ProxyGroup name="sources">
<SourceProxy name="PVblockMeshReader" class="vtkPVblockMeshReader">
<!-- File name - compulsory -->
<StringVectorProperty
name="FileName"
command="SetFileName"
number_of_elements="1"
animateable="0">
<FileListDomain name="files"/>
<Documentation>
Specifies the filename for the OpenFOAM blockMesh Reader.
</Documentation>
</StringVectorProperty>
<!-- File name - compulsory -->
<StringVectorProperty
name="FileName"
command="SetFileName"
number_of_elements="1"
animateable="0">
<FileListDomain name="files"/>
<Documentation>
The file name
</Documentation>
</StringVectorProperty>
<!-- Show Point Numbers check-box -->
<IntVectorProperty
name="UiShowPointNumbers"
command="SetShowPointNumbers"
number_of_elements="1"
default_values="1"
is_internal="1"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Show point numbers in render window.
</Documentation>
</IntVectorProperty>
<!-- Refresh button -->
<Property
name="UiRefresh"
command="SetRefresh"
label="Refresh"
animateable="0">
<Documentation>
Rescan for updated blockMeshDict.
</Documentation>
</Property>
<!-- Refresh button -->
<IntVectorProperty
name="UiRefresh"
command="SetRefresh"
number_of_elements="1"
is_internal="0"
default_values="0"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Rescan for updated blockMeshDict.
</Documentation>
</IntVectorProperty>
<!-- Show Point Numbers check-box -->
<IntVectorProperty
name="UiShowPointNumbers"
command="SetShowPointNumbers"
label="Show Point Numbers"
number_of_elements="1"
default_values="1"
animateable="0">
<BooleanDomain name="bool"/>
<Documentation>
Show point numbers in the visualisation
</Documentation>
</IntVectorProperty>
<!-- Available Blocks array -->
<StringVectorProperty
name="BlockArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="Block"/>
</StringVectorProperty>
<StringVectorProperty
name="BlockStatus"
label="Blocks"
command="SetBlockArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="BlockArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="BlockArrayStatus" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
Select the blocks to load
</Documentation>
</StringVectorProperty>
<!--
| Selections
-->
<!-- Available CurvedEdges array -->
<StringVectorProperty
name="CurvedEdgesArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="CurvedEdges"/>
</StringVectorProperty>
<StringVectorProperty
name="CurvedEdgesStatus"
label="Curved Edges"
command="SetCurvedEdgesArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="CurvedEdgesArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="CurvedEdgesArrayStatus" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
Select the curved edges to load
</Documentation>
</StringVectorProperty>
<!-- Available Blocks array -->
<StringVectorProperty
name="BlockArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="Block"/>
</StringVectorProperty>
<StringVectorProperty
name="BlockStatus"
label="Blocks"
command="SetBlockArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="BlockArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="BlockArrayStatus" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
This property contains a list of the blocks
</Documentation>
</StringVectorProperty>
<PropertyGroup label="Selection">
<Property name="BlockArrayStatus"/>
<Property name="BlockStatus"/>
<Property name="CurvedEdgesArrayStatus"/>
<Property name="CurvedEdgesStatus"/>
</PropertyGroup>
<!-- Available CurvedEdges array -->
<StringVectorProperty
name="CurvedEdgesArrayStatus"
information_only="1">
<ArraySelectionInformationHelper attribute_name="CurvedEdges"/>
</StringVectorProperty>
<StringVectorProperty
name="CurvedEdgesStatus"
label="Curved Edges"
command="SetCurvedEdgesArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="CurvedEdgesArrayStatus"
animateable="0">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="CurvedEdgesArrayStatus" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
This property contains a list of the curved edges
</Documentation>
</StringVectorProperty>
<Hints>
<ReaderFactory
extensions="blockMesh"
file_description="OpenFOAM blockMesh"/>
</Hints>
<Hints>
<Property name="FileName" show="0"/>
<Property name="UiRefresh" show="0"/>
<Property name="UiShowPointNumbers" show="0"/>
<ReaderFactory extensions="blockMesh"
file_description="OpenFOAM blockMesh"/>
</Hints>
</SourceProxy>
</ProxyGroup>
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>

View File

@ -1,143 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "pqPVblockMeshReaderPanel.h"
// QT
#include <QGridLayout>
#include <QCheckBox>
#include <QLabel>
#include <QLayout>
#include <QString>
#include <QPushButton>
#include <QtDebug>
// Paraview <-> QT UI
#include "pqAnimationScene.h"
#include "pqApplicationCore.h"
#include "pqPipelineRepresentation.h"
#include "pqServerManagerModel.h"
#include "pqView.h"
// Paraview Server Manager
#include "vtkSMDoubleVectorProperty.h"
#include "vtkSMIntVectorProperty.h"
#include "vtkSMProperty.h"
#include "vtkSMSourceProxy.h"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
pqPVblockMeshReaderPanel::pqPVblockMeshReaderPanel
(
pqProxy *proxy,
QWidget *p
)
:
pqAutoGeneratedObjectPanel(proxy, p)
{
// Create first sublayout (at top of the panel)
QGridLayout *form = new QGridLayout();
this->PanelLayout->addLayout(form, 0, 0, 1, -1);
vtkSMProperty* prop = 0;
// Refresh button for updating blocks
if ((prop = this->proxy()->GetProperty("UiRefresh")) != 0)
{
prop->SetImmediateUpdate(1);
QPushButton* refresh = new QPushButton("Refresh");
refresh->setToolTip("Rescan for updated blockMeshDict.");
form->addWidget(refresh, 0, 0, Qt::AlignLeft);
QObject::connect
(
refresh,
SIGNAL(clicked()),
this,
SLOT(RefreshPressed())
);
}
// Checkbox for showing point numbers
if ((prop = this->proxy()->GetProperty("UiShowPointNumbers")) != 0)
{
prop->SetImmediateUpdate(true);
ShowPointNumbers_ = new QCheckBox("Show Point Numbers");
ShowPointNumbers_->setToolTip("Show point numbers in render window.");
ShowPointNumbers_->setChecked
(
vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
);
form->addWidget(ShowPointNumbers_);
connect
(
ShowPointNumbers_,
SIGNAL(stateChanged(int)),
this,
SLOT(ShowPointNumbersToggled())
);
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void pqPVblockMeshReaderPanel::ShowPointNumbersToggled()
{
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiShowPointNumbers")
)->SetElement(0, ShowPointNumbers_->isChecked());
// Update the active view
if (this->view())
{
this->view()->render();
}
// OR: update all views
// pqApplicationCore::instance()->render();
}
void pqPVblockMeshReaderPanel::RefreshPressed()
{
// Update everything
vtkSMIntVectorProperty::SafeDownCast
(
this->proxy()->GetProperty("UiRefresh")
)->Modified();
vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline();
// Render all views
pqApplicationCore::instance()->render();
}
// ************************************************************************* //

View File

@ -1,86 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
pqPVblockMeshReaderPanel
Description
GUI modifications for the ParaView reader panel
A custom panel for the PVblockMeshReader.
SourceFiles
pqPVblockMeshReaderPanel.cxx
\*---------------------------------------------------------------------------*/
#ifndef pqPVblockMeshReaderPanel_h
#define pqPVblockMeshReaderPanel_h
#include "pqAutoGeneratedObjectPanel.h"
// Forward declaration of QT classes
class QCheckBox;
class QLineEdit;
class QTimer;
class QToolButton;
// Forward declaration of ParaView classes
class vtkSMSourceProxy;
/*---------------------------------------------------------------------------*\
Class pqPVblockMeshReaderPanel Declaration
\*---------------------------------------------------------------------------*/
class pqPVblockMeshReaderPanel
:
public pqAutoGeneratedObjectPanel
{
// Private data
Q_OBJECT;
typedef pqAutoGeneratedObjectPanel Superclass;
//- Show Point Numbers checkbox
QCheckBox* ShowPointNumbers_;
protected slots:
void ShowPointNumbersToggled();
void RefreshPressed();
public:
// Constructors
//- Construct from components
pqPVblockMeshReaderPanel(pqProxy*, QWidget*);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -218,7 +218,7 @@ int vtkPVblockMeshReader::RequestData
}
void vtkPVblockMeshReader::SetRefresh(int val)
void vtkPVblockMeshReader::SetRefresh()
{
// Delete the current blockMesh to force re-read and update
if (foamData_)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -78,7 +78,7 @@ public:
// Description:
// Refresh blockMesh from changes to blockMeshDict
virtual void SetRefresh(int);
virtual void SetRefresh();
// Description:
// Blocks selection list control