mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: avoid deprecated paraview method SetImmediateUpdate()
- add support for patch names in block mesh reader.
This commit is contained in:
@ -27,20 +27,17 @@
|
|||||||
</Documentation>
|
</Documentation>
|
||||||
</DoubleVectorProperty>
|
</DoubleVectorProperty>
|
||||||
|
|
||||||
<!-- Refresh button -->
|
<!-- Refresh (push button) -->
|
||||||
<IntVectorProperty animateable="0"
|
<Property
|
||||||
name="Refresh"
|
name="Refresh"
|
||||||
command="SetRefresh"
|
command="Refresh"
|
||||||
default_values="0"
|
|
||||||
number_of_elements="1"
|
|
||||||
panel_visibility="default">
|
panel_visibility="default">
|
||||||
<BooleanDomain name="bool"/>
|
<Documentation>Rescan for updated times/fields.</Documentation>
|
||||||
<Documentation>
|
</Property>
|
||||||
Rescan for updated times/fields.
|
|
||||||
</Documentation>
|
|
||||||
</IntVectorProperty>
|
|
||||||
|
|
||||||
<!-- Skip Zero Time check-box -->
|
<!-- General Controls -->
|
||||||
|
|
||||||
|
<!-- Skip Zero Time (check-box) -->
|
||||||
<IntVectorProperty animateable="0"
|
<IntVectorProperty animateable="0"
|
||||||
name="ZeroTime"
|
name="ZeroTime"
|
||||||
label="Skip Zero Time"
|
label="Skip Zero Time"
|
||||||
@ -54,7 +51,7 @@
|
|||||||
</Documentation>
|
</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Include Sets check-box -->
|
<!-- Include Sets (check-box) -->
|
||||||
<IntVectorProperty animateable="0"
|
<IntVectorProperty animateable="0"
|
||||||
name="IncludeSets"
|
name="IncludeSets"
|
||||||
command="SetIncludeSets"
|
command="SetIncludeSets"
|
||||||
@ -67,7 +64,7 @@
|
|||||||
</Documentation>
|
</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Include Zones check-box -->
|
<!-- Include Zones (check-box) -->
|
||||||
<IntVectorProperty animateable="0"
|
<IntVectorProperty animateable="0"
|
||||||
name="IncludeZones"
|
name="IncludeZones"
|
||||||
command="SetIncludeZones"
|
command="SetIncludeZones"
|
||||||
@ -81,7 +78,7 @@
|
|||||||
</Documentation>
|
</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Show Groups Only check-box -->
|
<!-- Show Groups Only (check-box) -->
|
||||||
<IntVectorProperty animateable="0"
|
<IntVectorProperty animateable="0"
|
||||||
name="ShowGroupsOnly"
|
name="ShowGroupsOnly"
|
||||||
label="Groups Only"
|
label="Groups Only"
|
||||||
@ -95,7 +92,7 @@
|
|||||||
</Documentation>
|
</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Show Patch Names check-box -->
|
<!-- Show Patch Names (check-box) -->
|
||||||
<IntVectorProperty animateable="0"
|
<IntVectorProperty animateable="0"
|
||||||
name="ShowPatchNames"
|
name="ShowPatchNames"
|
||||||
label="Patch Names"
|
label="Patch Names"
|
||||||
@ -109,7 +106,7 @@
|
|||||||
</Documentation>
|
</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Interpolate Fields check-box -->
|
<!-- Interpolate Fields (check-box) -->
|
||||||
<IntVectorProperty animateable="0"
|
<IntVectorProperty animateable="0"
|
||||||
name="InterpolateFields"
|
name="InterpolateFields"
|
||||||
command="SetInterpolateVolFields"
|
command="SetInterpolateVolFields"
|
||||||
@ -122,7 +119,7 @@
|
|||||||
</Documentation>
|
</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Extrapolate Patches check-box -->
|
<!-- Extrapolate Patches (check-box) -->
|
||||||
<IntVectorProperty animateable="0"
|
<IntVectorProperty animateable="0"
|
||||||
name="ExtrapolatePatches"
|
name="ExtrapolatePatches"
|
||||||
command="SetExtrapolatePatches"
|
command="SetExtrapolatePatches"
|
||||||
@ -135,7 +132,7 @@
|
|||||||
</Documentation>
|
</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Force GUI update check box -->
|
<!-- Force GUI update (check-box) -->
|
||||||
<IntVectorProperty animateable="0"
|
<IntVectorProperty animateable="0"
|
||||||
name="UpdateGUI"
|
name="UpdateGUI"
|
||||||
command="SetUpdateGUI"
|
command="SetUpdateGUI"
|
||||||
@ -148,7 +145,7 @@
|
|||||||
</Documentation>
|
</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Use VTK Polyhedron check-box -->
|
<!-- Use VTK Polyhedron (check-box) -->
|
||||||
<IntVectorProperty animateable="0"
|
<IntVectorProperty animateable="0"
|
||||||
name="UseVTKPolyhedron"
|
name="UseVTKPolyhedron"
|
||||||
label="Use VTK Polyhedron"
|
label="Use VTK Polyhedron"
|
||||||
@ -162,7 +159,7 @@
|
|||||||
</Documentation>
|
</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Cache Mesh check-box -->
|
<!-- Cache Mesh (check-box) -->
|
||||||
<IntVectorProperty animateable="0"
|
<IntVectorProperty animateable="0"
|
||||||
name="CacheMesh"
|
name="CacheMesh"
|
||||||
command="SetCacheMesh"
|
command="SetCacheMesh"
|
||||||
@ -175,9 +172,23 @@
|
|||||||
</Documentation>
|
</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!--
|
<PropertyGroup
|
||||||
| Selections
|
label="General Controls"
|
||||||
-->
|
panel_widget="openfoam_reader_general_controls">
|
||||||
|
<Property name="Refresh"/>
|
||||||
|
<Property name="ZeroTime"/>
|
||||||
|
<Property name="IncludeSets"/>
|
||||||
|
<Property name="IncludeZones"/>
|
||||||
|
<Property name="InterpolateFields"/>
|
||||||
|
<Property name="ExtrapolatePatches"/>
|
||||||
|
<Property name="ShowGroupsOnly"/>
|
||||||
|
<Property name="ShowPatchNames"/>
|
||||||
|
<Property name="UpdateGUI"/>
|
||||||
|
<Property name="UseVTKPolyhedron"/>
|
||||||
|
<Property name="CacheMesh"/>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Parts Selections -->
|
||||||
|
|
||||||
<!-- Available Parts (volume, patches, lagrangian) array -->
|
<!-- Available Parts (volume, patches, lagrangian) array -->
|
||||||
<StringVectorProperty
|
<StringVectorProperty
|
||||||
@ -204,6 +215,13 @@
|
|||||||
</Documentation>
|
</Documentation>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
|
<PropertyGroup label="Parts">
|
||||||
|
<Property name="PartArrayStatus"/>
|
||||||
|
<Property name="PartStatus"/>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Fields Selections -->
|
||||||
|
|
||||||
<!-- Available volFields array -->
|
<!-- Available volFields array -->
|
||||||
<StringVectorProperty
|
<StringVectorProperty
|
||||||
name="VolFieldArrayStatus"
|
name="VolFieldArrayStatus"
|
||||||
@ -273,6 +291,17 @@
|
|||||||
<Documentation>The list of point fields.</Documentation>
|
<Documentation>The list of point fields.</Documentation>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
|
<PropertyGroup label="Fields">
|
||||||
|
<Property name="VolFieldArrayStatus"/>
|
||||||
|
<Property name="VolFieldStatus"/>
|
||||||
|
<Property name="LagrangianFieldArrayStatus"/>
|
||||||
|
<Property name="LagrangianFieldStatus"/>
|
||||||
|
<Property name="PointFieldArrayStatus"/>
|
||||||
|
<Property name="PointFieldStatus"/>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Miscellaneous -->
|
||||||
|
|
||||||
<!-- Print button -->
|
<!-- Print button -->
|
||||||
<Property animateable="0"
|
<Property animateable="0"
|
||||||
name="PrintInfo"
|
name="PrintInfo"
|
||||||
@ -290,36 +319,6 @@
|
|||||||
file_description="OpenFOAM reader module" />
|
file_description="OpenFOAM reader module" />
|
||||||
</Hints>
|
</Hints>
|
||||||
|
|
||||||
<PropertyGroup
|
|
||||||
label="General Controls"
|
|
||||||
panel_widget="openfoam_reader_general_controls">
|
|
||||||
<Property name="Refresh"/>
|
|
||||||
<Property name="ZeroTime"/>
|
|
||||||
<Property name="IncludeSets"/>
|
|
||||||
<Property name="IncludeZones"/>
|
|
||||||
<Property name="InterpolateFields"/>
|
|
||||||
<Property name="ExtrapolatePatches"/>
|
|
||||||
<Property name="ShowGroupsOnly"/>
|
|
||||||
<Property name="ShowPatchNames"/>
|
|
||||||
<Property name="UpdateGUI"/>
|
|
||||||
<Property name="UseVTKPolyhedron"/>
|
|
||||||
<Property name="CacheMesh"/>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup label="Parts">
|
|
||||||
<Property name="PartArrayStatus"/>
|
|
||||||
<Property name="PartStatus"/>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup label="Fields">
|
|
||||||
<Property name="VolFieldArrayStatus"/>
|
|
||||||
<Property name="VolFieldStatus"/>
|
|
||||||
<Property name="LagrangianFieldArrayStatus"/>
|
|
||||||
<Property name="LagrangianFieldStatus"/>
|
|
||||||
<Property name="PointFieldArrayStatus"/>
|
|
||||||
<Property name="PointFieldStatus"/>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</SourceProxy>
|
</SourceProxy>
|
||||||
</ProxyGroup>
|
</ProxyGroup>
|
||||||
</ServerManagerConfiguration>
|
</ServerManagerConfiguration>
|
||||||
|
|||||||
@ -30,7 +30,7 @@ License
|
|||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
#include "pqApplicationCore.h"
|
#include "pqPVApplicationCore.h"
|
||||||
#include "pqPipelineRepresentation.h"
|
#include "pqPipelineRepresentation.h"
|
||||||
#include "pqView.h"
|
#include "pqView.h"
|
||||||
#include "vtkSMDocumentation.h"
|
#include "vtkSMDocumentation.h"
|
||||||
@ -45,8 +45,7 @@ License
|
|||||||
static QAbstractButton* setButtonProperties
|
static QAbstractButton* setButtonProperties
|
||||||
(
|
(
|
||||||
QAbstractButton* b,
|
QAbstractButton* b,
|
||||||
vtkSMIntVectorProperty* prop,
|
vtkSMProperty* prop
|
||||||
bool initChecked = true
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
QString tip;
|
QString tip;
|
||||||
@ -68,10 +67,13 @@ static QAbstractButton* setButtonProperties
|
|||||||
}
|
}
|
||||||
b->setFocusPolicy(Qt::NoFocus); // avoid dotted border
|
b->setFocusPolicy(Qt::NoFocus); // avoid dotted border
|
||||||
|
|
||||||
// initial checked state
|
vtkSMIntVectorProperty* intProp =
|
||||||
if (initChecked)
|
vtkSMIntVectorProperty::SafeDownCast(prop);
|
||||||
|
|
||||||
|
// initial checked state for integer (bool) properties
|
||||||
|
if (intProp)
|
||||||
{
|
{
|
||||||
b->setChecked(prop->GetElement(0));
|
b->setChecked(intProp->GetElement(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
@ -97,19 +99,27 @@ static vtkSMIntVectorProperty* lookupIntProp
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void pqFoamReaderControls::updatePartsStatus()
|
void pqFoamReaderControls::fireCommand
|
||||||
|
(
|
||||||
|
vtkSMIntVectorProperty* prop,
|
||||||
|
bool checked
|
||||||
|
)
|
||||||
{
|
{
|
||||||
vtkSMProperty* prop = this->proxy()->GetProperty("PartArrayStatus");
|
vtkSMProxy* pxy = this->proxy();
|
||||||
if (prop)
|
|
||||||
{
|
prop->SetElement(0, checked); // Toogle bool
|
||||||
this->proxy()->UpdatePropertyInformation(prop);
|
|
||||||
}
|
// Fire off command
|
||||||
|
prop->Modified();
|
||||||
|
pxy->UpdateProperty(pxy->GetPropertyName(prop));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pqFoamReaderControls::updatePartsStatus(bool)
|
void pqFoamReaderControls::updateParts()
|
||||||
{
|
{
|
||||||
updatePartsStatus();
|
vtkSMProxy* pxy = this->proxy();
|
||||||
|
|
||||||
|
pxy->UpdatePropertyInformation(pxy->GetProperty("PartArrayStatus"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -117,25 +127,28 @@ void pqFoamReaderControls::updatePartsStatus(bool)
|
|||||||
|
|
||||||
void pqFoamReaderControls::refreshPressed()
|
void pqFoamReaderControls::refreshPressed()
|
||||||
{
|
{
|
||||||
// Update everything
|
vtkSMProxy* pxy = this->proxy();
|
||||||
|
|
||||||
|
// Fire off command
|
||||||
refresh_->Modified();
|
refresh_->Modified();
|
||||||
|
pxy->UpdateProperty(pxy->GetPropertyName(refresh_));
|
||||||
|
|
||||||
vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline();
|
vtkSMSourceProxy::SafeDownCast(pxy)->UpdatePipeline();
|
||||||
|
|
||||||
// Update all views
|
// Trigger a rendering (all views)
|
||||||
pqApplicationCore::instance()->render();
|
pqPVApplicationCore::instance()->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pqFoamReaderControls::cacheMesh(bool checked)
|
void pqFoamReaderControls::cacheMesh(bool checked)
|
||||||
{
|
{
|
||||||
cacheMesh_->SetElement(0, checked);
|
fireCommand(cacheMesh_, checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pqFoamReaderControls::showPatchNames(bool checked)
|
void pqFoamReaderControls::showPatchNames(bool checked)
|
||||||
{
|
{
|
||||||
showPatchNames_->SetElement(0, checked);
|
fireCommand(showPatchNames_, checked);
|
||||||
|
|
||||||
// update the active view
|
// update the active view
|
||||||
if (this->view())
|
if (this->view())
|
||||||
@ -143,28 +156,28 @@ void pqFoamReaderControls::showPatchNames(bool checked)
|
|||||||
this->view()->render();
|
this->view()->render();
|
||||||
}
|
}
|
||||||
// OR: update all views
|
// OR: update all views
|
||||||
// pqApplicationCore::instance()->render();
|
// pqPVApplicationCore::instance()->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pqFoamReaderControls::showGroupsOnly(bool checked)
|
void pqFoamReaderControls::showGroupsOnly(bool checked)
|
||||||
{
|
{
|
||||||
showGroupsOnly_->SetElement(0, checked);
|
fireCommand(showGroupsOnly_, checked);
|
||||||
updatePartsStatus();
|
updateParts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pqFoamReaderControls::includeSets(bool checked)
|
void pqFoamReaderControls::includeSets(bool checked)
|
||||||
{
|
{
|
||||||
includeSets_->SetElement(0, checked);
|
fireCommand(includeSets_, checked);
|
||||||
updatePartsStatus();
|
updateParts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pqFoamReaderControls::includeZones(bool checked)
|
void pqFoamReaderControls::includeZones(bool checked)
|
||||||
{
|
{
|
||||||
includeZones_->SetElement(0, checked);
|
fireCommand(includeZones_, checked);
|
||||||
updatePartsStatus();
|
updateParts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -178,7 +191,7 @@ pqFoamReaderControls::pqFoamReaderControls
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
Superclass(proxy, parent),
|
Superclass(proxy, parent),
|
||||||
refresh_(lookupIntProp(group, "Refresh")),
|
refresh_(group->GetProperty("Refresh")),
|
||||||
showPatchNames_(lookupIntProp(group, "ShowPatchNames")),
|
showPatchNames_(lookupIntProp(group, "ShowPatchNames")),
|
||||||
showGroupsOnly_(lookupIntProp(group, "ShowGroupsOnly")),
|
showGroupsOnly_(lookupIntProp(group, "ShowGroupsOnly")),
|
||||||
includeSets_(lookupIntProp(group, "IncludeSets")),
|
includeSets_(lookupIntProp(group, "IncludeSets")),
|
||||||
@ -196,11 +209,10 @@ pqFoamReaderControls::pqFoamReaderControls
|
|||||||
if (refresh_)
|
if (refresh_)
|
||||||
{
|
{
|
||||||
QPushButton* b = new QPushButton(this);
|
QPushButton* b = new QPushButton(this);
|
||||||
setButtonProperties(b, refresh_, false);
|
setButtonProperties(b, refresh_);
|
||||||
form->addWidget(b, row, 0, Qt::AlignLeft);
|
form->addWidget(b, row, 0, Qt::AlignLeft);
|
||||||
|
|
||||||
connect(b, SIGNAL(clicked()), this, SLOT(refreshPressed()));
|
connect(b, SIGNAL(clicked()), this, SLOT(refreshPressed()));
|
||||||
refresh_->SetImmediateUpdate(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
intProp* zeroTime = lookupIntProp(group, "ZeroTime");
|
intProp* zeroTime = lookupIntProp(group, "ZeroTime");
|
||||||
@ -233,9 +245,7 @@ pqFoamReaderControls::pqFoamReaderControls
|
|||||||
form->addWidget(b, row, 0, Qt::AlignLeft);
|
form->addWidget(b, row, 0, Qt::AlignLeft);
|
||||||
|
|
||||||
addPropertyLink(b, "checked", SIGNAL(toggled(bool)), includeSets_);
|
addPropertyLink(b, "checked", SIGNAL(toggled(bool)), includeSets_);
|
||||||
|
|
||||||
connect(b, SIGNAL(toggled(bool)), this, SLOT(includeSets(bool)));
|
connect(b, SIGNAL(toggled(bool)), this, SLOT(includeSets(bool)));
|
||||||
includeSets_->SetImmediateUpdate(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showGroupsOnly_)
|
if (showGroupsOnly_)
|
||||||
@ -245,9 +255,7 @@ pqFoamReaderControls::pqFoamReaderControls
|
|||||||
form->addWidget(b, row, 1, Qt::AlignLeft);
|
form->addWidget(b, row, 1, Qt::AlignLeft);
|
||||||
|
|
||||||
addPropertyLink(b, "checked", SIGNAL(toggled(bool)), showGroupsOnly_);
|
addPropertyLink(b, "checked", SIGNAL(toggled(bool)), showGroupsOnly_);
|
||||||
|
|
||||||
connect(b, SIGNAL(toggled(bool)), this, SLOT(showGroupsOnly(bool)));
|
connect(b, SIGNAL(toggled(bool)), this, SLOT(showGroupsOnly(bool)));
|
||||||
showGroupsOnly_->SetImmediateUpdate(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -262,9 +270,7 @@ pqFoamReaderControls::pqFoamReaderControls
|
|||||||
form->addWidget(b, row, 0, Qt::AlignLeft);
|
form->addWidget(b, row, 0, Qt::AlignLeft);
|
||||||
|
|
||||||
addPropertyLink(b, "checked", SIGNAL(toggled(bool)), includeZones_);
|
addPropertyLink(b, "checked", SIGNAL(toggled(bool)), includeZones_);
|
||||||
|
|
||||||
connect(b, SIGNAL(toggled(bool)), this, SLOT(includeZones(bool)));
|
connect(b, SIGNAL(toggled(bool)), this, SLOT(includeZones(bool)));
|
||||||
includeZones_->SetImmediateUpdate(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showPatchNames_)
|
if (showPatchNames_)
|
||||||
@ -274,7 +280,6 @@ pqFoamReaderControls::pqFoamReaderControls
|
|||||||
form->addWidget(b, row, 1, Qt::AlignLeft);
|
form->addWidget(b, row, 1, Qt::AlignLeft);
|
||||||
|
|
||||||
connect(b, SIGNAL(toggled(bool)), this, SLOT(showPatchNames(bool)));
|
connect(b, SIGNAL(toggled(bool)), this, SLOT(showPatchNames(bool)));
|
||||||
showPatchNames_->SetImmediateUpdate(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// LINE
|
// LINE
|
||||||
@ -327,7 +332,7 @@ pqFoamReaderControls::pqFoamReaderControls
|
|||||||
if (updateGui)
|
if (updateGui)
|
||||||
{
|
{
|
||||||
QPushButton* b = new QPushButton(this);
|
QPushButton* b = new QPushButton(this);
|
||||||
setButtonProperties(b, updateGui, false);
|
setButtonProperties(b, updateGui);
|
||||||
form->addWidget(b, row, 0, Qt::AlignLeft);
|
form->addWidget(b, row, 0, Qt::AlignLeft);
|
||||||
|
|
||||||
addPropertyLink(b, "checked", SIGNAL(clicked()), updateGui);
|
addPropertyLink(b, "checked", SIGNAL(clicked()), updateGui);
|
||||||
@ -350,7 +355,6 @@ pqFoamReaderControls::pqFoamReaderControls
|
|||||||
form->addWidget(b, row, 2, Qt::AlignLeft);
|
form->addWidget(b, row, 2, Qt::AlignLeft);
|
||||||
|
|
||||||
connect(b, SIGNAL(toggled(bool)), this, SLOT(cacheMesh(bool)));
|
connect(b, SIGNAL(toggled(bool)), this, SLOT(cacheMesh(bool)));
|
||||||
cacheMesh_->SetImmediateUpdate(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,7 @@ SourceFiles
|
|||||||
#include "pqPropertyWidget.h"
|
#include "pqPropertyWidget.h"
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
|
class vtkSMProperty;
|
||||||
class vtkSMIntVectorProperty;
|
class vtkSMIntVectorProperty;
|
||||||
|
|
||||||
|
|
||||||
@ -53,8 +54,8 @@ class pqFoamReaderControls
|
|||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Refresh (bool property - as push button)
|
//- Refresh (push button)
|
||||||
vtkSMIntVectorProperty* refresh_;
|
vtkSMProperty* refresh_;
|
||||||
|
|
||||||
//- Show Patch Names (bool property)
|
//- Show Patch Names (bool property)
|
||||||
vtkSMIntVectorProperty* showPatchNames_;
|
vtkSMIntVectorProperty* showPatchNames_;
|
||||||
@ -72,15 +73,28 @@ class pqFoamReaderControls
|
|||||||
vtkSMIntVectorProperty* cacheMesh_;
|
vtkSMIntVectorProperty* cacheMesh_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Update property
|
||||||
|
void fireCommand(vtkSMProperty* prop);
|
||||||
|
|
||||||
|
//- Toggle and update bool property
|
||||||
|
void fireCommand(vtkSMIntVectorProperty* prop, bool checked);
|
||||||
|
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
pqFoamReaderControls(const pqFoamReaderControls&) = delete;
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const pqFoamReaderControls&) = delete;
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Update "PartArrayStatus" property information
|
//- Update "PartArrayStatus" property information
|
||||||
void updatePartsStatus();
|
void updateParts();
|
||||||
|
|
||||||
//- Update "PartArrayStatus" property information
|
|
||||||
void updatePartsStatus(bool unused);
|
|
||||||
|
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|||||||
@ -80,7 +80,6 @@ vtkPVFoamReader::vtkPVFoamReader()
|
|||||||
TimeStepRange[1] = 0;
|
TimeStepRange[1] = 0;
|
||||||
|
|
||||||
CacheMesh = true;
|
CacheMesh = true;
|
||||||
Refresh = false;
|
|
||||||
|
|
||||||
SkipZeroTime = false;
|
SkipZeroTime = false;
|
||||||
ExtrapolatePatches = false;
|
ExtrapolatePatches = false;
|
||||||
@ -138,9 +137,11 @@ vtkPVFoamReader::~vtkPVFoamReader()
|
|||||||
|
|
||||||
if (backend_)
|
if (backend_)
|
||||||
{
|
{
|
||||||
// remove patch names
|
// Remove text actors
|
||||||
updatePatchNamesView(false);
|
updatePatchNamesView(false);
|
||||||
|
|
||||||
delete backend_;
|
delete backend_;
|
||||||
|
backend_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileName)
|
if (FileName)
|
||||||
@ -202,13 +203,13 @@ int vtkPVFoamReader::RequestInformation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!backend_)
|
if (backend_)
|
||||||
{
|
{
|
||||||
backend_ = new Foam::vtkPVFoam(FileName, this);
|
backend_->updateInfo();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
backend_->updateInfo();
|
backend_ = new Foam::vtkPVFoam(FileName, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<double> times = backend_->findTimes(this->SkipZeroTime);
|
std::vector<double> times = backend_->findTimes(this->SkipZeroTime);
|
||||||
@ -450,7 +451,7 @@ void vtkPVFoamReader::PrintInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVFoamReader::SetRefresh(bool val)
|
void vtkPVFoamReader::Refresh()
|
||||||
{
|
{
|
||||||
Modified();
|
Modified();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,7 +88,7 @@ public:
|
|||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// OpenFOAM refresh times/fields
|
// OpenFOAM refresh times/fields
|
||||||
virtual void SetRefresh(bool);
|
virtual void Refresh();
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// OpenFOAM skip/include the 0/ time directory
|
// OpenFOAM skip/include the 0/ time directory
|
||||||
@ -231,7 +231,6 @@ private:
|
|||||||
void updatePatchNamesView(const bool show);
|
void updatePatchNamesView(const bool show);
|
||||||
|
|
||||||
int TimeStepRange[2];
|
int TimeStepRange[2];
|
||||||
bool Refresh;
|
|
||||||
bool CacheMesh;
|
bool CacheMesh;
|
||||||
bool SkipZeroTime;
|
bool SkipZeroTime;
|
||||||
|
|
||||||
|
|||||||
@ -45,6 +45,35 @@ namespace Foam
|
|||||||
defineTypeNameAndDebug(vtkPVFoam, 0);
|
defineTypeNameAndDebug(vtkPVFoam, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
vtkTextActor* Foam::vtkPVFoam::createTextActor
|
||||||
|
(
|
||||||
|
const string& s,
|
||||||
|
const point& pt
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vtkTextActor* txt = vtkTextActor::New();
|
||||||
|
txt->SetInput(s.c_str());
|
||||||
|
|
||||||
|
// Set text properties
|
||||||
|
vtkTextProperty* tprop = txt->GetTextProperty();
|
||||||
|
tprop->SetFontFamilyToArial();
|
||||||
|
tprop->BoldOn();
|
||||||
|
tprop->ShadowOff();
|
||||||
|
tprop->SetLineSpacing(1.0);
|
||||||
|
tprop->SetFontSize(14);
|
||||||
|
tprop->SetColor(1.0, 0.0, 1.0);
|
||||||
|
tprop->SetJustificationToCentered();
|
||||||
|
|
||||||
|
txt->GetPositionCoordinate()->SetCoordinateSystemToWorld();
|
||||||
|
txt->GetPositionCoordinate()->SetValue(pt.x(), pt.y(), pt.z());
|
||||||
|
|
||||||
|
return txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::vtkPVFoam::resetCounters()
|
void Foam::vtkPVFoam::resetCounters()
|
||||||
@ -606,11 +635,6 @@ void Foam::vtkPVFoam::renderPatchNames
|
|||||||
const bool show
|
const bool show
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!meshPtr_)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// always remove old actors first
|
// always remove old actors first
|
||||||
|
|
||||||
forAll(patchTextActorsPtrs_, patchi)
|
forAll(patchTextActorsPtrs_, patchi)
|
||||||
@ -620,7 +644,7 @@ void Foam::vtkPVFoam::renderPatchNames
|
|||||||
}
|
}
|
||||||
patchTextActorsPtrs_.clear();
|
patchTextActorsPtrs_.clear();
|
||||||
|
|
||||||
if (show)
|
if (show && meshPtr_)
|
||||||
{
|
{
|
||||||
// get the display patches, strip off any suffix
|
// get the display patches, strip off any suffix
|
||||||
hashedWordList selectedPatches = getSelected
|
hashedWordList selectedPatches = getSelected
|
||||||
@ -737,17 +761,16 @@ void Foam::vtkPVFoam::renderPatchNames
|
|||||||
{
|
{
|
||||||
const polyPatch& pp = pbMesh[patchi];
|
const polyPatch& pp = pbMesh[patchi];
|
||||||
|
|
||||||
label globalZoneI = 0;
|
|
||||||
|
|
||||||
// Only selected patches will have a non-zero number of zones
|
// Only selected patches will have a non-zero number of zones
|
||||||
label nDisplayZones = min(MAXPATCHZONES, nZones[patchi]);
|
const label nDisplayZones = min(MAXPATCHZONES, nZones[patchi]);
|
||||||
label increment = 1;
|
label increment = 1;
|
||||||
if (nZones[patchi] >= MAXPATCHZONES)
|
if (nZones[patchi] >= MAXPATCHZONES)
|
||||||
{
|
{
|
||||||
increment = nZones[patchi]/MAXPATCHZONES;
|
increment = nZones[patchi]/MAXPATCHZONES;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (label i = 0; i < nDisplayZones; i++)
|
label globalZoneI = 0;
|
||||||
|
for (label i = 0; i < nDisplayZones; ++i, globalZoneI += increment)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -756,45 +779,24 @@ void Foam::vtkPVFoam::renderPatchNames
|
|||||||
<< "globalZoneI = " << globalZoneI << endl;
|
<< "globalZoneI = " << globalZoneI << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkTextActor* txt = vtkTextActor::New();
|
// Into a list for later removal
|
||||||
|
patchTextActorsPtrs_[displayZoneI++] = createTextActor
|
||||||
txt->SetInput(pp.name().c_str());
|
|
||||||
|
|
||||||
// Set text properties
|
|
||||||
vtkTextProperty* tprop = txt->GetTextProperty();
|
|
||||||
tprop->SetFontFamilyToArial();
|
|
||||||
tprop->BoldOff();
|
|
||||||
tprop->ShadowOff();
|
|
||||||
tprop->SetLineSpacing(1.0);
|
|
||||||
tprop->SetFontSize(14);
|
|
||||||
tprop->SetColor(1.0, 0.0, 1.0);
|
|
||||||
tprop->SetJustificationToCentered();
|
|
||||||
|
|
||||||
// Set text to use 3-D world co-ordinates
|
|
||||||
txt->GetPositionCoordinate()->SetCoordinateSystemToWorld();
|
|
||||||
|
|
||||||
txt->GetPositionCoordinate()->SetValue
|
|
||||||
(
|
(
|
||||||
zoneCentre[patchi][globalZoneI].x(),
|
pp.name(),
|
||||||
zoneCentre[patchi][globalZoneI].y(),
|
zoneCentre[patchi][globalZoneI]
|
||||||
zoneCentre[patchi][globalZoneI].z()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add text to each renderer
|
|
||||||
renderer->AddViewProp(txt);
|
|
||||||
|
|
||||||
// Maintain a list of text labels added so that they can be
|
|
||||||
// removed later
|
|
||||||
patchTextActorsPtrs_[displayZoneI] = txt;
|
|
||||||
|
|
||||||
globalZoneI += increment;
|
|
||||||
displayZoneI++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize the patch names list to the actual number of patch names added
|
// Resize the patch names list to the actual number of patch names added
|
||||||
patchTextActorsPtrs_.setSize(displayZoneI);
|
patchTextActorsPtrs_.setSize(displayZoneI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add text to each renderer
|
||||||
|
forAll(patchTextActorsPtrs_, actori)
|
||||||
|
{
|
||||||
|
renderer->AddViewProp(patchTextActorsPtrs_[actori]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -223,6 +223,9 @@ class vtkPVFoam
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Create a text actor
|
||||||
|
static vtkTextActor* createTextActor(const string& s, const point& pt);
|
||||||
|
|
||||||
//- Reset data counters
|
//- Reset data counters
|
||||||
void resetCounters();
|
void resetCounters();
|
||||||
|
|
||||||
|
|||||||
@ -14,20 +14,32 @@
|
|||||||
<Documentation>The filename for the OpenFOAM blockMesh reader.</Documentation>
|
<Documentation>The filename for the OpenFOAM blockMesh reader.</Documentation>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
<!-- Refresh button (push button) -->
|
<!-- Refresh (push button) -->
|
||||||
<IntVectorProperty animateable="0"
|
<Property
|
||||||
name="Refresh"
|
name="Refresh"
|
||||||
command="SetRefresh"
|
command="Refresh"
|
||||||
|
panel_visibility="default">
|
||||||
|
<Documentation>Rescan for updated blockMeshDict.</Documentation>
|
||||||
|
</Property>
|
||||||
|
|
||||||
|
<!-- General Controls -->
|
||||||
|
|
||||||
|
<!-- Show Patch Names (check-box) -->
|
||||||
|
<IntVectorProperty animateable="0"
|
||||||
|
name="ShowPatchNames"
|
||||||
|
label="Patch Names"
|
||||||
|
command="SetShowPatchNames"
|
||||||
default_values="0"
|
default_values="0"
|
||||||
number_of_elements="1"
|
number_of_elements="1"
|
||||||
panel_visibility="default">
|
panel_visibility="default">
|
||||||
<BooleanDomain name="bool"/>
|
<BooleanDomain name="bool"/>
|
||||||
<Documentation>Rescan for updated blockMeshDict.</Documentation>
|
<Documentation>Show patch names in render window.</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!-- Show Point Numbers (check-box) -->
|
<!-- Show Point Numbers (check-box) -->
|
||||||
<IntVectorProperty animateable="0"
|
<IntVectorProperty animateable="0"
|
||||||
name="ShowPointNumbers"
|
name="ShowPointNumbers"
|
||||||
|
label="Point Numbers"
|
||||||
command="SetShowPointNumbers"
|
command="SetShowPointNumbers"
|
||||||
default_values="1"
|
default_values="1"
|
||||||
number_of_elements="1"
|
number_of_elements="1"
|
||||||
@ -36,9 +48,15 @@
|
|||||||
<Documentation>Show point numbers in render window.</Documentation>
|
<Documentation>Show point numbers in render window.</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
<!--
|
<PropertyGroup
|
||||||
| Selections
|
label="General Controls"
|
||||||
-->
|
panel_widget="openfoam_blockMesh_general_controls">
|
||||||
|
<Property name="Refresh"/>
|
||||||
|
<Property name="ShowPatchNames"/>
|
||||||
|
<Property name="ShowPointNumbers"/>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Selections -->
|
||||||
|
|
||||||
<!-- Available Blocks array -->
|
<!-- Available Blocks array -->
|
||||||
<StringVectorProperty
|
<StringVectorProperty
|
||||||
@ -86,19 +104,6 @@
|
|||||||
<Documentation>The list of curved edges</Documentation>
|
<Documentation>The list of curved edges</Documentation>
|
||||||
</StringVectorProperty>
|
</StringVectorProperty>
|
||||||
|
|
||||||
<Hints>
|
|
||||||
<ReaderFactory
|
|
||||||
extensions="blockMesh"
|
|
||||||
file_description="OpenFOAM blockMesh"/>
|
|
||||||
</Hints>
|
|
||||||
|
|
||||||
<PropertyGroup
|
|
||||||
label="General Controls"
|
|
||||||
panel_widget="openfoam_blockMesh_general_controls">
|
|
||||||
<Property name="Refresh"/>
|
|
||||||
<Property name="ShowPointNumbers"/>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup label="Selections">
|
<PropertyGroup label="Selections">
|
||||||
<Property name="BlockArrayStatus"/>
|
<Property name="BlockArrayStatus"/>
|
||||||
<Property name="BlockStatus"/>
|
<Property name="BlockStatus"/>
|
||||||
@ -106,6 +111,12 @@
|
|||||||
<Property name="CurvedEdgesStatus"/>
|
<Property name="CurvedEdgesStatus"/>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Hints>
|
||||||
|
<ReaderFactory
|
||||||
|
extensions="blockMesh"
|
||||||
|
file_description="OpenFOAM blockMesh"/>
|
||||||
|
</Hints>
|
||||||
|
|
||||||
</SourceProxy>
|
</SourceProxy>
|
||||||
</ProxyGroup>
|
</ProxyGroup>
|
||||||
</ServerManagerConfiguration>
|
</ServerManagerConfiguration>
|
||||||
|
|||||||
@ -29,7 +29,7 @@ License
|
|||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
#include "pqApplicationCore.h"
|
#include "pqPVApplicationCore.h"
|
||||||
#include "pqView.h"
|
#include "pqView.h"
|
||||||
#include "vtkSMDocumentation.h"
|
#include "vtkSMDocumentation.h"
|
||||||
#include "vtkSMIntVectorProperty.h"
|
#include "vtkSMIntVectorProperty.h"
|
||||||
@ -43,8 +43,7 @@ License
|
|||||||
static QAbstractButton* setButtonProperties
|
static QAbstractButton* setButtonProperties
|
||||||
(
|
(
|
||||||
QAbstractButton* b,
|
QAbstractButton* b,
|
||||||
vtkSMIntVectorProperty* prop,
|
vtkSMProperty* prop
|
||||||
bool initChecked = true
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
QString tip;
|
QString tip;
|
||||||
@ -66,10 +65,14 @@ static QAbstractButton* setButtonProperties
|
|||||||
}
|
}
|
||||||
b->setFocusPolicy(Qt::NoFocus); // avoid dotted border
|
b->setFocusPolicy(Qt::NoFocus); // avoid dotted border
|
||||||
|
|
||||||
// initial checked state
|
|
||||||
if (initChecked)
|
vtkSMIntVectorProperty* intProp =
|
||||||
|
vtkSMIntVectorProperty::SafeDownCast(prop);
|
||||||
|
|
||||||
|
// initial checked state for integer (bool) properties
|
||||||
|
if (intProp)
|
||||||
{
|
{
|
||||||
b->setChecked(prop->GetElement(0));
|
b->setChecked(intProp->GetElement(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
@ -93,23 +96,61 @@ static vtkSMIntVectorProperty* lookupIntProp
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void pqFoamBlockMeshControls::fireCommand(vtkSMProperty* prop)
|
||||||
|
{
|
||||||
|
vtkSMProxy* pxy = this->proxy();
|
||||||
|
|
||||||
|
// Fire off command
|
||||||
|
prop->Modified();
|
||||||
|
pxy->UpdateProperty(pxy->GetPropertyName(prop));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pqFoamBlockMeshControls::fireCommand
|
||||||
|
(
|
||||||
|
vtkSMIntVectorProperty* prop,
|
||||||
|
bool checked
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vtkSMProxy* pxy = this->proxy();
|
||||||
|
|
||||||
|
prop->SetElement(0, checked); // Toogle bool
|
||||||
|
|
||||||
|
// Fire off command
|
||||||
|
prop->Modified();
|
||||||
|
pxy->UpdateProperty(pxy->GetPropertyName(prop));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pqFoamBlockMeshControls::updateParts()
|
||||||
|
{
|
||||||
|
vtkSMProxy* pxy = this->proxy();
|
||||||
|
|
||||||
|
pxy->UpdatePropertyInformation(pxy->GetProperty("BlockArrayStatus"));
|
||||||
|
pxy->UpdatePropertyInformation(pxy->GetProperty("CurvedEdgesArrayStatus"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void pqFoamBlockMeshControls::refreshPressed()
|
void pqFoamBlockMeshControls::refreshPressed()
|
||||||
{
|
{
|
||||||
// Update everything
|
fireCommand(refresh_);
|
||||||
refresh_->Modified();
|
|
||||||
|
|
||||||
vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline();
|
vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline();
|
||||||
|
|
||||||
// Render all views
|
// Trigger a rendering (all views)
|
||||||
pqApplicationCore::instance()->render();
|
pqPVApplicationCore::instance()->render();
|
||||||
|
|
||||||
|
updateParts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void pqFoamBlockMeshControls::showPointNumbers(bool checked)
|
void pqFoamBlockMeshControls::showPatchNames(bool checked)
|
||||||
{
|
{
|
||||||
showPointNumbers_->SetElement(0, checked);
|
fireCommand(showPatchNames_, checked);
|
||||||
|
|
||||||
// Update the active view
|
// Update the active view
|
||||||
if (this->view())
|
if (this->view())
|
||||||
@ -118,7 +159,22 @@ void pqFoamBlockMeshControls::showPointNumbers(bool checked)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// OR: update all views
|
// OR: update all views
|
||||||
// pqApplicationCore::instance()->render();
|
// pqPVApplicationCore::instance()->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pqFoamBlockMeshControls::showPointNumbers(bool checked)
|
||||||
|
{
|
||||||
|
fireCommand(showPointNumbers_, checked);
|
||||||
|
|
||||||
|
// Update the active view
|
||||||
|
if (this->view())
|
||||||
|
{
|
||||||
|
this->view()->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
// OR: update all views
|
||||||
|
// pqPVApplicationCore::instance()->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -132,7 +188,8 @@ pqFoamBlockMeshControls::pqFoamBlockMeshControls
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
Superclass(proxy, parent),
|
Superclass(proxy, parent),
|
||||||
refresh_(lookupIntProp(group, "Refresh")),
|
refresh_(group->GetProperty("Refresh")),
|
||||||
|
showPatchNames_(lookupIntProp(group, "ShowPatchNames")),
|
||||||
showPointNumbers_(lookupIntProp(group, "ShowPointNumbers"))
|
showPointNumbers_(lookupIntProp(group, "ShowPointNumbers"))
|
||||||
{
|
{
|
||||||
QGridLayout* form = new QGridLayout(this);
|
QGridLayout* form = new QGridLayout(this);
|
||||||
@ -140,21 +197,28 @@ pqFoamBlockMeshControls::pqFoamBlockMeshControls
|
|||||||
if (refresh_)
|
if (refresh_)
|
||||||
{
|
{
|
||||||
QPushButton* b = new QPushButton(this);
|
QPushButton* b = new QPushButton(this);
|
||||||
setButtonProperties(b, refresh_, false);
|
setButtonProperties(b, refresh_);
|
||||||
form->addWidget(b, 0, 0, Qt::AlignLeft);
|
form->addWidget(b, 0, 0, Qt::AlignLeft);
|
||||||
|
|
||||||
connect(b, SIGNAL(clicked()), this, SLOT(refreshPressed()));
|
connect(b, SIGNAL(clicked()), this, SLOT(refreshPressed()));
|
||||||
refresh_->SetImmediateUpdate(true);
|
}
|
||||||
|
|
||||||
|
if (showPatchNames_)
|
||||||
|
{
|
||||||
|
QCheckBox* b = new QCheckBox(this);
|
||||||
|
setButtonProperties(b, showPatchNames_);
|
||||||
|
form->addWidget(b, 0, 1, Qt::AlignLeft);
|
||||||
|
|
||||||
|
connect(b, SIGNAL(toggled(bool)), this, SLOT(showPatchNames(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showPointNumbers_)
|
if (showPointNumbers_)
|
||||||
{
|
{
|
||||||
QCheckBox* b = new QCheckBox(this);
|
QCheckBox* b = new QCheckBox(this);
|
||||||
setButtonProperties(b, showPointNumbers_);
|
setButtonProperties(b, showPointNumbers_);
|
||||||
form->addWidget(b, 0, 1, Qt::AlignLeft);
|
form->addWidget(b, 0, 2, Qt::AlignLeft);
|
||||||
|
|
||||||
connect(b, SIGNAL(toggled(bool)), this, SLOT(showPointNumbers(bool)));
|
connect(b, SIGNAL(toggled(bool)), this, SLOT(showPointNumbers(bool)));
|
||||||
showPointNumbers_->SetImmediateUpdate(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ Class
|
|||||||
Description
|
Description
|
||||||
Customized property controls for the ParaView blockMesh reader.
|
Customized property controls for the ParaView blockMesh reader.
|
||||||
|
|
||||||
Refresh and ShowPointNumbers.
|
Refresh, ShowPatchNames, ShowPointNumbers.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
pqFoamBlockMeshControls.cxx
|
pqFoamBlockMeshControls.cxx
|
||||||
@ -39,6 +39,7 @@ SourceFiles
|
|||||||
#include "pqPropertyWidget.h"
|
#include "pqPropertyWidget.h"
|
||||||
|
|
||||||
// Forward declarations (ParaView)
|
// Forward declarations (ParaView)
|
||||||
|
class vtkSMProperty;
|
||||||
class vtkSMIntVectorProperty;
|
class vtkSMIntVectorProperty;
|
||||||
|
|
||||||
|
|
||||||
@ -55,8 +56,11 @@ class pqFoamBlockMeshControls
|
|||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Refresh (bool property - as push button)
|
//- Refresh (push button)
|
||||||
vtkSMIntVectorProperty* refresh_;
|
vtkSMProperty* refresh_;
|
||||||
|
|
||||||
|
//- Show Patch Names (bool property)
|
||||||
|
vtkSMIntVectorProperty* showPatchNames_;
|
||||||
|
|
||||||
//- Show Point Numbers (bool property)
|
//- Show Point Numbers (bool property)
|
||||||
vtkSMIntVectorProperty* showPointNumbers_;
|
vtkSMIntVectorProperty* showPointNumbers_;
|
||||||
@ -64,6 +68,16 @@ class pqFoamBlockMeshControls
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Update property
|
||||||
|
void fireCommand(vtkSMProperty* prop);
|
||||||
|
|
||||||
|
//- Toggle and update bool property
|
||||||
|
void fireCommand(vtkSMIntVectorProperty* prop, bool checked);
|
||||||
|
|
||||||
|
//- Update "BlockArrayStatus", "CurvedEdgesArrayStatus" information
|
||||||
|
void updateParts();
|
||||||
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
pqFoamBlockMeshControls(const pqFoamBlockMeshControls&) = delete;
|
pqFoamBlockMeshControls(const pqFoamBlockMeshControls&) = delete;
|
||||||
|
|
||||||
@ -78,6 +92,9 @@ protected slots:
|
|||||||
//- Trigger refresh
|
//- Trigger refresh
|
||||||
void refreshPressed();
|
void refreshPressed();
|
||||||
|
|
||||||
|
//- Sync property with changed checkbox state, update rendered view(s)
|
||||||
|
void showPatchNames(bool checked);
|
||||||
|
|
||||||
//- Sync property with changed checkbox state, update rendered view(s)
|
//- Sync property with changed checkbox state, update rendered view(s)
|
||||||
void showPointNumbers(bool checked);
|
void showPointNumbers(bool checked);
|
||||||
|
|
||||||
|
|||||||
@ -59,6 +59,7 @@ vtkPVblockMeshReader::vtkPVblockMeshReader()
|
|||||||
FileName = nullptr;
|
FileName = nullptr;
|
||||||
backend_ = nullptr;
|
backend_ = nullptr;
|
||||||
|
|
||||||
|
ShowPatchNames = false;
|
||||||
ShowPointNumbers = true;
|
ShowPointNumbers = true;
|
||||||
|
|
||||||
BlockSelection = vtkDataArraySelection::New();
|
BlockSelection = vtkDataArraySelection::New();
|
||||||
@ -95,9 +96,12 @@ vtkPVblockMeshReader::~vtkPVblockMeshReader()
|
|||||||
|
|
||||||
if (backend_)
|
if (backend_)
|
||||||
{
|
{
|
||||||
// Remove point numbers
|
// Remove text actors
|
||||||
|
updatePatchNamesView(false);
|
||||||
updatePointNumbersView(false);
|
updatePointNumbersView(false);
|
||||||
|
|
||||||
delete backend_;
|
delete backend_;
|
||||||
|
backend_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileName)
|
if (FileName)
|
||||||
@ -110,6 +114,7 @@ vtkPVblockMeshReader::~vtkPVblockMeshReader()
|
|||||||
|
|
||||||
SelectionObserver->Delete();
|
SelectionObserver->Delete();
|
||||||
BlockSelection->Delete();
|
BlockSelection->Delete();
|
||||||
|
CurvedEdgesSelection->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -124,35 +129,25 @@ int vtkPVblockMeshReader::RequestInformation
|
|||||||
{
|
{
|
||||||
vtkDebugMacro(<<"RequestInformation");
|
vtkDebugMacro(<<"RequestInformation");
|
||||||
|
|
||||||
if (Foam::vtkPVblockMesh::debug)
|
|
||||||
{
|
|
||||||
cout<<"REQUEST_INFORMATION\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!FileName)
|
if (!FileName)
|
||||||
{
|
{
|
||||||
vtkErrorMacro("FileName has to be specified!");
|
vtkErrorMacro("FileName has to be specified!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nInfo = outputVector->GetNumberOfInformationObjects();
|
|
||||||
|
|
||||||
if (Foam::vtkPVblockMesh::debug)
|
if (Foam::vtkPVblockMesh::debug)
|
||||||
{
|
{
|
||||||
cout<<"RequestInformation with " << nInfo << " item(s)\n";
|
cout<<"REQUEST_INFORMATION\n";
|
||||||
for (int infoI = 0; infoI < nInfo; ++infoI)
|
outputVector->GetInformationObject(0)->Print(cout);
|
||||||
{
|
|
||||||
outputVector->GetInformationObject(infoI)->Print(cout);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!backend_)
|
if (backend_)
|
||||||
{
|
{
|
||||||
backend_ = new Foam::vtkPVblockMesh(FileName, this);
|
backend_->updateInfo();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
backend_->updateInfo();
|
backend_ = new Foam::vtkPVblockMesh(FileName, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -181,15 +176,10 @@ int vtkPVblockMeshReader::RequestData
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nInfo = outputVector->GetNumberOfInformationObjects();
|
|
||||||
|
|
||||||
if (Foam::vtkPVblockMesh::debug)
|
if (Foam::vtkPVblockMesh::debug)
|
||||||
{
|
{
|
||||||
cout<<"RequestData with " << nInfo << " item(s)\n";
|
cout<<"REQUEST_DATA:\n";
|
||||||
for (int infoI = 0; infoI < nInfo; ++infoI)
|
outputVector->GetInformationObject(0)->Print(cout);
|
||||||
{
|
|
||||||
outputVector->GetInformationObject(infoI)->Print(cout);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
|
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::SafeDownCast
|
||||||
@ -207,6 +197,8 @@ int vtkPVblockMeshReader::RequestData
|
|||||||
}
|
}
|
||||||
|
|
||||||
backend_->Update(output);
|
backend_->Update(output);
|
||||||
|
|
||||||
|
updatePatchNamesView(ShowPatchNames);
|
||||||
updatePointNumbersView(ShowPointNumbers);
|
updatePointNumbersView(ShowPointNumbers);
|
||||||
|
|
||||||
// Do any cleanup on the OpenFOAM side
|
// Do any cleanup on the OpenFOAM side
|
||||||
@ -216,17 +208,30 @@ int vtkPVblockMeshReader::RequestData
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVblockMeshReader::SetRefresh(bool val)
|
void vtkPVblockMeshReader::Refresh()
|
||||||
{
|
{
|
||||||
// Delete the current blockMesh to force re-read and update
|
// Delete the current blockMesh to force re-read and update
|
||||||
if (backend_)
|
if (backend_)
|
||||||
{
|
{
|
||||||
|
// Remove text actors
|
||||||
|
updatePatchNamesView(false);
|
||||||
updatePointNumbersView(false);
|
updatePointNumbersView(false);
|
||||||
|
|
||||||
delete backend_;
|
delete backend_;
|
||||||
backend_ = nullptr;
|
backend_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Modified();
|
this->Modified();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vtkPVblockMeshReader::SetShowPatchNames(bool val)
|
||||||
|
{
|
||||||
|
if (ShowPatchNames != val)
|
||||||
|
{
|
||||||
|
ShowPatchNames = val;
|
||||||
|
updatePatchNamesView(ShowPatchNames);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -240,6 +245,38 @@ void vtkPVblockMeshReader::SetShowPointNumbers(bool val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vtkPVblockMeshReader::updatePatchNamesView(const bool show)
|
||||||
|
{
|
||||||
|
pqApplicationCore* appCore = pqApplicationCore::instance();
|
||||||
|
|
||||||
|
// Need to check this, since our destructor calls this
|
||||||
|
if (!appCore)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Server manager model for querying items in the server manager
|
||||||
|
pqServerManagerModel* smModel = appCore->getServerManagerModel();
|
||||||
|
if (!smModel || !backend_)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get all the pqRenderView instances
|
||||||
|
QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
|
||||||
|
for (int viewI=0; viewI<renderViews.size(); ++viewI)
|
||||||
|
{
|
||||||
|
backend_->renderPatchNames
|
||||||
|
(
|
||||||
|
renderViews[viewI]->getRenderViewProxy()->GetRenderer(),
|
||||||
|
show
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use refresh here?
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVblockMeshReader::updatePointNumbersView(const bool show)
|
void vtkPVblockMeshReader::updatePointNumbersView(const bool show)
|
||||||
{
|
{
|
||||||
pqApplicationCore* appCore = pqApplicationCore::instance();
|
pqApplicationCore* appCore = pqApplicationCore::instance();
|
||||||
@ -257,7 +294,6 @@ void vtkPVblockMeshReader::updatePointNumbersView(const bool show)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get all the pqRenderView instances
|
// Get all the pqRenderView instances
|
||||||
QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
|
QList<pqRenderView*> renderViews = smModel->findItems<pqRenderView*>();
|
||||||
for (int viewI=0; viewI<renderViews.size(); ++viewI)
|
for (int viewI=0; viewI<renderViews.size(); ++viewI)
|
||||||
@ -290,39 +326,30 @@ void vtkPVblockMeshReader::PrintSelf(ostream& os, vtkIndent indent)
|
|||||||
|
|
||||||
vtkDataArraySelection* vtkPVblockMeshReader::GetBlockSelection()
|
vtkDataArraySelection* vtkPVblockMeshReader::GetBlockSelection()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetBlockSelection");
|
|
||||||
return BlockSelection;
|
return BlockSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVblockMeshReader::GetNumberOfBlockArrays()
|
int vtkPVblockMeshReader::GetNumberOfBlockArrays()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetNumberOfBlockArrays");
|
|
||||||
return BlockSelection->GetNumberOfArrays();
|
return BlockSelection->GetNumberOfArrays();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* vtkPVblockMeshReader::GetBlockArrayName(int index)
|
const char* vtkPVblockMeshReader::GetBlockArrayName(int index)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetBlockArrayName");
|
|
||||||
return BlockSelection->GetArrayName(index);
|
return BlockSelection->GetArrayName(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVblockMeshReader::GetBlockArrayStatus(const char* name)
|
int vtkPVblockMeshReader::GetBlockArrayStatus(const char* name)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetBlockArrayStatus");
|
|
||||||
return BlockSelection->ArrayIsEnabled(name);
|
return BlockSelection->ArrayIsEnabled(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVblockMeshReader::SetBlockArrayStatus
|
void vtkPVblockMeshReader::SetBlockArrayStatus
|
||||||
(
|
(
|
||||||
const char* name,
|
const char* name,
|
||||||
int status
|
int status
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"SetBlockArrayStatus");
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
BlockSelection->EnableArray(name);
|
BlockSelection->EnableArray(name);
|
||||||
@ -339,39 +366,30 @@ void vtkPVblockMeshReader::SetBlockArrayStatus
|
|||||||
|
|
||||||
vtkDataArraySelection* vtkPVblockMeshReader::GetCurvedEdgesSelection()
|
vtkDataArraySelection* vtkPVblockMeshReader::GetCurvedEdgesSelection()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetCurvedEdgesSelection");
|
|
||||||
return CurvedEdgesSelection;
|
return CurvedEdgesSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVblockMeshReader::GetNumberOfCurvedEdgesArrays()
|
int vtkPVblockMeshReader::GetNumberOfCurvedEdgesArrays()
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetNumberOfCurvedEdgesArrays");
|
|
||||||
return CurvedEdgesSelection->GetNumberOfArrays();
|
return CurvedEdgesSelection->GetNumberOfArrays();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* vtkPVblockMeshReader::GetCurvedEdgesArrayName(int index)
|
const char* vtkPVblockMeshReader::GetCurvedEdgesArrayName(int index)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetCurvedEdgesArrayName");
|
|
||||||
return CurvedEdgesSelection->GetArrayName(index);
|
return CurvedEdgesSelection->GetArrayName(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vtkPVblockMeshReader::GetCurvedEdgesArrayStatus(const char* name)
|
int vtkPVblockMeshReader::GetCurvedEdgesArrayStatus(const char* name)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"GetCurvedEdgesArrayStatus");
|
|
||||||
return CurvedEdgesSelection->ArrayIsEnabled(name);
|
return CurvedEdgesSelection->ArrayIsEnabled(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVblockMeshReader::SetCurvedEdgesArrayStatus
|
void vtkPVblockMeshReader::SetCurvedEdgesArrayStatus
|
||||||
(
|
(
|
||||||
const char* name,
|
const char* name,
|
||||||
int status
|
int status
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
vtkDebugMacro(<<"SetCurvedEdgesArrayStatus");
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
CurvedEdgesSelection->EnableArray(name);
|
CurvedEdgesSelection->EnableArray(name);
|
||||||
|
|||||||
@ -71,6 +71,11 @@ public:
|
|||||||
vtkSetStringMacro(FileName);
|
vtkSetStringMacro(FileName);
|
||||||
vtkGetStringMacro(FileName);
|
vtkGetStringMacro(FileName);
|
||||||
|
|
||||||
|
// Description:
|
||||||
|
// Display patch names
|
||||||
|
virtual void SetShowPatchNames(bool);
|
||||||
|
vtkGetMacro(ShowPatchNames, bool);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// Display corner point labels
|
// Display corner point labels
|
||||||
virtual void SetShowPointNumbers(bool);
|
virtual void SetShowPointNumbers(bool);
|
||||||
@ -78,22 +83,22 @@ public:
|
|||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// Refresh blockMesh from changes to blockMeshDict
|
// Refresh blockMesh from changes to blockMeshDict
|
||||||
virtual void SetRefresh(bool);
|
virtual void Refresh();
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// Blocks selection list control
|
// Blocks selection list control
|
||||||
vtkDataArraySelection* GetBlockSelection();
|
vtkDataArraySelection* GetBlockSelection();
|
||||||
int GetNumberOfBlockArrays();
|
int GetNumberOfBlockArrays();
|
||||||
int GetBlockArrayStatus(const char*);
|
int GetBlockArrayStatus(const char* name);
|
||||||
void SetBlockArrayStatus(const char*, int status);
|
void SetBlockArrayStatus(const char* name, int status);
|
||||||
const char* GetBlockArrayName(int index);
|
const char* GetBlockArrayName(int index);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// CurvedEdges selection list control
|
// CurvedEdges selection list control
|
||||||
vtkDataArraySelection* GetCurvedEdgesSelection();
|
vtkDataArraySelection* GetCurvedEdgesSelection();
|
||||||
int GetNumberOfCurvedEdgesArrays();
|
int GetNumberOfCurvedEdgesArrays();
|
||||||
int GetCurvedEdgesArrayStatus(const char*);
|
int GetCurvedEdgesArrayStatus(const char* name);
|
||||||
void SetCurvedEdgesArrayStatus(const char*, int status);
|
void SetCurvedEdgesArrayStatus(const char* name, int status);
|
||||||
const char* GetCurvedEdgesArrayName(int index);
|
const char* GetCurvedEdgesArrayName(int index);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
@ -119,17 +124,17 @@ protected:
|
|||||||
//- Return information about mesh, times, etc without loading anything
|
//- Return information about mesh, times, etc without loading anything
|
||||||
virtual int RequestInformation
|
virtual int RequestInformation
|
||||||
(
|
(
|
||||||
vtkInformation*,
|
vtkInformation* unusedRequest,
|
||||||
vtkInformationVector**,
|
vtkInformationVector** unusedInputVector,
|
||||||
vtkInformationVector*
|
vtkInformationVector* outputVector
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Get the mesh/fields for a particular time
|
//- Get the mesh for a particular time
|
||||||
virtual int RequestData
|
virtual int RequestData
|
||||||
(
|
(
|
||||||
vtkInformation*,
|
vtkInformation* unusedRequest,
|
||||||
vtkInformationVector**,
|
vtkInformationVector** unusedInputVector,
|
||||||
vtkInformationVector*
|
vtkInformationVector* outputVector
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Fill in additional port information
|
//- Fill in additional port information
|
||||||
@ -149,15 +154,20 @@ private:
|
|||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const vtkPVblockMeshReader&) = delete;
|
void operator=(const vtkPVblockMeshReader&) = delete;
|
||||||
|
|
||||||
|
//- Add/remove patch names to/from the view
|
||||||
|
void updatePatchNamesView(const bool show);
|
||||||
|
|
||||||
//- 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 Patch Names
|
||||||
|
bool ShowPatchNames;
|
||||||
|
|
||||||
//- Show Point Numbers
|
//- Show Point Numbers
|
||||||
bool ShowPointNumbers;
|
bool ShowPointNumbers;
|
||||||
|
|
||||||
vtkDataArraySelection* BlockSelection;
|
vtkDataArraySelection* BlockSelection;
|
||||||
|
|
||||||
vtkDataArraySelection* CurvedEdgesSelection;
|
vtkDataArraySelection* CurvedEdgesSelection;
|
||||||
|
|
||||||
//- Backend portion of the reader
|
//- Backend portion of the reader
|
||||||
|
|||||||
@ -28,6 +28,7 @@ License
|
|||||||
|
|
||||||
// OpenFOAM includes
|
// OpenFOAM includes
|
||||||
#include "blockMesh.H"
|
#include "blockMesh.H"
|
||||||
|
#include "blockMeshTools.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "patchZones.H"
|
#include "patchZones.H"
|
||||||
#include "OStringStream.H"
|
#include "OStringStream.H"
|
||||||
@ -47,6 +48,34 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
vtkTextActor* Foam::vtkPVblockMesh::createTextActor
|
||||||
|
(
|
||||||
|
const string& s,
|
||||||
|
const point& pt
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vtkTextActor* txt = vtkTextActor::New();
|
||||||
|
txt->SetInput(s.c_str());
|
||||||
|
|
||||||
|
// Set text properties
|
||||||
|
vtkTextProperty* tprop = txt->GetTextProperty();
|
||||||
|
tprop->SetFontFamilyToArial();
|
||||||
|
tprop->BoldOn();
|
||||||
|
tprop->ShadowOff();
|
||||||
|
tprop->SetLineSpacing(1.0);
|
||||||
|
tprop->SetFontSize(14);
|
||||||
|
tprop->SetColor(1.0, 0.0, 1.0);
|
||||||
|
tprop->SetJustificationToCentered();
|
||||||
|
|
||||||
|
txt->GetPositionCoordinate()->SetCoordinateSystemToWorld();
|
||||||
|
txt->GetPositionCoordinate()->SetValue(pt.x(), pt.y(), pt.z());
|
||||||
|
|
||||||
|
return txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::vtkPVblockMesh::resetCounters()
|
void Foam::vtkPVblockMesh::resetCounters()
|
||||||
@ -60,7 +89,7 @@ void Foam::vtkPVblockMesh::resetCounters()
|
|||||||
|
|
||||||
void Foam::vtkPVblockMesh::updateInfoBlocks
|
void Foam::vtkPVblockMesh::updateInfoBlocks
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* arraySelection
|
vtkDataArraySelection* select
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
arrayRange& range = arrayRangeBlocks_;
|
arrayRange& range = arrayRangeBlocks_;
|
||||||
@ -71,7 +100,7 @@ void Foam::vtkPVblockMesh::updateInfoBlocks
|
|||||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "null") << "]" << endl;
|
<< " [meshPtr=" << (meshPtr_ ? "set" : "null") << "]" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
range.reset(arraySelection->GetNumberOfArrays());
|
range.reset(select->GetNumberOfArrays());
|
||||||
|
|
||||||
const blockMesh& blkMesh = *meshPtr_;
|
const blockMesh& blkMesh = *meshPtr_;
|
||||||
|
|
||||||
@ -92,7 +121,7 @@ void Foam::vtkPVblockMesh::updateInfoBlocks
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add "blockId" or "blockId - zoneName" to GUI list
|
// Add "blockId" or "blockId - zoneName" to GUI list
|
||||||
arraySelection->AddArray(ostr.str().c_str());
|
select->AddArray(ostr.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
range += nBlocks;
|
range += nBlocks;
|
||||||
@ -106,7 +135,7 @@ void Foam::vtkPVblockMesh::updateInfoBlocks
|
|||||||
|
|
||||||
void Foam::vtkPVblockMesh::updateInfoEdges
|
void Foam::vtkPVblockMesh::updateInfoEdges
|
||||||
(
|
(
|
||||||
vtkDataArraySelection* arraySelection
|
vtkDataArraySelection* select
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
arrayRange& range = arrayRangeEdges_;
|
arrayRange& range = arrayRangeEdges_;
|
||||||
@ -117,7 +146,7 @@ void Foam::vtkPVblockMesh::updateInfoEdges
|
|||||||
<< " [meshPtr=" << (meshPtr_ ? "set" : "null") << "]" << endl;
|
<< " [meshPtr=" << (meshPtr_ ? "set" : "null") << "]" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
range.reset(arraySelection->GetNumberOfArrays());
|
range.reset(select->GetNumberOfArrays());
|
||||||
|
|
||||||
const blockMesh& blkMesh = *meshPtr_;
|
const blockMesh& blkMesh = *meshPtr_;
|
||||||
const blockEdgeList& edges = blkMesh.edges();
|
const blockEdgeList& edges = blkMesh.edges();
|
||||||
@ -131,7 +160,7 @@ void Foam::vtkPVblockMesh::updateInfoEdges
|
|||||||
ostr << " - " << edges[edgeI].type();
|
ostr << " - " << edges[edgeI].type();
|
||||||
|
|
||||||
// Add "beg:end - type" to GUI list
|
// Add "beg:end - type" to GUI list
|
||||||
arraySelection->AddArray(ostr.str().c_str());
|
select->AddArray(ostr.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
range += edges.size();
|
range += edges.size();
|
||||||
@ -251,14 +280,6 @@ Foam::vtkPVblockMesh::~vtkPVblockMesh()
|
|||||||
Info<< "~vtkPVblockMesh" << endl;
|
Info<< "~vtkPVblockMesh" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hmm. pointNumberTextActors are not getting removed
|
|
||||||
//
|
|
||||||
forAll(pointNumberTextActorsPtrs_, pointi)
|
|
||||||
{
|
|
||||||
pointNumberTextActorsPtrs_[pointi]->Delete();
|
|
||||||
}
|
|
||||||
pointNumberTextActorsPtrs_.clear();
|
|
||||||
|
|
||||||
delete meshPtr_;
|
delete meshPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,6 +432,103 @@ void Foam::vtkPVblockMesh::CleanUp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtkPVblockMesh::renderPatchNames
|
||||||
|
(
|
||||||
|
vtkRenderer* renderer,
|
||||||
|
const bool show
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// always remove old actors first
|
||||||
|
forAll(patchTextActorsPtrs_, actori)
|
||||||
|
{
|
||||||
|
renderer->RemoveViewProp(patchTextActorsPtrs_[actori]);
|
||||||
|
patchTextActorsPtrs_[actori]->Delete();
|
||||||
|
}
|
||||||
|
patchTextActorsPtrs_.clear();
|
||||||
|
|
||||||
|
// the number of text actors
|
||||||
|
label nActors = 0;
|
||||||
|
|
||||||
|
if (show && meshPtr_)
|
||||||
|
{
|
||||||
|
const blockMesh& blkMesh = *meshPtr_;
|
||||||
|
const dictionary& meshDescription = blkMesh.meshDict();
|
||||||
|
const pointField& cornerPts = blkMesh.vertices();
|
||||||
|
const scalar scaleFactor = blkMesh.scaleFactor();
|
||||||
|
|
||||||
|
if (!meshDescription.found("boundary"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 8 sides per block is plenty
|
||||||
|
patchTextActorsPtrs_.setSize(8*blkMesh.size());
|
||||||
|
|
||||||
|
// Collect all variables
|
||||||
|
dictionary varDict(meshDescription.subOrEmptyDict("namedVertices"));
|
||||||
|
varDict.merge(meshDescription.subOrEmptyDict("namedBlocks"));
|
||||||
|
|
||||||
|
// Read like boundary file
|
||||||
|
const PtrList<entry> patchesInfo(meshDescription.lookup("boundary"));
|
||||||
|
|
||||||
|
forAll(patchesInfo, patchi)
|
||||||
|
{
|
||||||
|
const entry& patchInfo = patchesInfo[patchi];
|
||||||
|
|
||||||
|
if (!patchInfo.isDict())
|
||||||
|
{
|
||||||
|
IOWarningInFunction(meshDescription)
|
||||||
|
<< "Entry " << patchInfo << " in boundary section is not a"
|
||||||
|
<< " valid dictionary."
|
||||||
|
<< endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const word& patchName = patchInfo.keyword();
|
||||||
|
|
||||||
|
// Read block faces
|
||||||
|
faceList patchFaces = blockMeshTools::read<face>
|
||||||
|
(
|
||||||
|
patchInfo.dict().lookup("faces"),
|
||||||
|
varDict
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(patchFaces, facei)
|
||||||
|
{
|
||||||
|
const face& f = patchFaces[facei];
|
||||||
|
|
||||||
|
// Into a list for later removal
|
||||||
|
patchTextActorsPtrs_[nActors++] = createTextActor
|
||||||
|
(
|
||||||
|
patchName,
|
||||||
|
f.centre(cornerPts) * scaleFactor
|
||||||
|
);
|
||||||
|
|
||||||
|
if (nActors == patchTextActorsPtrs_.size())
|
||||||
|
{
|
||||||
|
// hit max allocated space - bail out
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nActors == patchTextActorsPtrs_.size())
|
||||||
|
{
|
||||||
|
// hit max allocated space - bail out
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
patchTextActorsPtrs_.setSize(nActors);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add text to each renderer
|
||||||
|
forAll(patchTextActorsPtrs_, actori)
|
||||||
|
{
|
||||||
|
renderer->AddViewProp(patchTextActorsPtrs_[actori]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVblockMesh::renderPointNumbers
|
void Foam::vtkPVblockMesh::renderPointNumbers
|
||||||
(
|
(
|
||||||
vtkRenderer* renderer,
|
vtkRenderer* renderer,
|
||||||
@ -419,12 +537,12 @@ void Foam::vtkPVblockMesh::renderPointNumbers
|
|||||||
{
|
{
|
||||||
// always remove old actors first
|
// always remove old actors first
|
||||||
|
|
||||||
forAll(pointNumberTextActorsPtrs_, pointi)
|
forAll(pointTextActorsPtrs_, actori)
|
||||||
{
|
{
|
||||||
renderer->RemoveViewProp(pointNumberTextActorsPtrs_[pointi]);
|
renderer->RemoveViewProp(pointTextActorsPtrs_[actori]);
|
||||||
pointNumberTextActorsPtrs_[pointi]->Delete();
|
pointTextActorsPtrs_[actori]->Delete();
|
||||||
}
|
}
|
||||||
pointNumberTextActorsPtrs_.clear();
|
pointTextActorsPtrs_.clear();
|
||||||
|
|
||||||
if (show && meshPtr_)
|
if (show && meshPtr_)
|
||||||
{
|
{
|
||||||
@ -432,49 +550,29 @@ void Foam::vtkPVblockMesh::renderPointNumbers
|
|||||||
const pointField& cornerPts = blkMesh.vertices();
|
const pointField& cornerPts = blkMesh.vertices();
|
||||||
const scalar scaleFactor = blkMesh.scaleFactor();
|
const scalar scaleFactor = blkMesh.scaleFactor();
|
||||||
|
|
||||||
pointNumberTextActorsPtrs_.setSize(cornerPts.size());
|
pointTextActorsPtrs_.setSize(cornerPts.size());
|
||||||
forAll(cornerPts, pointi)
|
forAll(cornerPts, pointi)
|
||||||
{
|
{
|
||||||
vtkTextActor* txt = vtkTextActor::New();
|
|
||||||
|
|
||||||
// Display either pointi as a number or with its name
|
// Display either pointi as a number or with its name
|
||||||
// (looked up from blockMeshDict)
|
// (looked up from blockMeshDict)
|
||||||
{
|
OStringStream os;
|
||||||
OStringStream os;
|
blockVertex::write(os, pointi, blkMesh.meshDict());
|
||||||
blockVertex::write(os, pointi, blkMesh.meshDict());
|
|
||||||
txt->SetInput(os.str().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set text properties
|
// Into a list for later removal
|
||||||
vtkTextProperty* tprop = txt->GetTextProperty();
|
pointTextActorsPtrs_[pointi] = createTextActor
|
||||||
tprop->SetFontFamilyToArial();
|
|
||||||
tprop->BoldOn();
|
|
||||||
tprop->ShadowOff();
|
|
||||||
tprop->SetLineSpacing(1.0);
|
|
||||||
tprop->SetFontSize(14);
|
|
||||||
tprop->SetColor(1.0, 0.0, 1.0);
|
|
||||||
tprop->SetJustificationToCentered();
|
|
||||||
|
|
||||||
// Set text to use 3-D world co-ordinates
|
|
||||||
txt->GetPositionCoordinate()->SetCoordinateSystemToWorld();
|
|
||||||
|
|
||||||
txt->GetPositionCoordinate()->SetValue
|
|
||||||
(
|
(
|
||||||
cornerPts[pointi].x()*scaleFactor,
|
os.str(),
|
||||||
cornerPts[pointi].y()*scaleFactor,
|
cornerPts[pointi]*scaleFactor
|
||||||
cornerPts[pointi].z()*scaleFactor
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add text to each renderer
|
|
||||||
renderer->AddViewProp(txt);
|
|
||||||
|
|
||||||
// Maintain a list of text labels added so that they can be
|
|
||||||
// removed later
|
|
||||||
pointNumberTextActorsPtrs_[pointi] = txt;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// Add text to each renderer
|
||||||
|
forAll(pointTextActorsPtrs_, actori)
|
||||||
|
{
|
||||||
|
renderer->AddViewProp(pointTextActorsPtrs_[actori]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtkPVblockMesh::PrintSelf(ostream& os, vtkIndent indent) const
|
void Foam::vtkPVblockMesh::PrintSelf(ostream& os, vtkIndent indent) const
|
||||||
|
|||||||
@ -109,38 +109,38 @@ class vtkPVblockMesh
|
|||||||
//- First instance and size of block corners (only partially used)
|
//- First instance and size of block corners (only partially used)
|
||||||
arrayRange arrayRangeCorners_;
|
arrayRange arrayRangeCorners_;
|
||||||
|
|
||||||
|
//- List of patch names for rendering to window
|
||||||
|
List<vtkTextActor*> patchTextActorsPtrs_;
|
||||||
|
|
||||||
//- List of point numbers for rendering to window
|
//- List of point numbers for rendering to window
|
||||||
List<vtkTextActor*> pointNumberTextActorsPtrs_;
|
List<vtkTextActor*> pointTextActorsPtrs_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Create a text actor
|
||||||
|
static vtkTextActor* createTextActor(const string& s, const point& pt);
|
||||||
|
|
||||||
//- Reset data counters
|
//- Reset data counters
|
||||||
void resetCounters();
|
void resetCounters();
|
||||||
|
|
||||||
// Update information helper functions
|
//- OpenFOAM mesh
|
||||||
|
void updateFoamMesh();
|
||||||
|
|
||||||
//- Internal block info
|
//- Internal block info
|
||||||
void updateInfoBlocks(vtkDataArraySelection*);
|
void updateInfoBlocks(vtkDataArraySelection* select);
|
||||||
|
|
||||||
//- Block curved edges info
|
//- Block curved edges info
|
||||||
void updateInfoEdges(vtkDataArraySelection*);
|
void updateInfoEdges(vtkDataArraySelection* select);
|
||||||
|
|
||||||
// Update helper functions
|
//- Mesh blocks
|
||||||
|
void convertMeshBlocks(vtkMultiBlockDataSet*, int& blockNo);
|
||||||
|
|
||||||
//- OpenFOAM mesh
|
//- Mesh curved edges
|
||||||
void updateFoamMesh();
|
void convertMeshEdges(vtkMultiBlockDataSet*, int& blockNo);
|
||||||
|
|
||||||
// Mesh conversion functions
|
//- Mesh corners
|
||||||
|
void convertMeshCorners(vtkMultiBlockDataSet*, int& blockNo);
|
||||||
//- Mesh blocks
|
|
||||||
void convertMeshBlocks(vtkMultiBlockDataSet*, int& blockNo);
|
|
||||||
|
|
||||||
//- Mesh curved edges
|
|
||||||
void convertMeshEdges(vtkMultiBlockDataSet*, int& blockNo);
|
|
||||||
|
|
||||||
//- Mesh corners
|
|
||||||
void convertMeshCorners(vtkMultiBlockDataSet*, int& blockNo);
|
|
||||||
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
@ -181,6 +181,9 @@ public:
|
|||||||
//- Clean any storage
|
//- Clean any storage
|
||||||
void CleanUp();
|
void CleanUp();
|
||||||
|
|
||||||
|
//- Add/remove patch names to/from the view
|
||||||
|
void renderPatchNames(vtkRenderer*, const bool show);
|
||||||
|
|
||||||
//- Add/remove point numbers to/from the view
|
//- Add/remove point numbers to/from the view
|
||||||
void renderPointNumbers(vtkRenderer*, const bool show);
|
void renderPointNumbers(vtkRenderer*, const bool show);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user