|
|
|||
File indexing completed on 2026-04-09 07:48:58
0001 #pragma once 0002 0003 0004 #ifdef DEBUG_RECORD 0005 0006 #include <vector> 0007 #include <string> 0008 #include "OpticksCSG.h" 0009 #include "csg_classify.h" 0010 #include "CSG_API_EXPORT.hh" 0011 0012 struct quad6 ; 0013 0014 /** 0015 CSGRecord 0016 =========== 0017 0018 * CSGRecord_ENABLED envvar is the initial setting, this can be changed with SetEnabled. 0019 * operation also requires the special (non-default) compilation flag DEBUG_RECORD 0020 0021 0022 For understanding CSGRecords note that records are added at CSG decisions 0023 For example with the below tree decisions are made at nodeIdx 2,3,1 0024 as postorder is followed, ie 4,5,[2],6,7,[3],[1] 0025 But loopbacks are done so there will often be repeated decisions 0026 with tmin advanced also at nodeIdx 2,3,1. 0027 0028 0029 in 0030 1 0031 0.00 0032 -0.00 0033 0034 un in 0035 2 3 0036 0.00 0.00 0037 -0.00 -0.00 0038 0039 zs cy !zs !cy 0040 4 5 6 7 0041 194.00 0.10 186.00 0.10 0042 -39.00 -38.90 -40.00 -39.90 0043 0044 0045 0046 TODO: get the winning nodeIdx into the final result CSGRecord ? 0047 0048 **/ 0049 0050 struct CSG_API CSGRecord 0051 { 0052 static bool ENABLED ; 0053 static void SetEnabled(bool enabled); 0054 0055 static std::vector<quad6> record ; 0056 0057 0058 CSGRecord( const quad6& r_ ); 0059 const quad6& r ; 0060 0061 unsigned typecode ; 0062 IntersectionState_t l_state ; 0063 IntersectionState_t r_state ; 0064 0065 bool leftIsCloser ; 0066 bool l_promote_miss ; 0067 bool l_complement ; 0068 bool l_unbounded ; 0069 bool l_false ; 0070 bool r_promote_miss ; 0071 bool r_complement ; 0072 bool r_unbounded ; 0073 bool r_false ; 0074 unsigned tloop ; 0075 unsigned nodeIdx ; 0076 unsigned ctrl ; 0077 0078 float tmin ; // may be advanced : but dont see that with simple looping of leaf 0079 float t_min ; // overall fixed value 0080 float tminAdvanced ; // direct collection of the advanced for upcoming looping 0081 0082 void unpack(unsigned packed ); 0083 0084 static void Dump(const char* msg="CSGRecord::Dump"); 0085 static std::string Desc( const quad6& r, unsigned irec, const char* label ); 0086 std::string desc(unsigned irec, const char* label ) const ; 0087 static void Save(const char* dir); 0088 static void Clear(); 0089 }; 0090 0091 #endif 0092 0093 0094 /** 0095 Attempting to read the CSGRecord 0096 ================================== 0097 0098 * TODO: look at simpler examples to confirm 0099 * TODO: confirm the below reading of the tealeaves by for example carrying forward winner nodeIdx thru the levels 0100 * TODO: make it easier to read by removing noise or improving layout 0101 * TODO: revive the recursive CPU only intersect implementation, it would be useful as a cross-check 0102 and for elucidation as the recursive algorithm is much simpler and should give exactly the same results 0103 using exactly the same node visits : as the iterative algorithm is supposed to mimic 0104 what recursion would have done 0105 0106 * optixrap/cu/csg_intersect_boolean.h:unsupported_recursive_csg_r 0107 0108 0109 0110 0111 in 0112 1 0113 0.00 0114 -0.00 0115 0116 un in 0117 2 3 0118 0.00 0.00 0119 -0.00 -0.00 0120 0121 zs cy !zs !cy 0122 4 5 6 7 0123 194.00 0.10 186.00 0.10 0124 -39.00 -38.90 -40.00 -39.90 0125 0126 0127 0128 2022-08-29 09:57:04.550 INFO [40471266] [CSGSimtraceRerun::report@169] with : DEBUG_RECORD 0129 2022-08-29 09:57:04.550 INFO [40471266] [CSGRecord::Dump@134] CSGSimtraceRerun::report CSGRecord::record.size 10IsEnabled 0 0130 tloop 0 nodeIdx 2 irec 0 label rec union 0131 r.q0.f left ( 0.0000 0.0000 -1.0000 -78.8386) Enter - - - leftIsCloser 0132 r.q1.f right ( 0.0000 0.0000 -1.0000 78.9570) Enter - - - ctrl RETURN_A 0133 r.q3.f tmin/t_min ( 0.0000 0.0000 0.0000 0.0000) tmin 0.0000 t_min 0.0000 tminAdvanced 0.0000 0134 r.q4.f result ( 0.0000 0.0000 -1.0000 -78.8386) 0135 tloop 0 nodeIdx 3 irec 1 label rec intersection 0136 r.q0.f left ( -0.0000 -0.0000 1.0000 -77.6548) Exit - l_complement l_unbounded leftIsCloser 0137 r.q1.f right ( -0.0000 -0.0000 1.0000 77.7732) Exit - r_complement r_unbounded ctrl RETURN_A 0138 r.q3.f tmin/t_min ( 0.0000 0.0000 0.0000 0.0000) tmin 0.0000 t_min 0.0000 tminAdvanced 0.0000 0139 r.q4.f result ( -0.0000 -0.0000 1.0000 77.6548) 0140 tloop 0 nodeIdx 1 irec 2 label rec intersection 0141 r.q0.f left ( 0.0000 0.0000 -1.0000 -78.8386) Enter - - - 0142 r.q1.f right ( -0.0000 -0.0000 1.0000 77.6548) Exit - r_complement r_unbounded rightIsCloser ctrl LOOP_B 0143 r.q3.f tmin/t_min ( 0.0000 0.0000 77.6549 0.0000) tmin 0.0000 t_min 0.0000 tminAdvanced 77.6549 0144 r.q4.f result ( 0.0000 0.0000 0.0000 0.0000) 0145 0146 Third CSGRecord is a root (nodeIdx:1) decision to LOOP_B, which is nodeIdx:3 0147 0148 0149 tloop 1 nodeIdx 3 irec 3 label rec intersection 0150 r.q0.f left ( -0.0000 0.0000 0.0000 -0.0000) Exit l_promote_miss l_complement - 0151 r.q1.f right ( -0.0000 -0.0000 1.0000 77.7732) Exit - r_complement r_unbounded rightIsCloser ctrl RETURN_B 0152 r.q3.f tmin/t_min ( 77.6549 0.0000 0.0000 0.0000) tmin 77.6549 t_min 0.0000 tminAdvanced 0.0000 0153 r.q4.f result ( -0.0000 -0.0000 1.0000 77.7732) 0154 tloop 2 nodeIdx 1 irec 4 label rec intersection 0155 r.q0.f left ( 0.0000 0.0000 -1.0000 -78.8386) Enter - - - 0156 r.q1.f right ( -0.0000 -0.0000 1.0000 77.7732) Exit - r_complement r_unbounded rightIsCloser ctrl LOOP_B 0157 r.q3.f tmin/t_min ( 0.0000 0.0000 77.7733 0.0000) tmin 0.0000 t_min 0.0000 tminAdvanced 77.7733 0158 r.q4.f result ( 0.0000 0.0000 0.0000 0.0000) 0159 0160 Get back to root but get another LOOP_B decision, so back to nodeIdx:3 0161 0162 0163 tloop 3 nodeIdx 3 irec 5 label rec intersection 0164 r.q0.f left ( -0.0000 0.0000 0.0000 -0.0000) Exit l_promote_miss l_complement - 0165 r.q1.f right ( -0.0000 -0.0000 -1.0000 125.1237) Enter - r_complement r_unbounded rightIsCloser ctrl RETURN_B 0166 r.q3.f tmin/t_min ( 77.7733 0.0000 0.0000 0.0000) tmin 77.7733 t_min 0.0000 tminAdvanced 0.0000 0167 r.q4.f result ( -0.0000 -0.0000 -1.0000 125.1237) 0168 tloop 4 nodeIdx 1 irec 6 label rec intersection 0169 r.q0.f left ( 0.0000 0.0000 -1.0000 -78.8386) Enter - - - leftIsCloser 0170 r.q1.f right ( -0.0000 -0.0000 -1.0000 125.1237) Enter - r_complement r_unbounded ctrl LOOP_A 0171 r.q3.f tmin/t_min ( 0.0000 0.0000 78.8387 0.0000) tmin 0.0000 t_min 0.0000 tminAdvanced 78.8387 0172 r.q4.f result ( 0.0000 0.0000 0.0000 0.0000) 0173 0174 This root decision is to LOOP_A, so back to nodeIdx:2 0175 0176 0177 tloop 5 nodeIdx 2 irec 7 label rec union 0178 r.q0.f left ( 0.0138 0.0000 0.9998 -354.6146) Exit - - - 0179 r.q1.f right ( 0.0000 0.0000 -1.0000 78.9570) Enter - - - rightIsCloser ctrl LOOP_B 0180 r.q3.f tmin/t_min ( 78.8387 0.0000 78.9571 0.0000) tmin 78.8387 t_min 0.0000 tminAdvanced 78.9571 0181 r.q4.f result ( 0.0000 0.0000 0.0000 0.0000) 0182 0183 First LOOP_B so are checking again the outer cy, but the next decision is RETURN_A so the outer zs wins at this stage 0184 0185 tloop 7 nodeIdx 2 irec 8 label rec union 0186 r.q0.f left ( 0.0138 0.0000 0.9998 -354.6146) Exit - - - 0187 r.q1.f right ( 0.0000 0.0000 1.0000 125.1237) Exit - - - rightIsCloser ctrl RETURN_A 0188 r.q3.f tmin/t_min ( 78.8387 0.0000 0.0000 0.0000) tmin 78.8387 t_min 0.0000 tminAdvanced 0.0000 0189 r.q4.f result ( 0.0138 0.0000 0.9998 -354.6146) 0190 0191 0192 Notice how the same distance : 125.1237 is appearing on both sides of the tree :that is the cause of coincidence issues 0193 and probably the reason for all the loopbacks ? 0194 0195 But then back to root comparison get final RETURN_B decision, so 0196 0197 tloop 8 nodeIdx 1 irec 9 label rec intersection 0198 r.q0.f left ( 0.0138 0.0000 0.9998 -354.6146) Exit - - - 0199 r.q1.f right ( -0.0000 -0.0000 -1.0000 125.1237) Enter - r_complement r_unbounded rightIsCloser ctrl RETURN_B 0200 r.q3.f tmin/t_min ( 0.0000 0.0000 0.0000 0.0000) tmin 0.0000 t_min 0.0000 tminAdvanced 0.0000 0201 r.q4.f result ( -0.0000 -0.0000 -1.0000 125.1237) 0202 2022-08-29 09:57:04.551 INFO [40471266] [CSGSimtraceRerun::report@172] save CSGRecord.npy to fold /tmp/blyth/opticks/GeoChain/nmskSolidMask/G4CXSimtraceTest/ALL 0203 2022-08-29 09:57:04.551 INFO [40471266] [CSGRecord::Save@247] dir /tmp/blyth/opticks/GeoChain/nmskSolidMask/G4CXSimtraceTest/ALL num_record 10 0204 NP::init size 240 ebyte 4 num_char 960 0205 with : DEBUG 0206 epsilon:CSG blyth$ 0207 0208 0209 **/ 0210
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|