Merge branch 'feature-random-numbers' into 'develop'

Updated random numbers

See merge request !107
This commit is contained in:
Andrew Heather
2017-04-28 10:11:18 +01:00
109 changed files with 658 additions and 1053 deletions

View File

@ -259,7 +259,7 @@ bool Foam::edgeIntersections::inlinePerturb
if (perturbStart)
{
// Perturb with something (hopefully) larger than tolerance.
scalar t = 4.0*(rndGen.scalar01() - 0.5);
scalar t = 4.0*(rndGen.sample01<scalar>() - 0.5);
points1[v0] += t*surf1PointTol[e[0]]*n;
const labelList& pEdges = surf1.pointEdges()[e[0]];
@ -272,7 +272,7 @@ bool Foam::edgeIntersections::inlinePerturb
if (perturbEnd)
{
// Perturb with something larger than tolerance.
scalar t = 4.0*(rndGen.scalar01() - 0.5);
scalar t = 4.0*(rndGen.sample01<scalar>() - 0.5);
points1[v1] += t*surf1PointTol[e[1]]*n;
const labelList& pEdges = surf1.pointEdges()[e[1]];
@ -319,7 +319,7 @@ bool Foam::edgeIntersections::rotatePerturb
//label pointi = e[0];
// Generate random vector slightly larger than tolerance.
vector rndVec = rndGen.vector01() - vector(0.5, 0.5, 0.5);
vector rndVec = rndGen.sample01<vector>() - vector(0.5, 0.5, 0.5);
// Make sure rndVec only perp to edge
vector n(points1[meshPoints[e[1]]] - points1[meshPoints[e[0]]]);
@ -404,7 +404,8 @@ bool Foam::edgeIntersections::offsetPerturb
if (nearType == triPointRef::POINT || nearType == triPointRef::EDGE)
{
// Shift edge towards tri centre
vector offset = 0.01*rndGen.scalar01()*(ctr - pHit.hitPoint());
vector offset =
0.01*rndGen.sample01<scalar>()*(ctr - pHit.hitPoint());
// shift e[0]
points1[meshPoints[e[0]]] += offset;