mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
- The bitSet class replaces the old PackedBoolList class.
The redesign provides better block-wise access and reduced method
calls. This helps both in cases where the bitSet may be relatively
sparse, and in cases where advantage of contiguous operations can be
made. This makes it easier to work with a bitSet as top-level object.
In addition to the previously available count() method to determine
if a bitSet is being used, now have simpler queries:
- all() - true if all bits in the addressable range are empty
- any() - true if any bits are set at all.
- none() - true if no bits are set.
These are faster than count() and allow early termination.
The new test() method tests the value of a single bit position and
returns a bool without any ambiguity caused by the return type
(like the get() method), nor the const/non-const access (like
operator[] has). The name corresponds to what std::bitset uses.
The new find_first(), find_last(), find_next() methods provide a faster
means of searching for bits that are set.
This can be especially useful when using a bitSet to control an
conditional:
OLD (with macro):
forAll(selected, celli)
{
if (selected[celli])
{
sumVol += mesh_.cellVolumes()[celli];
}
}
NEW (with const_iterator):
for (const label celli : selected)
{
sumVol += mesh_.cellVolumes()[celli];
}
or manually
for
(
label celli = selected.find_first();
celli != -1;
celli = selected.find_next()
)
{
sumVol += mesh_.cellVolumes()[celli];
}
- When marking up contiguous parts of a bitset, an interval can be
represented more efficiently as a labelRange of start/size.
For example,
OLD:
if (isA<processorPolyPatch>(pp))
{
forAll(pp, i)
{
ignoreFaces.set(i);
}
}
NEW:
if (isA<processorPolyPatch>(pp))
{
ignoreFaces.set(pp.range());
}
Notes for fluentMeshToFoam with zone preservation
#################################################
1. New option added:
- writeSets:
Writes all Fluent boundaries faceSets preserving Fluent names
Writes all Fluent regions to cellSets preserving Fluent names
lines: 1375 - 1393 & 1673 - 1741
sets are useful for post-processing using foamToVTK with the "-faceSet
<name>" and "-cellSet <name>" options.
- writeZones:
Writes all regions to cellZones preserving Fluent names
Writes all region internal face to faceZones preserving Fluent names
lines: 1545 - 1667
Zones are usefull for porous media and MRF calculations
2. Zone Access
- Zones are simple lists of label lists that can be accessed from polyMesh
with the cellZones(), faceZones() and pointZones() member functions
- Example (Members from polyMesh.H and ZoneMesh.H):
const labelList& thisCellZone = mesh.cellZones()["thisZoneName"];
- Zone integrity is preserved during mesh modification and decompomposition.
- Once created via addZones, zones allow modification through non-const
access
3. Fluent boundary types.
- All internal and baffle elements are ignored during conversion
- Boundary faces labelled as internal (i.e. interior, interface, internal,
solid, fan, radiator, porous-jump) but that are in fact external boundaries
will be added to a default wall boundary.