|
|
|||
File indexing completed on 2026-06-04 07:59:12
0001 #!/usr/bin/env bash 0002 # Force-triangulate a CURVED solid (the water sphere in 0003 # opticks_raindrop_sphere.gdml) and require the GPU hit count to match the 0004 # analytic CSG sphere within tolerance. Unlike a box -- whose 12 triangles 0005 # coincide with the analytic faces, giving bit-identical counts -- a sphere 0006 # tessellates to an INSCRIBED polyhedron, so the triangulated count sits 0007 # just below analytic and converges as the rotation-step resolution rises: 0008 # 0009 # rotation steps : 6 12 24 48 96 | analytic 0010 # Opticks hits : 10938 11950 12313 12322 12323 | 12330 0011 # 0012 # Resolution is user-controllable per solid via U4Mesh env vars, e.g. 0013 # U4Mesh__NumberOfRotationSteps_solidName_G4_WATER_solid=48 (exact name) 0014 # U4Mesh__NumberOfRotationSteps_entityType_G4Orb=48 (by solid type) 0015 # and which solids triangulate is the comma-separated stree__force_triangulate_solid 0016 # list. At the default 24 steps the count is within 0.14% of analytic; the 2% 0017 # tolerance below absorbs cross-OptiX-version numerics while still failing hard 0018 # if the triangulated-GAS wiring breaks (zero / grossly wrong hits). 0019 set -e 0020 0021 GDML="$OPTICKS_HOME/tests/geom/opticks_raindrop_sphere.gdml" 0022 MAC="$OPTICKS_HOME/tests/run.mac" 0023 SEED=42 0024 TOL=0.02 0025 0026 ANA=$(GPURaytrace -g "$GDML" -m "$MAC" -s "$SEED" 2>&1 \ 0027 | awk '/Opticks: NumHits:/ {print $NF}') 0028 0029 TRI=$(stree__force_triangulate_solid=G4_WATER_solid \ 0030 GPURaytrace -g "$GDML" -m "$MAC" -s "$SEED" 2>&1 \ 0031 | awk '/Opticks: NumHits:/ {print $NF}') 0032 0033 echo "analytic=$ANA triangulated=$TRI tol=$TOL" 0034 [ -n "$ANA" ] && [ -n "$TRI" ] || { echo "FAILED: missing hit count (ANA=$ANA TRI=$TRI)"; exit 1; } 0035 OK=$(awk -v a="$ANA" -v t="$TRI" -v tol="$TOL" \ 0036 'BEGIN{ if(a+0<=0){print 0; exit} d=(a>t?a-t:t-a)/a; print (d<=tol)?1:0 }') 0037 [ "$OK" = "1" ] || { echo "FAILED: |analytic-triangulated|/analytic > $TOL (ANA=$ANA TRI=$TRI)"; exit 1; } 0038 echo "PASSED"
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|