Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
7f0cc004
Commit
7f0cc004
authored
Apr 28, 2017
by
Andrew Heather
Browse files
ENH: Random numbers - updated dependent code from change cachedRandom->Random class
parent
b07bc1f0
Changes
96
Hide whitespace changes
Inline
Side-by-side
applications/test/BinSum/Test-BinSum.C
View file @
7f0cc004
...
...
@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
scalarField
samples
(
10000000
);
forAll
(
samples
,
i
)
{
samples
[
i
]
=
rndGen
.
scalar
01
();
samples
[
i
]
=
rndGen
.
sample01
<
scalar
>
();
}
const
scalar
min
=
0
;
...
...
applications/test/Distribution/Test-Distribution.C
View file @
7f0cc004
...
...
@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
for
(
label
i
=
0
;
i
<
randomDistributionTestSize
;
i
++
)
{
dS
.
add
(
2
.
5
*
R
.
GaussNormal
()
+
8
.
5
);
dS
.
add
(
2
.
5
*
R
.
GaussNormal
<
scalar
>
()
+
8
.
5
);
}
Info
<<
"Mean "
<<
dS
.
mean
()
<<
nl
...
...
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
for
(
label
i
=
0
;
i
<
randomDistributionTestSize
;
i
++
)
{
dS2
.
add
(
1
.
5
*
R
.
GaussNormal
()
-
6
.
0
);
dS2
.
add
(
1
.
5
*
R
.
GaussNormal
<
scalar
>
()
-
6
.
0
);
}
Info
<<
"Mean "
<<
dS2
.
mean
()
<<
nl
...
...
@@ -121,7 +121,7 @@ int main(int argc, char *argv[])
for
(
label
i
=
0
;
i
<
randomDistributionTestSize
;
i
++
)
{
dS
.
add
(
R
.
scalar
01
()
+
10
*
Pstream
::
myProcNo
());
dS
.
add
(
R
.
sample01
<
scalar
>
()
+
10
*
Pstream
::
myProcNo
());
}
Pout
<<
"Mean "
<<
dS
.
mean
()
<<
nl
...
...
@@ -155,7 +155,7 @@ int main(int argc, char *argv[])
for
(
label
i
=
0
;
i
<
randomDistributionTestSize
;
i
++
)
{
dV
.
add
(
R
.
vector
01
());
dV
.
add
(
R
.
sample01
<
vector
>
());
// Adding separate GaussNormal components with component
// weights
...
...
@@ -164,9 +164,9 @@ int main(int argc, char *argv[])
(
vector
(
R
.
GaussNormal
()
*
3
.
0
+
1
.
5
,
R
.
GaussNormal
()
*
0
.
25
+
4
.
0
,
R
.
GaussNormal
()
*
3
.
0
-
1
.
5
R
.
GaussNormal
<
scalar
>
()
*
3
.
0
+
1
.
5
,
R
.
GaussNormal
<
scalar
>
()
*
0
.
25
+
4
.
0
,
R
.
GaussNormal
<
scalar
>
()
*
3
.
0
-
1
.
5
),
vector
(
1
.
0
,
2
.
0
,
5
.
0
)
);
...
...
@@ -225,7 +225,7 @@ int main(int argc, char *argv[])
for
(
label
i
=
0
;
i
<
randomDistributionTestSize
;
i
++
)
{
dT
.
add
(
R
.
tensor
01
());
dT
.
add
(
R
.
sample01
<
tensor
>
());
}
Info
<<
"Mean "
<<
dT
.
mean
()
<<
nl
...
...
@@ -249,7 +249,7 @@ int main(int argc, char *argv[])
for
(
label
i
=
0
;
i
<
randomDistributionTestSize
;
i
++
)
{
dSyT
.
add
(
R
.
symmTensor
01
());
dSyT
.
add
(
R
.
sample01
<
symmTensor
>
());
}
Info
<<
"Mean "
<<
dSyT
.
mean
()
<<
nl
...
...
@@ -273,7 +273,7 @@ int main(int argc, char *argv[])
for
(
label
i
=
0
;
i
<
randomDistributionTestSize
;
i
++
)
{
dSpT
.
add
(
R
.
sphericalTensor
01
());
dSpT
.
add
(
R
.
sample01
<
sphericalTensor
>
());
}
Info
<<
"Mean "
<<
dSpT
.
mean
()
<<
nl
...
...
applications/test/Polynomial/Test-Polynomial.C
View file @
7f0cc004
...
...
@@ -152,7 +152,7 @@ int main(int argc, char *argv[])
Random
rnd
(
123456
);
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
scalar
x
=
rnd
.
scalar
01
()
*
100
;
scalar
x
=
rnd
.
sample01
<
scalar
>
()
*
100
;
scalar
px
=
polyValue
(
x
);
scalar
ipx
=
intPolyValue
(
x
);
...
...
applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H
View file @
7f0cc004
...
...
@@ -293,9 +293,9 @@ inline Foam::point Foam::conformalVoronoiMesh::perturbPoint
scalar
pert
=
1e-12
*
defaultCellSize
();
perturbedPt
.
x
()
+=
pert
*
(
rndGen_
.
scalar
01
()
-
0
.
5
);
perturbedPt
.
y
()
+=
pert
*
(
rndGen_
.
scalar
01
()
-
0
.
5
);
perturbedPt
.
z
()
+=
pert
*
(
rndGen_
.
scalar
01
()
-
0
.
5
);
perturbedPt
.
x
()
+=
pert
*
(
rndGen_
.
sample01
<
scalar
>
()
-
0
.
5
);
perturbedPt
.
y
()
+=
pert
*
(
rndGen_
.
sample01
<
scalar
>
()
-
0
.
5
);
perturbedPt
.
z
()
+=
pert
*
(
rndGen_
.
sample01
<
scalar
>
()
-
0
.
5
);
return
perturbedPt
;
}
...
...
applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C
View file @
7f0cc004
...
...
@@ -553,11 +553,11 @@ bool Foam::autoDensity::fillBox
+
vector
(
delta
.
x
()
*
(
i
+
0
.
5
+
0
.
1
*
(
rndGen
().
scalar
01
()
-
0
.
5
)),
*
(
i
+
0
.
5
+
0
.
1
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
)),
delta
.
y
()
*
(
j
+
0
.
5
+
0
.
1
*
(
rndGen
().
scalar
01
()
-
0
.
5
)),
*
(
j
+
0
.
5
+
0
.
1
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
)),
delta
.
z
()
*
(
k
+
0
.
5
+
0
.
1
*
(
rndGen
().
scalar
01
()
-
0
.
5
))
*
(
k
+
0
.
5
+
0
.
1
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
))
);
}
}
...
...
@@ -662,7 +662,7 @@ bool Foam::autoDensity::fillBox
// TODO - is there a lot of cost in the 1/density calc? Could
// assess on
// (1/maxDensity)/(1/localDensity) = minVolume/localVolume
if
(
localDensity
/
maxDensity
>
rndGen
().
scalar
01
())
if
(
localDensity
/
maxDensity
>
rndGen
().
sample01
<
scalar
>
())
{
scalar
localVolume
=
1
/
localDensity
;
...
...
@@ -675,7 +675,7 @@ bool Foam::autoDensity::fillBox
scalar
addProbability
=
(
totalVolume
-
volumeAdded
)
/
localVolume
;
scalar
r
=
rndGen
().
scalar
01
();
scalar
r
=
rndGen
().
sample01
<
scalar
>
();
if
(
debug
)
{
...
...
@@ -729,7 +729,7 @@ bool Foam::autoDensity::fillBox
{
trialPoints
++
;
point
p
=
min
+
cmptMultiply
(
span
,
rndGen
().
vector
01
());
point
p
=
min
+
cmptMultiply
(
span
,
rndGen
().
sample01
<
vector
>
());
scalar
localSize
=
cellShapeControls
().
cellSize
(
p
);
...
...
@@ -785,7 +785,7 @@ bool Foam::autoDensity::fillBox
// Accept possible placements proportional to the relative local
// density
if
(
localDensity
/
maxDensity
>
rndGen
().
scalar
01
())
if
(
localDensity
/
maxDensity
>
rndGen
().
sample01
<
scalar
>
())
{
scalar
localVolume
=
1
/
localDensity
;
...
...
@@ -798,7 +798,7 @@ bool Foam::autoDensity::fillBox
scalar
addProbability
=
(
totalVolume
-
volumeAdded
)
/
localVolume
;
scalar
r
=
rndGen
().
scalar
01
();
scalar
r
=
rndGen
().
sample01
<
scalar
>
();
if
(
debug
)
{
...
...
applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.C
View file @
7f0cc004
...
...
@@ -129,9 +129,9 @@ List<Vb::Point> bodyCentredCubic::initialPoints() const
if
(
randomiseInitialGrid_
)
{
pA
.
x
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
pA
.
y
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
pA
.
z
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
pA
.
x
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
pA
.
y
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
pA
.
z
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
}
if
(
Pstream
::
parRun
())
...
...
@@ -150,9 +150,9 @@ List<Vb::Point> bodyCentredCubic::initialPoints() const
if
(
randomiseInitialGrid_
)
{
pB
.
x
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
pB
.
y
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
pB
.
z
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
pB
.
x
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
pB
.
y
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
pB
.
z
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
}
if
(
Pstream
::
parRun
())
...
...
applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.C
View file @
7f0cc004
...
...
@@ -127,9 +127,9 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
if
(
randomiseInitialGrid_
)
{
p
.
x
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
p
.
y
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
p
.
z
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
p
.
x
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
p
.
y
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
p
.
z
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
}
if
(
Pstream
::
parRun
())
...
...
@@ -155,9 +155,9 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
if
(
randomiseInitialGrid_
)
{
p
.
x
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
p
.
y
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
p
.
z
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
p
.
x
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
p
.
y
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
p
.
z
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
}
if
(
Pstream
::
parRun
())
...
...
@@ -183,9 +183,9 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
if
(
randomiseInitialGrid_
)
{
p
.
x
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
p
.
y
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
p
.
z
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
p
.
x
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
p
.
y
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
p
.
z
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
}
if
(
Pstream
::
parRun
())
...
...
@@ -211,9 +211,9 @@ List<Vb::Point> faceCentredCubic::initialPoints() const
if
(
randomiseInitialGrid_
)
{
p
.
x
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
p
.
y
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
p
.
z
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
p
.
x
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
p
.
y
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
p
.
z
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
}
if
(
Pstream
::
parRun
())
...
...
applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.C
View file @
7f0cc004
...
...
@@ -198,9 +198,15 @@ List<Vb::Point> pointFile::initialPoints() const
if
(
randomiseInitialGrid_
)
{
p
.
x
()
+=
randomPerturbationCoeff_
*
(
rndGen
().
scalar01
()
-
0
.
5
);
p
.
y
()
+=
randomPerturbationCoeff_
*
(
rndGen
().
scalar01
()
-
0
.
5
);
p
.
z
()
+=
randomPerturbationCoeff_
*
(
rndGen
().
scalar01
()
-
0
.
5
);
p
.
x
()
+=
randomPerturbationCoeff_
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
p
.
y
()
+=
randomPerturbationCoeff_
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
p
.
z
()
+=
randomPerturbationCoeff_
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
}
initialPoints
.
append
(
Vb
::
Point
(
p
.
x
(),
p
.
y
(),
p
.
z
()));
...
...
applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/rayShooting/rayShooting.C
View file @
7f0cc004
...
...
@@ -86,9 +86,9 @@ void rayShooting::splitLine
{
Foam
::
point
newPt
(
midPoint
.
x
()
+
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
),
midPoint
.
y
()
+
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
),
midPoint
.
z
()
+
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
)
midPoint
.
x
()
+
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
),
midPoint
.
y
()
+
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
),
midPoint
.
z
()
+
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
)
);
if
...
...
applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C
View file @
7f0cc004
...
...
@@ -128,9 +128,9 @@ List<Vb::Point> uniformGrid::initialPoints() const
if
(
randomiseInitialGrid_
)
{
p
.
x
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
p
.
y
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
p
.
z
()
+=
pert
*
(
rndGen
().
scalar
01
()
-
0
.
5
);
p
.
x
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
p
.
y
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
p
.
z
()
+=
pert
*
(
rndGen
().
sample01
<
scalar
>
()
-
0
.
5
);
}
if
...
...
applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/CV2D.C
View file @
7f0cc004
...
...
@@ -264,8 +264,8 @@ void Foam::CV2D::insertGrid()
if
(
meshControls
().
randomiseInitialGrid
())
{
p
.
x
()
+=
pert
*
(
rndGen
.
scalar
01
()
-
0
.
5
);
p
.
y
()
+=
pert
*
(
rndGen
.
scalar
01
()
-
0
.
5
);
p
.
x
()
+=
pert
*
(
rndGen
.
sample01
<
scalar
>
()
-
0
.
5
);
p
.
y
()
+=
pert
*
(
rndGen
.
sample01
<
scalar
>
()
-
0
.
5
);
}
if
(
qSurf_
.
wellInside
(
p
,
0
.
5
*
meshControls
().
minCellSize2
()))
...
...
applications/utilities/postProcessing/miscellaneous/pdfPlot/createFields.H
View file @
7f0cc004
...
...
@@ -20,7 +20,7 @@
const
fileName
pdfPath
=
runTime
.
path
()
/
"pdf"
;
mkDir
(
pdfPath
);
cached
Random
rndGen
(
label
(
0
),
-
1
)
;
Random
rndGen
;
autoPtr
<
distributionModels
::
distributionModel
>
p
(
...
...
applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C
View file @
7f0cc004
...
...
@@ -783,7 +783,7 @@ labelPair edgeIntersectionsAndShuffleCGAL
const
edge
&
e
=
edges
[
edgeI
];
forAll
(
e
,
eI
)
{
vector
d
=
rndGen
.
vector01
()
-
p05
;
vector
d
=
rndGen
.
sample01
<
vector
>
()
-
p05
;
surf1Points
[
mp
[
e
[
eI
]]]
+=
surf1PointTol
[
e
[
eI
]]
*
d
;
}
}
...
...
applications/utilities/surface/surfaceInertia/surfaceInertia.C
View file @
7f0cc004
...
...
@@ -125,9 +125,9 @@ int main(int argc, char *argv[])
<<
"No eigenValues found, shape may have symmetry, "
<<
"perturbing inertia tensor diagonal"
<<
endl
;
J
.
xx
()
*=
1
.
0
+
SMALL
*
rand
.
scalar
01
();
J
.
yy
()
*=
1
.
0
+
SMALL
*
rand
.
scalar
01
();
J
.
zz
()
*=
1
.
0
+
SMALL
*
rand
.
scalar
01
();
J
.
xx
()
*=
1
.
0
+
SMALL
*
rand
.
sample01
<
scalar
>
();
J
.
yy
()
*=
1
.
0
+
SMALL
*
rand
.
sample01
<
scalar
>
();
J
.
zz
()
*=
1
.
0
+
SMALL
*
rand
.
sample01
<
scalar
>
();
eVal
=
eigenValues
(
J
);
...
...
src/OpenFOAM/Make/files
View file @
7f0cc004
...
...
@@ -111,7 +111,6 @@ $(sha1)/SHA1.C
$(sha1)/SHA1Digest.C
primitives/random/Random/Random.C
primitives/random/cachedRandom/cachedRandom.C
ranges = primitives/ranges
$(ranges)/labelRange/labelRange.C
...
...
src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedron.H
View file @
7f0cc004
...
...
@@ -42,7 +42,6 @@ SourceFiles
#include
"point.H"
#include
"primitiveFieldsFwd.H"
#include
"pointHit.H"
#include
"cachedRandom.H"
#include
"Random.H"
#include
"FixedList.H"
#include
"UList.H"
...
...
@@ -239,10 +238,6 @@ public:
// uniform distribution
inline
Point
randomPoint
(
Random
&
rndGen
)
const
;
//- Return a random point in the tetrahedron from a
// uniform distribution
inline
Point
randomPoint
(
cachedRandom
&
rndGen
)
const
;
//- Calculate the barycentric coordinates of the given
// point, in the same order as a, b, c, d. Returns the
// determinant of the solution.
...
...
src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H
View file @
7f0cc004
...
...
@@ -249,42 +249,6 @@ inline Point Foam::tetrahedron<Point, PointRef>::randomPoint
// Adapted from
// http://vcg.isti.cnr.it/activities/geometryegraphics/pointintetraedro.html
scalar
s
=
rndGen
.
scalar01
();
scalar
t
=
rndGen
.
scalar01
();
scalar
u
=
rndGen
.
scalar01
();
if
(
s
+
t
>
1.0
)
{
s
=
1.0
-
s
;
t
=
1.0
-
t
;
}
if
(
t
+
u
>
1.0
)
{
scalar
tmp
=
u
;
u
=
1.0
-
s
-
t
;
t
=
1.0
-
tmp
;
}
else
if
(
s
+
t
+
u
>
1.0
)
{
scalar
tmp
=
u
;
u
=
s
+
t
+
u
-
1.0
;
s
=
1.0
-
t
-
tmp
;
}
return
(
1
-
s
-
t
-
u
)
*
a_
+
s
*
b_
+
t
*
c_
+
u
*
d_
;
}
template
<
class
Point
,
class
PointRef
>
inline
Point
Foam
::
tetrahedron
<
Point
,
PointRef
>::
randomPoint
(
cachedRandom
&
rndGen
)
const
{
// Adapted from
// http://vcg.isti.cnr.it/activities/geometryegraphics/pointintetraedro.html
scalar
s
=
rndGen
.
sample01
<
scalar
>
();
scalar
t
=
rndGen
.
sample01
<
scalar
>
();
scalar
u
=
rndGen
.
sample01
<
scalar
>
();
...
...
src/OpenFOAM/meshes/primitiveShapes/triangle/triangle.H
View file @
7f0cc004
...
...
@@ -40,7 +40,6 @@ SourceFiles
#include
"tensor.H"
#include
"pointHit.H"
#include
"Random.H"
#include
"cachedRandom.H"
#include
"FixedList.H"
#include
"UList.H"
#include
"linePointRef.H"
...
...
@@ -238,10 +237,6 @@ public:
// distribution
inline
Point
randomPoint
(
Random
&
rndGen
)
const
;
//- Return a random point on the triangle from a uniform
// distribution
inline
Point
randomPoint
(
cachedRandom
&
rndGen
)
const
;
//- Calculate the barycentric coordinates of the given
// point, in the same order as a, b, c. Returns the
// determinant of the solution.
...
...
src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H
View file @
7f0cc004
...
...
@@ -249,25 +249,6 @@ inline Point Foam::triangle<Point, PointRef>::randomPoint(Random& rndGen) const
// from "Graphics Gems", Academic Press, 1990
// http://tog.acm.org/GraphicsGems/gems/TriPoints.c
scalar
s
=
rndGen
.
scalar01
();
scalar
t
=
sqrt
(
rndGen
.
scalar01
());
return
(
1
-
t
)
*
a_
+
(
1
-
s
)
*
t
*
b_
+
s
*
t
*
c_
;
}
template
<
class
Point
,
class
PointRef
>
inline
Point
Foam
::
triangle
<
Point
,
PointRef
>::
randomPoint
(
cachedRandom
&
rndGen
)
const
{
// Generating Random Points in Triangles
// by Greg Turk
// from "Graphics Gems", Academic Press, 1990
// http://tog.acm.org/GraphicsGems/gems/TriPoints.c
scalar
s
=
rndGen
.
sample01
<
scalar
>
();
scalar
t
=
sqrt
(
rndGen
.
sample01
<
scalar
>
());
...
...
src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.H
View file @
7f0cc004
...
...
@@ -335,7 +335,7 @@ public:
label
distanceCmp
(
const
point
&
pt
,
const
treeBoundBox
&
other
)
const
;
//- Return slightly wider bounding box
// Extends all dimensions with s*span*Random::scalar
01
()
// Extends all dimensions with s*span*Random::
sample01<
scalar
>
()
// and guarantees in any direction s*mag(span) minimum width
inline
treeBoundBox
extend
(
Random
&
rndGen
,
const
scalar
s
)
const
;
...
...
Prev
1
2
3
4
5
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment