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