diff --git a/src/dynamicMesh/motionSolvers/displacement/pointSmoothing/displacementPointSmoothingMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/pointSmoothing/displacementPointSmoothingMotionSolver.C index abb52d5cfa..0d3ff48e36 100644 --- a/src/dynamicMesh/motionSolvers/displacement/pointSmoothing/displacementPointSmoothingMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/pointSmoothing/displacementPointSmoothingMotionSolver.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2024 OpenCFD Ltd. + Copyright (C) 2024-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -61,20 +61,11 @@ void Foam::displacementPointSmoothingMotionSolver::markAffectedFaces labelHashSet& affectedFaces ) { - PackedBoolList affectedPoints(mesh().nPoints(), false); + bitSet affectedPoints(mesh().nPoints()); - forAllConstIter(labelHashSet, changedFaces, iter) + for (const label facei : changedFaces) { - const label faceI(iter.key()); - - const face& fPoints(mesh().faces()[faceI]); - - forAll(fPoints, fPointI) - { - const label pointI(fPoints[fPointI]); - - affectedPoints[pointI] = true; - } + affectedPoints.set(mesh().faces()[facei]); } syncTools::syncPointList @@ -85,20 +76,11 @@ void Foam::displacementPointSmoothingMotionSolver::markAffectedFaces 0U ); - forAll(affectedPoints, pointI) + for (const label pointi : affectedPoints) { - if (affectedPoints[pointI]) + for (const label celli : mesh().pointCells()[pointi]) { - const labelList& pCells(mesh().pointCells()[pointI]); - - forAll(pCells, pointCellI) - { - const label cellI(pCells[pointCellI]); - - const labelList& cFaces(mesh().cells()[cellI]); - - affectedFaces.insert(cFaces); - } + affectedFaces.insert(mesh().cells()[celli]); } } } @@ -108,7 +90,7 @@ bool Foam::displacementPointSmoothingMotionSolver::relax() { if ( - (relaxationFactors_.size() == 0) + relaxationFactors_.empty() || (relaxationFactors_.size() == 1 && relaxationFactors_[0] == 1.0) ) { @@ -125,17 +107,12 @@ bool Foam::displacementPointSmoothingMotionSolver::relax() // -1 indicates a point which is not to be moved // 0 is the starting value for a moving point labelList relaxationLevel(mesh().nPoints(), -1); - forAllConstIter(labelHashSet, affectedFaces, iter) + + for (const label facei : affectedFaces) { - const label faceI(iter.key()); - - const face& fPoints(mesh().faces()[faceI]); - - forAll(fPoints, fPointI) + for (const label pointi : mesh().faces()[facei]) { - const label pointI(fPoints[fPointI]); - - relaxationLevel[pointI] = 0; + relaxationLevel[pointi] = 0; } } @@ -196,32 +173,18 @@ bool Foam::displacementPointSmoothingMotionSolver::relax() markAffectedFaces(markedFaces, affectedFaces); // Increase relaxation and check convergence - PackedBoolList pointsToRelax(mesh().nPoints(), false); + bitSet pointsToRelax(mesh().nPoints()); complete = true; - forAllConstIter(labelHashSet, affectedFaces, iter) + for (const label facei : affectedFaces) { - const label faceI(iter.key()); - - const face& fPoints(mesh().faces()[faceI]); - - forAll(fPoints, fPointI) - { - const label pointI(fPoints[fPointI]); - - pointsToRelax[pointI] = true; - } + pointsToRelax.set(mesh().faces()[facei]); } - forAll(pointsToRelax, pointI) + for (const label pointi : pointsToRelax) { - if - ( - pointsToRelax[pointI] - && (relaxationLevel[pointI] < relaxationFactors_.size() - 1) - ) + if (relaxationLevel[pointi] < relaxationFactors_.size() - 1) { - ++ relaxationLevel[pointI]; - + ++ relaxationLevel[pointi]; complete = false; } } @@ -241,17 +204,15 @@ bool Foam::displacementPointSmoothingMotionSolver::relax() // Check for convergence bool converged(true); - forAll(mesh().faces(), faceI) + forAll(mesh().faces(), facei) { - const face& fPoints(mesh().faces()[faceI]); + const face& fPoints(mesh().faces()[facei]); - forAll(fPoints, fPointI) + for (const label pointi : fPoints) { - const label pointI(fPoints[fPointI]); - - if (relaxationLevel[pointI] > 0) + if (relaxationLevel[pointi] > 0) { - facesToMove_.insert(faceI); + facesToMove_.insert(facei); converged = false; @@ -319,7 +280,7 @@ displacementPointSmoothingMotionSolver pointSmoother_(pointSmoother::New(mesh, coeffDict())), nPointSmootherIter_ ( - readLabel(coeffDict().lookup("nPointSmootherIter")) + coeffDict().get