mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: code reduction in PackedList, PackedBoolList (issue #751)
- eliminate iterators from PackedList since they were unused, had
lower performance than direct access and added unneeded complexity.
- eliminate auto-vivify for the PackedList '[] operator.
The set() method provides any required auto-vivification and
removing this ability from the '[]' operator allows for a lower
when accessing the values. Replaced the previous cascade of iterators
with simpler reference class.
PackedBoolList:
- (temporarily) eliminate logic and addition operators since
these contained partially unclear semantics.
- 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.
- more consistent use of PackedBoolList test(), set(), unset() methods
for fewer operation and clearer code. Eg,
if (list.test(index)) ... | if (list[index]) ...
if (!list.test(index)) ... | if (list[index] == 0u) ...
list.set(index); | list[index] = 1u;
list.unset(index); | list[index] = 0u;
- deleted the operator=(const labelUList&) and replaced with a setMany()
method for more clarity about the intended operation and to avoid any
potential inadvertent behaviour.
This commit is contained in:
@ -128,14 +128,14 @@ int main(int argc, char *argv[])
|
||||
if (protectedCell.empty())
|
||||
{
|
||||
protectedCell.setSize(mesh.nCells());
|
||||
protectedCell = 0;
|
||||
protectedCell = false;
|
||||
}
|
||||
|
||||
forAll(betav, celli)
|
||||
{
|
||||
if (betav[celli] < 0.99)
|
||||
{
|
||||
protectedCell[celli] = 1;
|
||||
protectedCell.set(celli);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ labelList receptorNeigCell(mesh.nInternalFaces(), -1);
|
||||
&& neiType == cellCellStencil::CALCULATED
|
||||
)
|
||||
{
|
||||
isOwnerInterpolatedFace[faceI] = true;
|
||||
isOwnerInterpolatedFace.set(faceI);
|
||||
|
||||
const vector& fc = mesh.faceCentres()[faceI];
|
||||
|
||||
@ -106,7 +106,7 @@ labelList receptorNeigCell(mesh.nInternalFaces(), -1);
|
||||
&& neiType == cellCellStencil::INTERPOLATED
|
||||
)
|
||||
{
|
||||
isNeiInterpolatedFace[faceI] = true;
|
||||
isNeiInterpolatedFace.set(faceI);
|
||||
|
||||
const vector& fc = mesh.faceCentres()[faceI];
|
||||
for (label zoneI = 0; zoneI < nZones; zoneI++)
|
||||
|
||||
@ -103,30 +103,6 @@ int main(int argc, char *argv[])
|
||||
Info<< "[0] == [1] (unexpected)\n";
|
||||
}
|
||||
|
||||
Info<< "\ntest operator== with iterator\n";
|
||||
{
|
||||
PackedList<3>::iterator iter = list1[1];
|
||||
|
||||
if (iter != list1[8])
|
||||
{
|
||||
Info<< "iter != [8] (expected)\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "iter == [8] (unexpected)\n";
|
||||
}
|
||||
|
||||
if (*iter != list1[8])
|
||||
{
|
||||
Info<< "*iter != [8] (unexpected)\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "*iter == [8] (expected)\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
const PackedList<3>& constLst = list1;
|
||||
Info<< "\ntest operator[] const with out-of-range index\n";
|
||||
@ -246,56 +222,10 @@ int main(int argc, char *argv[])
|
||||
list1[32] = 2;
|
||||
list1[33] = 3;
|
||||
|
||||
Info<< "\ntest iterator\n";
|
||||
PackedList<3>::iterator iter = list1.begin();
|
||||
Info<< "begin():";
|
||||
iter.printInfo(Info) << "\n";
|
||||
|
||||
Info<< "iterator:" << *iter << "\n";
|
||||
*iter = 5;
|
||||
iter.printInfo(Info);
|
||||
list1.printInfo(Info, true);
|
||||
|
||||
iter = list1[31];
|
||||
Info<< "iterator:" << *iter << "\n";
|
||||
iter.printInfo(Info);
|
||||
|
||||
|
||||
Info<< "\ntest get() method\n";
|
||||
Info<< "get(10):" << list1.get(10) << " and list[10]:" << list1[10] << "\n";
|
||||
list1.printInfo(Info, true);
|
||||
|
||||
Info<< "\ntest iterator indexing\n";
|
||||
Info<< "cend() ";
|
||||
list1.cend().printInfo(Info) << "\n";
|
||||
|
||||
{
|
||||
Info<< "\ntest assignment of iterator\n";
|
||||
list1.printInfo(Info, true);
|
||||
Info<< "cend()\n";
|
||||
list1.end().printInfo(Info);
|
||||
PackedList<3>::iterator cit = list1[100];
|
||||
Info<< "out-of-range: ";
|
||||
cit.printInfo(Info);
|
||||
cit = list1[15];
|
||||
Info<< "in-range: ";
|
||||
cit.printInfo(Info);
|
||||
Info<< "out-of-range: ";
|
||||
cit = list1[1000];
|
||||
cit.printInfo(Info);
|
||||
}
|
||||
|
||||
|
||||
for
|
||||
(
|
||||
PackedList<3>::iterator cit = list1[30];
|
||||
cit != list1.end();
|
||||
++cit
|
||||
)
|
||||
{
|
||||
cit.printInfo(Info);
|
||||
}
|
||||
|
||||
Info<< "\ntest operator[] auto-vivify\n";
|
||||
Info<< "size:" << list1.size() << "\n";
|
||||
|
||||
|
||||
@ -225,36 +225,6 @@ int main(int argc, char *argv[])
|
||||
<< " sum " << sum << nl;
|
||||
|
||||
|
||||
// Read via iterator
|
||||
sum = 0;
|
||||
for (label iter = 0; iter < nIters; ++iter)
|
||||
{
|
||||
forAllIters(packed, it)
|
||||
{
|
||||
sum += it;
|
||||
}
|
||||
}
|
||||
std::cout
|
||||
<< "Reading packed using iterator:" << timer.cpuTimeIncrement()
|
||||
<< " s" << nl
|
||||
<< " sum " << sum << nl;
|
||||
|
||||
|
||||
// Read via iterator
|
||||
sum = 0;
|
||||
for (label iter = 0; iter < nIters; ++iter)
|
||||
{
|
||||
forAllConstIters(packed, cit)
|
||||
{
|
||||
sum += *cit;
|
||||
}
|
||||
}
|
||||
std::cout
|
||||
<< "Reading packed using const_iterator():" << timer.cpuTimeIncrement()
|
||||
<< " s" << nl
|
||||
<< " sum " << sum << nl;
|
||||
|
||||
|
||||
// Read empty hash
|
||||
sum = 0;
|
||||
for (label iter = 0; iter < nIters; ++iter)
|
||||
@ -367,18 +337,6 @@ int main(int argc, char *argv[])
|
||||
Info<< "Writing packed using set:" << timer.cpuTimeIncrement()
|
||||
<< " s" << nl;
|
||||
|
||||
// Write packed
|
||||
for (label iter = 0; iter < nIters; ++iter)
|
||||
{
|
||||
forAllIters(packed, it)
|
||||
{
|
||||
*it = 1;
|
||||
}
|
||||
}
|
||||
Info<< "Writing packed using iterator:" << timer.cpuTimeIncrement()
|
||||
<< " s" << nl;
|
||||
|
||||
|
||||
// Write packed
|
||||
for (label iter = 0; iter < nIters; ++iter)
|
||||
{
|
||||
|
||||
@ -53,9 +53,10 @@ int main(int argc, char *argv[])
|
||||
Info<< "\nalternating bit pattern\n";
|
||||
list1.printInfo(Info, true);
|
||||
|
||||
PackedBoolList list2 = ~list1;
|
||||
PackedBoolList list2(list1);
|
||||
list2.flip();
|
||||
|
||||
Info<< "\ncomplementary bit pattern\n";
|
||||
Info<< "\nflipped bit pattern\n";
|
||||
list2.printBits(Info);
|
||||
|
||||
// set every other on
|
||||
@ -80,62 +81,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
labelList list2Labels = list2.used();
|
||||
|
||||
Info<< "\noperator|\n";
|
||||
|
||||
list1.printBits(Info);
|
||||
list2.printBits(Info);
|
||||
Info<< "==\n";
|
||||
(list1 | list2).printBits(Info);
|
||||
|
||||
Info<< "\noperator& : does trim\n";
|
||||
(list1 & list2).printBits(Info);
|
||||
|
||||
Info<< "\noperator^\n";
|
||||
(list1 ^ list2).printBits(Info);
|
||||
|
||||
|
||||
Info<< "\noperator|=\n";
|
||||
{
|
||||
PackedBoolList list3 = list1;
|
||||
(list3 |= list2).printBits(Info);
|
||||
}
|
||||
|
||||
Info<< "\noperator|= with labelUList\n";
|
||||
{
|
||||
PackedBoolList list3 = list1;
|
||||
(list3 |= list2Labels).printBits(Info);
|
||||
}
|
||||
|
||||
Info<< "\noperator&=\n";
|
||||
{
|
||||
PackedBoolList list3 = list1;
|
||||
(list3 &= list2).printBits(Info);
|
||||
}
|
||||
|
||||
Info<< "\noperator+=\n";
|
||||
{
|
||||
PackedBoolList list3 = list1;
|
||||
(list3 += list2).printBits(Info);
|
||||
}
|
||||
|
||||
Info<< "\noperator+= with labelUList\n";
|
||||
{
|
||||
PackedBoolList list3 = list1;
|
||||
(list3 += list2Labels).printBits(Info);
|
||||
}
|
||||
|
||||
Info<< "\noperator-=\n";
|
||||
{
|
||||
PackedBoolList list3 = list1;
|
||||
(list3 -= list2).printBits(Info);
|
||||
}
|
||||
|
||||
Info<< "\noperator-= with labelUList\n";
|
||||
{
|
||||
PackedBoolList list3 = list1;
|
||||
(list3 -= list2Labels).printBits(Info);
|
||||
}
|
||||
|
||||
PackedBoolList list4
|
||||
(
|
||||
ITstream
|
||||
@ -151,7 +96,8 @@ int main(int argc, char *argv[])
|
||||
Info<< list4 << " indices: " << list4.used() << nl;
|
||||
|
||||
Info<< "\nassign from labelList\n";
|
||||
list4 = labelList{0, 1, 2, 3, 12, 13, 14, 19, 20, 21};
|
||||
list4.clear();
|
||||
list4.setMany(labelList{0, 1, 2, 3, 12, 13, 14, 19, 20, 21});
|
||||
|
||||
list4.printInfo(Info, true);
|
||||
Info<< list4 << " indices: " << list4.used() << nl;
|
||||
|
||||
@ -84,7 +84,7 @@ void modifyOrAddFace
|
||||
PackedBoolList& modifiedFace
|
||||
)
|
||||
{
|
||||
if (!modifiedFace[facei])
|
||||
if (modifiedFace.set(facei))
|
||||
{
|
||||
// First usage of face. Modify.
|
||||
meshMod.setAction
|
||||
@ -102,7 +102,6 @@ void modifyOrAddFace
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
modifiedFace[facei] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -342,7 +341,7 @@ void subsetTopoSets
|
||||
PackedBoolList isSet(set.maxSize(mesh));
|
||||
forAllConstIter(labelHashSet, set, iter)
|
||||
{
|
||||
isSet[iter.key()] = true;
|
||||
isSet.set(iter.key());
|
||||
}
|
||||
label nSet = 0;
|
||||
forAll(map, i)
|
||||
@ -375,7 +374,7 @@ void createCoupledBaffles
|
||||
fvMesh& mesh,
|
||||
const labelList& coupledWantedPatch,
|
||||
polyTopoChange& meshMod,
|
||||
PackedBoolList& modifiedFace
|
||||
PackedBoolList& modifiedFace
|
||||
)
|
||||
{
|
||||
const faceZoneMesh& faceZones = mesh.faceZones();
|
||||
@ -443,7 +442,7 @@ void createCyclicCoupledBaffles
|
||||
const labelList& cyclicMasterPatch,
|
||||
const labelList& cyclicSlavePatch,
|
||||
polyTopoChange& meshMod,
|
||||
PackedBoolList& modifiedFace
|
||||
PackedBoolList& modifiedFace
|
||||
)
|
||||
{
|
||||
const faceZoneMesh& faceZones = mesh.faceZones();
|
||||
|
||||
@ -588,7 +588,7 @@ int main(int argc, char *argv[])
|
||||
label edgeI = iter.key();
|
||||
const edge& e = edges[edgeI];
|
||||
|
||||
collapseEdge[edgeI] = true;
|
||||
collapseEdge.set(edgeI);
|
||||
collapsePointToLocation.set(e[1], points[e[0]]);
|
||||
|
||||
newPoints[e[0]] = iter();
|
||||
|
||||
@ -907,7 +907,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "Merging edge " << e << " since length " << d
|
||||
<< " << " << mergeDim << nl;
|
||||
|
||||
collapseEdge[edgeI] = true;
|
||||
collapseEdge.set(edgeI);
|
||||
collapsePointToLocation.set(e[1], points[e[0]]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2190,12 +2190,12 @@ int main(int argc, char *argv[])
|
||||
// and generate space overlapping columns of cells.
|
||||
if (eFaces.size() != 2)
|
||||
{
|
||||
nonManifoldEdge[edgeI] = 1;
|
||||
nonManifoldEdge.set(edgeI);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nonManifoldEdge[edgeI] = 1;
|
||||
nonManifoldEdge.set(edgeI);
|
||||
}
|
||||
}
|
||||
else if (eFaces.size() == 2)
|
||||
@ -2222,7 +2222,7 @@ int main(int argc, char *argv[])
|
||||
ePatches[1] = zoneZonePatch_min[index];
|
||||
}
|
||||
|
||||
nonManifoldEdge[edgeI] = 1;
|
||||
nonManifoldEdge.set(edgeI);
|
||||
}
|
||||
}
|
||||
else if (sidePatchID[edgeI] != -1)
|
||||
@ -2260,7 +2260,7 @@ int main(int argc, char *argv[])
|
||||
ePatches[i] = zoneSidePatch[zoneID[eFaces[i]]];
|
||||
}
|
||||
}
|
||||
nonManifoldEdge[edgeI] = 1;
|
||||
nonManifoldEdge.set(edgeI);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -270,7 +270,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "Merging edge " << e << " since length " << d
|
||||
<< " << " << mergeDim << nl;
|
||||
|
||||
collapseEdge[edgeI] = true;
|
||||
collapseEdge.set(edgeI);
|
||||
collapsePointToLocation.set(e[1], points[e[0]]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -341,7 +341,7 @@ void Foam::controlMeshRefinement::initialMeshPopulation
|
||||
|
||||
if (!keep)
|
||||
{
|
||||
keepVertex[vI] = false;
|
||||
keepVertex.unset(vI);
|
||||
}
|
||||
}
|
||||
|
||||
@ -516,7 +516,7 @@ void Foam::controlMeshRefinement::initialMeshPopulation
|
||||
|
||||
if (!keep)
|
||||
{
|
||||
keepVertex[vI] = false;
|
||||
keepVertex.unset(vI);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1081,11 +1081,7 @@ void Foam::conformalVoronoiMesh::move()
|
||||
Zero
|
||||
);
|
||||
|
||||
PackedBoolList pointToBeRetained
|
||||
(
|
||||
number_of_vertices(),
|
||||
true
|
||||
);
|
||||
PackedBoolList pointToBeRetained(number_of_vertices(), true);
|
||||
|
||||
DynamicList<Point> pointsToInsert(number_of_vertices());
|
||||
|
||||
@ -1170,8 +1166,8 @@ void Foam::conformalVoronoiMesh::move()
|
||||
|
||||
if
|
||||
(
|
||||
pointToBeRetained[vA->index()] == true
|
||||
&& pointToBeRetained[vB->index()] == true
|
||||
pointToBeRetained.test(vA->index())
|
||||
&& pointToBeRetained.test(vB->index())
|
||||
)
|
||||
{
|
||||
const Foam::point pt(0.5*(dVA + dVB));
|
||||
@ -1185,12 +1181,12 @@ void Foam::conformalVoronoiMesh::move()
|
||||
|
||||
if (vA->internalPoint() && !vA->referred() && !vA->fixed())
|
||||
{
|
||||
pointToBeRetained[vA->index()] = false;
|
||||
pointToBeRetained.unset(vA->index());
|
||||
}
|
||||
|
||||
if (vB->internalPoint() && !vB->referred() && !vB->fixed())
|
||||
{
|
||||
pointToBeRetained[vB->index()] = false;
|
||||
pointToBeRetained.unset(vB->index());
|
||||
}
|
||||
|
||||
// Do not consider this Delaunay edge any further
|
||||
@ -1368,8 +1364,8 @@ void Foam::conformalVoronoiMesh::move()
|
||||
// removed.
|
||||
if
|
||||
(
|
||||
pointToBeRetained[vA->index()] == true
|
||||
&& pointToBeRetained[vB->index()] == true
|
||||
pointToBeRetained.test(vA->index())
|
||||
&& pointToBeRetained.test(vB->index())
|
||||
)
|
||||
{
|
||||
const Foam::point pt(0.5*(dVA + dVB));
|
||||
@ -1388,7 +1384,7 @@ void Foam::conformalVoronoiMesh::move()
|
||||
&& !vA->fixed()
|
||||
)
|
||||
{
|
||||
pointToBeRetained[vA->index()] = false;
|
||||
pointToBeRetained.unset(vA->index());
|
||||
}
|
||||
|
||||
if
|
||||
@ -1398,7 +1394,7 @@ void Foam::conformalVoronoiMesh::move()
|
||||
&& !vB->fixed()
|
||||
)
|
||||
{
|
||||
pointToBeRetained[vB->index()] = false;
|
||||
pointToBeRetained.unset(vB->index());
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1454,7 +1450,7 @@ void Foam::conformalVoronoiMesh::move()
|
||||
{
|
||||
if (vit->internalPoint() && !vit->referred() && !vit->fixed())
|
||||
{
|
||||
if (pointToBeRetained[vit->index()] == true)
|
||||
if (pointToBeRetained.test(vit->index()))
|
||||
{
|
||||
limitDisplacement
|
||||
(
|
||||
@ -1484,7 +1480,7 @@ void Foam::conformalVoronoiMesh::move()
|
||||
{
|
||||
if (vit->internalPoint() && !vit->referred() && !vit->fixed())
|
||||
{
|
||||
if (pointToBeRetained[vit->index()] == true)
|
||||
if (pointToBeRetained.test(vit->index()))
|
||||
{
|
||||
// Convert vit->point() to FOAM vector (double) to do addition,
|
||||
// avoids memory increase because a record of the constructions
|
||||
@ -1540,7 +1536,7 @@ void Foam::conformalVoronoiMesh::move()
|
||||
{
|
||||
if (vit->internalPoint() && !vit->referred())
|
||||
{
|
||||
if (pointToBeRetained[vit->index()] == true)
|
||||
if (pointToBeRetained.test(vit->index()))
|
||||
{
|
||||
meshTools::writeOBJ(str, topoint(vit->point()));
|
||||
|
||||
|
||||
@ -1116,10 +1116,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
|
||||
{
|
||||
const face f = pMesh.faces()[iter.key()];
|
||||
|
||||
forAll(f, fPtI)
|
||||
{
|
||||
ptToBeLimited[f[fPtI]] = true;
|
||||
}
|
||||
ptToBeLimited.setMany(f);
|
||||
}
|
||||
|
||||
// // Limit connected cells
|
||||
@ -1153,10 +1150,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
|
||||
|
||||
// const labelList& cP = cellPts[celli];
|
||||
|
||||
// forAll(cP, cPI)
|
||||
// {
|
||||
// ptToBeLimited[cP[cPI]] = true;
|
||||
// }
|
||||
// ptToBeLimited.setMany(cP);
|
||||
// }
|
||||
|
||||
|
||||
@ -1176,7 +1170,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality
|
||||
|
||||
if (cI >= 0)
|
||||
{
|
||||
if (ptToBeLimited[cI] == true)
|
||||
if (ptToBeLimited.test(cI))
|
||||
{
|
||||
cit->filterCount()++;
|
||||
}
|
||||
@ -2557,10 +2551,7 @@ void Foam::conformalVoronoiMesh::removeUnusedPoints
|
||||
{
|
||||
const face& f = faces[fI];
|
||||
|
||||
forAll(f, fPtI)
|
||||
{
|
||||
ptUsed[f[fPtI]] = true;
|
||||
}
|
||||
ptUsed.setMany(f);
|
||||
}
|
||||
|
||||
label pointi = 0;
|
||||
@ -2572,7 +2563,7 @@ void Foam::conformalVoronoiMesh::removeUnusedPoints
|
||||
|
||||
forAll(ptUsed, ptUI)
|
||||
{
|
||||
if (ptUsed[ptUI] == true)
|
||||
if (ptUsed.test(ptUI))
|
||||
{
|
||||
oldToNew[ptUI] = pointi++;
|
||||
}
|
||||
@ -2610,15 +2601,8 @@ Foam::labelList Foam::conformalVoronoiMesh::removeUnusedCells
|
||||
|
||||
// Scan all faces to find all of the cells that are used
|
||||
|
||||
forAll(owner, oI)
|
||||
{
|
||||
cellUsed[owner[oI]] = true;
|
||||
}
|
||||
|
||||
forAll(neighbour, nI)
|
||||
{
|
||||
cellUsed[neighbour[nI]] = true;
|
||||
}
|
||||
cellUsed.setMany(owner);
|
||||
cellUsed.setMany(neighbour);
|
||||
|
||||
label celli = 0;
|
||||
|
||||
@ -2629,7 +2613,7 @@ Foam::labelList Foam::conformalVoronoiMesh::removeUnusedCells
|
||||
|
||||
forAll(cellUsed, cellUI)
|
||||
{
|
||||
if (cellUsed[cellUI] == true)
|
||||
if (cellUsed.test(cellUI))
|
||||
{
|
||||
oldToNew[cellUI] = celli++;
|
||||
}
|
||||
@ -2645,7 +2629,7 @@ Foam::labelList Foam::conformalVoronoiMesh::removeUnusedCells
|
||||
|
||||
forAll(cellUsed, cUI)
|
||||
{
|
||||
if (cellUsed[cUI] == false)
|
||||
if (!cellUsed.test(cUI))
|
||||
{
|
||||
unusedCells.append(cUI);
|
||||
}
|
||||
|
||||
@ -2290,7 +2290,7 @@ void Foam::conformalVoronoiMesh::reinsertSurfaceConformation()
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedElems[vI] = false;
|
||||
selectedElems.unset(vI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -949,18 +949,7 @@ void Foam::conformalVoronoiMesh::writeMesh
|
||||
orEqOp<unsigned int>()
|
||||
);
|
||||
|
||||
labelList addr(boundaryFacesToRemove.count());
|
||||
label count = 0;
|
||||
|
||||
forAll(boundaryFacesToRemove, facei)
|
||||
{
|
||||
if (boundaryFacesToRemove[facei])
|
||||
{
|
||||
addr[count++] = facei;
|
||||
}
|
||||
}
|
||||
|
||||
addr.setSize(count);
|
||||
labelList addr(boundaryFacesToRemove.used());
|
||||
|
||||
faceSet indirectPatchFaces
|
||||
(
|
||||
|
||||
@ -639,8 +639,8 @@ void Foam::CV2D::newPoints()
|
||||
// to be removed.
|
||||
if
|
||||
(
|
||||
pointToBeRetained[vA->index()] == true
|
||||
&& pointToBeRetained[vB->index()] == true
|
||||
pointToBeRetained.test(vA->index())
|
||||
&& pointToBeRetained.test(vB->index())
|
||||
)
|
||||
{
|
||||
pointsToInsert.push_back(toPoint(0.5*(dVA + dVB)));
|
||||
@ -648,12 +648,12 @@ void Foam::CV2D::newPoints()
|
||||
|
||||
if (vA->internalPoint())
|
||||
{
|
||||
pointToBeRetained[vA->index()] = false;
|
||||
pointToBeRetained.unset(vA->index());
|
||||
}
|
||||
|
||||
if (vB->internalPoint())
|
||||
{
|
||||
pointToBeRetained[vB->index()] = false;
|
||||
pointToBeRetained.unset(vB->index());
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -689,7 +689,7 @@ void Foam::CV2D::newPoints()
|
||||
{
|
||||
if (vit->internalPoint())
|
||||
{
|
||||
if (pointToBeRetained[vit->index()])
|
||||
if (pointToBeRetained.test(vit->index()))
|
||||
{
|
||||
pointsToInsert.push_front
|
||||
(
|
||||
|
||||
@ -309,7 +309,7 @@ void Foam::mergeAndWrite
|
||||
PackedBoolList isInSet(mesh.nCells());
|
||||
forAllConstIter(cellSet, set, iter)
|
||||
{
|
||||
isInSet[iter.key()] = true;
|
||||
isInSet.set(iter.key());
|
||||
}
|
||||
|
||||
|
||||
@ -329,8 +329,8 @@ void Foam::mergeAndWrite
|
||||
DynamicList<label> outsideFaces(3*set.size());
|
||||
for (label facei = 0; facei < mesh.nInternalFaces(); facei++)
|
||||
{
|
||||
bool ownVal = isInSet[mesh.faceOwner()[facei]];
|
||||
bool neiVal = isInSet[mesh.faceNeighbour()[facei]];
|
||||
const bool ownVal = isInSet[mesh.faceOwner()[facei]];
|
||||
const bool neiVal = isInSet[mesh.faceNeighbour()[facei]];
|
||||
|
||||
if (ownVal != neiVal)
|
||||
{
|
||||
@ -349,7 +349,7 @@ void Foam::mergeAndWrite
|
||||
{
|
||||
label facei = pp.start()+i;
|
||||
|
||||
bool neiVal = bndInSet[facei-mesh.nInternalFaces()];
|
||||
const bool neiVal = bndInSet[facei-mesh.nInternalFaces()];
|
||||
if (isInSet[fc[i]] && !neiVal)
|
||||
{
|
||||
outsideFaces.append(facei);
|
||||
|
||||
@ -195,7 +195,7 @@ void modifyOrAddFace
|
||||
PackedBoolList& modifiedFace
|
||||
)
|
||||
{
|
||||
if (!modifiedFace[facei])
|
||||
if (modifiedFace.set(facei))
|
||||
{
|
||||
// First usage of face. Modify.
|
||||
meshMod.setAction
|
||||
@ -213,7 +213,6 @@ void modifyOrAddFace
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
modifiedFace[facei] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -157,7 +157,7 @@ void Foam::meshDualiser::generateDualBoundaryEdges
|
||||
{
|
||||
label edgeI = pEdges[pEdgeI];
|
||||
|
||||
if (edgeToDualPoint_[edgeI] == -1 && isBoundaryEdge.get(edgeI) == 1)
|
||||
if (edgeToDualPoint_[edgeI] == -1 && isBoundaryEdge.test(edgeI))
|
||||
{
|
||||
const edge& e = mesh_.edges()[edgeI];
|
||||
|
||||
@ -397,7 +397,7 @@ void Foam::meshDualiser::createFacesAroundEdge
|
||||
startFacei, // face
|
||||
true, // ownerSide
|
||||
fp, // fp
|
||||
isBoundaryEdge.get(edgeI) == 1 // isBoundaryEdge
|
||||
isBoundaryEdge.test(edgeI) // isBoundaryEdge
|
||||
);
|
||||
ie.setCanonical();
|
||||
|
||||
@ -509,7 +509,7 @@ void Foam::meshDualiser::createFacesAroundEdge
|
||||
{
|
||||
// Back at start face (for internal edge only). See if this needs
|
||||
// adding.
|
||||
if (isBoundaryEdge.get(edgeI) == 0)
|
||||
if (!isBoundaryEdge.test(edgeI))
|
||||
{
|
||||
label startDual = faceToDualPoint_[startFaceLabel];
|
||||
|
||||
@ -891,10 +891,7 @@ void Foam::meshDualiser::setRefinement
|
||||
{
|
||||
const labelList& fEdges = mesh_.faceEdges()[facei];
|
||||
|
||||
forAll(fEdges, i)
|
||||
{
|
||||
isBoundaryEdge.set(fEdges[i], 1);
|
||||
}
|
||||
isBoundaryEdge.setMany(fEdges);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -100,9 +100,9 @@ class meshDualiser
|
||||
// emanating from (boundary & feature) point
|
||||
void generateDualBoundaryEdges
|
||||
(
|
||||
const PackedBoolList&,
|
||||
const PackedBoolList& isBoundaryEdge,
|
||||
const label pointi,
|
||||
polyTopoChange&
|
||||
polyTopoChange& meshMod
|
||||
);
|
||||
|
||||
//- Check that owner and neighbour of face have same dual cell
|
||||
@ -143,10 +143,10 @@ class meshDualiser
|
||||
void createFacesAroundEdge
|
||||
(
|
||||
const bool splitFace,
|
||||
const PackedBoolList&,
|
||||
const PackedBoolList& isBoundaryEdge,
|
||||
const label edgeI,
|
||||
const label startFacei,
|
||||
polyTopoChange&,
|
||||
polyTopoChange& meshMod,
|
||||
boolList& doneEFaces
|
||||
) const;
|
||||
|
||||
|
||||
@ -397,7 +397,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
forAll(fEdges, i)
|
||||
{
|
||||
isBoundaryEdge.set(fEdges[i], 1);
|
||||
isBoundaryEdge.set(fEdges[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ void printEdgeStats(const polyMesh& mesh)
|
||||
|
||||
forAll(edges, edgeI)
|
||||
{
|
||||
if (isMasterEdge[edgeI])
|
||||
if (isMasterEdge.test(edgeI))
|
||||
{
|
||||
const edge& e = edges[edgeI];
|
||||
|
||||
|
||||
@ -306,14 +306,14 @@ void subsetTopoSets
|
||||
PackedBoolList isSet(set.maxSize(mesh));
|
||||
forAllConstIters(set, iter)
|
||||
{
|
||||
isSet[iter.key()] = true;
|
||||
isSet.set(iter.key());
|
||||
}
|
||||
label nSet = 0;
|
||||
forAll(map, i)
|
||||
{
|
||||
if (isSet[map[i]])
|
||||
{
|
||||
nSet++;
|
||||
++nSet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -528,7 +528,7 @@ int main(int argc, char *argv[])
|
||||
newFacesFromSplit
|
||||
);
|
||||
|
||||
visitedFace[hitSurfI][facei] = true;
|
||||
visitedFace[hitSurfI].set(facei);
|
||||
|
||||
forAll(newFacesFromSplit, newFacei)
|
||||
{
|
||||
|
||||
@ -152,7 +152,7 @@ tmp<vectorField> calcPointNormals
|
||||
const edge& e = s.edges()[edgeI];
|
||||
forAll(e, i)
|
||||
{
|
||||
if (!isFeaturePoint[e[i]])
|
||||
if (!isFeaturePoint.test(e[i]))
|
||||
{
|
||||
pointNormals[e[i]] = Zero;
|
||||
}
|
||||
@ -179,7 +179,7 @@ tmp<vectorField> calcPointNormals
|
||||
const edge& e = s.edges()[edgeI];
|
||||
forAll(e, i)
|
||||
{
|
||||
if (!isFeaturePoint[e[i]])
|
||||
if (!isFeaturePoint.test(e[i]))
|
||||
{
|
||||
pointNormals[e[i]] += n;
|
||||
nNormals[e[i]]++;
|
||||
@ -242,7 +242,7 @@ void detectSelfIntersections
|
||||
|
||||
if (hitInfo.hit())
|
||||
{
|
||||
isEdgeIntersecting[edgeI] = true;
|
||||
isEdgeIntersecting.set(edgeI);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -297,7 +297,7 @@ label detectIntersectionPoints
|
||||
{
|
||||
scale[pointI] = max(0.0, scale[pointI]-0.2);
|
||||
|
||||
isPointOnHitEdge[pointI] = true;
|
||||
isPointOnHitEdge.set(pointI);
|
||||
nHits++;
|
||||
}
|
||||
}
|
||||
@ -425,7 +425,7 @@ void minSmooth
|
||||
|
||||
forAll(fld, pointI)
|
||||
{
|
||||
if (isAffectedPoint.get(pointI) == 1)
|
||||
if (isAffectedPoint.test(pointI))
|
||||
{
|
||||
newFld[pointI] = min
|
||||
(
|
||||
@ -458,13 +458,13 @@ void lloydsSmoothing
|
||||
forAll(edges, edgeI)
|
||||
{
|
||||
const edge& e = edges[edgeI];
|
||||
if (isSmoothPoint[e[0]])
|
||||
if (isSmoothPoint.test(e[0]))
|
||||
{
|
||||
newIsSmoothPoint[e[1]] = true;
|
||||
newIsSmoothPoint.set(e[1]);
|
||||
}
|
||||
if (isSmoothPoint[e[1]])
|
||||
if (isSmoothPoint.test(e[1]))
|
||||
{
|
||||
newIsSmoothPoint[e[0]] = true;
|
||||
newIsSmoothPoint.set(e[0]);
|
||||
}
|
||||
}
|
||||
Info<< "From points-to-smooth " << isSmoothPoint.count()
|
||||
@ -545,11 +545,11 @@ void lloydsSmoothing
|
||||
const edge& e = edges[edgeI];
|
||||
if (isSmoothPoint[e[0]])
|
||||
{
|
||||
newIsSmoothPoint[e[1]] = true;
|
||||
newIsSmoothPoint.set(e[1]);
|
||||
}
|
||||
if (isSmoothPoint[e[1]])
|
||||
{
|
||||
newIsSmoothPoint[e[0]] = true;
|
||||
newIsSmoothPoint.set(e[0]);
|
||||
}
|
||||
}
|
||||
Info<< "From points-to-smooth " << isSmoothPoint.count()
|
||||
@ -662,17 +662,11 @@ int main(int argc, char *argv[])
|
||||
<< " out of " << s.nEdges() << nl
|
||||
<< endl;
|
||||
|
||||
PackedBoolList isFeaturePoint(s.nPoints());
|
||||
forAll(features.featurePoints(), i)
|
||||
{
|
||||
label pointI = features.featurePoints()[i];
|
||||
isFeaturePoint[pointI] = true;
|
||||
}
|
||||
PackedBoolList isFeaturePoint(s.nPoints(), features.featurePoints());
|
||||
|
||||
const List<surfaceFeatures::edgeStatus> edgeStat(features.toStatus());
|
||||
|
||||
|
||||
|
||||
|
||||
const pointField initialPoints(s.points());
|
||||
|
||||
|
||||
@ -809,9 +803,9 @@ int main(int argc, char *argv[])
|
||||
// Accumulate all affected points
|
||||
forAll(isAffectedPoint, pointI)
|
||||
{
|
||||
if (isAffectedPoint[pointI])
|
||||
if (isAffectedPoint.test(pointI))
|
||||
{
|
||||
isScaledPoint[pointI] = true;
|
||||
isScaledPoint.set(pointI);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ tmp<pointField> avg
|
||||
{
|
||||
vector& avgPos = avg[vertI];
|
||||
|
||||
if (fixedPoints[vertI])
|
||||
if (fixedPoints.test(vertI))
|
||||
{
|
||||
avgPos = s.localPoints()[vertI];
|
||||
}
|
||||
@ -121,7 +121,7 @@ void getFixedPoints
|
||||
{
|
||||
if (from0To1[fpI] != -1)
|
||||
{
|
||||
fixedPoints[from0To1[fpI]] = true;
|
||||
fixedPoints.set(from0To1[fpI]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user