ENH: update blockMesh reader for paraview 5.2 (issue #337)
- although this is not the final desired form, since it uses individual pqPropertyWidget customizations (ie, ugly layout, too many bits of code), but is an interesting intermediate solution that may be useful in other contexts.
This commit is contained in:
parent
801076f8d0
commit
71ea6bec62
@ -1,11 +1,4 @@
|
|||||||
# create a plugin that adds a reader to the ParaView GUI
|
# Create a plugin to add 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.
|
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||||
|
|
||||||
@ -25,7 +18,7 @@ INCLUDE_DIRECTORIES(
|
|||||||
)
|
)
|
||||||
|
|
||||||
ADD_DEFINITIONS(
|
ADD_DEFINITIONS(
|
||||||
-std=c++0x
|
-std=c++11
|
||||||
-DWM_$ENV{WM_PRECISION_OPTION}
|
-DWM_$ENV{WM_PRECISION_OPTION}
|
||||||
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
|
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
|
||||||
)
|
)
|
||||||
@ -37,44 +30,44 @@ SET(
|
|||||||
"Single output directory for building all libraries."
|
"Single output directory for building all libraries."
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
|
||||||
# Define combined plugin
|
|
||||||
#
|
|
||||||
|
|
||||||
# Extend the auto-generated panel
|
IF (PARAVIEW_QT_VERSION VERSION_GREATER "4")
|
||||||
QT4_WRAP_CPP(MOC_SRCS pqPVblockMeshReaderPanel.h)
|
QT5_WRAP_CPP(MOC_SRCS
|
||||||
|
pqRefreshProperty.h
|
||||||
ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
|
pqShowPointNumbersProperty.h
|
||||||
CLASS_NAME pqPVblockMeshReaderPanel
|
|
||||||
XML_NAME PVblockMeshReader # name of SourceProxy in *SM.xml
|
|
||||||
XML_GROUP sources
|
|
||||||
)
|
|
||||||
|
|
||||||
# Separate GUI_RESOURCE_FILES deprecated with paraview 4.3
|
|
||||||
# so check if version < 4.4
|
|
||||||
|
|
||||||
IF(("${PARAVIEW_VERSION_MAJOR}" LESS 5) AND ("${PARAVIEW_VERSION_MINOR}" LESS 4))
|
|
||||||
ADD_PARAVIEW_PLUGIN(
|
|
||||||
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()
|
ELSE()
|
||||||
ADD_PARAVIEW_PLUGIN(
|
QT4_WRAP_CPP(MOC_SRCS
|
||||||
PVblockMeshReader_SM "1.0"
|
pqRefreshProperty.h
|
||||||
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
|
pqShowPointNumbersProperty.h
|
||||||
SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
|
|
||||||
GUI_INTERFACES ${IFACES}
|
|
||||||
GUI_SOURCES pqPVblockMeshReaderPanel.cxx
|
|
||||||
${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
|
|
||||||
)
|
)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Build the client-side plugin
|
ADD_PARAVIEW_PROPERTY_WIDGET(IFACES0 IFACES0_SRCS
|
||||||
|
TYPE "openfoam_refresh_button"
|
||||||
|
CLASS_NAME pqRefreshProperty
|
||||||
|
)
|
||||||
|
|
||||||
|
ADD_PARAVIEW_PROPERTY_WIDGET(IFACES1 IFACES1_SRCS
|
||||||
|
TYPE "openfoam_show_point_numbers"
|
||||||
|
CLASS_NAME pqShowPointNumbersProperty
|
||||||
|
)
|
||||||
|
|
||||||
|
ADD_PARAVIEW_PLUGIN(
|
||||||
|
PVblockMeshReader_SM "1.0"
|
||||||
|
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
|
||||||
|
SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
|
||||||
|
GUI_INTERFACES
|
||||||
|
${IFACES0}
|
||||||
|
${IFACES1}
|
||||||
|
SOURCES
|
||||||
|
${IFACES0_SRCS}
|
||||||
|
${IFACES1_SRCS}
|
||||||
|
${MOC_SRCS}
|
||||||
|
pqRefreshProperty.cxx
|
||||||
|
pqShowPointNumbersProperty.cxx
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(
|
TARGET_LINK_LIBRARIES(
|
||||||
PVblockMeshReader_SM
|
PVblockMeshReader_SM
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
<RCC>
|
|
||||||
<qresource prefix="/ParaViewResources" >
|
|
||||||
<file>PVblockMeshReader.xml</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
@ -1,7 +0,0 @@
|
|||||||
<ParaViewReaders>
|
|
||||||
<!-- deprecated with paraview-4.3, use hints in *SM.xml -->
|
|
||||||
<Reader name="PVblockMeshReader"
|
|
||||||
extensions="blockMesh"
|
|
||||||
file_description="OpenFOAM blockMesh reader">
|
|
||||||
</Reader>
|
|
||||||
</ParaViewReaders>
|
|
@ -5,45 +5,38 @@
|
|||||||
class="vtkPVblockMeshReader">
|
class="vtkPVblockMeshReader">
|
||||||
|
|
||||||
<!-- File name - compulsory -->
|
<!-- File name - compulsory -->
|
||||||
<StringVectorProperty
|
<StringVectorProperty animateable="0"
|
||||||
name="FileName"
|
name="FileName"
|
||||||
command="SetFileName"
|
command="SetFileName"
|
||||||
number_of_elements="1"
|
number_of_elements="1"
|
||||||
animateable="0">
|
panel_visibility="never">
|
||||||
<FileListDomain name="files"/>
|
<FileListDomain name="files"/>
|
||||||
<Documentation>
|
<Documentation>The filename for the OpenFOAM blockMesh reader.</Documentation>
|
||||||
Specifies the filename for the OpenFOAM blockMesh Reader.
|
|
||||||
</Documentation>
|
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
<!-- Show Point Numbers check-box -->
|
<!-- Refresh button (push button) -->
|
||||||
<IntVectorProperty
|
<IntVectorProperty animateable="0"
|
||||||
name="UiShowPointNumbers"
|
name="Refresh"
|
||||||
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 -->
|
|
||||||
<IntVectorProperty
|
|
||||||
name="UiRefresh"
|
|
||||||
command="SetRefresh"
|
command="SetRefresh"
|
||||||
number_of_elements="1"
|
|
||||||
is_internal="0"
|
|
||||||
default_values="0"
|
default_values="0"
|
||||||
animateable="0">
|
panel_widget="openfoam_refresh_button"
|
||||||
|
number_of_elements="1"
|
||||||
|
panel_visibility="default">
|
||||||
<BooleanDomain name="bool"/>
|
<BooleanDomain name="bool"/>
|
||||||
<Documentation>
|
<Documentation>Rescan for updated blockMeshDict.</Documentation>
|
||||||
Rescan for updated blockMeshDict.
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
|
<!-- Show Point Numbers (check-box) -->
|
||||||
|
<IntVectorProperty animateable="0"
|
||||||
|
name="ShowPointNumbers"
|
||||||
|
command="SetShowPointNumbers"
|
||||||
|
default_values="1"
|
||||||
|
panel_widget="openfoam_show_point_numbers"
|
||||||
|
number_of_elements="1"
|
||||||
|
panel_visibility="default">
|
||||||
|
<BooleanDomain name="bool"/>
|
||||||
|
<Documentation>Show point numbers in render window.</Documentation>
|
||||||
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
| Selections
|
| Selections
|
||||||
@ -55,7 +48,7 @@
|
|||||||
information_only="1">
|
information_only="1">
|
||||||
<ArraySelectionInformationHelper attribute_name="Block"/>
|
<ArraySelectionInformationHelper attribute_name="Block"/>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
<StringVectorProperty
|
<StringVectorProperty animateable="0"
|
||||||
name="BlockStatus"
|
name="BlockStatus"
|
||||||
label="Blocks"
|
label="Blocks"
|
||||||
command="SetBlockArrayStatus"
|
command="SetBlockArrayStatus"
|
||||||
@ -63,16 +56,13 @@
|
|||||||
repeat_command="1"
|
repeat_command="1"
|
||||||
number_of_elements_per_command="2"
|
number_of_elements_per_command="2"
|
||||||
element_types="2 0"
|
element_types="2 0"
|
||||||
information_property="BlockArrayStatus"
|
information_property="BlockArrayStatus">
|
||||||
animateable="0">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
<ArraySelectionDomain name="array_list">
|
||||||
<RequiredProperties>
|
<RequiredProperties>
|
||||||
<Property name="BlockArrayStatus" function="ArrayList"/>
|
<Property name="BlockArrayStatus" function="ArrayList"/>
|
||||||
</RequiredProperties>
|
</RequiredProperties>
|
||||||
</ArraySelectionDomain>
|
</ArraySelectionDomain>
|
||||||
<Documentation>
|
<Documentation>The list of blocks</Documentation>
|
||||||
This property contains a list of the blocks
|
|
||||||
</Documentation>
|
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
<!-- Available CurvedEdges array -->
|
<!-- Available CurvedEdges array -->
|
||||||
@ -81,7 +71,7 @@
|
|||||||
information_only="1">
|
information_only="1">
|
||||||
<ArraySelectionInformationHelper attribute_name="CurvedEdges"/>
|
<ArraySelectionInformationHelper attribute_name="CurvedEdges"/>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
<StringVectorProperty
|
<StringVectorProperty animateable="0"
|
||||||
name="CurvedEdgesStatus"
|
name="CurvedEdgesStatus"
|
||||||
label="Curved Edges"
|
label="Curved Edges"
|
||||||
command="SetCurvedEdgesArrayStatus"
|
command="SetCurvedEdgesArrayStatus"
|
||||||
@ -89,26 +79,33 @@
|
|||||||
repeat_command="1"
|
repeat_command="1"
|
||||||
number_of_elements_per_command="2"
|
number_of_elements_per_command="2"
|
||||||
element_types="2 0"
|
element_types="2 0"
|
||||||
information_property="CurvedEdgesArrayStatus"
|
information_property="CurvedEdgesArrayStatus">
|
||||||
animateable="0">
|
|
||||||
<ArraySelectionDomain name="array_list">
|
<ArraySelectionDomain name="array_list">
|
||||||
<RequiredProperties>
|
<RequiredProperties>
|
||||||
<Property name="CurvedEdgesArrayStatus" function="ArrayList"/>
|
<Property name="CurvedEdgesArrayStatus" function="ArrayList"/>
|
||||||
</RequiredProperties>
|
</RequiredProperties>
|
||||||
</ArraySelectionDomain>
|
</ArraySelectionDomain>
|
||||||
<Documentation>
|
<Documentation>The list of curved edges</Documentation>
|
||||||
This property contains a list of the curved edges
|
|
||||||
</Documentation>
|
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
<Hints>
|
<Hints>
|
||||||
<Property name="FileName" show="0"/>
|
<ReaderFactory
|
||||||
<Property name="UiRefresh" show="0"/>
|
extensions="blockMesh"
|
||||||
<Property name="UiShowPointNumbers" show="0"/>
|
|
||||||
<ReaderFactory extensions="blockMesh"
|
|
||||||
file_description="OpenFOAM blockMesh"/>
|
file_description="OpenFOAM blockMesh"/>
|
||||||
</Hints>
|
</Hints>
|
||||||
|
|
||||||
|
<PropertyGroup label="General Controls">
|
||||||
|
<Property name="Refresh"/>
|
||||||
|
<Property name="ShowPointNumbers"/>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup label="Selections">
|
||||||
|
<Property name="BlockArrayStatus"/>
|
||||||
|
<Property name="BlockStatus"/>
|
||||||
|
<Property name="CurvedEdgesArrayStatus"/>
|
||||||
|
<Property name="CurvedEdgesStatus"/>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
</SourceProxy>
|
</SourceProxy>
|
||||||
</ProxyGroup>
|
</ProxyGroup>
|
||||||
</ServerManagerConfiguration>
|
</ServerManagerConfiguration>
|
||||||
|
@ -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();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
@ -0,0 +1,120 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 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 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 "pqRefreshProperty.h"
|
||||||
|
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QGridLayout>
|
||||||
|
|
||||||
|
#include "pqApplicationCore.h"
|
||||||
|
#include "pqView.h"
|
||||||
|
#include "vtkSMDocumentation.h"
|
||||||
|
#include "vtkSMIntVectorProperty.h"
|
||||||
|
#include "vtkSMSourceProxy.h"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// file-scope
|
||||||
|
static void setButtonProperties
|
||||||
|
(
|
||||||
|
QAbstractButton* b,
|
||||||
|
vtkSMIntVectorProperty* prop,
|
||||||
|
bool initChecked = true
|
||||||
|
)
|
||||||
|
{
|
||||||
|
QString tip;
|
||||||
|
|
||||||
|
vtkSMDocumentation* doc = prop->GetDocumentation();
|
||||||
|
if (doc)
|
||||||
|
{
|
||||||
|
const char* txt = doc->GetDescription();
|
||||||
|
if (txt)
|
||||||
|
{
|
||||||
|
tip = QString(txt).simplified();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
b->setText(prop->GetXMLLabel());
|
||||||
|
if (tip.size())
|
||||||
|
{
|
||||||
|
b->setToolTip(tip);
|
||||||
|
}
|
||||||
|
b->setFocusPolicy(Qt::NoFocus); // avoid dotted border
|
||||||
|
|
||||||
|
// initial checked state
|
||||||
|
if (initChecked)
|
||||||
|
{
|
||||||
|
b->setChecked(prop->GetElement(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void pqRefreshProperty::refreshPressed()
|
||||||
|
{
|
||||||
|
// Update everything
|
||||||
|
refresh_->Modified();
|
||||||
|
|
||||||
|
vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline();
|
||||||
|
|
||||||
|
// Render all views
|
||||||
|
pqApplicationCore::instance()->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
pqRefreshProperty::pqRefreshProperty
|
||||||
|
(
|
||||||
|
vtkSMProxy* proxy,
|
||||||
|
vtkSMProperty* prop,
|
||||||
|
QWidget* parent
|
||||||
|
)
|
||||||
|
:
|
||||||
|
Superclass(proxy, parent),
|
||||||
|
refresh_(vtkSMIntVectorProperty::SafeDownCast(prop))
|
||||||
|
{
|
||||||
|
// Replace with our UI content
|
||||||
|
this->setShowLabel(false);
|
||||||
|
|
||||||
|
QGridLayout* form = new QGridLayout(this);
|
||||||
|
|
||||||
|
QPushButton* b = new QPushButton(this);
|
||||||
|
setButtonProperties(b, refresh_, false);
|
||||||
|
form->addWidget(b, 0, 0, Qt::AlignLeft);
|
||||||
|
|
||||||
|
connect(b, SIGNAL(clicked()), this, SLOT(refreshPressed()));
|
||||||
|
refresh_->SetImmediateUpdate(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
pqRefreshProperty::~pqRefreshProperty()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -22,60 +22,63 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
pqPVblockMeshReaderPanel
|
pqRefreshProperty
|
||||||
|
|
||||||
Description
|
Description
|
||||||
GUI modifications for the ParaView reader panel
|
Custom refresh button (ParaView blockMesh reader)
|
||||||
|
|
||||||
A custom panel for the PVblockMeshReader.
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
pqPVblockMeshReaderPanel.cxx
|
pqRefreshProperty.cxx
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
#ifndef pqPVblockMeshReaderPanel_h
|
#ifndef pqRefreshProperty_h
|
||||||
#define pqPVblockMeshReaderPanel_h
|
#define pqRefreshProperty_h
|
||||||
|
|
||||||
#include "pqAutoGeneratedObjectPanel.h"
|
#include "pqPropertyWidget.h"
|
||||||
|
|
||||||
// Forward declaration of QT classes
|
// Forward declarations (ParaView)
|
||||||
|
class vtkSMIntVectorProperty;
|
||||||
class QCheckBox;
|
|
||||||
class QLineEdit;
|
|
||||||
class QTimer;
|
|
||||||
class QToolButton;
|
|
||||||
|
|
||||||
// Forward declaration of ParaView classes
|
|
||||||
class vtkSMSourceProxy;
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class pqPVblockMeshReaderPanel Declaration
|
Class pqRefreshProperty Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class pqPVblockMeshReaderPanel
|
class pqRefreshProperty
|
||||||
:
|
:
|
||||||
public pqAutoGeneratedObjectPanel
|
public pqPropertyWidget
|
||||||
{
|
{
|
||||||
// Private data
|
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
typedef pqAutoGeneratedObjectPanel Superclass;
|
typedef pqPropertyWidget Superclass;
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Refresh (bool property - as push button)
|
||||||
|
vtkSMIntVectorProperty* refresh_;
|
||||||
|
|
||||||
//- Show Point Numbers checkbox
|
|
||||||
QCheckBox* ShowPointNumbers_;
|
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
void ShowPointNumbersToggled();
|
// Protected Member Functions
|
||||||
void RefreshPressed();
|
|
||||||
|
//- Trigger refresh
|
||||||
|
void refreshPressed();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
pqPVblockMeshReaderPanel(pqProxy*, QWidget*);
|
pqRefreshProperty
|
||||||
|
(
|
||||||
|
vtkSMProxy* proxy,
|
||||||
|
vtkSMProperty* prop,
|
||||||
|
QWidget* parent = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~pqRefreshProperty();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -0,0 +1,122 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 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 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 "pqShowPointNumbersProperty.h"
|
||||||
|
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QGridLayout>
|
||||||
|
|
||||||
|
#include "pqApplicationCore.h"
|
||||||
|
#include "pqView.h"
|
||||||
|
#include "vtkSMDocumentation.h"
|
||||||
|
#include "vtkSMIntVectorProperty.h"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// file-scope
|
||||||
|
static void setButtonProperties
|
||||||
|
(
|
||||||
|
QAbstractButton* b,
|
||||||
|
vtkSMIntVectorProperty* prop,
|
||||||
|
bool initChecked = true
|
||||||
|
)
|
||||||
|
{
|
||||||
|
QString tip;
|
||||||
|
|
||||||
|
vtkSMDocumentation* doc = prop->GetDocumentation();
|
||||||
|
if (doc)
|
||||||
|
{
|
||||||
|
const char* txt = doc->GetDescription();
|
||||||
|
if (txt)
|
||||||
|
{
|
||||||
|
tip = QString(txt).simplified();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
b->setText(prop->GetXMLLabel());
|
||||||
|
if (tip.size())
|
||||||
|
{
|
||||||
|
b->setToolTip(tip);
|
||||||
|
}
|
||||||
|
b->setFocusPolicy(Qt::NoFocus); // avoid dotted border
|
||||||
|
|
||||||
|
// initial checked state
|
||||||
|
if (initChecked)
|
||||||
|
{
|
||||||
|
b->setChecked(prop->GetElement(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void pqShowPointNumbersProperty::showPointNumbers(bool checked)
|
||||||
|
{
|
||||||
|
showPointNumbers_->SetElement(0, checked);
|
||||||
|
|
||||||
|
// Update the active view
|
||||||
|
if (this->view())
|
||||||
|
{
|
||||||
|
this->view()->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
// OR: update all views
|
||||||
|
// pqApplicationCore::instance()->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
pqShowPointNumbersProperty::pqShowPointNumbersProperty
|
||||||
|
(
|
||||||
|
vtkSMProxy* proxy,
|
||||||
|
vtkSMProperty* prop,
|
||||||
|
QWidget* parent
|
||||||
|
)
|
||||||
|
:
|
||||||
|
Superclass(proxy, parent),
|
||||||
|
showPointNumbers_(vtkSMIntVectorProperty::SafeDownCast(prop))
|
||||||
|
{
|
||||||
|
// Replace with our UI content
|
||||||
|
this->setShowLabel(false);
|
||||||
|
|
||||||
|
QGridLayout* form = new QGridLayout(this);
|
||||||
|
|
||||||
|
QCheckBox* b = new QCheckBox(this);
|
||||||
|
setButtonProperties(b, showPointNumbers_);
|
||||||
|
form->addWidget(b, 0, 0, Qt::AlignLeft);
|
||||||
|
|
||||||
|
connect(b, SIGNAL(toggled(bool)), this, SLOT(showPointNumbers(bool)));
|
||||||
|
showPointNumbers_->SetImmediateUpdate(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
pqShowPointNumbersProperty::~pqShowPointNumbersProperty()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,89 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 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 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
|
||||||
|
pqShowPointNumbersProperty
|
||||||
|
|
||||||
|
Description
|
||||||
|
Custom UI handling of show-points (ParaView blockMesh reader)
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
pqShowPointNumbersProperty.cxx
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
#ifndef pqShowPointNumbersProperty_h
|
||||||
|
#define pqShowPointNumbersProperty_h
|
||||||
|
|
||||||
|
#include "pqPropertyWidget.h"
|
||||||
|
|
||||||
|
// Forward declarations (ParaView)
|
||||||
|
class vtkSMIntVectorProperty;
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class pqShowPointNumbersProperty Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class pqShowPointNumbersProperty
|
||||||
|
:
|
||||||
|
public pqPropertyWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT;
|
||||||
|
typedef pqPropertyWidget Superclass;
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Show Point Numbers (bool property)
|
||||||
|
vtkSMIntVectorProperty* showPointNumbers_;
|
||||||
|
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Sync property with changed checkbox state, update rendered view(s)
|
||||||
|
void showPointNumbers(bool checked);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
pqShowPointNumbersProperty
|
||||||
|
(
|
||||||
|
vtkSMProxy* proxy,
|
||||||
|
vtkSMProperty* prop,
|
||||||
|
QWidget* parent = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~pqShowPointNumbersProperty();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -59,7 +59,7 @@ vtkPVblockMeshReader::vtkPVblockMeshReader()
|
|||||||
FileName = nullptr;
|
FileName = nullptr;
|
||||||
foamData_ = nullptr;
|
foamData_ = nullptr;
|
||||||
|
|
||||||
ShowPointNumbers = 1;
|
ShowPointNumbers = true;
|
||||||
|
|
||||||
BlockSelection = vtkDataArraySelection::New();
|
BlockSelection = vtkDataArraySelection::New();
|
||||||
CurvedEdgesSelection = vtkDataArraySelection::New();
|
CurvedEdgesSelection = vtkDataArraySelection::New();
|
||||||
@ -92,7 +92,7 @@ vtkPVblockMeshReader::vtkPVblockMeshReader()
|
|||||||
|
|
||||||
vtkPVblockMeshReader::~vtkPVblockMeshReader()
|
vtkPVblockMeshReader::~vtkPVblockMeshReader()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"Deconstructor");
|
vtkDebugMacro(<<"Destructor");
|
||||||
|
|
||||||
if (foamData_)
|
if (foamData_)
|
||||||
{
|
{
|
||||||
@ -106,8 +106,8 @@ vtkPVblockMeshReader::~vtkPVblockMeshReader()
|
|||||||
delete [] FileName;
|
delete [] FileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockSelection->RemoveObserver(this->SelectionObserver);
|
BlockSelection->RemoveAllObservers();
|
||||||
CurvedEdgesSelection->RemoveObserver(this->SelectionObserver);
|
CurvedEdgesSelection->RemoveAllObservers();
|
||||||
|
|
||||||
SelectionObserver->Delete();
|
SelectionObserver->Delete();
|
||||||
BlockSelection->Delete();
|
BlockSelection->Delete();
|
||||||
@ -218,7 +218,7 @@ int vtkPVblockMeshReader::RequestData
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVblockMeshReader::SetRefresh(int val)
|
void vtkPVblockMeshReader::SetRefresh(bool val)
|
||||||
{
|
{
|
||||||
// Delete the current blockMesh to force re-read and update
|
// Delete the current blockMesh to force re-read and update
|
||||||
if (foamData_)
|
if (foamData_)
|
||||||
@ -232,7 +232,7 @@ void vtkPVblockMeshReader::SetRefresh(int val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVblockMeshReader::SetShowPointNumbers(const int val)
|
void vtkPVblockMeshReader::SetShowPointNumbers(bool val)
|
||||||
{
|
{
|
||||||
if (ShowPointNumbers != val)
|
if (ShowPointNumbers != val)
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -73,12 +73,12 @@ public:
|
|||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// Display corner point labels
|
// Display corner point labels
|
||||||
virtual void SetShowPointNumbers(int);
|
virtual void SetShowPointNumbers(bool);
|
||||||
vtkGetMacro(ShowPointNumbers, int);
|
vtkGetMacro(ShowPointNumbers, bool);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// Refresh blockMesh from changes to blockMeshDict
|
// Refresh blockMesh from changes to blockMeshDict
|
||||||
virtual void SetRefresh(int);
|
virtual void SetRefresh(bool);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// Blocks selection list control
|
// Blocks selection list control
|
||||||
@ -144,25 +144,23 @@ protected:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
vtkPVblockMeshReader(const vtkPVblockMeshReader&);
|
vtkPVblockMeshReader(const vtkPVblockMeshReader&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const vtkPVblockMeshReader&);
|
void operator=(const vtkPVblockMeshReader&) = delete;
|
||||||
|
|
||||||
//- 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
|
//- Show Point Numbers
|
||||||
int ShowPointNumbers;
|
bool ShowPointNumbers;
|
||||||
|
|
||||||
vtkDataArraySelection* BlockSelection;
|
vtkDataArraySelection* BlockSelection;
|
||||||
|
|
||||||
vtkDataArraySelection* CurvedEdgesSelection;
|
vtkDataArraySelection* CurvedEdgesSelection;
|
||||||
|
|
||||||
//BTX
|
|
||||||
Foam::vtkPVblockMesh* foamData_;
|
Foam::vtkPVblockMesh* foamData_;
|
||||||
//ETX
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -63,13 +63,15 @@ void Foam::vtkPVblockMesh::updateInfoBlocks
|
|||||||
vtkDataArraySelection* arraySelection
|
vtkDataArraySelection* arraySelection
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
arrayRange& range = arrayRangeBlocks_;
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVblockMesh::updateInfoBlocks"
|
Info<< "<beg> Foam::vtkPVblockMesh::updateInfoBlocks"
|
||||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
|
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayRangeBlocks_.reset( arraySelection->GetNumberOfArrays() );
|
range.reset(arraySelection->GetNumberOfArrays());
|
||||||
|
|
||||||
const blockMesh& blkMesh = *meshPtr_;
|
const blockMesh& blkMesh = *meshPtr_;
|
||||||
|
|
||||||
@ -80,21 +82,20 @@ void Foam::vtkPVblockMesh::updateInfoBlocks
|
|||||||
|
|
||||||
// Display either blockI as a number or with its name
|
// Display either blockI as a number or with its name
|
||||||
// (looked up from blockMeshDict)
|
// (looked up from blockMeshDict)
|
||||||
OStringStream os;
|
OStringStream ostr;
|
||||||
blockDescriptor::write(os, blockI, blkMesh.meshDict());
|
blockDescriptor::write(ostr, blockI, blkMesh.meshDict());
|
||||||
word partName(os.str());
|
|
||||||
|
|
||||||
// append the (optional) zone name
|
// append the (optional) zone name
|
||||||
if (!blockDef.zoneName().empty())
|
if (!blockDef.zoneName().empty())
|
||||||
{
|
{
|
||||||
partName += " - " + blockDef.zoneName();
|
ostr << " - " << blockDef.zoneName();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add blockId and zoneName to GUI list
|
// Add "blockId" or "blockId - zoneName" to GUI list
|
||||||
arraySelection->AddArray(partName.c_str());
|
arraySelection->AddArray(ostr.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayRangeBlocks_ += nBlocks;
|
range += nBlocks;
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -111,18 +112,19 @@ void Foam::vtkPVblockMesh::updateInfoEdges
|
|||||||
vtkDataArraySelection* arraySelection
|
vtkDataArraySelection* arraySelection
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
arrayRange& range = arrayRangeEdges_;
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "<beg> Foam::vtkPVblockMesh::updateInfoEdges"
|
Info<< "<beg> Foam::vtkPVblockMesh::updateInfoEdges"
|
||||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
|
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() );
|
range.reset(arraySelection->GetNumberOfArrays());
|
||||||
|
|
||||||
const blockMesh& blkMesh = *meshPtr_;
|
const blockMesh& blkMesh = *meshPtr_;
|
||||||
const blockEdgeList& edges = blkMesh.edges();
|
const blockEdgeList& edges = blkMesh.edges();
|
||||||
|
|
||||||
const int nEdges = edges.size();
|
|
||||||
forAll(edges, edgeI)
|
forAll(edges, edgeI)
|
||||||
{
|
{
|
||||||
OStringStream ostr;
|
OStringStream ostr;
|
||||||
@ -135,7 +137,7 @@ void Foam::vtkPVblockMesh::updateInfoEdges
|
|||||||
arraySelection->AddArray(ostr.str().c_str());
|
arraySelection->AddArray(ostr.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayRangeEdges_ += nEdges;
|
range += edges.size();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -287,12 +289,8 @@ void Foam::vtkPVblockMesh::updateInfo()
|
|||||||
// or preserve the enabled selections
|
// or preserve the enabled selections
|
||||||
stringList enabledParts;
|
stringList enabledParts;
|
||||||
stringList enabledEdges;
|
stringList enabledEdges;
|
||||||
bool firstTime = false;
|
const bool firstTime = (!blockSelection->GetNumberOfArrays() && !meshPtr_);
|
||||||
if (!blockSelection->GetNumberOfArrays() && !meshPtr_)
|
if (!firstTime)
|
||||||
{
|
|
||||||
firstTime = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
enabledParts = getSelectedArrayEntries(blockSelection);
|
enabledParts = getSelectedArrayEntries(blockSelection);
|
||||||
enabledEdges = getSelectedArrayEntries(edgeSelection);
|
enabledEdges = getSelectedArrayEntries(edgeSelection);
|
||||||
|
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -41,18 +41,11 @@ SourceFiles
|
|||||||
#ifndef vtkPVblockMesh_H
|
#ifndef vtkPVblockMesh_H
|
||||||
#define vtkPVblockMesh_H
|
#define vtkPVblockMesh_H
|
||||||
|
|
||||||
// do not include legacy strstream headers
|
|
||||||
#ifndef VTK_EXCLUDE_STRSTREAM_HEADERS
|
|
||||||
# define VTK_EXCLUDE_STRSTREAM_HEADERS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "className.H"
|
#include "className.H"
|
||||||
#include "fileName.H"
|
#include "fileName.H"
|
||||||
#include "stringList.H"
|
#include "stringList.H"
|
||||||
#include "wordList.H"
|
#include "wordList.H"
|
||||||
|
|
||||||
#include "primitivePatch.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
|
||||||
|
|
||||||
class vtkDataArraySelection;
|
class vtkDataArraySelection;
|
||||||
@ -198,6 +191,7 @@ class vtkPVblockMesh
|
|||||||
//- List of point numbers for rendering to window
|
//- List of point numbers for rendering to window
|
||||||
List<vtkTextActor*> pointNumberTextActorsPtrs_;
|
List<vtkTextActor*> pointNumberTextActorsPtrs_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
// Convenience method use to convert the readers from VTK 5
|
// Convenience method use to convert the readers from VTK 5
|
||||||
@ -211,23 +205,6 @@ class vtkPVblockMesh
|
|||||||
const std::string& datasetName
|
const std::string& datasetName
|
||||||
);
|
);
|
||||||
|
|
||||||
// Convenience method use to convert the readers from VTK 5
|
|
||||||
// multiblock API to the current composite data infrastructure
|
|
||||||
static vtkDataSet* GetDataSetFromBlock
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange&,
|
|
||||||
const label datasetNo
|
|
||||||
);
|
|
||||||
|
|
||||||
// Convenience method use to convert the readers from VTK 5
|
|
||||||
// multiblock API to the current composite data infrastructure
|
|
||||||
static label GetNumberOfDataSets
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Update boolList from GUI selection
|
//- Update boolList from GUI selection
|
||||||
static void updateBoolListStatus
|
static void updateBoolListStatus
|
||||||
(
|
(
|
||||||
@ -294,10 +271,10 @@ class vtkPVblockMesh
|
|||||||
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
vtkPVblockMesh(const vtkPVblockMesh&);
|
vtkPVblockMesh(const vtkPVblockMesh&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const vtkPVblockMesh&);
|
void operator=(const vtkPVblockMesh&) = delete;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -234,7 +234,6 @@ void Foam::vtkPVblockMesh::convertMeshEdges
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// anything added?
|
// anything added?
|
||||||
if (datasetNo)
|
if (datasetNo)
|
||||||
{
|
{
|
||||||
@ -286,7 +285,7 @@ void Foam::vtkPVblockMesh::convertMeshCorners
|
|||||||
scaleFactor
|
scaleFactor
|
||||||
);
|
);
|
||||||
|
|
||||||
vtkcells->InsertNextCell(1, &pointId);
|
vtkcells->InsertNextCell(1, &pointId); // VTK_VERTEX
|
||||||
pointId++;
|
pointId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,11 +295,7 @@ void Foam::vtkPVblockMesh::convertMeshCorners
|
|||||||
vtkmesh->SetVerts(vtkcells);
|
vtkmesh->SetVerts(vtkcells);
|
||||||
vtkcells->Delete();
|
vtkcells->Delete();
|
||||||
|
|
||||||
AddToBlock
|
AddToBlock(output, vtkmesh, range, datasetNo, range.name());
|
||||||
(
|
|
||||||
output, vtkmesh, range, datasetNo,
|
|
||||||
arrayRangeCorners_.name()
|
|
||||||
);
|
|
||||||
vtkmesh->Delete();
|
vtkmesh->Delete();
|
||||||
|
|
||||||
datasetNo++;
|
datasetNo++;
|
||||||
|
@ -3,7 +3,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) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -126,47 +126,6 @@ void Foam::vtkPVblockMesh::AddToBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vtkDataSet* Foam::vtkPVblockMesh::GetDataSetFromBlock
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange& range,
|
|
||||||
const label datasetNo
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const int blockNo = range.block();
|
|
||||||
|
|
||||||
vtkDataObject* blockDO = output->GetBlock(blockNo);
|
|
||||||
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
|
|
||||||
|
|
||||||
if (block)
|
|
||||||
{
|
|
||||||
return vtkDataSet::SafeDownCast(block->GetBlock(datasetNo));
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ununsed at the moment
|
|
||||||
Foam::label Foam::vtkPVblockMesh::GetNumberOfDataSets
|
|
||||||
(
|
|
||||||
vtkMultiBlockDataSet* output,
|
|
||||||
const arrayRange& range
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const int blockNo = range.block();
|
|
||||||
|
|
||||||
vtkDataObject* blockDO = output->GetBlock(blockNo);
|
|
||||||
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
|
|
||||||
if (block)
|
|
||||||
{
|
|
||||||
return block->GetNumberOfBlocks();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::wordHashSet Foam::vtkPVblockMesh::getSelected
|
Foam::wordHashSet Foam::vtkPVblockMesh::getSelected
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* select
|
vtkDataArraySelection* select
|
||||||
|
Loading…
Reference in New Issue
Block a user