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:
@ -75,8 +75,8 @@ void Foam::syncTools::checkTransform
|
|||||||
// Determines for every point whether it is coupled and if so sets only one.
|
// Determines for every point whether it is coupled and if so sets only one.
|
||||||
Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh)
|
Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh)
|
||||||
{
|
{
|
||||||
PackedBoolList isMasterPoint(mesh.nPoints(), 0);
|
PackedBoolList isMasterPoint(mesh.nPoints());
|
||||||
PackedBoolList donePoint(mesh.nPoints(), 0);
|
PackedBoolList donePoint(mesh.nPoints());
|
||||||
|
|
||||||
|
|
||||||
// Do multiple shared points. Min. proc is master
|
// Do multiple shared points. Min. proc is master
|
||||||
@ -194,8 +194,8 @@ Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh)
|
|||||||
// Determines for every edge whether it is coupled and if so sets only one.
|
// Determines for every edge whether it is coupled and if so sets only one.
|
||||||
Foam::PackedBoolList Foam::syncTools::getMasterEdges(const polyMesh& mesh)
|
Foam::PackedBoolList Foam::syncTools::getMasterEdges(const polyMesh& mesh)
|
||||||
{
|
{
|
||||||
PackedBoolList isMasterEdge(mesh.nEdges(), 0);
|
PackedBoolList isMasterEdge(mesh.nEdges());
|
||||||
PackedBoolList doneEdge(mesh.nEdges(), 0);
|
PackedBoolList doneEdge(mesh.nEdges());
|
||||||
|
|
||||||
|
|
||||||
// Do multiple shared edges. Min. proc is master
|
// Do multiple shared edges. Min. proc is master
|
||||||
|
|||||||
@ -35,9 +35,6 @@ Description
|
|||||||
#include "pointData.H"
|
#include "pointData.H"
|
||||||
#include "PointEdgeWave.H"
|
#include "PointEdgeWave.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
// Calculate inverse sum of edge weights (currently always 1.0)
|
// Calculate inverse sum of edge weights (currently always 1.0)
|
||||||
@ -240,7 +237,7 @@ void Foam::autoLayerDriver::smoothNormals
|
|||||||
const edgeList& edges = mesh.edges();
|
const edgeList& edges = mesh.edges();
|
||||||
|
|
||||||
// Points that do not change.
|
// Points that do not change.
|
||||||
PackedBoolList isFixedPoint(mesh.nPoints(), 0);
|
PackedBoolList isFixedPoint(mesh.nPoints());
|
||||||
|
|
||||||
// Internal points that are fixed
|
// Internal points that are fixed
|
||||||
forAll(fixedPoints, i)
|
forAll(fixedPoints, i)
|
||||||
|
|||||||
@ -47,12 +47,7 @@ Description
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
defineTypeNameAndDebug(Foam::autoSnapDriver, 0);
|
||||||
{
|
|
||||||
|
|
||||||
defineTypeNameAndDebug(autoSnapDriver, 0);
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
@ -1308,7 +1303,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface
|
|||||||
|
|
||||||
|
|
||||||
// Faces that do not move
|
// Faces that do not move
|
||||||
PackedBoolList isZonedFace(mesh.nFaces(), 0);
|
PackedBoolList isZonedFace(mesh.nFaces());
|
||||||
{
|
{
|
||||||
// 1. All faces on zoned surfaces
|
// 1. All faces on zoned surfaces
|
||||||
const wordList& faceZoneNames = surfaces.faceZoneNames();
|
const wordList& faceZoneNames = surfaces.faceZoneNames();
|
||||||
|
|||||||
@ -1274,7 +1274,7 @@ Foam::labelList Foam::meshRefinement::intersectedPoints() const
|
|||||||
const faceList& faces = mesh_.faces();
|
const faceList& faces = mesh_.faces();
|
||||||
|
|
||||||
// Mark all points on faces that will become baffles
|
// Mark all points on faces that will become baffles
|
||||||
PackedBoolList isBoundaryPoint(mesh_.nPoints(), 0u);
|
PackedBoolList isBoundaryPoint(mesh_.nPoints());
|
||||||
label nBoundaryPoints = 0;
|
label nBoundaryPoints = 0;
|
||||||
|
|
||||||
forAll(surfaceIndex_, faceI)
|
forAll(surfaceIndex_, faceI)
|
||||||
|
|||||||
@ -36,15 +36,19 @@ License
|
|||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
#include "decompositionMethod.H"
|
#include "decompositionMethod.H"
|
||||||
#include "vectorList.H"
|
#include "vectorList.H"
|
||||||
|
#include "PackedBoolList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
defineTypeNameAndDebug(distributedTriSurfaceMesh, 0);
|
||||||
defineTypeNameAndDebug(distributedTriSurfaceMesh, 0);
|
addToRunTimeSelectionTable
|
||||||
addToRunTimeSelectionTable(searchableSurface, distributedTriSurfaceMesh, dict);
|
(
|
||||||
|
searchableSurface,
|
||||||
|
distributedTriSurfaceMesh,
|
||||||
|
dict
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -873,7 +877,7 @@ Foam::distributedTriSurfaceMesh::independentlyDistributedBbs
|
|||||||
bbs[procI].setSize(1);
|
bbs[procI].setSize(1);
|
||||||
//bbs[procI][0] = boundBox::invertedBox;
|
//bbs[procI][0] = boundBox::invertedBox;
|
||||||
bbs[procI][0].min() = point( VGREAT, VGREAT, VGREAT);
|
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)
|
forAll (s, triI)
|
||||||
@ -917,8 +921,7 @@ void Foam::distributedTriSurfaceMesh::calcBounds
|
|||||||
// Unfortunately nPoints constructs meshPoints() so do compact version
|
// Unfortunately nPoints constructs meshPoints() so do compact version
|
||||||
// ourselves
|
// ourselves
|
||||||
|
|
||||||
PackedList<1> pointIsUsed(points().size());
|
PackedBoolList pointIsUsed(points().size());
|
||||||
pointIsUsed = 0U;
|
|
||||||
|
|
||||||
nPoints = 0;
|
nPoints = 0;
|
||||||
bb.min() = point(VGREAT, VGREAT, VGREAT);
|
bb.min() = point(VGREAT, VGREAT, VGREAT);
|
||||||
@ -933,7 +936,7 @@ void Foam::distributedTriSurfaceMesh::calcBounds
|
|||||||
forAll(f, fp)
|
forAll(f, fp)
|
||||||
{
|
{
|
||||||
label pointI = 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.min() = ::Foam::min(bb.min(), points()[pointI]);
|
||||||
bb.max() = ::Foam::max(bb.max(), points()[pointI]);
|
bb.max() = ::Foam::max(bb.max(), points()[pointI]);
|
||||||
|
|||||||
@ -82,8 +82,8 @@ bool Foam::rawTopoChangerFvMesh::update()
|
|||||||
// - internal faces inflated out of nothing
|
// - internal faces inflated out of nothing
|
||||||
// - patch faces created out of previously internal faces
|
// - patch faces created out of previously internal faces
|
||||||
|
|
||||||
// Is face mapped in any way
|
// Is face mapped in any way?
|
||||||
PackedList<1> mappedFace(nFaces());
|
PackedBoolList mappedFace(nFaces());
|
||||||
|
|
||||||
const label nOldInternal = topoChangeMap().oldPatchStarts()[0];
|
const label nOldInternal = topoChangeMap().oldPatchStarts()[0];
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@ SourceFiles
|
|||||||
#define rawTopoChangerFvMesh_H
|
#define rawTopoChangerFvMesh_H
|
||||||
|
|
||||||
#include "topoChangerFvMesh.H"
|
#include "topoChangerFvMesh.H"
|
||||||
#include "PackedList.H"
|
#include "PackedBoolList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -64,12 +64,12 @@ class rawTopoChangerFvMesh
|
|||||||
static void setUnmappedValues
|
static void setUnmappedValues
|
||||||
(
|
(
|
||||||
GeometricField<Type, PatchField, GeoMesh>& fld,
|
GeometricField<Type, PatchField, GeoMesh>& fld,
|
||||||
const PackedList<1>& mappedFace,
|
const PackedBoolList& mappedFace,
|
||||||
const GeometricField<Type, PatchField, GeoMesh>& baseFld
|
const GeometricField<Type, PatchField, GeoMesh>& baseFld
|
||||||
);
|
);
|
||||||
|
|
||||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
void zeroUnmappedValues(const PackedList<1>&) const;
|
void zeroUnmappedValues(const PackedBoolList&) const;
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
rawTopoChangerFvMesh(const rawTopoChangerFvMesh&);
|
rawTopoChangerFvMesh(const rawTopoChangerFvMesh&);
|
||||||
|
|||||||
@ -33,7 +33,7 @@ template<class Type, template<class> class PatchField, class GeoMesh>
|
|||||||
void Foam::rawTopoChangerFvMesh::setUnmappedValues
|
void Foam::rawTopoChangerFvMesh::setUnmappedValues
|
||||||
(
|
(
|
||||||
GeometricField<Type, PatchField, GeoMesh>& fld,
|
GeometricField<Type, PatchField, GeoMesh>& fld,
|
||||||
const PackedList<1>& mappedFace,
|
const PackedBoolList& mappedFace,
|
||||||
const GeometricField<Type, PatchField, GeoMesh>& baseFld
|
const GeometricField<Type, PatchField, GeoMesh>& baseFld
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -65,7 +65,7 @@ void Foam::rawTopoChangerFvMesh::setUnmappedValues
|
|||||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
void Foam::rawTopoChangerFvMesh::zeroUnmappedValues
|
void Foam::rawTopoChangerFvMesh::zeroUnmappedValues
|
||||||
(
|
(
|
||||||
const PackedList<1>& mappedFace
|
const PackedBoolList& mappedFace
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
typedef GeometricField<Type, PatchField, GeoMesh> FieldType;
|
typedef GeometricField<Type, PatchField, GeoMesh> FieldType;
|
||||||
|
|||||||
Reference in New Issue
Block a user