mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: incorrect bitSet auto-vivify in snappy
- should use bitSet::set() and not bitSet::operator[] to auto-vivify out-of-range entries - use bitSet::test() instead of bitSet::operator[] when testing non-const variables - circumvents any potential out-of-range issues.
This commit is contained in:
@ -2754,9 +2754,9 @@ const
|
|||||||
label nMasterFaces = 0;
|
label nMasterFaces = 0;
|
||||||
forAll(isMasterFace, i)
|
forAll(isMasterFace, i)
|
||||||
{
|
{
|
||||||
if (isMasterFace[i])
|
if (isMasterFace.test(i))
|
||||||
{
|
{
|
||||||
nMasterFaces++;
|
++nMasterFaces;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2764,9 +2764,9 @@ const
|
|||||||
label nMasterPoints = 0;
|
label nMasterPoints = 0;
|
||||||
forAll(isMeshMasterPoint, i)
|
forAll(isMeshMasterPoint, i)
|
||||||
{
|
{
|
||||||
if (isMeshMasterPoint[i])
|
if (isMeshMasterPoint.test(i))
|
||||||
{
|
{
|
||||||
nMasterPoints++;
|
++nMasterPoints;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2333,20 +2333,20 @@ void Foam::meshRefinement::getIntersections
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
namedSurfaceIndex[faceI] = surface2[i];
|
namedSurfaceIndex[faceI] = surface2[i];
|
||||||
posOrientation[faceI] = ((area&normal2[i]) > 0);
|
posOrientation.set(faceI, ((area&normal2[i]) > 0));
|
||||||
nSurfFaces[surface2[i]]++;
|
nSurfFaces[surface2[i]]++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
namedSurfaceIndex[faceI] = surface1[i];
|
namedSurfaceIndex[faceI] = surface1[i];
|
||||||
posOrientation[faceI] = ((area&normal1[i]) > 0);
|
posOrientation.set(faceI, ((area&normal1[i]) > 0));
|
||||||
nSurfFaces[surface1[i]]++;
|
nSurfFaces[surface1[i]]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (surface2[i] != -1)
|
else if (surface2[i] != -1)
|
||||||
{
|
{
|
||||||
namedSurfaceIndex[faceI] = surface2[i];
|
namedSurfaceIndex[faceI] = surface2[i];
|
||||||
posOrientation[faceI] = ((area&normal2[i]) > 0);
|
posOrientation.set(faceI, ((area&normal2[i]) > 0));
|
||||||
nSurfFaces[surface2[i]]++;
|
nSurfFaces[surface2[i]]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1025,9 +1025,9 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
facePatch[facei] = nearestAdaptPatch[facei];
|
facePatch[facei] = nearestAdaptPatch[facei];
|
||||||
if (isMasterFace[facei])
|
if (isMasterFace.test(facei))
|
||||||
{
|
{
|
||||||
nBaffleFaces++;
|
++nBaffleFaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do NOT update boundary data since this would grow
|
// Do NOT update boundary data since this would grow
|
||||||
|
|||||||
@ -261,7 +261,7 @@ Foam::labelList Foam::meshRefinement::getChangedFaces
|
|||||||
|
|
||||||
forAll(changedFace, faceI)
|
forAll(changedFace, faceI)
|
||||||
{
|
{
|
||||||
if (changedFace[faceI] && isMasterFace[faceI])
|
if (changedFace[faceI] && isMasterFace.test(faceI))
|
||||||
{
|
{
|
||||||
nMasterChanged++;
|
nMasterChanged++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -634,7 +634,7 @@ void Foam::snappyLayerDriver::handleNonManifolds
|
|||||||
(
|
(
|
||||||
pp.edgeFaces()[edgei].size() == 1
|
pp.edgeFaces()[edgei].size() == 1
|
||||||
&& edgeGlobalFaces[edgei].size() == 1
|
&& edgeGlobalFaces[edgei].size() == 1
|
||||||
&& isCoupledEdge[meshEdgei]
|
&& isCoupledEdge.test(meshEdgei)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Edge of patch but no continuation across processor.
|
// Edge of patch but no continuation across processor.
|
||||||
@ -4336,7 +4336,7 @@ void Foam::snappyLayerDriver::addLayers
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
label oldFacei = map.faceMap()[facei];
|
label oldFacei = map.faceMap()[facei];
|
||||||
if (oldFacei != -1 && oldBaffleFace[oldFacei])
|
if (oldFacei != -1 && oldBaffleFace.test(oldFacei))
|
||||||
{
|
{
|
||||||
const face& f = mesh.faces()[facei];
|
const face& f = mesh.faces()[facei];
|
||||||
forAll(f, fp)
|
forAll(f, fp)
|
||||||
@ -4680,7 +4680,7 @@ void Foam::snappyLayerDriver::doLayers
|
|||||||
facei++
|
facei++
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (intOrCoupled[facei] && isExtrudedZoneFace[facei])
|
if (intOrCoupled[facei] && isExtrudedZoneFace.test(facei))
|
||||||
{
|
{
|
||||||
faceZoneOnCoupledFace = true;
|
faceZoneOnCoupledFace = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -183,7 +183,7 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::smoothInternalDisplacement
|
|||||||
label ownLevel = cellLevel[mesh.faceOwner()[facei]];
|
label ownLevel = cellLevel[mesh.faceOwner()[facei]];
|
||||||
label neiLevel = cellLevel[mesh.faceNeighbour()[facei]];
|
label neiLevel = cellLevel[mesh.faceNeighbour()[facei]];
|
||||||
|
|
||||||
if (!isFront[facei] && ownLevel != neiLevel)
|
if (!isFront.test(facei) && ownLevel != neiLevel)
|
||||||
{
|
{
|
||||||
const face& f = mesh.faces()[facei];
|
const face& f = mesh.faces()[facei];
|
||||||
isMovingPoint.set(f);
|
isMovingPoint.set(f);
|
||||||
@ -200,7 +200,7 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::smoothInternalDisplacement
|
|||||||
label ownLevel = cellLevel[mesh.faceOwner()[facei]];
|
label ownLevel = cellLevel[mesh.faceOwner()[facei]];
|
||||||
label neiLevel = neiCellLevel[facei-mesh.nInternalFaces()];
|
label neiLevel = neiCellLevel[facei-mesh.nInternalFaces()];
|
||||||
|
|
||||||
if (!isFront[facei] && ownLevel != neiLevel)
|
if (!isFront.test(facei) && ownLevel != neiLevel)
|
||||||
{
|
{
|
||||||
const face& f = mesh.faces()[facei];
|
const face& f = mesh.faces()[facei];
|
||||||
isMovingPoint.set(f);
|
isMovingPoint.set(f);
|
||||||
@ -239,7 +239,7 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::smoothInternalDisplacement
|
|||||||
|
|
||||||
forAll(isMovingPoint, pointi)
|
forAll(isMovingPoint, pointi)
|
||||||
{
|
{
|
||||||
if (isMovingPoint[pointi])
|
if (isMovingPoint.test(pointi))
|
||||||
{
|
{
|
||||||
const labelList& pCells = mesh.pointCells(pointi);
|
const labelList& pCells = mesh.pointCells(pointi);
|
||||||
|
|
||||||
|
|||||||
@ -271,7 +271,7 @@ void Foam::snappySnapDriver::calcNearestFace
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
const faceZone& fZone = mesh.faceZones()[zonei];
|
const faceZone& fZone = mesh.faceZones()[zonei];
|
||||||
bitSet isZonedFace(mesh.nFaces(), fZone);
|
const bitSet isZonedFace(mesh.nFaces(), fZone);
|
||||||
|
|
||||||
DynamicList<label> ppFaces(fZone.size());
|
DynamicList<label> ppFaces(fZone.size());
|
||||||
DynamicList<label> meshFaces(fZone.size());
|
DynamicList<label> meshFaces(fZone.size());
|
||||||
@ -451,7 +451,7 @@ void Foam::snappySnapDriver::calcNearestFacePointProperties
|
|||||||
List<List<point>>& pointFaceSurfNormals,
|
List<List<point>>& pointFaceSurfNormals,
|
||||||
List<List<point>>& pointFaceDisp,
|
List<List<point>>& pointFaceDisp,
|
||||||
List<List<point>>& pointFaceCentres,
|
List<List<point>>& pointFaceCentres,
|
||||||
List<labelList>& pointFacePatchID
|
List<labelList>& pointFacePatchID
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = meshRefiner_.mesh();
|
const fvMesh& mesh = meshRefiner_.mesh();
|
||||||
@ -603,7 +603,7 @@ void Foam::snappySnapDriver::calcNearestFacePointProperties
|
|||||||
{
|
{
|
||||||
label pointi = meshToPatchPoint[f[fp]];
|
label pointi = meshToPatchPoint[f[fp]];
|
||||||
|
|
||||||
if (pointi != -1 && isBoundaryPoint[pointi])
|
if (pointi != -1 && isBoundaryPoint.test(pointi))
|
||||||
{
|
{
|
||||||
List<point>& pNormals = pointFaceSurfNormals[pointi];
|
List<point>& pNormals = pointFaceSurfNormals[pointi];
|
||||||
List<point>& pDisp = pointFaceDisp[pointi];
|
List<point>& pDisp = pointFaceDisp[pointi];
|
||||||
@ -1440,13 +1440,13 @@ void Foam::snappySnapDriver::releasePointsNextToMultiPatch
|
|||||||
pointFacePatchID[pointi],
|
pointFacePatchID[pointi],
|
||||||
pointFaceCentres[pointi]
|
pointFaceCentres[pointi]
|
||||||
);
|
);
|
||||||
isMultiPatchPoint[pointi] = multiPatchPt.hit();
|
isMultiPatchPoint.set(pointi, multiPatchPt.hit());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Make sure multi-patch points are also attracted
|
// 2. Make sure multi-patch points are also attracted
|
||||||
forAll(isMultiPatchPoint, pointi)
|
forAll(isMultiPatchPoint, pointi)
|
||||||
{
|
{
|
||||||
if (isMultiPatchPoint[pointi])
|
if (isMultiPatchPoint.test(pointi))
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -1484,11 +1484,11 @@ void Foam::snappySnapDriver::releasePointsNextToMultiPatch
|
|||||||
label pointi = f[fp];
|
label pointi = f[fp];
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
isMultiPatchPoint[pointi]
|
isMultiPatchPoint.test(pointi)
|
||||||
&& patchConstraints[pointi].first() > 1
|
&& patchConstraints[pointi].first() > 1
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
nMultiPatchPoints++;
|
++nMultiPatchPoints;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1499,7 +1499,7 @@ void Foam::snappySnapDriver::releasePointsNextToMultiPatch
|
|||||||
label pointi = f[fp];
|
label pointi = f[fp];
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
!isMultiPatchPoint[pointi]
|
!isMultiPatchPoint.test(pointi)
|
||||||
&& patchConstraints[pointi].first() > 1
|
&& patchConstraints[pointi].first() > 1
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -2870,7 +2870,7 @@ void Foam::snappySnapDriver::determineBaffleFeatures
|
|||||||
if (efn.size() == 2 && (efn[0]&efn[1]) < baffleFeatureCos)
|
if (efn.size() == 2 && (efn[0]&efn[1]) < baffleFeatureCos)
|
||||||
{
|
{
|
||||||
isBaffleEdge.set(edgei);
|
isBaffleEdge.set(edgei);
|
||||||
nBaffleEdges++;
|
++nBaffleEdges;
|
||||||
const edge& e = pp.edges()[edgei];
|
const edge& e = pp.edges()[edgei];
|
||||||
pointStatus[e[0]] = 0;
|
pointStatus[e[0]] = 0;
|
||||||
pointStatus[e[1]] = 0;
|
pointStatus[e[1]] = 0;
|
||||||
|
|||||||
@ -36,6 +36,7 @@ SourceFiles
|
|||||||
#ifndef trackedParticle_H
|
#ifndef trackedParticle_H
|
||||||
#define trackedParticle_H
|
#define trackedParticle_H
|
||||||
|
|
||||||
|
#include "bitSet.H"
|
||||||
#include "particle.H"
|
#include "particle.H"
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
|
|
||||||
@ -44,11 +45,9 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward declarations
|
||||||
|
|
||||||
class trackedParticleCloud;
|
class trackedParticleCloud;
|
||||||
|
|
||||||
|
|
||||||
// Forward declaration of friend functions and operators
|
|
||||||
|
|
||||||
class trackedParticle;
|
class trackedParticle;
|
||||||
|
|
||||||
Ostream& operator<<(Ostream&, const trackedParticle&);
|
Ostream& operator<<(Ostream&, const trackedParticle&);
|
||||||
|
|||||||
Reference in New Issue
Block a user