43void Foam::ensightMesh::clear()
45 cellZoneParts_.clear();
46 faceZoneParts_.clear();
47 boundaryParts_.clear();
51void Foam::ensightMesh::renumber()
55 for (
const label
id : cellZoneParts_.sortedToc())
57 cellZoneParts_[id].index() = partNo++;
60 for (
const label
id : boundaryParts_.sortedToc())
62 boundaryParts_[id].index() = partNo++;
65 for (
const label
id : faceZoneParts_.sortedToc())
67 faceZoneParts_[id].index() = partNo++;
74Foam::ensightMesh::ensightMesh
83Foam::ensightMesh::ensightMesh
89 options_(new options(opts)),
121 const auto&
pbm = mesh_.boundaryMesh();
126 if (option().useBoundaryMesh())
130 option().patchSelection(),
131 option().patchExclude()
138 const auto&
pp =
pbm[patchi];
157 const auto& czMatcher = option().cellZoneSelection();
162 if (option().useCellZones())
165 czoneIds = mesh_.cellZones().indices
167 option().cellZoneSelection(),
168 option().cellZoneExclude()
175 if (option().useFaceZones())
178 fzoneIds = mesh_.faceZones().indices
180 option().faceZoneSelection(),
181 option().faceZoneExclude()
194 for (
const label zoneId : czoneIds)
196 const auto& zn = mesh_.cellZones()[zoneId];
197 const auto& zoneName = zn.name();
202 cellSelection.resize(mesh_.nCells());
204 cellSelection.set(zn);
209 part.identifier() = zoneId;
210 part.rename(zoneName);
212 part.classify(mesh_, zn);
223 if (option().useInternalMesh() && czMatcher.empty())
229 if (cellZoneParts_.empty())
234 part.identifier() = internalZone;
235 part.rename(
"internalMesh");
237 part.classify(mesh_);
249 cellSelection.flip();
256 part.identifier() = internalZone;
257 part.rename(
"internalMesh");
259 part.classify(mesh_, cellSelection);
271 cellSelection.clearStorage();
273 else if (cellSelection.none())
276 cellSelection.clearStorage();
285 excludeFace.resize(mesh_.nFaces());
287 const labelList& owner = mesh_.faceOwner();
291 const label celli = owner[facei];
293 if (!cellSelection.test(celli))
295 excludeFace.set(facei);
307 excludeFace.resize(mesh_.nFaces());
316 || (cpp && !cpp->owner())
321 excludeFace.set(
p.range());
331 const auto& patchName =
p.
name();
348 part.rename(patchName);
372 for (
const label zoneId : fzoneIds)
374 const auto& zn = mesh_.faceZones()[zoneId];
375 const auto& zoneName = zn.name();
380 part.identifier() = zoneId;
381 part.rename(zoneName);
402 faceZoneParts_.erase(zoneId);
408 needsUpdate_ =
false;
424 for (
const label
id : cellZoneParts_.sortedToc())
426 cellZoneParts_[id].write(
os, mesh_, parallel);
430 for (
const label
id : boundaryParts_.sortedToc())
432 boundaryParts_[id].write(
os, mesh_, parallel);
436 for (
const label
id : faceZoneParts_.sortedToc())
438 faceZoneParts_[id].write(
os, mesh_, parallel);
446 cellZoneParts_.empty()
447 && boundaryParts_.empty()
448 && faceZoneParts_.empty()
Various functions to operate on Lists.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const polyBoundaryMesh & pbm
const word & name() const noexcept
Return the object name.
void resize(const label len)
Adjust allocated size of list.
bool empty() const noexcept
True if the list is empty (ie, size() is zero).
void resize(const label numElem, const unsigned int val=0u)
Reset addressable list size, does not shrink the allocated size.
void clearStorage()
Clear the list and delete storage.
void size(const label n)
Older name for setAddressableSize.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void flip()
Invert all bits in the addressable region.
void set(const bitSet &bitset)
Set specified bits from another bitset.
bool none() const
True if no bits in this bitset are set.
bool test(const label pos) const
Test for True value at specified position, never auto-vivify entries.
bool any() const
True if any bits in this bitset are set.
Sorting/classification of cells (3D) into corresponding ensight element types.
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.
void reduce()
Sum element counts across all processes.
void classify(const polyMesh &mesh)
Classify cell types and set the element lists.
InfoProxy< ensightCells > info() const noexcept
Return info proxy, used to print information to a stream.
void clear()
Set addressable sizes to zero, free up addressing memory.
Sorting/classification of faces (2D) into corresponding ensight types.
void classify(const UList< face > &faces)
Classify the face types and set the element lists.
label total() const noexcept
Same as totalSize.
void reduce()
Sum element counts across all processes.
InfoProxy< ensightFaces > info() const noexcept
Return info proxy, used to print information to a stream.
void clear()
Set addressable sizes to zero, free up addressing memory.
A variant of ensightFile (Ensight writing) that includes the extra geometry file header information.
Configuration options for the ensightMesh.
void write(ensightGeoFile &os, bool parallel=UPstream::parRun()) const
Write geometry to file (normally in parallel). Adds beginGeometry() marker.
void correct()
Update for new mesh.
int verbose() const noexcept
Output verbosity level.
const ensightMesh::options & option() const
Reference to the writer/mesh options.
static const label internalZone
The zone-id for internal mesh or unzoned cells.
const polyMesh & mesh() const noexcept
Reference to the underlying polyMesh.
void rename(const string &value)
Change the part name or description.
label identifier() const noexcept
OpenFOAM identifier (patch, zone, etc), -1 when not in use.
Mesh consisting of general polyhedral cells.
A patch is a list of labels that address the faces in the global face list.
OBJstream os(runTime.globalPath()/outputName)
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values within a list.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
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< bool > boolList
A List of bools.
bool isType(const U &obj)
Check if typeid of the object and Type are identical.
#define forAll(list, i)
Loop across all elements in list.