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",
69 identity(patch0.range()),
74 cleanupFaceZones.insert(fzs.back().name());
79 mergeName +
"Side1Zone",
80 identity(patch1.range()),
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();
144 polyPatchList newPatches(oldPatches.size());
145 label nNewPatches = 0;
147 wordHashSet removedPatches(cleanupPatches.capacity());
149 forAll(oldPatches, patchi)
151 const word& patchName = oldPatches[patchi].name();
155 !cleanupPatches.contains(patchName)
156 || returnReduceOr(oldPatches[patchi].size())
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
186 <<
" " << flatOutput(removedPatches.sortedToc()) << endl;
191 auto& zmesh =
mesh.pointZones();
192 zmesh.clearAddressing();
193 PtrList<pointZone>& zones = zmesh;
195 wordHashSet removedZones(2*zones.size());
202 !cleanupPointZones.contains(zones[zonei].name())
203 || returnReduceOr(zones[zonei].size())
206 zones.set(nZones, zones.release(zonei));
211 removedZones.insert(zones[zonei].
name());
214 zones.resize(nZones);
217 if (removedZones.size())
219 Info<<
"Removed " << removedZones.size()
220 <<
" empty point zones:" << nl
221 <<
" " << flatOutput(removedZones.sortedToc()) << endl;
227 auto& zmesh =
mesh.faceZones();
228 zmesh.clearAddressing();
229 PtrList<faceZone>& zones = zmesh;
231 wordHashSet removedZones(2*zones.size());
238 !cleanupFaceZones.contains(zones[zonei].name())
239 || returnReduceOr(zones[zonei].size())
242 zones.set(nZones, zones.release(zonei));
247 removedZones.insert(zones[zonei].
name());
250 zones.resize(nZones);
253 if (removedZones.size())
255 Info<<
"Removed " << removedZones.size()
256 <<
" empty merged face zones:" << nl
257 <<
" " << flatOutput(removedZones.sortedToc()) << endl;
263 Info<<
"No patch pairs to merge" <<
endl;