Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // ~/opticks/sysrap/tests/SEvt__addGenstep_test.sh
0002 
0003 
0004 #include "scuda.h"
0005 #include "squad.h"
0006 #include "NPFold.h"
0007 
0008 
0009 struct SEvt__addGenstep_test
0010 {
0011     static void addGenstep(const NP* a)
0012     {
0013         int num_gs = a ? a->shape[0] : -1 ;
0014         assert( num_gs > 0 );
0015         quad6* qq = (quad6*)a->bytes();
0016         for(int i=0 ; i < num_gs ; i++) addGenstep(qq[i]) ;
0017     }
0018 
0019     static void addGenstep(const quad6& q_)
0020     {
0021         unsigned gentype = q_.gentype();
0022         unsigned matline_ = q_.matline();
0023         std::cout << "addGenstep_Q6 " << matline_ << std::endl ;
0024         quad6& q = const_cast<quad6&>(q_);
0025         q.set_matline(100);
0026         // THIS IS CHANGING THE ORIGIN ARRAY
0027     }
0028 };
0029 
0030 
0031 int main(int argc, char** argv)
0032 {
0033     const int N = 2 ;
0034     std::vector<quad6> gs(N) ;
0035     for(int i=0 ; i < N ; i++) gs[i].zero() ;
0036     const NP* a = NPX::ArrayFromVec<int,quad6>( gs, 6, 4) ;
0037     NP* a0 = a->copy();
0038 
0039     SEvt__addGenstep_test::addGenstep( a );
0040 
0041     NP* a1 = a->copy();
0042 
0043 
0044     NPFold* f = new NPFold ;
0045     f->add("a0", a0 );
0046     f->add("a1", a1 );
0047     f->save("$FOLD");
0048 
0049     return 0 ;
0050 }
0051 
0052