paraFoam: Added support for wildcards in etc/paraFoam::defaultFields
Specifying default fields for complex and multi-phase cases is simplified and
generalized by using wildcards to select sets of related field names, e.g.
defaultFields (p p_rgh U "U\..*" T "T\..*" "alpha\..*");
selects the velocity, temperature and phase-fraction fields of all phases in
addition to the pressure fields.
This commit is contained in:
@ -451,12 +451,12 @@ void Foam::vtkPVFoam::updateInfoPatches
|
|||||||
|
|
||||||
if (!reader_->GetShowGroupsOnly())
|
if (!reader_->GetShowGroupsOnly())
|
||||||
{
|
{
|
||||||
wordReList defaultPatchTypes
|
const wordReList defaultPatchTypes
|
||||||
(
|
(
|
||||||
configDict_.lookupOrDefault
|
configDict_.lookupOrDefault
|
||||||
(
|
(
|
||||||
"defaultPatchTypes",
|
"defaultPatchTypes",
|
||||||
wordReList{"patch", "wall"}
|
wordReList(wordList({"patch", "wall"}))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -45,19 +45,51 @@ void Foam::vtkPVFoam::updateInfoFields
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use the db directly since this might be called without a mesh,
|
||||||
|
// but the region must get added back in
|
||||||
|
word regionPrefix;
|
||||||
|
if (meshRegion_ != polyMesh::defaultRegion)
|
||||||
|
{
|
||||||
|
regionPrefix = meshRegion_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const instantList times = dbPtr_().times();
|
||||||
|
|
||||||
stringList enabledEntries;
|
stringList enabledEntries;
|
||||||
|
|
||||||
if (select->GetNumberOfArrays() == 0 && !meshPtr_)
|
if (select->GetNumberOfArrays() == 0 && !meshPtr_)
|
||||||
{
|
{
|
||||||
wordList defaultFields
|
const wordReList defaultFieldRes
|
||||||
(
|
(
|
||||||
configDict_.lookupOrDefault("defaultFields", wordList{"p", "U"})
|
configDict_.lookupOrDefault
|
||||||
|
(
|
||||||
|
"defaultFields",
|
||||||
|
wordReList(wordList{"p", "U"})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
wordHashSet objectNameSet;
|
||||||
|
forAll(times, timei)
|
||||||
|
{
|
||||||
|
// Search for list of objects for this time and mesh region
|
||||||
|
IOobjectList objects(dbPtr_(), times[timei].name(), regionPrefix);
|
||||||
|
|
||||||
|
forAllConstIter(IOobjectList, objects, iter)
|
||||||
|
{
|
||||||
|
objectNameSet.insert(iter.key());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const wordList objectNames(objectNameSet.toc());
|
||||||
|
const labelList defaultFields
|
||||||
|
(
|
||||||
|
findStrings(defaultFieldRes, objectNames)
|
||||||
);
|
);
|
||||||
|
|
||||||
enabledEntries.setSize(defaultFields.size());
|
enabledEntries.setSize(defaultFields.size());
|
||||||
forAll(defaultFields, i)
|
forAll(defaultFields, i)
|
||||||
{
|
{
|
||||||
enabledEntries[i] = defaultFields[i];
|
enabledEntries[i] = objectNames[defaultFields[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -68,15 +100,6 @@ void Foam::vtkPVFoam::updateInfoFields
|
|||||||
|
|
||||||
select->RemoveAllArrays();
|
select->RemoveAllArrays();
|
||||||
|
|
||||||
// use the db directly since this might be called without a mesh,
|
|
||||||
// but the region must get added back in
|
|
||||||
word regionPrefix;
|
|
||||||
if (meshRegion_ != polyMesh::defaultRegion)
|
|
||||||
{
|
|
||||||
regionPrefix = meshRegion_;
|
|
||||||
}
|
|
||||||
|
|
||||||
instantList times = dbPtr_().times();
|
|
||||||
forAll(times, timei)
|
forAll(times, timei)
|
||||||
{
|
{
|
||||||
// Search for list of objects for this time and mesh region
|
// Search for list of objects for this time and mesh region
|
||||||
@ -110,7 +133,7 @@ void Foam::vtkPVFoam::updateInfoFields
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore the enabled selections
|
// Restore the enabled selections
|
||||||
setSelectedArrayEntries(select, enabledEntries);
|
setSelectedArrayEntries(select, enabledEntries);
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|||||||
@ -15,7 +15,7 @@ FoamFile
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
defaultFields (U p p_rgh T alpha.water alpha.air);
|
defaultFields (p p_rgh U "U\..*" T "T\..*" "alpha\..*");
|
||||||
|
|
||||||
defaultPatchTypes (patch wall);
|
defaultPatchTypes (patch wall);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user