From 07ddd52d6a26976d2931f555d4f0ccff0c23937c Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Mon, 24 Sep 2012 17:09:53 +0100
Subject: [PATCH] ENH: patchGroups: disable patch display

---
 .../PV3FoamReader/PV3FoamReader_SM.xml        | 19 ++++-
 .../PV3FoamReader/pqPV3FoamReaderPanel.cxx    | 50 ++++++++++++-
 .../PV3FoamReader/pqPV3FoamReaderPanel.h      |  6 +-
 .../PV3FoamReader/vtkPV3FoamReader.cxx        | 16 +++-
 .../PV3FoamReader/vtkPV3FoamReader.h          |  8 +-
 .../PV3FoamReader/vtkPV3Foam/Make/files       |  1 -
 .../PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H     | 13 +++-
 .../PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C | 44 +++++++++--
 ...3FoamMeshPatch.C => vtkPV3FoamTemplates.C} | 13 +++-
 .../vtkPV3Foam/vtkPV3FoamUpdateInfo.C         | 73 +++++++++++--------
 10 files changed, 189 insertions(+), 54 deletions(-)
 rename applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/{vtkPV3FoamMeshPatch.C => vtkPV3FoamTemplates.C} (87%)

diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml
index 10873c3734e..a798530ce8a 100644
--- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml
+++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/PV3FoamReader_SM.xml
@@ -107,7 +107,6 @@
       <BooleanDomain name="bool"/>
       <Documentation>
         Use vtkPolyhedron instead of decomposing polyhedra.
-        !!Actually uses vtkConvexPointSet until this is properly supported in VTK!!
       </Documentation>
     </IntVectorProperty>
 
@@ -154,6 +153,20 @@
       </Documentation>
     </IntVectorProperty>
 
+    <!-- Show Groups Only check-box -->
+    <IntVectorProperty
+      name="UiShowGroupsOnly"
+      command="SetShowGroupsOnly"
+      number_of_elements="1"
+      default_values="0"
+      is_internal="1"
+      animateable="0">
+      <BooleanDomain name="bool"/>
+      <Documentation>
+        Show groups only
+      </Documentation>
+    </IntVectorProperty>
+
     <!-- Force GUI update check box -->
     <IntVectorProperty
       name="UpdateGUI"
@@ -193,7 +206,8 @@
         </RequiredProperties>
       </ArraySelectionDomain>
       <Documentation>
-        This property contains a list of the mesh parts (patches, sets, zones).
+        This property contains a list of the mesh parts
+        (patches, groups, sets, zones).
       </Documentation>
     </StringVectorProperty>
 
@@ -281,6 +295,7 @@
     <Property name="UiZeroTime" show="0"/>
     <Property name="UiRefresh" show="0"/>
     <Property name="UiShowPatchNames" show="0"/>
+    <Property name="UiShowGroupsOnly" show="0"/>
     <Property name="UiIncludeSets" show="0"/>
     <Property name="UiIncludeZones" show="0"/>
   </Hints>
diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.cxx b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.cxx
index 66327dc6f58..babdd460c92 100644
--- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.cxx
+++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.cxx
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -109,7 +109,7 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
 
     QFrame* hline1 = new QFrame(this);
     hline1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
-    form->addWidget(hline1, 1, 0, 1, 2);
+    form->addWidget(hline1, 1, 0, 1, 3);
 
     // checkbox for caching mesh
     if ((prop = this->proxy()->GetProperty("UiCacheMesh")) != 0)
@@ -166,6 +166,34 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
     }
 
 
+    // checkbox for Groups Only
+    if ((prop = this->proxy()->GetProperty("UiShowGroupsOnly")) != 0)
+    {
+        // immediate update on the Server Manager side
+        prop->SetImmediateUpdate(true);
+
+        ShowGroupsOnly_ = new QCheckBox("Groups Only");
+        ShowGroupsOnly_->setChecked
+        (
+            vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
+        );
+        ShowGroupsOnly_->setToolTip
+        (
+            "Show patchGroups only."
+        );
+
+        // row/col 2, 2
+        form->addWidget(ShowGroupsOnly_, 2, 2, Qt::AlignLeft);
+        connect
+        (
+            ShowGroupsOnly_,
+            SIGNAL(stateChanged(int)),
+            this,
+            SLOT(ShowGroupsOnlyToggled())
+        );
+    }
+
+
     // checkbox for include sets
     if ((prop = this->proxy()->GetProperty("UiIncludeSets")) != 0)
     {
@@ -278,7 +306,7 @@ pqPV3FoamReaderPanel::pqPV3FoamReaderPanel
 
     QFrame* hline2 = new QFrame(this);
     hline2->setFrameStyle(QFrame::HLine | QFrame::Sunken);
-    form->addWidget(hline2, 5, 0, 1, 2);
+    form->addWidget(hline2, 5, 0, 1, 3);
 }
 
 
@@ -336,6 +364,22 @@ void pqPV3FoamReaderPanel::ShowPatchNamesToggled()
 }
 
 
+void pqPV3FoamReaderPanel::ShowGroupsOnlyToggled()
+{
+    vtkSMProperty* prop;
+
+    vtkSMIntVectorProperty::SafeDownCast
+    (
+        this->proxy()->GetProperty("UiShowGroupsOnly")
+    )->SetElement(0, ShowGroupsOnly_->isChecked());
+
+    if ((prop = this->proxy()->GetProperty("PartArrayStatus")) != 0)
+    {
+        this->proxy()->UpdatePropertyInformation(prop);
+    }
+}
+
+
 void pqPV3FoamReaderPanel::IncludeSetsToggled()
 {
     vtkSMProperty* prop;
diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.h b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.h
index f7b057ecc75..c4594c257e7 100644
--- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.h
+++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/pqPV3FoamReaderPanel.h
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -71,6 +71,9 @@ class pqPV3FoamReaderPanel
     //- Show Patch Names checkbox
     QCheckBox* ShowPatchNames_;
 
+    //- Show Groups Only checkbox
+    QCheckBox* ShowGroupsOnly_;
+
     //- IncludeSets checkbox
     QCheckBox* IncludeSets_;
 
@@ -90,6 +93,7 @@ protected slots:
     void ZeroTimeToggled();
     void RefreshPressed();
     void ShowPatchNamesToggled();
+    void ShowGroupsOnlyToggled();
     void IncludeSetsToggled();
     void IncludeZonesToggled();
     void InterpolateVolFieldsToggled();
diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx
index a2671ddb9d4..27c3f63fe55 100644
--- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx
+++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -85,6 +85,7 @@ vtkPV3FoamReader::vtkPV3FoamReader()
     IncludeSets = 0;
     IncludeZones = 0;
     ShowPatchNames = 0;
+    ShowGroupsOnly = 0;
     InterpolateVolFields = 1;
 
     UpdateGUI = 0;
@@ -463,6 +464,19 @@ void vtkPV3FoamReader::SetShowPatchNames(int val)
 }
 
 
+void vtkPV3FoamReader::SetShowGroupsOnly(int val)
+{
+    if (ShowGroupsOnly != val)
+    {
+        ShowGroupsOnly = val;
+        if (foamData_)
+        {
+            foamData_->updateInfo();
+        }
+    }
+}
+
+
 void vtkPV3FoamReader::updatePatchNamesView(const bool show)
 {
     pqApplicationCore* appCore = pqApplicationCore::instance();
diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h
index da31ba6231b..aa4bec44b69 100644
--- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h
+++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.h
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -121,6 +121,11 @@ public:
     virtual void SetShowPatchNames(int);
     vtkGetMacro(ShowPatchNames, int);
 
+    // Description:
+    // OpenFOAM display patchGroups
+    virtual void SetShowGroupsOnly(int);
+    vtkGetMacro(ShowGroupsOnly, int);
+
     // Description:
     // OpenFOAM volField interpolation
     vtkSetMacro(InterpolateVolFields, int);
@@ -231,6 +236,7 @@ private:
     int IncludeSets;
     int IncludeZones;
     int ShowPatchNames;
+    int ShowGroupsOnly;
     int InterpolateVolFields;
 
     //- Dummy variable/switch to invoke a reader update
diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/files b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/files
index e71b857bb2e..685ea2e8a02 100644
--- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/files
+++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/files
@@ -2,7 +2,6 @@ vtkPV3Foam.C
 vtkPV3FoamFields.C
 vtkPV3FoamMesh.C
 vtkPV3FoamMeshLagrangian.C
-vtkPV3FoamMeshPatch.C
 vtkPV3FoamMeshSet.C
 vtkPV3FoamMeshVolume.C
 vtkPV3FoamMeshZone.C
diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H
index b4d031b7ecc..397dc7ecc2e 100644
--- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H
+++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -33,7 +33,7 @@ SourceFiles
     vtkPV3FoamFields.C
     vtkPV3FoamMesh.C
     vtkPV3FoamMeshLagrangian.C
-    vtkPV3FoamMeshPatch.C
+    vtkPV3FoamTemplates.C
     vtkPV3FoamMeshSet.C
     vtkPV3FoamMeshVolume.C
     vtkPV3FoamMeshZone.C
@@ -443,7 +443,8 @@ class vtkPV3Foam
             );
 
             //- Add patch mesh
-            vtkPolyData* patchVTKMesh(const polyPatch&);
+            template<class PatchType>
+            vtkPolyData* patchVTKMesh(const word& name, const PatchType&);
 
             //- Add face zone mesh
             vtkPolyData* faceZoneVTKMesh
@@ -736,6 +737,12 @@ public:
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+#ifdef NoRepository
+#   include "vtkPV3FoamTemplates.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
 #endif
 
 // ************************************************************************* //
diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C
index c77216d8588..b229da94790 100644
--- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C
+++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -31,6 +31,7 @@ License
 #include "pointSet.H"
 #include "fvMeshSubset.H"
 #include "vtkPV3FoamReader.h"
+#include "uindirectPrimitivePatch.H"
 
 // VTK includes
 #include "vtkDataArraySelection.h"
@@ -171,21 +172,50 @@ void Foam::vtkPV3Foam::convertMeshPatches
 
     for (int partId = range.start(); partId < range.end(); ++partId)
     {
-        const word patchName = getPartName(partId);
-        const label  patchId = patches.findPatchID(patchName);
-
-        if (!partStatus_[partId] || patchId < 0)
+        if (!partStatus_[partId])
         {
             continue;
         }
 
+        const word patchName = getPartName(partId);
+
+        labelHashSet patchIds(patches.patchSet(List<wordRe>(1, patchName)));
+
         if (debug)
         {
-            Info<< "Creating VTK mesh for patch[" << patchId <<"] "
+            Info<< "Creating VTK mesh for patches [" << patchIds <<"] "
                 << patchName  << endl;
         }
 
-        vtkPolyData* vtkmesh = patchVTKMesh(patches[patchId]);
+        vtkPolyData* vtkmesh = NULL;
+        if (patchIds.size() == 1)
+        {
+            vtkmesh = patchVTKMesh(patchName, patches[patchIds.begin().key()]);
+        }
+        else
+        {
+            // Patch group. Collect patch faces.
+            label sz = 0;
+            forAllConstIter(labelHashSet, patchIds, iter)
+            {
+                sz += patches[iter.key()].size();
+            }
+            labelList meshFaceLabels(sz);
+            sz = 0;
+            forAllConstIter(labelHashSet, patchIds, iter)
+            {
+                const polyPatch& pp = patches[iter.key()];
+                forAll(pp, i)
+                {
+                    meshFaceLabels[sz++] = pp.start()+i;
+                }
+            }
+            UIndirectList<face> fcs(mesh.faces(), meshFaceLabels);
+            uindirectPrimitivePatch pp(fcs, mesh.points());
+
+            vtkmesh = patchVTKMesh(patchName, pp);
+        }
+
 
         if (vtkmesh)
         {
diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamTemplates.C
similarity index 87%
rename from applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C
rename to applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamTemplates.C
index 29f64dc5afc..605fb463ef2 100644
--- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C
+++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamTemplates.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -37,13 +37,18 @@ License
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh(const polyPatch& p)
+template<class PatchType>
+vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh
+(
+    const word& name,
+    const PatchType& p
+)
 {
     vtkPolyData* vtkmesh = vtkPolyData::New();
 
     if (debug)
     {
-        Info<< "<beg> Foam::vtkPV3Foam::patchVTKMesh - " << p.name() << endl;
+        Info<< "<beg> Foam::vtkPV3Foam::patchVTKMesh - " << name << endl;
         printMemory();
     }
 
@@ -83,7 +88,7 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh(const polyPatch& p)
 
     if (debug)
     {
-        Info<< "<end> Foam::vtkPV3Foam::patchVTKMesh - " << p.name() << endl;
+        Info<< "<end> Foam::vtkPV3Foam::patchVTKMesh - " << name << endl;
         printMemory();
     }
 
diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C
index 642e5dbaae5..ac66e9279e1 100644
--- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C
+++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -241,7 +241,6 @@ void Foam::vtkPV3Foam::updateInfoPatches
     {
         const polyBoundaryMesh& patches = meshPtr_->boundaryMesh();
         const HashTable<labelList, word>& groups = patches.groupPatchIDs();
-
         const wordList allPatchNames = patches.names();
 
         // Add patch groups
@@ -273,13 +272,16 @@ void Foam::vtkPV3Foam::updateInfoPatches
 
                 if (enabledEntriesSet.found(vtkGrpName))
                 {
-                    forAll(patchIDs, i)
+                    //enabledEntriesSet.erase(vtkGrpName);
+                    if (!reader_->GetShowGroupsOnly())
                     {
-                        const polyPatch& pp = patches[patchIDs[i]];
-                        string vtkPatchName = pp.name() + " - patch";
-                        enabledEntriesSet.insert(vtkPatchName);
+                        forAll(patchIDs, i)
+                        {
+                            const polyPatch& pp = patches[patchIDs[i]];
+                            string vtkPatchName = pp.name() + " - patch";
+                            enabledEntriesSet.insert(vtkPatchName);
+                        }
                     }
-                    enabledEntriesSet.erase(vtkGrpName);
                 }
             }
         }
@@ -288,19 +290,22 @@ void Foam::vtkPV3Foam::updateInfoPatches
         // Add patches
         // ~~~~~~~~~~~
 
-        forAll(patches, patchI)
+        if (!reader_->GetShowGroupsOnly())
         {
-            const polyPatch& pp = patches[patchI];
-
-            if (pp.size())
+            forAll(patches, patchI)
             {
-                // Add patch to GUI list
-                arraySelection->AddArray
-                (
-                    (pp.name() + " - patch").c_str()
-                );
+                const polyPatch& pp = patches[patchI];
 
-                ++nPatches;
+                if (pp.size())
+                {
+                    // Add patch to GUI list
+                    arraySelection->AddArray
+                    (
+                        (pp.name() + " - patch").c_str()
+                    );
+
+                    ++nPatches;
+                }
             }
         }
     }
@@ -356,6 +361,7 @@ void Foam::vtkPV3Foam::updateInfoPatches
 
                 wordList groupNames;
                 patchDict.readIfPresent("inGroups", groupNames);
+
                 forAll(groupNames, groupI)
                 {
                     HashTable<labelList, word>::iterator iter = groups.find
@@ -394,20 +400,22 @@ void Foam::vtkPV3Foam::updateInfoPatches
                 if (nFaces)
                 {
                     string vtkGrpName = groupName + " - group";
-
                     arraySelection->AddArray(vtkGrpName.c_str());
 
                     ++nPatches;
 
                     if (enabledEntriesSet.found(vtkGrpName))
                     {
-                        forAll(patchIDs, i)
+                        //enabledEntriesSet.erase(vtkGrpName);
+                        if (!reader_->GetShowGroupsOnly())
                         {
-                            string vtkPatchName =
-                                names[patchIDs[i]] + " - patch";
-                            enabledEntriesSet.insert(vtkPatchName);
+                            forAll(patchIDs, i)
+                            {
+                                string vtkPatchName =
+                                    names[patchIDs[i]] + " - patch";
+                                enabledEntriesSet.insert(vtkPatchName);
+                            }
                         }
-                        enabledEntriesSet.erase(vtkGrpName);
                     }
                 }
             }
@@ -416,17 +424,20 @@ void Foam::vtkPV3Foam::updateInfoPatches
             // Add (non-zero) patches to the list of mesh parts
             // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-            forAll(names, patchI)
+            if (!reader_->GetShowGroupsOnly())
             {
-                // Valid patch if nFace > 0 - add patch to GUI list
-                if (sizes[patchI])
+                forAll(names, patchI)
                 {
-                    arraySelection->AddArray
-                    (
-                        (names[patchI] + " - patch").c_str()
-                    );
+                    // Valid patch if nFace > 0 - add patch to GUI list
+                    if (sizes[patchI])
+                    {
+                        arraySelection->AddArray
+                        (
+                            (names[patchI] + " - patch").c_str()
+                        );
 
-                    ++nPatches;
+                        ++nPatches;
+                    }
                 }
             }
         }
-- 
GitLab