mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: update code style for point-smoothing
This commit is contained in:
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2024 OpenCFD Ltd.
|
Copyright (C) 2024-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -61,20 +61,11 @@ void Foam::displacementPointSmoothingMotionSolver::markAffectedFaces
|
|||||||
labelHashSet& affectedFaces
|
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());
|
affectedPoints.set(mesh().faces()[facei]);
|
||||||
|
|
||||||
const face& fPoints(mesh().faces()[faceI]);
|
|
||||||
|
|
||||||
forAll(fPoints, fPointI)
|
|
||||||
{
|
|
||||||
const label pointI(fPoints[fPointI]);
|
|
||||||
|
|
||||||
affectedPoints[pointI] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
syncTools::syncPointList
|
syncTools::syncPointList
|
||||||
@ -85,20 +76,11 @@ void Foam::displacementPointSmoothingMotionSolver::markAffectedFaces
|
|||||||
0U
|
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]);
|
affectedFaces.insert(mesh().cells()[celli]);
|
||||||
|
|
||||||
forAll(pCells, pointCellI)
|
|
||||||
{
|
|
||||||
const label cellI(pCells[pointCellI]);
|
|
||||||
|
|
||||||
const labelList& cFaces(mesh().cells()[cellI]);
|
|
||||||
|
|
||||||
affectedFaces.insert(cFaces);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,7 +90,7 @@ bool Foam::displacementPointSmoothingMotionSolver::relax()
|
|||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
(relaxationFactors_.size() == 0)
|
relaxationFactors_.empty()
|
||||||
|| (relaxationFactors_.size() == 1 && relaxationFactors_[0] == 1.0)
|
|| (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
|
// -1 indicates a point which is not to be moved
|
||||||
// 0 is the starting value for a moving point
|
// 0 is the starting value for a moving point
|
||||||
labelList relaxationLevel(mesh().nPoints(), -1);
|
labelList relaxationLevel(mesh().nPoints(), -1);
|
||||||
forAllConstIter(labelHashSet, affectedFaces, iter)
|
|
||||||
|
for (const label facei : affectedFaces)
|
||||||
{
|
{
|
||||||
const label faceI(iter.key());
|
for (const label pointi : mesh().faces()[facei])
|
||||||
|
|
||||||
const face& fPoints(mesh().faces()[faceI]);
|
|
||||||
|
|
||||||
forAll(fPoints, fPointI)
|
|
||||||
{
|
{
|
||||||
const label pointI(fPoints[fPointI]);
|
relaxationLevel[pointi] = 0;
|
||||||
|
|
||||||
relaxationLevel[pointI] = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,32 +173,18 @@ bool Foam::displacementPointSmoothingMotionSolver::relax()
|
|||||||
markAffectedFaces(markedFaces, affectedFaces);
|
markAffectedFaces(markedFaces, affectedFaces);
|
||||||
|
|
||||||
// Increase relaxation and check convergence
|
// Increase relaxation and check convergence
|
||||||
PackedBoolList pointsToRelax(mesh().nPoints(), false);
|
bitSet pointsToRelax(mesh().nPoints());
|
||||||
complete = true;
|
complete = true;
|
||||||
forAllConstIter(labelHashSet, affectedFaces, iter)
|
for (const label facei : affectedFaces)
|
||||||
{
|
{
|
||||||
const label faceI(iter.key());
|
pointsToRelax.set(mesh().faces()[facei]);
|
||||||
|
|
||||||
const face& fPoints(mesh().faces()[faceI]);
|
|
||||||
|
|
||||||
forAll(fPoints, fPointI)
|
|
||||||
{
|
|
||||||
const label pointI(fPoints[fPointI]);
|
|
||||||
|
|
||||||
pointsToRelax[pointI] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(pointsToRelax, pointI)
|
for (const label pointi : pointsToRelax)
|
||||||
{
|
{
|
||||||
if
|
if (relaxationLevel[pointi] < relaxationFactors_.size() - 1)
|
||||||
(
|
|
||||||
pointsToRelax[pointI]
|
|
||||||
&& (relaxationLevel[pointI] < relaxationFactors_.size() - 1)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
++ relaxationLevel[pointI];
|
++ relaxationLevel[pointi];
|
||||||
|
|
||||||
complete = false;
|
complete = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,17 +204,15 @@ bool Foam::displacementPointSmoothingMotionSolver::relax()
|
|||||||
|
|
||||||
// Check for convergence
|
// Check for convergence
|
||||||
bool converged(true);
|
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;
|
converged = false;
|
||||||
|
|
||||||
@ -319,7 +280,7 @@ displacementPointSmoothingMotionSolver
|
|||||||
pointSmoother_(pointSmoother::New(mesh, coeffDict())),
|
pointSmoother_(pointSmoother::New(mesh, coeffDict())),
|
||||||
nPointSmootherIter_
|
nPointSmootherIter_
|
||||||
(
|
(
|
||||||
readLabel(coeffDict().lookup("nPointSmootherIter"))
|
coeffDict().get<label>("nPointSmootherIter")
|
||||||
),
|
),
|
||||||
relaxedPoints_(mesh.points())
|
relaxedPoints_(mesh.points())
|
||||||
{
|
{
|
||||||
@ -352,7 +313,7 @@ displacementPointSmoothingMotionSolver
|
|||||||
),
|
),
|
||||||
nPointSmootherIter_
|
nPointSmootherIter_
|
||||||
(
|
(
|
||||||
readLabel(coeffDict().lookup("nPointSmootherIter"))
|
coeffDict().get<label>("nPointSmootherIter")
|
||||||
),
|
),
|
||||||
relaxedPoints_(mesh.points())
|
relaxedPoints_(mesh.points())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2024 OpenCFD Ltd.
|
Copyright (C) 2024-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -66,20 +66,11 @@ void Foam::displacementSmartPointSmoothingMotionSolver::markAffectedFaces
|
|||||||
labelHashSet& affectedFaces
|
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());
|
affectedPoints.set(mesh().faces()[facei]);
|
||||||
|
|
||||||
const face& fPoints(mesh().faces()[faceI]);
|
|
||||||
|
|
||||||
forAll(fPoints, fPointI)
|
|
||||||
{
|
|
||||||
const label pointI(fPoints[fPointI]);
|
|
||||||
|
|
||||||
affectedPoints[pointI] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
syncTools::syncPointList
|
syncTools::syncPointList
|
||||||
@ -90,20 +81,11 @@ void Foam::displacementSmartPointSmoothingMotionSolver::markAffectedFaces
|
|||||||
0U
|
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]);
|
affectedFaces.insert(mesh().cells()[celli]);
|
||||||
|
|
||||||
forAll(pCells, pointCellI)
|
|
||||||
{
|
|
||||||
const label cellI(pCells[pointCellI]);
|
|
||||||
|
|
||||||
const labelList& cFaces(mesh().cells()[cellI]);
|
|
||||||
|
|
||||||
affectedFaces.insert(cFaces);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,7 +95,7 @@ bool Foam::displacementSmartPointSmoothingMotionSolver::relax()
|
|||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
(relaxationFactors_.size() == 0)
|
relaxationFactors_.empty()
|
||||||
|| (relaxationFactors_.size() == 1 && relaxationFactors_[0] == 1.0)
|
|| (relaxationFactors_.size() == 1 && relaxationFactors_[0] == 1.0)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -130,17 +112,11 @@ bool Foam::displacementSmartPointSmoothingMotionSolver::relax()
|
|||||||
// -1 indicates a point which is not to be moved
|
// -1 indicates a point which is not to be moved
|
||||||
// 0 is the starting value for a moving point
|
// 0 is the starting value for a moving point
|
||||||
labelList relaxationLevel(mesh().nPoints(), -1);
|
labelList relaxationLevel(mesh().nPoints(), -1);
|
||||||
forAllConstIter(labelHashSet, affectedFaces, iter)
|
for (const label facei : affectedFaces)
|
||||||
{
|
{
|
||||||
const label faceI(iter.key());
|
for (const label pointi : mesh().faces()[facei])
|
||||||
|
|
||||||
const face& fPoints(mesh().faces()[faceI]);
|
|
||||||
|
|
||||||
forAll(fPoints, fPointI)
|
|
||||||
{
|
{
|
||||||
const label pointI(fPoints[fPointI]);
|
relaxationLevel[pointi] = 0;
|
||||||
|
|
||||||
relaxationLevel[pointI] = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,29 +218,16 @@ bool Foam::displacementSmartPointSmoothingMotionSolver::relax()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Increase relaxation and check convergence
|
// Increase relaxation and check convergence
|
||||||
PackedBoolList pointsToRelax(mesh().nPoints(), false);
|
bitSet pointsToRelax(mesh().nPoints());
|
||||||
complete = true;
|
complete = true;
|
||||||
forAllConstIter(labelHashSet, affectedFaces, iter)
|
for (const label facei : affectedFaces)
|
||||||
{
|
{
|
||||||
const label faceI(iter.key());
|
pointsToRelax.set(mesh().faces()[facei]);
|
||||||
|
|
||||||
const face& fPoints(mesh().faces()[faceI]);
|
|
||||||
|
|
||||||
forAll(fPoints, fPointI)
|
|
||||||
{
|
|
||||||
const label pointI(fPoints[fPointI]);
|
|
||||||
|
|
||||||
pointsToRelax[pointI] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(pointsToRelax, pointI)
|
for (const label pointI : pointsToRelax)
|
||||||
{
|
{
|
||||||
if
|
if (relaxationLevel[pointI] < relaxationFactors_.size() - 1)
|
||||||
(
|
|
||||||
pointsToRelax[pointI]
|
|
||||||
&& (relaxationLevel[pointI] < relaxationFactors_.size() - 1)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
++ relaxationLevel[pointI];
|
++ relaxationLevel[pointI];
|
||||||
|
|
||||||
@ -287,17 +250,13 @@ bool Foam::displacementSmartPointSmoothingMotionSolver::relax()
|
|||||||
|
|
||||||
// Check for convergence
|
// Check for convergence
|
||||||
bool converged(true);
|
bool converged(true);
|
||||||
forAll(mesh().faces(), faceI)
|
forAll(mesh().faces(), facei)
|
||||||
{
|
{
|
||||||
const face& fPoints(mesh().faces()[faceI]);
|
for (const label pointi : mesh().faces()[facei])
|
||||||
|
|
||||||
forAll(fPoints, fPointI)
|
|
||||||
{
|
{
|
||||||
const label pointI(fPoints[fPointI]);
|
if (relaxationLevel[pointi] > 0)
|
||||||
|
|
||||||
if (relaxationLevel[pointI] > 0)
|
|
||||||
{
|
{
|
||||||
facesToMove_.insert(faceI);
|
facesToMove_.insert(facei);
|
||||||
|
|
||||||
converged = false;
|
converged = false;
|
||||||
|
|
||||||
@ -404,7 +363,7 @@ displacementSmartPointSmoothingMotionSolver
|
|||||||
pointSmoother_(pointSmoother::New(mesh, coeffDict())),
|
pointSmoother_(pointSmoother::New(mesh, coeffDict())),
|
||||||
nPointSmootherIter_
|
nPointSmootherIter_
|
||||||
(
|
(
|
||||||
readLabel(coeffDict().lookup("nPointSmootherIter"))
|
coeffDict().get<label>("nPointSmootherIter")
|
||||||
),
|
),
|
||||||
relaxedPoints_(mesh.points())
|
relaxedPoints_(mesh.points())
|
||||||
{
|
{
|
||||||
@ -448,7 +407,7 @@ displacementSmartPointSmoothingMotionSolver
|
|||||||
),
|
),
|
||||||
nPointSmootherIter_
|
nPointSmootherIter_
|
||||||
(
|
(
|
||||||
readLabel(coeffDict().lookup("nPointSmootherIter"))
|
coeffDict().get<label>("nPointSmootherIter")
|
||||||
),
|
),
|
||||||
relaxedPoints_(mesh.points())
|
relaxedPoints_(mesh.points())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2021,2024 OpenCFD Ltd.
|
Copyright (C) 2021,2024-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -752,9 +752,9 @@ hexMeshSmootherMotionSolver
|
|||||||
pointSmoother_(pointSmoother::New(mesh, coeffDict())),
|
pointSmoother_(pointSmoother::New(mesh, coeffDict())),
|
||||||
nPointSmootherIter_
|
nPointSmootherIter_
|
||||||
(
|
(
|
||||||
readLabel(coeffDict().lookup("nPointSmootherIter"))
|
coeffDict().get<label>("nPointSmootherIter")
|
||||||
),
|
),
|
||||||
relaxationFactors_(coeffDict().lookup("relaxationFactors")),
|
relaxationFactors_(coeffDict().get<scalarList>("relaxationFactors")),
|
||||||
relaxationLevel_(mesh.nPoints(), 0),
|
relaxationLevel_(mesh.nPoints(), 0),
|
||||||
relaxedPoints_(mesh.points()),
|
relaxedPoints_(mesh.points()),
|
||||||
//surfacesDict_(coeffDict().subDict("geometry")),
|
//surfacesDict_(coeffDict().subDict("geometry")),
|
||||||
@ -885,9 +885,9 @@ hexMeshSmootherMotionSolver
|
|||||||
//),
|
//),
|
||||||
nPointSmootherIter_
|
nPointSmootherIter_
|
||||||
(
|
(
|
||||||
readLabel(coeffDict().lookup("nPointSmootherIter"))
|
coeffDict().get<label>("nPointSmootherIter")
|
||||||
),
|
),
|
||||||
relaxationFactors_(coeffDict().lookup("relaxationFactors")),
|
relaxationFactors_(coeffDict().get<scalarList>("relaxationFactors")),
|
||||||
relaxationLevel_(mesh.nPoints(), 0),
|
relaxationLevel_(mesh.nPoints(), 0),
|
||||||
relaxedPoints_(mesh.points()),
|
relaxedPoints_(mesh.points()),
|
||||||
//surfacesDict_(coeffDict().subDict("geometry")),
|
//surfacesDict_(coeffDict().subDict("geometry")),
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2024 OpenCFD Ltd.
|
Copyright (C) 2024-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -283,10 +283,4 @@ Foam::cellPointConnectivity::cellPointConnectivity(const polyMesh& mesh)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::cellPointConnectivity::~cellPointConnectivity()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2024 OpenCFD Ltd.
|
Copyright (C) 2024-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,8 +37,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef cellPointConnectivity_H
|
#ifndef Foam_cellPointConnectivity_H
|
||||||
#define cellPointConnectivity_H
|
#define Foam_cellPointConnectivity_H
|
||||||
|
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "MeshObject.H"
|
#include "MeshObject.H"
|
||||||
@ -56,7 +56,7 @@ class cellPointConnectivity
|
|||||||
:
|
:
|
||||||
public MoveableMeshObject<polyMesh>
|
public MoveableMeshObject<polyMesh>
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Reference to the polyMesh
|
//- Reference to the polyMesh
|
||||||
const polyMesh& mesh_;
|
const polyMesh& mesh_;
|
||||||
@ -70,11 +70,11 @@ class cellPointConnectivity
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- No copy construct
|
||||||
cellPointConnectivity(const cellPointConnectivity&);
|
cellPointConnectivity(const cellPointConnectivity&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- No copy assignment
|
||||||
void operator=(const cellPointConnectivity&);
|
void operator=(const cellPointConnectivity&) = delete;
|
||||||
|
|
||||||
//- Generate the connectivity
|
//- Generate the connectivity
|
||||||
void generateCellPointConnectivity(label cellI);
|
void generateCellPointConnectivity(label cellI);
|
||||||
@ -89,11 +89,11 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct an IOobject and a polymesh
|
//- Construct an IOobject and a polymesh
|
||||||
cellPointConnectivity(const polyMesh&);
|
explicit cellPointConnectivity(const polyMesh&);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~cellPointConnectivity();
|
~cellPointConnectivity() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2024 OpenCFD Ltd.
|
Copyright (C) 2024-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -118,7 +118,7 @@ geometricElementTransformPointSmoother
|
|||||||
pointSmoother(mesh, dict),
|
pointSmoother(mesh, dict),
|
||||||
transformationParameter_
|
transformationParameter_
|
||||||
(
|
(
|
||||||
readScalar(dict.lookup("transformationParameter"))
|
dict.get<scalar>("transformationParameter")
|
||||||
)
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -168,10 +168,8 @@ void Foam::pointSmoothers::geometricElementTransformPointSmoother::calculate
|
|||||||
pointField transformedPoints(currentPoints);
|
pointField transformedPoints(currentPoints);
|
||||||
|
|
||||||
// Calculate the internal transformations
|
// Calculate the internal transformations
|
||||||
forAllConstIter(labelHashSet, cellsToMove, iter)
|
for (const label cellI : cellsToMove)
|
||||||
{
|
{
|
||||||
const label cellI(iter.key());
|
|
||||||
|
|
||||||
const cell& cFaces
|
const cell& cFaces
|
||||||
(
|
(
|
||||||
mesh().cells()[cellI]
|
mesh().cells()[cellI]
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2024 OpenCFD Ltd.
|
Copyright (C) 2024-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -65,33 +65,19 @@ bool Foam::pointSmoother::isInternalOrProcessorFace(const label faceI) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::PackedBoolList> Foam::pointSmoother::pointsToMove
|
Foam::bitSet Foam::pointSmoother::pointsToMove
|
||||||
(
|
(
|
||||||
const labelList& facesToMove,
|
const labelList& facesToMove,
|
||||||
const bool moveInternalFaces
|
const bool moveInternalFaces
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
autoPtr<PackedBoolList> markerPtr
|
bitSet marker(mesh().nPoints());
|
||||||
(
|
|
||||||
new PackedBoolList(mesh().nPoints(), false)
|
|
||||||
);
|
|
||||||
|
|
||||||
PackedBoolList& marker(markerPtr());
|
for (const label facei : facesToMove)
|
||||||
|
|
||||||
forAll(facesToMove, faceToMoveI)
|
|
||||||
{
|
{
|
||||||
const label faceI(facesToMove[faceToMoveI]);
|
if (moveInternalFaces || !isInternalOrProcessorFace(facei))
|
||||||
|
|
||||||
if (moveInternalFaces || !isInternalOrProcessorFace(faceI))
|
|
||||||
{
|
{
|
||||||
const face& fPoints(mesh().faces()[faceI]);
|
marker.set(mesh().faces()[facei]);
|
||||||
|
|
||||||
forAll(fPoints, fPointI)
|
|
||||||
{
|
|
||||||
const label pointI(fPoints[fPointI]);
|
|
||||||
|
|
||||||
marker[pointI] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +89,7 @@ Foam::autoPtr<Foam::PackedBoolList> Foam::pointSmoother::pointsToMove
|
|||||||
0U
|
0U
|
||||||
);
|
);
|
||||||
|
|
||||||
return markerPtr;
|
return marker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -139,19 +125,20 @@ Foam::pointSmoother::New
|
|||||||
{
|
{
|
||||||
Info<< "Selecting pointSmoother type " << pointSmootherType << endl;
|
Info<< "Selecting pointSmoother type " << pointSmootherType << endl;
|
||||||
|
|
||||||
auto cstrIter = dictionaryConstructorTablePtr_->find(pointSmootherType);
|
auto* ctorPtr = dictionaryConstructorTable(pointSmootherType);
|
||||||
|
|
||||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
if (!ctorPtr)
|
||||||
{
|
{
|
||||||
FatalErrorIn("pointSmoother::New")
|
FatalIOErrorInLookup
|
||||||
<< "Unknown " << typeName << " type "
|
(
|
||||||
<< pointSmootherType << endl << endl
|
dict,
|
||||||
<< "Valid " << typeName << " types are : " << endl
|
typeName,
|
||||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
pointSmootherType,
|
||||||
<< exit(FatalError);
|
*dictionaryConstructorTablePtr_
|
||||||
|
) << exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cstrIter()(mesh, dict);
|
return autoPtr<pointSmoother>(ctorPtr(mesh, dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -162,18 +149,12 @@ Foam::pointSmoother::New
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
word pointSmootherType(dict.lookup(typeName));
|
word pointSmootherType(dict.get<word>(typeName));
|
||||||
|
|
||||||
return New(pointSmootherType, mesh, dict);
|
return New(pointSmootherType, mesh, dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::pointSmoother::~pointSmoother()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::pointSmoother::update
|
void Foam::pointSmoother::update
|
||||||
@ -203,7 +184,7 @@ void Foam::pointSmoother::update
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Note: do not want to apply boundary conditions whilst smoothing so
|
// Note: do not want to apply boundary conditions whilst smoothing so
|
||||||
// disable for now
|
// disable for now
|
||||||
//// Take over boundary values
|
//// Take over boundary values
|
||||||
//for (auto& ppf : pointDisplacement.boundaryFieldRef())
|
//for (auto& ppf : pointDisplacement.boundaryFieldRef())
|
||||||
//{
|
//{
|
||||||
@ -247,7 +228,7 @@ Foam::tmp<Foam::scalarField> Foam::pointSmoother::faceQuality
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
//return max(tortho, scalar(0.0));
|
// tortho.ref().clamp_min(0);
|
||||||
return tortho;
|
return tortho;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +257,7 @@ Foam::tmp<Foam::scalarField> Foam::pointSmoother::cellQuality
|
|||||||
const auto& faceOrtho = tfaceOrtho();
|
const auto& faceOrtho = tfaceOrtho();
|
||||||
|
|
||||||
// Min over cells
|
// Min over cells
|
||||||
tmp<scalarField> tortho(new scalarField(mesh().nCells(), GREAT));
|
auto tortho = tmp<scalarField>::New(mesh().nCells(), GREAT);
|
||||||
auto& ortho = tortho.ref();
|
auto& ortho = tortho.ref();
|
||||||
|
|
||||||
const auto& own = mesh().faceOwner();
|
const auto& own = mesh().faceOwner();
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2024 OpenCFD Ltd.
|
Copyright (C) 2024-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,12 +36,12 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef pointSmoother_H
|
#ifndef Foam_pointSmoother_H
|
||||||
#define pointSmoother_H
|
#define Foam_pointSmoother_H
|
||||||
|
|
||||||
#include "polyMeshGeometry.H"
|
#include "polyMeshGeometry.H"
|
||||||
#include "runTimeSelectionTables.H"
|
#include "runTimeSelectionTables.H"
|
||||||
#include "PackedBoolList.H"
|
#include "bitSet.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class pointSmoother
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Reference to the polyMesh
|
//- Reference to the polyMesh
|
||||||
const polyMesh& mesh_;
|
const polyMesh& mesh_;
|
||||||
@ -67,11 +67,11 @@ private:
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- No copy construct
|
||||||
pointSmoother(const pointSmoother&);
|
pointSmoother(const pointSmoother&) = delete;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- No copy assignment
|
||||||
void operator=(const pointSmoother&);
|
void operator=(const pointSmoother&) = delete;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -81,8 +81,8 @@ protected:
|
|||||||
//- Test if the given face is internal or on a processor boundary
|
//- Test if the given face is internal or on a processor boundary
|
||||||
bool isInternalOrProcessorFace(const label faceI) const;
|
bool isInternalOrProcessorFace(const label faceI) const;
|
||||||
|
|
||||||
//- Get a boolean list of the points to be moved
|
//- Get list of the points to be moved
|
||||||
autoPtr<PackedBoolList> pointsToMove
|
bitSet pointsToMove
|
||||||
(
|
(
|
||||||
const labelList& facesToMove,
|
const labelList& facesToMove,
|
||||||
const bool moveInternalFaces
|
const bool moveInternalFaces
|
||||||
@ -150,13 +150,13 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~pointSmoother();
|
virtual ~pointSmoother() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access the mesh
|
//- Access the mesh
|
||||||
const polyMesh& mesh() const
|
const polyMesh& mesh() const noexcept
|
||||||
{
|
{
|
||||||
return mesh_;
|
return mesh_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2024 OpenCFD Ltd.
|
Copyright (C) 2024-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -39,20 +39,15 @@ void Foam::pointSmoother::reset
|
|||||||
const bool resetInternalFaces
|
const bool resetInternalFaces
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
autoPtr<PackedBoolList> resetPointsPtr
|
bitSet resetPoints
|
||||||
(
|
(
|
||||||
pointsToMove(facesToMove, resetInternalFaces)
|
pointsToMove(facesToMove, resetInternalFaces)
|
||||||
);
|
);
|
||||||
|
|
||||||
const PackedBoolList& resetPoints(resetPointsPtr);
|
for (const label pointi: resetPoints)
|
||||||
|
|
||||||
forAll(resetPoints, pointI)
|
|
||||||
{
|
{
|
||||||
if (resetPoints[pointI])
|
weights[pointi] = pTraits<weightType>::zero;
|
||||||
{
|
pointDisplacement[pointi] = vector::zero;
|
||||||
weights[pointI] = pTraits<weightType>::zero;
|
|
||||||
pointDisplacement[pointI] = vector::zero;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,22 +76,16 @@ void Foam::pointSmoother::average
|
|||||||
vector::zero
|
vector::zero
|
||||||
);
|
);
|
||||||
|
|
||||||
autoPtr<PackedBoolList> averagePointsPtr
|
bitSet averagePoints
|
||||||
(
|
(
|
||||||
pointsToMove(facesToMove, true)
|
pointsToMove(facesToMove, true)
|
||||||
);
|
);
|
||||||
|
|
||||||
const PackedBoolList& averagePoints(averagePointsPtr);
|
for (const label pointi : averagePoints)
|
||||||
|
|
||||||
forAll(averagePoints, pointI)
|
|
||||||
{
|
{
|
||||||
if
|
if (weights[pointi] != pTraits<weightType>::zero)
|
||||||
(
|
|
||||||
averagePoints[pointI]
|
|
||||||
&& weights[pointI] != pTraits<weightType>::zero
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
pointDisplacement[pointI] /= weights[pointI];
|
pointDisplacement[pointi] /= weights[pointi];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2024 OpenCFD Ltd.
|
Copyright (C) 2024-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -34,7 +34,6 @@ License
|
|||||||
#include "dummyTransform.H"
|
#include "dummyTransform.H"
|
||||||
#include "ReadFields.H"
|
#include "ReadFields.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
#include "PackedBoolList.H"
|
|
||||||
#include "fvMeshTools.H"
|
#include "fvMeshTools.H"
|
||||||
#include "cellSetOption.H"
|
#include "cellSetOption.H"
|
||||||
#include "cellBitSet.H"
|
#include "cellBitSet.H"
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2024 OpenCFD Ltd.
|
Copyright (C) 2015-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -61,7 +61,6 @@ License
|
|||||||
#include "faceSet.H"
|
#include "faceSet.H"
|
||||||
#include "topoDistanceData.H"
|
#include "topoDistanceData.H"
|
||||||
#include "FaceCellWave.H"
|
#include "FaceCellWave.H"
|
||||||
#include "PackedBoolList.H"
|
|
||||||
|
|
||||||
// Leak path
|
// Leak path
|
||||||
#include "shortestPathSet.H"
|
#include "shortestPathSet.H"
|
||||||
@ -2778,7 +2777,7 @@ Foam::labelList Foam::meshRefinement::countEdgeFaces
|
|||||||
// Match pp edges to coupled edges
|
// Match pp edges to coupled edges
|
||||||
labelList patchEdges;
|
labelList patchEdges;
|
||||||
labelList coupledEdges;
|
labelList coupledEdges;
|
||||||
PackedBoolList sameEdgeOrientation;
|
bitSet sameEdgeOrientation;
|
||||||
PatchTools::matchEdges
|
PatchTools::matchEdges
|
||||||
(
|
(
|
||||||
pp,
|
pp,
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
Copyright (C) 2018-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -1652,7 +1652,7 @@ void Foam::meshRefinement::selectIntersectedFaces
|
|||||||
// // // Match pp edges to coupled edges
|
// // // Match pp edges to coupled edges
|
||||||
// // labelList patchEdges;
|
// // labelList patchEdges;
|
||||||
// // labelList coupledEdges;
|
// // labelList coupledEdges;
|
||||||
// // PackedBoolList sameEdgeOrientation;
|
// // bitSet sameEdgeOrientation;
|
||||||
// // PatchTools::matchEdges
|
// // PatchTools::matchEdges
|
||||||
// // (
|
// // (
|
||||||
// // pp,
|
// // pp,
|
||||||
|
|||||||
Reference in New Issue
Block a user