mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Store and access random number generator in conformalVoronoiMesh.
This commit is contained in:
@ -38,6 +38,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
|
||||
:
|
||||
HTriangulation(),
|
||||
runTime_(runTime),
|
||||
rndGen_(7864293),
|
||||
allGeometry_
|
||||
(
|
||||
IOobject
|
||||
@ -828,11 +829,9 @@ Foam::conformalVoronoiMesh::featurePointTree() const
|
||||
{
|
||||
if (featurePointTreePtr_.empty())
|
||||
{
|
||||
Random rndGen(92561);
|
||||
|
||||
treeBoundBox overallBb
|
||||
(
|
||||
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen, 1E-4)
|
||||
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen_, 1E-4)
|
||||
);
|
||||
|
||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
@ -110,6 +110,9 @@ private:
|
||||
//- The time registry of the application
|
||||
const Time& runTime_;
|
||||
|
||||
//- Random number generator
|
||||
mutable Random rndGen_;
|
||||
|
||||
//- All geometry of the meshing process, including surfaces to be
|
||||
// conformed to and those to be used for refinement
|
||||
searchableSurfaces allGeometry_;
|
||||
@ -701,6 +704,9 @@ public:
|
||||
//- Return the Time object
|
||||
inline const Time& time() const;
|
||||
|
||||
//- Return the random number generator
|
||||
inline Random& rndGen() const;
|
||||
|
||||
//- Return the conformationSurfaces object
|
||||
inline const conformationSurfaces& geometryToConformTo() const;
|
||||
|
||||
|
||||
@ -122,10 +122,11 @@ void Foam::conformalVoronoiMesh::calcDualMesh
|
||||
<< "A mesh could not be produced to satisfy the specified "
|
||||
<< "quality criteria." << nl
|
||||
<< "The quality and the surface conformation controls "
|
||||
<< "can be altered and the internalDelaunayVertices read in "
|
||||
<< "to try again, or more cell size resolution and motion "
|
||||
<< "iterations can be applied in areas where problems are "
|
||||
<< "occurring."
|
||||
<< "can be altered and the " << nl
|
||||
<< "internalDelaunayVertices read in to try again, or more "
|
||||
<< "cell size resolution " << nl
|
||||
<< "and motion iterations can be applied in areas where "
|
||||
<< "problems are occurring."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
@ -632,11 +632,9 @@ void Foam::conformalVoronoiMesh::buildEdgeLocationTree
|
||||
const pointField& existingEdgeLocations
|
||||
) const
|
||||
{
|
||||
Random rndGen(72953);
|
||||
|
||||
treeBoundBox overallBb
|
||||
(
|
||||
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen, 1E-4)
|
||||
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen_, 1E-4)
|
||||
);
|
||||
|
||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
@ -658,11 +656,9 @@ void Foam::conformalVoronoiMesh::buildEdgeLocationTree
|
||||
|
||||
void Foam::conformalVoronoiMesh::buildSizeAndAlignmentTree() const
|
||||
{
|
||||
Random rndGen(627391);
|
||||
|
||||
treeBoundBox overallBb
|
||||
(
|
||||
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen, 1E-4)
|
||||
treeBoundBox(geometryToConformTo_.bounds()).extend(rndGen_, 1E-4)
|
||||
);
|
||||
|
||||
overallBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||
|
||||
@ -444,6 +444,12 @@ inline const Foam::Time& Foam::conformalVoronoiMesh::time() const
|
||||
}
|
||||
|
||||
|
||||
inline Foam::Random& Foam::conformalVoronoiMesh::rndGen() const
|
||||
{
|
||||
return rndGen_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::conformationSurfaces&
|
||||
Foam::conformalVoronoiMesh::geometryToConformTo() const
|
||||
{
|
||||
|
||||
@ -76,7 +76,8 @@ std::vector<Vb::Point> bodyCentredCubic::initialPoints() const
|
||||
|
||||
delta *= pow((1.0/2.0),-(1.0/3.0));
|
||||
|
||||
Random rndGen(1735621);
|
||||
Random& rndGen = cvMesh_.rndGen();
|
||||
|
||||
scalar pert = randomPerturbationCoeff_*cmptMin(delta);
|
||||
|
||||
std::vector<Vb::Point> initialPoints;
|
||||
|
||||
@ -36,8 +36,6 @@ SourceFiles
|
||||
#ifndef bodyCentredCubic_H
|
||||
#define bodyCentredCubic_H
|
||||
|
||||
#include "Switch.H"
|
||||
#include "Random.H"
|
||||
#include "initialPointsMethod.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -68,7 +68,7 @@ std::vector<Vb::Point> densityWeightedStochastic::initialPoints() const
|
||||
{
|
||||
const boundBox& bb = cvMesh_.geometryToConformTo().bounds();
|
||||
|
||||
Random rndGen(5234986);
|
||||
Random& rndGen = cvMesh_.rndGen();
|
||||
|
||||
std::vector<Vb::Point> initialPoints;
|
||||
|
||||
|
||||
@ -36,8 +36,6 @@ SourceFiles
|
||||
#ifndef densityWeightedStochastic_H
|
||||
#define densityWeightedStochastic_H
|
||||
|
||||
#include "Switch.H"
|
||||
#include "Random.H"
|
||||
#include "initialPointsMethod.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -76,7 +76,8 @@ std::vector<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
|
||||
delta *= pow((1.0/4.0),-(1.0/3.0));
|
||||
|
||||
Random rndGen(1735621);
|
||||
Random& rndGen = cvMesh_.rndGen();
|
||||
|
||||
scalar pert = randomPerturbationCoeff_*cmptMin(delta);
|
||||
|
||||
std::vector<Vb::Point> initialPoints;
|
||||
|
||||
@ -36,8 +36,6 @@ SourceFiles
|
||||
#ifndef faceCentredCubic_H
|
||||
#define faceCentredCubic_H
|
||||
|
||||
#include "Switch.H"
|
||||
#include "Random.H"
|
||||
#include "initialPointsMethod.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -38,6 +38,8 @@ SourceFiles
|
||||
#include "point.H"
|
||||
#include "conformalVoronoiMesh.H"
|
||||
#include "dictionary.H"
|
||||
#include "Random.H"
|
||||
#include "Switch.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
|
||||
@ -76,7 +76,8 @@ std::vector<Vb::Point> uniformGrid::initialPoints() const
|
||||
|
||||
delta *= pow((1.0),-(1.0/3.0));
|
||||
|
||||
Random rndGen(1735621);
|
||||
Random& rndGen = cvMesh_.rndGen();
|
||||
|
||||
scalar pert = randomPerturbationCoeff_*cmptMin(delta);
|
||||
|
||||
std::vector<Vb::Point> initialPoints;
|
||||
|
||||
@ -36,8 +36,6 @@ SourceFiles
|
||||
#ifndef uniformGrid_H
|
||||
#define uniformGrid_H
|
||||
|
||||
#include "Switch.H"
|
||||
#include "Random.H"
|
||||
#include "initialPointsMethod.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Reference in New Issue
Block a user