Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /**
0002 scuda_templated_test.cc : explore how to implement templated functions using float3/double3 etc..
0003 =====================================================================================================
0004 
0005 
0006 **/
0007 
0008 #include <iostream>
0009 #include "scuda.h"
0010 #include "scuda_double.h"
0011 #include "squad.h"
0012 #include "scuda_templated.h"
0013 
0014 template <typename F>
0015 F dummy_intersect( const F3& pos, const F3& dir )
0016 {
0017     std::cout << " pos " << pos << std::endl ;      
0018     std::cout << " dir " << dir << std::endl ;      
0019     return 0.f  ; 
0020 }
0021 
0022 template <typename F>
0023 void check_dummy_intersect()
0024 {
0025      std::cout << "check<" << ( sizeof(F) == 4 ? "float" : "double" ) << ">" << std::endl  ; 
0026 
0027      F3 pos = {0.f, 0.f, 0.f} ; 
0028      F3 dir = {0.f, 0.f, 1.f} ; 
0029      F dist = dummy_intersect<F>( pos, dir ) ; 
0030      std::cout << " dist " << dist << std::endl ; 
0031 
0032      Q4 q ; 
0033      q.u = {0,1,2,3} ; 
0034 
0035      std::cout << q << std::endl ; 
0036 }
0037 
0038 
0039 
0040 int main()
0041 {
0042      check<float>(); 
0043 #ifdef WITH_SCUDA_DOUBLE
0044      check<double>(); 
0045 #endif
0046 
0047      return 0 ; 
0048 }