25 meshDict.readIfPresent(
"mergePatchPairs", mergePatchPairs)
26 && mergePatchPairs.size()
29 Info<<
"Merging " << mergePatchPairs.size() <<
" patch pairs" <<
nl;
32 wordHashSet cleanupPatches(4*mergePatchPairs.size());
33 wordHashSet cleanupPointZones(2*mergePatchPairs.size());
34 wordHashSet cleanupFaceZones(2*mergePatchPairs.size());
36 Info<<
" Adding point and face zones" <<
endl;
38 const auto&
pbm =
mesh.boundaryMesh();
40 auto& pzs =
mesh.pointZones(); pzs.clearAddressing();
41 auto& fzs =
mesh.faceZones(); fzs.clearAddressing();
43 forAll(mergePatchPairs, pairi)
46 const polyPatch& patch0 =
pbm[mergePatchPairs[pairi].first()];
47 const polyPatch& patch1 =
pbm[mergePatchPairs[pairi].second()];
51 mergePatchPairs[pairi].first()
52 + mergePatchPairs[pairi].second()
59 mergeName +
"CutPointZone",
63 cleanupPointZones.insert(pzs.back().name());
68 mergeName +
"Side0Zone",
74 cleanupFaceZones.insert(fzs.back().name());
79 mergeName +
"Side1Zone",
85 cleanupFaceZones.insert(fzs.back().name());
90 mergeName +
"CutFaceZone",
94 cleanupFaceZones.insert(fzs.back().name());
99 Info<<
" Merging with attachPolyTopoChanger" <<
endl;
100 attachPolyTopoChanger polyMeshAttacher(
mesh);
101 polyMeshAttacher.resize(1);
103 forAll(mergePatchPairs, pairi)
105 cleanupPatches.insert(mergePatchPairs[pairi].first());
106 cleanupPatches.insert(mergePatchPairs[pairi].second());
110 mergePatchPairs[pairi].first()
111 + mergePatchPairs[pairi].second()
124 mergeName +
"Side0Zone",
125 mergeName +
"Side1Zone",
126 mergeName +
"CutPointZone",
127 mergeName +
"CutFaceZone",
128 mergePatchPairs[pairi].first(),
129 mergePatchPairs[pairi].second(),
130 slidingInterface::INTEGRAL,
132 intersection::VISIBLE
136 polyMeshAttacher.attach(
false);
142 const polyBoundaryMesh& oldPatches =
mesh.boundaryMesh();
145 label nNewPatches = 0;
147 wordHashSet removedPatches(cleanupPatches.capacity());
149 forAll(oldPatches, patchi)
151 const word& patchName = oldPatches[patchi].name();
155 !cleanupPatches.found(patchName)
162 oldPatches[patchi].clone
166 oldPatches[patchi].size(),
167 oldPatches[patchi].start()
175 removedPatches.insert(patchName);
179 newPatches.resize(nNewPatches);
181 mesh.removeBoundary();
182 mesh.addPatches(newPatches);
184 Info<<
"Removed " << removedPatches.size()
185 <<
" empty merged patches:" <<
nl 191 PtrList<pointZone>& zones =
mesh.pointZones();
192 mesh.pointZones().clearAddressing();
201 !cleanupPointZones.found(zones[zonei].name())
205 zones.set(nZones, zones.release(zonei));
206 zones[nZones].index() = nZones;
211 removedZones.insert(zones[zonei].
name());
214 zones.resize(nZones);
216 if (removedZones.size())
218 Info<<
"Removed " << removedZones.size()
219 <<
" empty point zones:" <<
nl 226 PtrList<faceZone>& zones =
mesh.faceZones();
227 mesh.faceZones().clearAddressing();
236 !cleanupFaceZones.found(zones[zonei].name())
240 zones.set(nZones, zones.release(zonei));
241 zones[nZones].index() = nZones;
246 removedZones.insert(zones[zonei].
name());
249 zones.resize(nZones);
251 if (removedZones.size())
253 Info<<
"Removed " << removedZones.size()
254 <<
" empty merged face zones:" <<
nl 261 Info<<
"No patch pairs to merge" <<
endl;
const IOdictionary & meshDict
const polyBoundaryMesh & pbm
void size(const label n)
Older name for setAddressableSize.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
#define forAll(list, i)
Loop across all elements in list.
PtrList< polyPatch > polyPatchList
Store lists of polyPatch as a PtrList.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
List< wordPair > wordPairList
List of wordPair.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
messageStream Info
Information stream (stdout output on master, null elsewhere)
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.