Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:17

0001 #!/bin/bash -l 
0002 usage(){ cat << EOU
0003 SGLM_set_frame_test.sh
0004 ========================
0005 
0006 TODO: NEEDS REWORKING FOR sfr.h REPLACING sframe.h 
0007 
0008 This standalone test aims to duplicate the sframe.h/SGLM.h view calculations 
0009 done by CSGOptiX::RenderMain. In more detail, the SGLM_set_frame_test.cc does:
0010 
0011 1. loads $BASE/sframe.npy into sframe.h instance
0012 
0013    * the sframe is persisted by CSGOptiX::render_snap
0014 
0015 2. instanciates SGLM.h and invokes SGLM::set_frame with the loaded frame
0016 3. invokes SGLM::writeDesc writing the SGLM::desc to $BASE/SGLM_set_frame_test.log
0017 
0018 ::
0019    
0020     ~/o/sysrap/tests/SGLM_set_frame_test.sh build_run_info_cat_diff  
0021     ~/o/sysrap/tests/SGLM_set_frame_test.sh build
0022     ~/o/sysrap/tests/SGLM_set_frame_test.sh run
0023     ~/o/sysrap/tests/SGLM_set_frame_test.sh info
0024     ~/o/sysrap/tests/SGLM_set_frame_test.sh cat
0025     ~/o/sysrap/tests/SGLM_set_frame_test.sh diff
0026          # compare the SGLM::desc logged from CSGOptiX::render_snap and SGLM_set_frame_test.cc 
0027 
0028 EOU
0029 }
0030 
0031 
0032 defarg="build_run_info_cat_diff"
0033 arg=${1:-$defarg}
0034 
0035 br="------------------------------------------------------------------------------"
0036 msg="=== $BASH_SOURCE :"
0037 name=SGLM_set_frame_test 
0038 bin=/tmp/$name
0039 
0040 cd $(dirname $(realpath $BASH_SOURCE))
0041 
0042 #sframe_fold=/tmp/$USER/opticks/GEOM/V0J008/CSGOptiXRdrTest
0043 sframe_fold=/data/blyth/opticks/GEOM/J23_1_0_rc3_ok0/jok-tds/ALL0/A001
0044 SFRAME_FOLD=${SFRAME_FOLD:-$sframe_fold}   # directory to load sframe.npy from 
0045 export SFRAME_FOLD
0046 
0047 tmin=0.5
0048 #eye=1000,1000,1000
0049 #eye=3.7878,3.7878,3.7878
0050 eye=-1,-1,0
0051 
0052 #escale=asis
0053 escale=extent
0054 
0055 export TMIN=${TMIN:-$tmin}
0056 export EYE=${EYE:-$eye}
0057 export ESCALE=${ESCALE:-$escale}
0058 
0059 ## TODO: update for NAMEPREFIX handling changes in CSGOptiX::render_snap 
0060 ## NATURAL PLACE TO DO THAT IS FROM WITHIN THE SCRIPTS THAT SET THE NAMEPREFIX
0061 
0062 DESC_REF=CSGOptiX__render_snap.log
0063 DESC_NAME=SGLM_set_frame_test.log
0064 DESC_PATH=$SFRAME_FOLD/$DESC_NAME
0065 vars="name bin SFRAME_FOLD arg DESC_NAME DESC_PATH TMIN"
0066 
0067 cuda_prefix=/usr/local/cuda
0068 CUDA_PREFIX=${CUDA_PREFIX:-$cuda_prefix}
0069 
0070 
0071 if [ "${arg/build}" != "$arg" ]; then 
0072     gcc $name.cc -g -Wall -std=c++11 -lstdc++ -I.. \
0073              -I$OPTICKS_PREFIX/externals/glm/glm \
0074              -I$CUDA_PREFIX/include -o $bin
0075     [ $? -ne 0 ] && echo $msg build error && exit 1 
0076     echo $BASH_SOURCE : build OK
0077 fi 
0078 
0079 if [ "${arg/run}" != "$arg" ]; then 
0080     $bin
0081     [ $? -ne 0 ] && echo $msg run error && exit 2 
0082     echo $BASH_SOURCE : run OK
0083 fi 
0084 
0085 if [ "${arg/cat}" != "$arg" ]; then
0086     ls -l $DESC_PATH
0087     echo $BASH_SOURCE : cat 
0088     echo $br
0089     cat $DESC_PATH
0090     echo $br
0091 fi 
0092 
0093 if [ "${arg/diff}" != "$arg" ]; then 
0094     cmd="( cd $SFRAME_FOLD && diff $DESC_REF $DESC_NAME)"
0095     echo $BASH_SOURCE diff 
0096     echo $cmd
0097     echo $br
0098     eval $cmd
0099     echo $br
0100 fi 
0101 
0102 if [ "${arg/info}" != "$arg" ]; then 
0103     for var in $vars ; do printf "%20s : %s \n" "$var" "${!var}" ; done 
0104     echo $BASH_SOURCE : info
0105 fi 
0106 
0107 exit 0 
0108