paraFoam: Add support for specifying the patch types loaded by default

The default patch types specified in the new defaultPatchTypes entry of the
etc paraFoam configuration dictionaries:

    defaultPatchTypes (patch wall);

Wildcards are supported, for example to specify that all patches loaded simply set
defaultPatchTypes to

    defaultPatchTypes (".*");
This commit is contained in:
Henry Weller
2017-10-04 13:53:12 +01:00
parent 8315fe0196
commit 4ece2ccf3d
4 changed files with 60 additions and 13 deletions

View File

@ -374,7 +374,8 @@ void Foam::vtkPVFoam::updateInfo()
// enable 'internalMesh' on the first call
// or preserve the enabled selections
stringList enabledEntries;
if (!partSelection->GetNumberOfArrays() && !meshPtr_)
bool first = !partSelection->GetNumberOfArrays() && !meshPtr_;
if (first)
{
enabledEntries.setSize(1);
enabledEntries[0] = "internalMesh";
@ -389,7 +390,7 @@ void Foam::vtkPVFoam::updateInfo()
// Update mesh parts list - add Lagrangian at the bottom
updateInfoInternalMesh(partSelection);
updateInfoPatches(partSelection, enabledEntries);
updateInfoPatches(partSelection, enabledEntries, first);
updateInfoSets(partSelection);
updateInfoZones(partSelection);
updateInfoLagrangian(partSelection);

View File

@ -348,7 +348,12 @@ class vtkPVFoam
void updateInfoLagrangian(vtkDataArraySelection*);
//- Patch info
void updateInfoPatches(vtkDataArraySelection*, stringList&);
void updateInfoPatches
(
vtkDataArraySelection*,
stringList&,
const bool
);
//- Set info
void updateInfoSets(vtkDataArraySelection*);

View File

@ -226,7 +226,8 @@ void Foam::vtkPVFoam::updateInfoLagrangian
void Foam::vtkPVFoam::updateInfoPatches
(
vtkDataArraySelection* arraySelection,
stringList& enabledEntries
stringList& enabledEntries,
const bool first
)
{
if (debug)
@ -284,7 +285,11 @@ void Foam::vtkPVFoam::updateInfoPatches
const polyPatch& pp = patches[patchIDs[i]];
if (pp.size())
{
string vtkPatchName = pp.name() + " - patch";
string vtkPatchName
(
pp.name() + " - " + pp.type()
);
enabledEntriesSet.insert(vtkPatchName);
}
}
@ -305,11 +310,10 @@ void Foam::vtkPVFoam::updateInfoPatches
if (pp.size())
{
const string vtkPatchName = pp.name() + " - " + pp.type();
// Add patch to GUI list
arraySelection->AddArray
(
(pp.name() + " - patch").c_str()
);
arraySelection->AddArray(vtkPatchName.c_str());
++nPatches;
}
@ -420,8 +424,19 @@ void Foam::vtkPVFoam::updateInfoPatches
{
if (sizes[patchIDs[i]])
{
string vtkPatchName =
names[patchIDs[i]] + " - patch";
const word patchType
(
patchEntries[patchIDs[i]].dict().lookup
(
"type"
)
);
string vtkPatchName
(
names[patchIDs[i]] + " - " + patchType
);
enabledEntriesSet.insert(vtkPatchName);
}
}
@ -436,16 +451,40 @@ void Foam::vtkPVFoam::updateInfoPatches
if (!reader_->GetShowGroupsOnly())
{
wordReList defaultPatchTypes
(
configDict_.lookupOrDefault
(
"defaultPatchTypes",
wordReList{"patch", "wall"}
)
);
forAll(names, patchi)
{
// Valid patch if nFace > 0 - add patch to GUI list
if (sizes[patchi])
{
arraySelection->AddArray
const word patchType
(
(names[patchi] + " - patch").c_str()
patchEntries[patchi].dict().lookup("type")
);
const string vtkPatchName
(
names[patchi] + " - " + patchType
);
arraySelection->AddArray(vtkPatchName.c_str());
if (first)
{
if (findStrings(defaultPatchTypes, patchType))
{
enabledEntriesSet.insert(vtkPatchName);
}
}
++nPatches;
}
}

View File

@ -17,4 +17,6 @@ FoamFile
defaultFields (U p p_rgh T alpha.water alpha.air);
defaultPatchTypes (patch wall);
// ************************************************************************* //