mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
use PackedBoolList typedef instead of PackedList<1>
Note:
PackedList constructor initializes to zero, faster not to do it
ourselves.
ie,
PackedList foo(nPoints);
vs.
PackedList foo(nPoints, 0);
saves an extra nPoints operations with shifts/masks etc.
If speed is important, change this type of code
PackedList isMaster(nPoints, 1u);
for (loop)
{
if (condition)
{
isMaster.set(i, 0u); // unset bit
}
}
return isMaster;
into this:
PackedList notMaster(nPoints);
for (loop)
{
if (!condition)
{
notMaster.set(i, 1u);
}
}
notMaster.flip();
return notMaster;
or this:
PackedList isMaster(nPoints);
isMaster.flip();
for (loop)
{
if (condition)
{
isMaster.set(i, 0u);
}
}
return isMaster;
This commit is contained in:
@ -36,15 +36,19 @@ License
|
||||
#include "IFstream.H"
|
||||
#include "decompositionMethod.H"
|
||||
#include "vectorList.H"
|
||||
#include "PackedBoolList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(distributedTriSurfaceMesh, 0);
|
||||
addToRunTimeSelectionTable(searchableSurface, distributedTriSurfaceMesh, dict);
|
||||
|
||||
defineTypeNameAndDebug(distributedTriSurfaceMesh, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
searchableSurface,
|
||||
distributedTriSurfaceMesh,
|
||||
dict
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -873,7 +877,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
|
||||
bbs[procI].setSize(1);
|
||||
//bbs[procI][0] = boundBox::invertedBox;
|
||||
bbs[procI][0].min() = point( VGREAT, VGREAT, VGREAT);
|
||||
bbs[procI][0].max() = point(-VGREAT, -VGREAT, -VGREAT);
|
||||
bbs[procI][0].max() = point(-VGREAT, -VGREAT, -VGREAT);
|
||||
}
|
||||
|
||||
forAll (s, triI)
|
||||
@ -917,8 +921,7 @@ void Foam::distributedTriSurfaceMesh::calcBounds
|
||||
// Unfortunately nPoints constructs meshPoints() so do compact version
|
||||
// ourselves
|
||||
|
||||
PackedList<1> pointIsUsed(points().size());
|
||||
pointIsUsed = 0U;
|
||||
PackedBoolList pointIsUsed(points().size());
|
||||
|
||||
nPoints = 0;
|
||||
bb.min() = point(VGREAT, VGREAT, VGREAT);
|
||||
@ -933,7 +936,7 @@ void Foam::distributedTriSurfaceMesh::calcBounds
|
||||
forAll(f, fp)
|
||||
{
|
||||
label pointI = f[fp];
|
||||
if (pointIsUsed.set(pointI, 1))
|
||||
if (pointIsUsed.set(pointI, 1u))
|
||||
{
|
||||
bb.min() = ::Foam::min(bb.min(), points()[pointI]);
|
||||
bb.max() = ::Foam::max(bb.max(), points()[pointI]);
|
||||
|
||||
Reference in New Issue
Block a user