65 void Foam::ensightMesh::clear()
67 cellZoneParts_.clear();
68 faceZoneParts_.clear();
69 boundaryParts_.clear();
73 void Foam::ensightMesh::renumber()
77 for (
const label
id : cellZoneParts_.sortedToc())
79 cellZoneParts_[id].index() = partNo++;
82 for (
const label
id : boundaryParts_.sortedToc())
84 boundaryParts_[id].index() = partNo++;
87 for (
const label
id : faceZoneParts_.sortedToc())
89 faceZoneParts_[id].index() = partNo++;
96 Foam::ensightMesh::ensightMesh
105 Foam::ensightMesh::ensightMesh
111 options_(new options(opts)),
128 const wordRes& czMatcher = option().cellZoneSelection();
129 const wordRes& fzMatcher = option().faceZoneSelection();
135 option().useCellZones()
136 && (!czMatcher.empty() || option().useInternalMesh())
138 ? mesh_.cellZones().names()
146 : czMatcher.matching(czNames)
153 option().useFaceZones()
154 ? mesh_.faceZones().names()
162 : fzMatcher.matching(fzNames)
169 option().useBoundaryMesh()
176 option().useBoundaryMesh()
180 option().patchSelection(),
181 option().patchExclude()
188 bitSet cellSelection;
195 for (
const label zoneId : czoneIds)
197 const word& zoneName = czNames[zoneId];
198 const cellZone& zn = mesh_.cellZones()[zoneId];
203 cellSelection.
resize(mesh_.nCells());
205 cellSelection.set(zn);
207 ensightCells& part = cellZoneParts_(zoneId);
210 part.identifier() = zoneId;
211 part.rename(zoneName);
213 part.classify(mesh_, zn);
220 if (option().useInternalMesh() && czMatcher.empty())
226 if (cellZoneParts_.empty())
228 ensightCells& part = cellZoneParts_(internalZone);
231 part.identifier() = internalZone;
232 part.rename(
"internalMesh");
234 part.classify(mesh_);
242 cellSelection.flip();
246 ensightCells& part = cellZoneParts_(internalZone);
249 part.identifier() = internalZone;
250 part.rename(
"internalMesh");
252 part.classify(mesh_, cellSelection);
260 cellSelection.clearStorage();
262 else if (cellSelection.none())
265 cellSelection.clearStorage();
274 excludeFace.resize(mesh_.nFaces());
276 const labelList& owner = mesh_.faceOwner();
280 const label celli = owner[facei];
282 if (!cellSelection.test(celli))
284 excludeFace.set(facei);
296 excludeFace.resize(mesh_.nFaces());
298 for (
const polyPatch&
p : mesh_.boundaryMesh())
300 const auto* procPatch = isA<processorPolyPatch>(
p);
302 if (isA<emptyPolyPatch>(
p))
304 excludeFace.set(
p.range());
306 else if (procPatch && !procPatch->owner())
309 excludeFace.set(
p.range());
319 const polyPatch&
p = mesh_.boundaryMesh()[
patchId];
321 if (isA<emptyPolyPatch>(
p))
326 else if (isA<processorPolyPatch>(
p))
332 ensightFaces& part = boundaryParts_(
patchId);
336 part.rename(patchName);
358 for (
const label zoneId : fzoneIds)
360 const word& zoneName = fzNames[zoneId];
361 const faceZone& zn = mesh_.faceZones()[zoneId];
363 ensightFaces& part = faceZoneParts_(zoneId);
366 part.identifier() = zoneId;
367 part.rename(zoneName);
385 faceZoneParts_.erase(zoneId);
391 needsUpdate_ =
false;
402 for (
const label
id : cellZoneParts_.sortedToc())
404 cellZoneParts_[id].write(
os, mesh_, parallel);
408 for (
const label
id : boundaryParts_.sortedToc())
410 boundaryParts_[id].write(
os, mesh_, parallel);
414 for (
const label
id : faceZoneParts_.sortedToc())
416 faceZoneParts_[id].write(
os, mesh_, parallel);