Removed deprecated calls to std::random_shuffle

This commit is contained in:
Will Bainbridge
2022-12-08 10:32:03 +00:00
parent 364e402b5b
commit 7efb6cc849
13 changed files with 59 additions and 58 deletions

View File

@ -40,7 +40,8 @@ Foam::DelaunayMesh<Triangulation>::DelaunayMesh(const Time& runTime)
Triangulation(),
vertexCount_(0),
cellCount_(0),
runTime_(runTime)
runTime_(runTime),
rndGen_(64293*Pstream::myProcNo())
{}
@ -54,7 +55,8 @@ Foam::DelaunayMesh<Triangulation>::DelaunayMesh
Triangulation(),
vertexCount_(0),
cellCount_(0),
runTime_(runTime)
runTime_(runTime),
rndGen_(64293*Pstream::myProcNo())
{
Info<< "Reading " << meshName << " from " << runTime.name() << endl;
@ -302,7 +304,7 @@ Foam::Map<Foam::label> Foam::DelaunayMesh<Triangulation>::rangeInsertWithInfo
);
}
std::random_shuffle(points.begin(), points.end());
rndGen().permute(points);
spatial_sort
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,6 +45,7 @@ SourceFiles
#include "CGALTriangulation3Ddefs.H"
#include "Time.H"
#include "autoPtr.H"
#include "Random.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -106,6 +107,9 @@ private:
//- Reference to Time
const Time& runTime_;
//- Random number generator
mutable Random rndGen_;
//- Spatial sort traits to use with a pair of point pointers and an int.
// Taken from a post on the CGAL lists: 2010-01/msg00004.html by
// Sebastien Loriot (Geometry Factory).
@ -219,6 +223,10 @@ public:
inline void resetVertexCount();
//- Access the random number generator
inline Random& rndGen() const;
// Triangulation manipulation functions
//- Clear the entire triangulation

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,7 +33,7 @@ inline const Foam::Time& Foam::DelaunayMesh<Triangulation>::time() const
template<class Triangulation>
void Foam::DelaunayMesh<Triangulation>::timeCheck
inline void Foam::DelaunayMesh<Triangulation>::timeCheck
(
const string& description,
const bool check
@ -90,31 +90,38 @@ inline Foam::label Foam::DelaunayMesh<Triangulation>::getNewVertexIndex() const
template<class Triangulation>
Foam::label Foam::DelaunayMesh<Triangulation>::cellCount() const
inline Foam::label Foam::DelaunayMesh<Triangulation>::cellCount() const
{
return cellCount_;
}
template<class Triangulation>
Foam::label Foam::DelaunayMesh<Triangulation>::vertexCount() const
inline Foam::label Foam::DelaunayMesh<Triangulation>::vertexCount() const
{
return vertexCount_;
}
template<class Triangulation>
void Foam::DelaunayMesh<Triangulation>::resetCellCount()
inline void Foam::DelaunayMesh<Triangulation>::resetCellCount()
{
cellCount_ = 0;
}
template<class Triangulation>
void Foam::DelaunayMesh<Triangulation>::resetVertexCount()
inline void Foam::DelaunayMesh<Triangulation>::resetVertexCount()
{
vertexCount_ = 0;
}
template<class Triangulation>
inline Foam::Random& Foam::DelaunayMesh<Triangulation>::rndGen() const
{
return rndGen_;
}
// ************************************************************************* //

View File

@ -900,7 +900,7 @@ Foam::DistributedDelaunayMesh<Triangulation>::rangeInsertReferredWithInfo
);
}
std::random_shuffle(pointsBbDistSqr.begin(), pointsBbDistSqr.end());
this->rndGen().permute(pointsBbDistSqr);
// Sort in ascending order by the distance of the point from the centre
// of the processor bounding box

View File

@ -827,7 +827,6 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
:
DistributedDelaunayMesh<Delaunay>(runTime),
runTime_(runTime),
rndGen_(64293*Pstream::myProcNo()),
foamyHexMeshControls_(foamyHexMeshDict),
allGeometry_
(
@ -846,7 +845,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
geometryToConformTo_
(
runTime_,
rndGen_,
rndGen(),
allGeometry_,
foamyHexMeshDict.subDict("surfaceConformation")
),
@ -856,7 +855,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
? new backgroundMeshDecomposition
(
runTime_,
rndGen_,
rndGen(),
geometryToConformTo_,
foamyHexMeshControls().foamyHexMeshDict().subDict
(
@ -884,7 +883,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
(
foamyHexMeshDict.subDict("initialPoints"),
runTime_,
rndGen_,
rndGen(),
geometryToConformTo_,
cellShapeControl_,
decomposition_
@ -986,7 +985,7 @@ void Foam::conformalVoronoiMesh::initialiseForConformation()
new backgroundMeshDecomposition
(
runTime_,
rndGen_,
rndGen(),
geometryToConformTo_,
foamyHexMeshControls().foamyHexMeshDict().subDict
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -139,9 +139,6 @@ private:
//- The time registry of the application
const Time& runTime_;
//- Random number generator
mutable Random rndGen_;
//- Controls for the conformal Voronoi meshing process
cvControls foamyHexMeshControls_;
@ -902,9 +899,6 @@ public:
//- Return the Time object
inline const Time& time() const;
//- Return the random number generator
inline Random& rndGen() const;
//- Return the allGeometry object
inline const searchableSurfaces& allGeometry() const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -293,9 +293,9 @@ inline Foam::point Foam::conformalVoronoiMesh::perturbPoint
scalar pert = 1e-12*defaultCellSize();
perturbedPt.x() += pert*(rndGen_.scalar01() - 0.5);
perturbedPt.y() += pert*(rndGen_.scalar01() - 0.5);
perturbedPt.z() += pert*(rndGen_.scalar01() - 0.5);
perturbedPt.x() += pert*(rndGen().scalar01() - 0.5);
perturbedPt.y() += pert*(rndGen().scalar01() - 0.5);
perturbedPt.z() += pert*(rndGen().scalar01() - 0.5);
return perturbedPt;
}
@ -533,12 +533,6 @@ inline const Foam::Time& Foam::conformalVoronoiMesh::time() const
}
inline Foam::Random& Foam::conformalVoronoiMesh::rndGen() const
{
return rndGen_;
}
inline const Foam::searchableSurfaces&
Foam::conformalVoronoiMesh::allGeometry() const
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -566,7 +566,7 @@ bool Foam::autoDensity::fillBox
// Randomise the order of the points to (potentially) improve the speed
// of assessing the density ratio, and prevent a box being filled from a
// corner when only some these points are required.
shuffle(samplePoints);
rndGen().permute(samplePoints);
scalarField sampleSizes = cellShapeControls().cellSize(samplePoints);