diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/PVFoamReader_SM.xml b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/PVFoamReader_SM.xml index a82c81850fa35a282bd566069b67469b21018d01..e88e13b61d36191cb776e5064c5c465be56ad019 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/PVFoamReader_SM.xml +++ b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/PVFoamReader_SM.xml @@ -148,7 +148,7 @@ <!-- Use VTK Polyhedron (check-box) --> <IntVectorProperty animateable="0" name="UseVTKPolyhedron" - label="Use VTK Polyhedron" + label="VTK Polyhedra" command="SetUseVTKPolyhedron" default_values="0" number_of_elements="1" diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/pqFoamReaderControls.cxx b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/pqFoamReaderControls.cxx index 3b6fe3da972e3c0e8d2b5607122c23a7ab5bacee..f501599397f7df9da01977a79ff78838333b8a1c 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/pqFoamReaderControls.cxx +++ b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/pqFoamReaderControls.cxx @@ -37,18 +37,20 @@ License #include "vtkSMIntVectorProperty.h" #include "vtkSMPropertyGroup.h" #include "vtkSMSourceProxy.h" +#include "vtkSMEnumerationDomain.h" // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // // file-scope -static QAbstractButton* setButtonProperties +// Widget properties +static QWidget* setWidgetProperties ( - QAbstractButton* b, + QWidget* widget, vtkSMProperty* prop ) { - QString tip; + widget->setFocusPolicy(Qt::NoFocus); // avoid dotted border vtkSMDocumentation* doc = prop->GetDocumentation(); if (doc) @@ -56,21 +58,33 @@ static QAbstractButton* setButtonProperties const char* txt = doc->GetDescription(); if (txt) { - tip = QString(txt).simplified(); + QString tip = QString(txt).simplified(); + if (tip.size()) + { + widget->setToolTip(tip); + } } } + return widget; +} + + +// file-scope +// Button properties +static QAbstractButton* setButtonProperties +( + QAbstractButton* b, + vtkSMProperty* prop +) +{ + setWidgetProperties(b, prop); b->setText(prop->GetXMLLabel()); - if (tip.size()) - { - b->setToolTip(tip); - } - b->setFocusPolicy(Qt::NoFocus); // avoid dotted border vtkSMIntVectorProperty* intProp = vtkSMIntVectorProperty::SafeDownCast(prop); - // initial checked state for integer (bool) properties + // Initial checked state for integer (bool) properties if (intProp) { b->setChecked(intProp->GetElement(0)); @@ -102,12 +116,12 @@ static vtkSMIntVectorProperty* lookupIntProp void pqFoamReaderControls::fireCommand ( vtkSMIntVectorProperty* prop, - bool checked + int val ) { vtkSMProxy* pxy = this->proxy(); - prop->SetElement(0, checked); // Toogle bool + prop->SetElement(0, val); // Set int value, toogle bool, etc // Fire off command prop->Modified(); @@ -140,9 +154,9 @@ void pqFoamReaderControls::refreshPressed() } -void pqFoamReaderControls::cacheMesh(bool checked) +void pqFoamReaderControls::cacheMesh(int val) { - fireCommand(cacheMesh_, checked); + fireCommand(cacheMesh_, val); } @@ -222,7 +236,10 @@ pqFoamReaderControls::pqFoamReaderControls setButtonProperties(b, zeroTime); form->addWidget(b, row, 1, Qt::AlignLeft); - addPropertyLink(b, "checked", SIGNAL(toggled(bool)), zeroTime); + addPropertyLink + ( + b, "checked", SIGNAL(toggled(bool)), zeroTime + ); } // LINE @@ -244,8 +261,14 @@ pqFoamReaderControls::pqFoamReaderControls setButtonProperties(b, includeSets_); form->addWidget(b, row, 0, Qt::AlignLeft); - addPropertyLink(b, "checked", SIGNAL(toggled(bool)), includeSets_); - connect(b, SIGNAL(toggled(bool)), this, SLOT(includeSets(bool))); + addPropertyLink + ( + b, "checked", SIGNAL(toggled(bool)), includeSets_ + ); + connect + ( + b, SIGNAL(toggled(bool)), this, SLOT(includeSets(bool)) + ); } if (showGroupsOnly_) @@ -254,8 +277,14 @@ pqFoamReaderControls::pqFoamReaderControls setButtonProperties(b, showGroupsOnly_); form->addWidget(b, row, 1, Qt::AlignLeft); - addPropertyLink(b, "checked", SIGNAL(toggled(bool)), showGroupsOnly_); - connect(b, SIGNAL(toggled(bool)), this, SLOT(showGroupsOnly(bool))); + addPropertyLink + ( + b, "checked", SIGNAL(toggled(bool)), showGroupsOnly_ + ); + connect + ( + b, SIGNAL(toggled(bool)), this, SLOT(showGroupsOnly(bool)) + ); } @@ -269,8 +298,14 @@ pqFoamReaderControls::pqFoamReaderControls setButtonProperties(b, includeZones_); form->addWidget(b, row, 0, Qt::AlignLeft); - addPropertyLink(b, "checked", SIGNAL(toggled(bool)), includeZones_); - connect(b, SIGNAL(toggled(bool)), this, SLOT(includeZones(bool))); + addPropertyLink + ( + b, "checked", SIGNAL(toggled(bool)), includeZones_ + ); + connect + ( + b, SIGNAL(toggled(bool)), this, SLOT(includeZones(bool)) + ); } if (showPatchNames_) @@ -279,7 +314,10 @@ pqFoamReaderControls::pqFoamReaderControls setButtonProperties(b, showPatchNames_); 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)) + ); } // LINE @@ -302,7 +340,10 @@ pqFoamReaderControls::pqFoamReaderControls setButtonProperties(b, interpolate); form->addWidget(b, row, 0, Qt::AlignLeft); - addPropertyLink(b, "checked", SIGNAL(toggled(bool)), interpolate); + addPropertyLink + ( + b, "checked", SIGNAL(toggled(bool)), interpolate + ); } intProp* extrapolate = lookupIntProp(group, "ExtrapolatePatches"); @@ -312,7 +353,10 @@ pqFoamReaderControls::pqFoamReaderControls setButtonProperties(b, extrapolate); form->addWidget(b, row, 1, Qt::AlignLeft); - addPropertyLink(b, "checked", SIGNAL(toggled(bool)), extrapolate); + addPropertyLink + ( + b, "checked", SIGNAL(toggled(bool)), extrapolate + ); } // LINE @@ -335,7 +379,10 @@ pqFoamReaderControls::pqFoamReaderControls setButtonProperties(b, updateGui); form->addWidget(b, row, 0, Qt::AlignLeft); - addPropertyLink(b, "checked", SIGNAL(clicked()), updateGui); + addPropertyLink + ( + b, "checked", SIGNAL(clicked()), updateGui + ); } intProp* usePolyhedron = lookupIntProp(group, "UseVTKPolyhedron"); @@ -345,7 +392,10 @@ pqFoamReaderControls::pqFoamReaderControls setButtonProperties(b, usePolyhedron); form->addWidget(b, row, 1, Qt::AlignLeft); - addPropertyLink(b, "checked", SIGNAL(toggled(bool)), usePolyhedron); + addPropertyLink + ( + b, "checked", SIGNAL(toggled(bool)), usePolyhedron + ); } if (cacheMesh_) @@ -353,8 +403,10 @@ pqFoamReaderControls::pqFoamReaderControls QCheckBox* b = new QCheckBox(this); setButtonProperties(b, cacheMesh_); 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)) + ); } } diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/pqFoamReaderControls.h b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/pqFoamReaderControls.h index fc3c8d4044b7eca2ba4cb6ffccf73f6dc5624d64..d8656d894b4dc2da85894ef94e1139f10d188353 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/pqFoamReaderControls.h +++ b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/PVFoamReader/pqFoamReaderControls.h @@ -78,8 +78,8 @@ class pqFoamReaderControls //- Update property void fireCommand(vtkSMProperty* prop); - //- Toggle and update bool property - void fireCommand(vtkSMIntVectorProperty* prop, bool checked); + //- Update int property or toggle bool property + void fireCommand(vtkSMIntVectorProperty* prop, int val); //- Disallow default bitwise copy construct diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqFoamBlockMeshControls.cxx b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqFoamBlockMeshControls.cxx index ab4a6517066433378fa09cf288e8f54d28b683df..abb2c7548688391c6400860cf8a2e85703198d40 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqFoamBlockMeshControls.cxx +++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqFoamBlockMeshControls.cxx @@ -40,13 +40,13 @@ License // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // // file-scope -static QAbstractButton* setButtonProperties +static QWidget* setWidgetProperties ( - QAbstractButton* b, + QWidget* widget, vtkSMProperty* prop ) { - QString tip; + widget->setFocusPolicy(Qt::NoFocus); // avoid dotted border vtkSMDocumentation* doc = prop->GetDocumentation(); if (doc) @@ -54,22 +54,32 @@ static QAbstractButton* setButtonProperties const char* txt = doc->GetDescription(); if (txt) { - tip = QString(txt).simplified(); + QString tip = QString(txt).simplified(); + if (tip.size()) + { + widget->setToolTip(tip); + } } } - b->setText(prop->GetXMLLabel()); - if (tip.size()) - { - b->setToolTip(tip); - } - b->setFocusPolicy(Qt::NoFocus); // avoid dotted border + return widget; +} +// file-scope +static QAbstractButton* setButtonProperties +( + QAbstractButton* b, + vtkSMProperty* prop +) +{ + setWidgetProperties(b, prop); + b->setText(prop->GetXMLLabel()); + vtkSMIntVectorProperty* intProp = vtkSMIntVectorProperty::SafeDownCast(prop); - // initial checked state for integer (bool) properties + // Initial checked state for integer (bool) properties if (intProp) { b->setChecked(intProp->GetElement(0)); @@ -111,12 +121,12 @@ void pqFoamBlockMeshControls::fireCommand(vtkSMProperty* prop) void pqFoamBlockMeshControls::fireCommand ( vtkSMIntVectorProperty* prop, - bool checked + int val ) { vtkSMProxy* pxy = this->proxy(); - prop->SetElement(0, checked); // Toogle bool + prop->SetElement(0, val); // Set int value, toogle bool, etc // Fire off command prop->Modified(); @@ -200,7 +210,10 @@ pqFoamBlockMeshControls::pqFoamBlockMeshControls setButtonProperties(b, refresh_); form->addWidget(b, 0, 0, Qt::AlignLeft); - connect(b, SIGNAL(clicked()), this, SLOT(refreshPressed())); + connect + ( + b, SIGNAL(clicked()), this, SLOT(refreshPressed()) + ); } if (showPatchNames_) @@ -209,7 +222,10 @@ pqFoamBlockMeshControls::pqFoamBlockMeshControls setButtonProperties(b, showPatchNames_); form->addWidget(b, 0, 1, Qt::AlignLeft); - connect(b, SIGNAL(toggled(bool)), this, SLOT(showPatchNames(bool))); + connect + ( + b, SIGNAL(toggled(bool)), this, SLOT(showPatchNames(bool)) + ); } if (showPointNumbers_) @@ -218,7 +234,10 @@ pqFoamBlockMeshControls::pqFoamBlockMeshControls setButtonProperties(b, showPointNumbers_); 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)) + ); } } diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqFoamBlockMeshControls.h b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqFoamBlockMeshControls.h index a46cdc30528cdfdfa4fd47b1453a065d31be4467..89d7e945db90579a201d85334cbc7e6df028ebba 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqFoamBlockMeshControls.h +++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqFoamBlockMeshControls.h @@ -71,8 +71,8 @@ class pqFoamBlockMeshControls //- Update property void fireCommand(vtkSMProperty* prop); - //- Toggle and update bool property - void fireCommand(vtkSMIntVectorProperty* prop, bool checked); + //- Update int property or toggle bool property + void fireCommand(vtkSMIntVectorProperty* prop, int val); //- Update "BlockArrayStatus", "CurvedEdgesArrayStatus" information void updateParts(); diff --git a/bin/paraFoam b/bin/paraFoam index dcfe4cf1d9cf6c0e23243acd10e68097cfebf1e4..0015e73952bca7d06a7cbdb3a8fe0ec4ef9f4a5c 100755 --- a/bin/paraFoam +++ b/bin/paraFoam @@ -26,10 +26,10 @@ # paraFoam # # Description -# start paraview with the OpenFOAM libraries +# Start paraview with the OpenFOAM libraries and reader modules. # # Note -# combining -block or -builtin options with the -region option yields +# Combining -block or -builtin options with -region option yields # undefined behaviour #------------------------------------------------------------------------------ usage() { @@ -37,7 +37,7 @@ usage() { while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<<USAGE -Usage: ${0##*/} [OPTION] [PARAVIEW_OPTION] +Usage: ${0##*/} [OPTION] [--] [PARAVIEW_OPTION] options: -block use blockMesh reader (uses .blockMesh extension) -case <dir> specify alternative case directory, default is the cwd @@ -46,10 +46,10 @@ options: -touchAll create .blockMesh, .OpenFOAM files (and for all regions) -vtk | -builtin use VTK builtin OpenFOAM reader (uses .foam extension) -help print the usage + --help paraview help -Paraview options start with a double dashes. - -* start paraview with the OpenFOAM libraries +Start paraview with the OpenFOAM libraries and reader modules. +Note that paraview options begin with double dashes. paraview=$(command -v paraview) @@ -57,12 +57,9 @@ USAGE exit 1 } -# We want to do nice exit when running paraview to give paraview opportunity -# to clean up +# Do a nice exit to give paraview an opportunity to clean up unset FOAM_ABORT -unset regionName optTouch - # Hack: change all locale to 'C' i.e. using '.' for decimal point. This is # only needed temporarily until paraview is locale aware. (git version is # already 2010-07) @@ -73,18 +70,19 @@ extension=OpenFOAM plugin=PVFoamReader # Parse options +unset regionName optTouch while [ "$#" -gt 0 ] do case "$1" in -h | -help) usage ;; - -block | -blockMesh) + -block*) extension=blockMesh plugin=PVblockMeshReader shift ;; - -builtin | -vtk) + -vtk | -built*) extension=foam unset plugin shift @@ -113,6 +111,11 @@ do shift break # Stop here, treat balance as paraview options ;; + --help) # Emit paraview help directly + exec paraview "$@" + echo "Error: could not exec paraview" 1>&2 + exit 1 # This should not have happened + ;; --*) break # Stop here, treat this and balance as paraview options ;; @@ -253,6 +256,8 @@ then # Has --data=.., send directly to paraview exec paraview "$@" + echo "Error: could not exec paraview" 1>&2 + exit 1 # This should not have happened else