PVblockMeshReader: Added "Refresh" button to update the blockMesh
Reconstructs the blockMesh and updates the display from the current blockMeshDict so that any changes can viewed without exiting paraFoam -block
This commit is contained in:
@ -106,10 +106,6 @@ public:
|
|||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
pqPVFoamReaderPanel(pqProxy*, QWidget*);
|
pqPVFoamReaderPanel(pqProxy*, QWidget*);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
// virtual ~pqPVFoamReaderPanel();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -43,6 +43,20 @@
|
|||||||
</Documentation>
|
</Documentation>
|
||||||
</IntVectorProperty>
|
</IntVectorProperty>
|
||||||
|
|
||||||
|
<!-- Refresh button -->
|
||||||
|
<IntVectorProperty
|
||||||
|
name="UiRefresh"
|
||||||
|
command="SetRefresh"
|
||||||
|
number_of_elements="1"
|
||||||
|
is_internal="0"
|
||||||
|
default_values="0"
|
||||||
|
animateable="0">
|
||||||
|
<BooleanDomain name="bool"/>
|
||||||
|
<Documentation>
|
||||||
|
Rescan for updated blockMeshDict.
|
||||||
|
</Documentation>
|
||||||
|
</IntVectorProperty>
|
||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
| Selections
|
| Selections
|
||||||
|
|||||||
@ -58,12 +58,30 @@ pqPVblockMeshReaderPanel::pqPVblockMeshReaderPanel
|
|||||||
:
|
:
|
||||||
pqAutoGeneratedObjectPanel(proxy, p)
|
pqAutoGeneratedObjectPanel(proxy, p)
|
||||||
{
|
{
|
||||||
// create first sublayout (at top of the panel)
|
// Create first sublayout (at top of the panel)
|
||||||
QGridLayout *form = new QGridLayout();
|
QGridLayout *form = new QGridLayout();
|
||||||
this->PanelLayout->addLayout(form, 0, 0, 1, -1);
|
this->PanelLayout->addLayout(form, 0, 0, 1, -1);
|
||||||
|
|
||||||
vtkSMProperty* prop = 0;
|
vtkSMProperty* prop = 0;
|
||||||
// checkbox for showing point numbers
|
|
||||||
|
// 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)
|
if ((prop = this->proxy()->GetProperty("UiShowPointNumbers")) != 0)
|
||||||
{
|
{
|
||||||
prop->SetImmediateUpdate(true);
|
prop->SetImmediateUpdate(true);
|
||||||
@ -97,7 +115,7 @@ void pqPVblockMeshReaderPanel::ShowPointNumbersToggled()
|
|||||||
this->proxy()->GetProperty("UiShowPointNumbers")
|
this->proxy()->GetProperty("UiShowPointNumbers")
|
||||||
)->SetElement(0, ShowPointNumbers_->isChecked());
|
)->SetElement(0, ShowPointNumbers_->isChecked());
|
||||||
|
|
||||||
// update the active view
|
// Update the active view
|
||||||
if (this->view())
|
if (this->view())
|
||||||
{
|
{
|
||||||
this->view()->render();
|
this->view()->render();
|
||||||
@ -107,4 +125,19 @@ void pqPVblockMeshReaderPanel::ShowPointNumbersToggled()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void pqPVblockMeshReaderPanel::RefreshPressed()
|
||||||
|
{
|
||||||
|
// Update everything
|
||||||
|
vtkSMIntVectorProperty::SafeDownCast
|
||||||
|
(
|
||||||
|
this->proxy()->GetProperty("UiRefresh")
|
||||||
|
)->Modified();
|
||||||
|
|
||||||
|
vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline();
|
||||||
|
|
||||||
|
// Render all views
|
||||||
|
pqApplicationCore::instance()->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -67,6 +67,7 @@ class pqPVblockMeshReaderPanel
|
|||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
void ShowPointNumbersToggled();
|
void ShowPointNumbersToggled();
|
||||||
|
void RefreshPressed();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -75,10 +76,6 @@ public:
|
|||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
pqPVblockMeshReaderPanel(pqProxy*, QWidget*);
|
pqPVblockMeshReaderPanel(pqProxy*, QWidget*);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
// virtual ~pqPVblockMeshReaderPanel();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -97,7 +97,7 @@ vtkPVblockMeshReader::~vtkPVblockMeshReader()
|
|||||||
|
|
||||||
if (foamData_)
|
if (foamData_)
|
||||||
{
|
{
|
||||||
// remove point numbers
|
// Remove point numbers
|
||||||
updatePointNumbersView(false);
|
updatePointNumbersView(false);
|
||||||
delete foamData_;
|
delete foamData_;
|
||||||
}
|
}
|
||||||
@ -117,7 +117,6 @@ vtkPVblockMeshReader::~vtkPVblockMeshReader()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Do everything except set the output info
|
|
||||||
int vtkPVblockMeshReader::RequestInformation
|
int vtkPVblockMeshReader::RequestInformation
|
||||||
(
|
(
|
||||||
vtkInformation* vtkNotUsed(request),
|
vtkInformation* vtkNotUsed(request),
|
||||||
@ -158,23 +157,10 @@ int vtkPVblockMeshReader::RequestInformation
|
|||||||
foamData_->updateInfo();
|
foamData_->updateInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
// might need some other type of error handling
|
|
||||||
|
|
||||||
// {
|
|
||||||
// vtkErrorMacro("could not find valid OpenFOAM blockMesh");
|
|
||||||
//
|
|
||||||
// // delete foamData and flag it as fatal error
|
|
||||||
// delete foamData_;
|
|
||||||
// foamData_ = nullptr;
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set the output info
|
|
||||||
int vtkPVblockMeshReader::RequestData
|
int vtkPVblockMeshReader::RequestData
|
||||||
(
|
(
|
||||||
vtkInformation* vtkNotUsed(request),
|
vtkInformation* vtkNotUsed(request),
|
||||||
@ -190,7 +176,7 @@ int vtkPVblockMeshReader::RequestData
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// catch previous error
|
// Catch previous error
|
||||||
if (!foamData_)
|
if (!foamData_)
|
||||||
{
|
{
|
||||||
vtkErrorMacro("Reader failed - perhaps no mesh?");
|
vtkErrorMacro("Reader failed - perhaps no mesh?");
|
||||||
@ -233,6 +219,18 @@ int vtkPVblockMeshReader::RequestData
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vtkPVblockMeshReader::SetRefresh(int val)
|
||||||
|
{
|
||||||
|
// Delete the current blockMesh to force re-read and update
|
||||||
|
if (foamData_)
|
||||||
|
{
|
||||||
|
delete foamData_;
|
||||||
|
foamData_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Modified();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void vtkPVblockMeshReader::SetShowPointNumbers(const int val)
|
void vtkPVblockMeshReader::SetShowPointNumbers(const int val)
|
||||||
{
|
{
|
||||||
@ -248,7 +246,7 @@ void vtkPVblockMeshReader::updatePointNumbersView(const bool show)
|
|||||||
{
|
{
|
||||||
pqApplicationCore* appCore = pqApplicationCore::instance();
|
pqApplicationCore* appCore = pqApplicationCore::instance();
|
||||||
|
|
||||||
// need to check this, since our destructor calls this
|
// Need to check this, since our destructor calls this
|
||||||
if (!appCore)
|
if (!appCore)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -273,7 +271,7 @@ void vtkPVblockMeshReader::updatePointNumbersView(const bool show)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// use refresh here?
|
// Use refresh here?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -81,6 +81,9 @@ public:
|
|||||||
vtkSetMacro(UpdateGUI, int);
|
vtkSetMacro(UpdateGUI, int);
|
||||||
vtkGetMacro(UpdateGUI, int);
|
vtkGetMacro(UpdateGUI, int);
|
||||||
|
|
||||||
|
// Description:
|
||||||
|
// Refresh blockMesh from changes to blockMeshDict
|
||||||
|
virtual void SetRefresh(int);
|
||||||
|
|
||||||
// Description:
|
// Description:
|
||||||
// Blocks selection list control
|
// Blocks selection list control
|
||||||
|
|||||||
Reference in New Issue
Block a user