mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: polyBoundaryMesh: matches patches to patchgroups
This commit is contained in:
@ -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
|
||||
@ -792,6 +792,52 @@ Foam::labelHashSet Foam::polyBoundaryMesh::patchSet
|
||||
}
|
||||
|
||||
|
||||
void Foam::polyBoundaryMesh::matchGroups
|
||||
(
|
||||
const labelUList& patchIDs,
|
||||
wordList& groups,
|
||||
labelHashSet& nonGroupPatches
|
||||
) const
|
||||
{
|
||||
// Current matched groups
|
||||
DynamicList<word> matchedGroups(1);
|
||||
|
||||
// Current set of unmatched patches
|
||||
nonGroupPatches = labelHashSet(patchIDs);
|
||||
|
||||
const HashTable<labelList, word>& groupPatchIDs = this->groupPatchIDs();
|
||||
for
|
||||
(
|
||||
HashTable<labelList,word>::const_iterator iter =
|
||||
groupPatchIDs.begin();
|
||||
iter != groupPatchIDs.end();
|
||||
++iter
|
||||
)
|
||||
{
|
||||
// Store currently unmatched patches so we can restore
|
||||
labelHashSet oldNonGroupPatches(nonGroupPatches);
|
||||
|
||||
// Match by deleting patches in group from the current set and seeing
|
||||
// if all have been deleted.
|
||||
labelHashSet groupPatchSet(iter());
|
||||
|
||||
label nMatch = nonGroupPatches.erase(groupPatchSet);
|
||||
|
||||
if (nMatch == groupPatchSet.size())
|
||||
{
|
||||
matchedGroups.append(iter.key());
|
||||
}
|
||||
else if (nMatch != 0)
|
||||
{
|
||||
// No full match. Undo.
|
||||
nonGroupPatches.transfer(oldNonGroupPatches);
|
||||
}
|
||||
}
|
||||
|
||||
groups.transfer(matchedGroups);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
|
||||
{
|
||||
if (!Pstream::parRun())
|
||||
|
||||
@ -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
|
||||
@ -195,6 +195,15 @@ public:
|
||||
const bool usePatchGroups = true
|
||||
) const;
|
||||
|
||||
//- Match the patches to groups. Returns all the (fully matched) groups
|
||||
// and any remaining unmatched patches.
|
||||
void matchGroups
|
||||
(
|
||||
const labelUList& patchIDs,
|
||||
wordList& groups,
|
||||
labelHashSet& nonGroupPatches
|
||||
) const;
|
||||
|
||||
//- Check whether all procs have all patches and in same order. Return
|
||||
// true if in error.
|
||||
bool checkParallelSync(const bool report = false) const;
|
||||
|
||||
Reference in New Issue
Block a user