mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +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:
@ -143,7 +143,7 @@ void Foam::createShellMesh::syncEdges
|
||||
if (!isChangedEdge[patchEdgeI])
|
||||
{
|
||||
changedEdges.append(patchEdgeI);
|
||||
isChangedEdge[patchEdgeI] = true;
|
||||
isChangedEdge.set(patchEdgeI);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -236,7 +236,7 @@ void Foam::createShellMesh::calcPointRegions
|
||||
if (!isChangedEdge[edgeI])
|
||||
{
|
||||
changedEdges.append(edgeI);
|
||||
isChangedEdge[edgeI] = true;
|
||||
isChangedEdge.set(edgeI);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -289,7 +289,7 @@ void Foam::createShellMesh::calcPointRegions
|
||||
pointGlobalRegions[facei][fp0] = edgeData[0];
|
||||
if (!isChangedFace[facei])
|
||||
{
|
||||
isChangedFace[facei] = true;
|
||||
isChangedFace.set(facei);
|
||||
changedFaces.append(facei);
|
||||
}
|
||||
}
|
||||
@ -300,7 +300,7 @@ void Foam::createShellMesh::calcPointRegions
|
||||
pointGlobalRegions[facei][fp1] = edgeData[1];
|
||||
if (!isChangedFace[facei])
|
||||
{
|
||||
isChangedFace[facei] = true;
|
||||
isChangedFace.set(facei);
|
||||
changedFaces.append(facei);
|
||||
}
|
||||
}
|
||||
@ -349,7 +349,7 @@ void Foam::createShellMesh::calcPointRegions
|
||||
if (!isChangedEdge[edgeI])
|
||||
{
|
||||
changedEdges.append(edgeI);
|
||||
isChangedEdge[edgeI] = true;
|
||||
isChangedEdge.set(edgeI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user