66 void Foam::ensightMesh::clear()
68 cellZoneParts_.clear();
69 faceZoneParts_.clear();
70 boundaryParts_.clear();
74 void Foam::ensightMesh::renumber()
78 for (
const label
id : cellZoneParts_.sortedToc())
80 cellZoneParts_[id].index() = partNo++;
83 for (
const label
id : boundaryParts_.sortedToc())
85 boundaryParts_[id].index() = partNo++;
88 for (
const label
id : faceZoneParts_.sortedToc())
90 faceZoneParts_[id].index() = partNo++;
97 Foam::ensightMesh::ensightMesh
106 Foam::ensightMesh::ensightMesh
112 options_(new options(opts)),
144 const wordRes& czMatcher = option().cellZoneSelection();
145 const wordRes& fzMatcher = option().faceZoneSelection();
151 option().useCellZones()
152 && (!czMatcher.
empty() || option().useInternalMesh())
154 ? mesh_.cellZones().names()
169 option().useFaceZones()
170 ? mesh_.faceZones().names()
185 option().useBoundaryMesh()
192 option().useBoundaryMesh()
196 option().patchSelection(),
197 option().patchExclude()
211 for (
const label zoneId : czoneIds)
213 const word& zoneName = czNames[zoneId];
214 const cellZone& zn = mesh_.cellZones()[zoneId];
219 cellSelection.
resize(mesh_.nCells());
221 cellSelection.
set(zn);
240 if (option().useInternalMesh() && czMatcher.
empty())
246 if (cellZoneParts_.empty())
248 ensightCells& part = cellZoneParts_(internalZone);
251 part.identifier() = internalZone;
252 part.rename(
"internalMesh");
254 part.classify(mesh_);
266 cellSelection.
flip();
270 ensightCells& part = cellZoneParts_(internalZone);
273 part.identifier() = internalZone;
274 part.rename(
"internalMesh");
276 part.classify(mesh_, cellSelection);
290 else if (cellSelection.
none())
302 excludeFace.
resize(mesh_.nFaces());
304 const labelList& owner = mesh_.faceOwner();
308 const label celli = owner[facei];
310 if (!cellSelection.
test(celli))
312 excludeFace.
set(facei);
324 excludeFace.
resize(mesh_.nFaces());
326 for (
const polyPatch&
p : mesh_.boundaryMesh())
328 const auto* cpp = isA<coupledPolyPatch>(
p);
332 isA<emptyPolyPatch>(
p)
333 || (cpp && !cpp->owner())
338 excludeFace.
set(
p.range());
348 const polyPatch&
p = mesh_.boundaryMesh()[
patchId];
350 if (isA<emptyPolyPatch>(
p))
355 else if (isA<processorPolyPatch>(
p))
361 ensightFaces& part = boundaryParts_(
patchId);
365 part.rename(patchName);
390 for (
const label zoneId : fzoneIds)
392 const word& zoneName = fzNames[zoneId];
393 const faceZone& zn = mesh_.faceZones()[zoneId];
395 ensightFaces& part = faceZoneParts_(zoneId);
398 part.identifier() = zoneId;
399 part.rename(zoneName);
420 faceZoneParts_.erase(zoneId);
426 needsUpdate_ =
false;
442 for (
const label
id : cellZoneParts_.sortedToc())
444 cellZoneParts_[id].
write(
os, mesh_, parallel);
448 for (
const label
id : boundaryParts_.sortedToc())
450 boundaryParts_[id].
write(
os, mesh_, parallel);
454 for (
const label
id : faceZoneParts_.sortedToc())
456 faceZoneParts_[id].write(
os, mesh_, parallel);
464 cellZoneParts_.empty()
465 && boundaryParts_.empty()
466 && faceZoneParts_.empty()
void classify(const polyMesh &mesh)
Classify cell types and set the element lists.
void size(const label n)
Older name for setAddressableSize.
void set(const bitSet &bitset)
Set specified bits from another bitset.
virtual Ostream & write(const char c) override
Write character.
void resize(const label len)
Adjust allocated size of list.
const ensightMesh::options & option() const
Reference to the writer/mesh options.
InfoProxy< ensightCells > info() const noexcept
Return info proxy, used to print information to a stream.
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values within a list.
void flip()
Invert all bits in the addressable region.
bool empty() const noexcept
True if List is empty (ie, size() is zero)
A variant of ensightFile (Ensight writing) that includes the extra geometry file header information...
Operations on lists of strings.
bool any() const
True if any bits in this bitset are set.
void resize(const label numElem, const unsigned int val=0u)
Reset addressable list size, does not shrink the allocated size.
#define forAll(list, i)
Loop across all elements in list.
void correct()
Update for new mesh.
static void writeBox(ensightGeoFile &os, const boundBox &bb, const label partIndex=0, const word &partName="geometry-box")
Write bounding box geometry. All parameters are only relevant on master No beginGeometry() marker...
static wordList nonProcessorPatchNames(const polyBoundaryMesh &bmesh)
label identifier() const noexcept
OpenFOAM identifier (patch, zone, etc), -1 when not in use.
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...
A class for handling words, derived from Foam::string.
Sorting/classification of cells (3D) into corresponding ensight element types.
void write(ensightGeoFile &os, bool parallel=UPstream::parRun()) const
Write geometry to file (normally in parallel). Adds beginGeometry() marker.
static labelList matching(const wordRe &select, const UList< StringType > &input, const bool invert=false)
Determine the list indices for all matches.
wordList names() const
Return a list of patch names.
wordList patchNames(nPatches)
labelList findMatching(const StringListType &input, const wordRes::filter &pred, AccessOp aop=identityOp())
Return ids for items with matching names.
A List of wordRe with additional matching capabilities.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
bool test(const label pos) const
Test for True value at specified position, never auto-vivify entries.
void reduce()
Sum element counts across all processes.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order.
void clear()
Set addressable sizes to zero, free up addressing memory.
Encapsulation of volume meshes for writing in ensight format. It manages cellZones, facesZone, patches.
OBJstream os(runTime.globalPath()/outputName)
List< word > wordList
List of word.
bool empty() const noexcept
True if the list is empty (ie, size() is zero).
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
messageStream Info
Information stream (stdout output on master, null elsewhere)
static const label internalZone
The zone-id for internal mesh or unzoned cells.
Configuration options for the ensightMesh.
void clearStorage()
Clear the list and delete storage.
Mesh consisting of general polyhedral cells.
int verbose() const noexcept
Output verbosity level.
List< label > labelList
A List of labels.
label nNonProcessor() const
The number of patches before the first processor patch.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
List< bool > boolList
A List of bools.
bool none() const
True if no bits in this bitset are set.
void rename(const string &value)
Change the part name or description.