diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index fdc73aa928..f5ae929324 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -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); diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H index 876be48b61..f56ed62897 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H @@ -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; diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C index 442cdd9528..0d40f4262e 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C @@ -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; } diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C index 98fdc3d251..ae9c3c1924 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C @@ -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); diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H index aff5f3cccd..d93a37dfc3 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H @@ -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 { diff --git a/src/mesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.C b/src/mesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.C index 9f1bef79bc..cc59d83b16 100644 --- a/src/mesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.C +++ b/src/mesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.C @@ -76,7 +76,8 @@ std::vector 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 initialPoints; diff --git a/src/mesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.H b/src/mesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.H index a36ff7c9fa..ea67464e32 100644 --- a/src/mesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.H +++ b/src/mesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.H @@ -36,8 +36,6 @@ SourceFiles #ifndef bodyCentredCubic_H #define bodyCentredCubic_H -#include "Switch.H" -#include "Random.H" #include "initialPointsMethod.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/mesh/conformalVoronoiMesh/initialPointsMethod/densityWeightedStochastic/densityWeightedStochastic.C b/src/mesh/conformalVoronoiMesh/initialPointsMethod/densityWeightedStochastic/densityWeightedStochastic.C index 8dd5c71e96..84559a98a3 100644 --- a/src/mesh/conformalVoronoiMesh/initialPointsMethod/densityWeightedStochastic/densityWeightedStochastic.C +++ b/src/mesh/conformalVoronoiMesh/initialPointsMethod/densityWeightedStochastic/densityWeightedStochastic.C @@ -68,7 +68,7 @@ std::vector densityWeightedStochastic::initialPoints() const { const boundBox& bb = cvMesh_.geometryToConformTo().bounds(); - Random rndGen(5234986); + Random& rndGen = cvMesh_.rndGen(); std::vector initialPoints; diff --git a/src/mesh/conformalVoronoiMesh/initialPointsMethod/densityWeightedStochastic/densityWeightedStochastic.H b/src/mesh/conformalVoronoiMesh/initialPointsMethod/densityWeightedStochastic/densityWeightedStochastic.H index 8cc1afc0cb..a7529a2758 100644 --- a/src/mesh/conformalVoronoiMesh/initialPointsMethod/densityWeightedStochastic/densityWeightedStochastic.H +++ b/src/mesh/conformalVoronoiMesh/initialPointsMethod/densityWeightedStochastic/densityWeightedStochastic.H @@ -36,8 +36,6 @@ SourceFiles #ifndef densityWeightedStochastic_H #define densityWeightedStochastic_H -#include "Switch.H" -#include "Random.H" #include "initialPointsMethod.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/mesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.C b/src/mesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.C index 0996fcd353..4f6b3fc1e2 100644 --- a/src/mesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.C +++ b/src/mesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.C @@ -76,7 +76,8 @@ std::vector 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 initialPoints; diff --git a/src/mesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.H b/src/mesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.H index 6d5d558f27..97fefab710 100644 --- a/src/mesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.H +++ b/src/mesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.H @@ -36,8 +36,6 @@ SourceFiles #ifndef faceCentredCubic_H #define faceCentredCubic_H -#include "Switch.H" -#include "Random.H" #include "initialPointsMethod.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/mesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.H b/src/mesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.H index 9129ebeaa0..7d03044c46 100644 --- a/src/mesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/initialPointsMethod.H +++ b/src/mesh/conformalVoronoiMesh/initialPointsMethod/initialPointsMethod/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" diff --git a/src/mesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C b/src/mesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C index 58052f3c76..66ac64b56e 100644 --- a/src/mesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C +++ b/src/mesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C @@ -76,7 +76,8 @@ std::vector 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 initialPoints; diff --git a/src/mesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.H b/src/mesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.H index 535276434b..e2aa1ff1a2 100644 --- a/src/mesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.H +++ b/src/mesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.H @@ -36,8 +36,6 @@ SourceFiles #ifndef uniformGrid_H #define uniformGrid_H -#include "Switch.H" -#include "Random.H" #include "initialPointsMethod.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //