Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
John Apostolakis
VecGeom
Commits
383c7a5e
Commit
383c7a5e
authored
Jul 26, 2021
by
Martin Kostelnik
Browse files
Fix per solid tolerances and change types from double to Precision
parent
c64128a3
Changes
16
Hide whitespace changes
Inline
Side-by-side
test/shape_tester/ShapeTester.cpp
View file @
383c7a5e
...
...
@@ -250,9 +250,9 @@ int ShapeTester<ImplT>::TestConsistencySolids()
if
(
fIfSaveAllData
)
{
Vec_t
point
;
for
(
int
i
=
0
;
i
<
fMaxPoints
;
i
++
)
{
point
=
fPoints
[
i
];
Inside_t
inside
=
fVolume
->
Inside
(
point
);
fResult
Double
[
i
]
=
(
double
)
inside
;
point
=
fPoints
[
i
];
Inside_t
inside
=
fVolume
->
Inside
(
point
);
fResult
Precision
[
i
]
=
(
Precision
)
inside
;
}
SaveResultsToFile
(
"Inside"
);
}
...
...
@@ -578,9 +578,9 @@ int ShapeTester<ImplT>::TestSafetyFromOutsideSolids()
if
(
fIfSaveAllData
)
{
Vec_t
point
;
for
(
int
i
=
0
;
i
<
fMaxPoints
;
i
++
)
{
point
=
fPoints
[
i
];
double
res
=
fVolume
->
SafetyToIn
(
point
);
fResult
Double
[
i
]
=
res
;
point
=
fPoints
[
i
];
Precision
res
=
fVolume
->
SafetyToIn
(
point
);
fResult
Precision
[
i
]
=
res
;
}
SaveResultsToFile
(
"SafetyFromOutside"
);
}
...
...
@@ -600,9 +600,9 @@ int ShapeTester<ImplT>::TestSafetyFromInsideSolids()
Vec_t
point
;
for
(
int
i
=
0
;
i
<
fMaxPoints
;
i
++
)
{
point
=
fPoints
[
i
];
double
res
=
fVolume
->
SafetyToOut
(
point
);
fResult
Double
[
i
]
=
res
;
point
=
fPoints
[
i
];
Precision
res
=
fVolume
->
SafetyToOut
(
point
);
fResult
Precision
[
i
]
=
res
;
}
SaveResultsToFile
(
"SafetyFromInside"
);
...
...
@@ -639,10 +639,10 @@ int ShapeTester<ImplT>::TestDistanceToInSolids()
if
(
fIfSaveAllData
)
{
Vec_t
point
,
direction
;
for
(
int
i
=
0
;
i
<
fMaxPoints
;
i
++
)
{
point
=
fPoints
[
i
];
direction
=
fDirections
[
i
];
double
res
=
fVolume
->
DistanceToIn
(
point
,
direction
);
fResult
Double
[
i
]
=
res
;
point
=
fPoints
[
i
];
direction
=
fDirections
[
i
];
Precision
res
=
fVolume
->
DistanceToIn
(
point
,
direction
);
fResult
Precision
[
i
]
=
res
;
Vec_t
normal
;
PropagatedNormalU
(
point
,
direction
,
res
,
normal
);
...
...
@@ -671,9 +671,9 @@ int ShapeTester<ImplT>::TestDistanceToOutSolids()
point
=
fPoints
[
i
];
direction
=
fDirections
[
i
];
normal
.
Set
(
0
);
double
res
=
CallDistanceToOut
(
fVolume
,
point
,
direction
,
normal
,
convex
);
Precision
res
=
CallDistanceToOut
(
fVolume
,
point
,
direction
,
normal
,
convex
);
fResult
Double
[
i
]
=
res
;
fResult
Precision
[
i
]
=
res
;
fResultVector
[
i
]
=
normal
;
}
}
...
...
@@ -688,8 +688,8 @@ int ShapeTester<ImplT>::TestFarAwayPoint()
int
errCode
=
0
;
Vec_t
point
,
point1
,
vec
,
direction
,
normal
,
pointSurf
;
int
icount
=
0
,
icount1
=
0
,
nError
=
0
;
double
distIn
,
diff
,
difMax
=
0.
,
maxDistIn
=
0.
;
double
tolerance
=
fSolidTolerance
;
Precision
distIn
,
diff
,
difMax
=
0.
,
maxDistIn
=
0.
;
Precision
tolerance
=
fSolidTolerance
;
ClearErrors
();
// for ( int j=0; j<fMaxPointsSurface+fMaxPointsEdge; j++)
...
...
@@ -1865,7 +1865,7 @@ void ShapeTester<ImplT>::CreatePointsAndDirections()
fPoints
.
resize
(
fMaxPoints
);
fDirections
.
resize
(
fMaxPoints
);
fResult
Double
.
resize
(
fMaxPoints
);
fResult
Precision
.
resize
(
fMaxPoints
);
fResultVector
.
resize
(
fMaxPoints
);
CreatePointsAndDirectionsOutside
();
...
...
@@ -1964,7 +1964,7 @@ int ShapeTester<ImplT>::SaveResultsToFile(const string &fMethod1)
if
(
saveVectors
)
file
<<
"Norm="
<<
PrintCoordinates
(
fResultVector
[
i
],
spacer
,
prec
)
<<
"
\n
"
;
else
file
<<
fResult
Double
[
i
]
<<
"
\n
"
;
file
<<
fResult
Precision
[
i
]
<<
"
\n
"
;
}
return
0
;
}
...
...
test/shape_tester/ShapeTester.h
View file @
383c7a5e
...
...
@@ -8,10 +8,16 @@
#include "VecGeom/base/Vector3D.h"
#include "VecGeom/base/RNG.h"
#ifdef VECGEOM_ROOT
#include "utilities/Visualizer.h"
#endif
const
double
kApproxEqualTolerance
=
1E-6
;
#ifdef VECGEOM_FLOAT_PRECISION
const
Precision
kApproxEqualTolerance
=
1e-3
;
#else
const
Precision
kApproxEqualTolerance
=
1e-6
;
#endif
using
vecgeom
::
Precision
;
using
Vec_t
=
vecgeom
::
Vector3D
<
Precision
>
;
...
...
@@ -141,11 +147,11 @@ private:
return
rand
;
}
inline
double
RandomIncrease
()
inline
Precision
RandomIncrease
()
{
double
tolerance
=
vecgeom
::
kTolerance
;
double
rand
=
-
1
+
2
*
fRNG
.
uniform
();
double
dif
=
tolerance
*
0.1
*
rand
;
Precision
tolerance
=
vecgeom
::
kTolerance
;
Precision
rand
=
-
1
+
2
*
fRNG
.
uniform
();
Precision
dif
=
tolerance
*
0.1
*
rand
;
return
dif
;
}
...
...
@@ -199,8 +205,8 @@ private:
ImplT
const
*
fVolume
;
// Pointer that owns shape object.
std
::
string
fVolumeString
;
// data member to store the name of volume;
std
::
vector
<
double
>
fResultDouble
;
// stl vector for storing the double results
std
::
vector
<
Vec_t
>
fResultVector
;
// stl vector for storing the vector results
std
::
vector
<
Precision
>
fResultPrecision
;
// stl vector for storing the double
/float
results
std
::
vector
<
Vec_t
>
fResultVector
;
// stl vector for storing the vector results
int
fOffsetSurface
;
// offset of surface points
int
fOffsetInside
;
// offset of inside points
...
...
@@ -229,7 +235,7 @@ private:
int
fNumDisp
;
// number of points to be displayed in case a shape is not following conventions.
bool
fVisualize
;
// Flag to be set or unset by EnableDebugger() function that user will
// call with true parameter if want to see visualization in case of some mismatch
double
fSolidTolerance
;
// Tolerance on boundary declared by solid (default kTolerance)
Precision
fSolidTolerance
;
// Tolerance on boundary declared by solid (default kTolerance)
#ifdef VECGEOM_ROOT
vecgeom
::
Visualizer
fVisualizer
;
// Visualizer object to visualize the geometry if fVisualize is set.
#endif
...
...
test/shape_tester/shape_testCone.cpp
View file @
383c7a5e
...
...
@@ -33,7 +33,9 @@ int runTester(ImplT const *shape, int npoints, bool debug, bool stat)
{
ShapeTester
<
ImplT
>
tester
;
tester
.
SetSolidTolerance
(
1.e-7
);
#ifndef VECGEOM_FLOAT_PRECISION
tester
.
SetSolidTolerance
(
1.e-7
);
#endif
tester
.
setDebug
(
debug
);
tester
.
setStat
(
stat
);
tester
.
SetMaxPoints
(
npoints
);
...
...
test/shape_tester/shape_testCutTube.cpp
View file @
383c7a5e
...
...
@@ -57,7 +57,6 @@ int main(int argc, char *argv[])
tester
.
setDebug
(
debug
);
tester
.
setStat
(
stat
);
tester
.
SetMaxPoints
(
npoints
);
tester
.
SetSolidTolerance
(
1.e-9
);
tester
.
SetTestBoundaryErrors
(
true
);
int
errCode
=
tester
.
Run
(
cuttube
);
...
...
test/shape_tester/shape_testExtruded.cpp
View file @
383c7a5e
...
...
@@ -23,7 +23,6 @@ int main(int argc, char *argv[])
tester
.
setDebug
(
debug
);
tester
.
setStat
(
stat
);
tester
.
SetMaxPoints
(
npoints
);
tester
.
SetSolidTolerance
(
1.e-9
);
tester
.
SetTestBoundaryErrors
(
false
);
int
errCode
=
tester
.
Run
(
placed
);
...
...
test/shape_tester/shape_testGenTrap.cpp
View file @
383c7a5e
...
...
@@ -89,7 +89,11 @@ int main(int argc, char *argv[])
tester
.
setDebug
(
debug
);
tester
.
setStat
(
stat
);
tester
.
SetMaxPoints
(
npoints
);
tester
.
SetSolidTolerance
(
1.e-7
);
#ifndef VECGEOM_FLOAT_PRECISION
tester
.
SetSolidTolerance
(
1.e-7
);
#endif
tester
.
SetTestBoundaryErrors
(
true
);
int
errCode
=
tester
.
Run
(
solid
);
...
...
test/shape_tester/shape_testGenericPolycone.cpp
View file @
383c7a5e
...
...
@@ -24,7 +24,11 @@ int main(int argc, char *argv[])
tester
.
setDebug
(
debug
);
tester
.
setStat
(
stat
);
tester
.
SetMaxPoints
(
npoints
);
tester
.
SetSolidTolerance
(
1.e-7
);
#ifndef VECGEOM_FLOAT_PRECISION
tester
.
SetSolidTolerance
(
1.e-7
);
#endif
tester
.
SetTestBoundaryErrors
(
false
);
int
errCode
=
tester
.
Run
(
poly2
);
...
...
test/shape_tester/shape_testHype.cpp
View file @
383c7a5e
...
...
@@ -17,7 +17,6 @@ int main(int argc, char *argv[])
tester
.
setDebug
(
debug
);
tester
.
setStat
(
stat
);
tester
.
SetMaxPoints
(
npoints
);
tester
.
SetSolidTolerance
(
1.e-9
);
tester
.
SetTestBoundaryErrors
(
true
);
int
errCode
=
tester
.
Run
(
hype
);
...
...
test/shape_tester/shape_testMultiUnion.cpp
View file @
383c7a5e
...
...
@@ -51,7 +51,6 @@ int main(int argc, char *argv[])
tester
.
setDebug
(
debug
);
tester
.
setStat
(
stat
);
tester
.
SetMaxPoints
(
npoints
);
tester
.
SetSolidTolerance
(
1.e-9
);
tester
.
SetTestBoundaryErrors
(
false
);
int
errCode
=
tester
.
Run
(
solid
);
...
...
test/shape_tester/shape_testOrb.cpp
View file @
383c7a5e
...
...
@@ -36,7 +36,6 @@ int runTester(ImplT const *shape, int npoints, bool debug, bool stat)
tester
.
setDebug
(
debug
);
tester
.
setStat
(
stat
);
tester
.
SetMaxPoints
(
npoints
);
tester
.
SetSolidTolerance
(
1.e-9
);
tester
.
SetTestBoundaryErrors
(
true
);
int
errCode
=
tester
.
Run
(
shape
);
...
...
test/shape_tester/shape_testParaboloid.cpp
View file @
383c7a5e
...
...
@@ -38,7 +38,6 @@ int runTester(ImplT const *shape, int npoints, bool debug, bool stat)
tester
.
setDebug
(
debug
);
tester
.
setStat
(
stat
);
tester
.
SetMaxPoints
(
npoints
);
tester
.
SetSolidTolerance
(
1.e-9
);
tester
.
SetTestBoundaryErrors
(
true
);
int
errCode
=
tester
.
Run
(
shape
);
...
...
test/shape_tester/shape_testParallelepiped.cpp
View file @
383c7a5e
...
...
@@ -53,7 +53,6 @@ int main(int argc, char *argv[])
tester
.
setDebug
(
debug
);
tester
.
setStat
(
stat
);
tester
.
SetMaxPoints
(
npoints
);
tester
.
SetSolidTolerance
(
1.e-9
);
tester
.
SetTestBoundaryErrors
(
true
);
int
errCode
=
tester
.
Run
(
solid
);
...
...
test/shape_tester/shape_testPolycone.cpp
View file @
383c7a5e
...
...
@@ -73,7 +73,6 @@ int main(int argc, char *argv[])
tester
.
setDebug
(
debug
);
tester
.
setStat
(
stat
);
tester
.
SetMaxPoints
(
npoints
);
tester
.
SetSolidTolerance
(
1.e-9
);
tester
.
SetTestBoundaryErrors
(
false
);
int
errCode
=
tester
.
Run
(
poly2
);
...
...
test/shape_tester/shape_testPolyhedron.cpp
View file @
383c7a5e
...
...
@@ -51,7 +51,6 @@ int main(int argc, char *argv[])
tester
.
setDebug
(
debug
);
tester
.
setStat
(
stat
);
tester
.
SetMaxPoints
(
npoints
);
tester
.
SetSolidTolerance
(
1.e-9
);
tester
.
SetTestBoundaryErrors
(
false
);
int
errCode
=
tester
.
Run
(
solid
);
...
...
test/shape_tester/shape_testTessellated.cpp
View file @
383c7a5e
...
...
@@ -33,7 +33,6 @@ int main(int argc, char *argv[])
tester
.
setDebug
(
debug
);
tester
.
setStat
(
stat
);
tester
.
SetMaxPoints
(
npoints
);
tester
.
SetSolidTolerance
(
1.e-9
);
tester
.
SetTestBoundaryErrors
(
false
);
int
errCode
=
tester
.
Run
(
solid
);
...
...
test/shape_tester/shape_testTet.cpp
View file @
383c7a5e
...
...
@@ -37,7 +37,6 @@ int runTester(ImplT const *shape, int npoints, bool debug, bool stat)
tester
.
setDebug
(
debug
);
tester
.
setStat
(
stat
);
tester
.
SetMaxPoints
(
npoints
);
tester
.
SetSolidTolerance
(
1.e-9
);
tester
.
SetTestBoundaryErrors
(
true
);
int
errCode
=
tester
.
Run
(
shape
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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