File indexing completed on 2026-04-10 07:49:32
0001
0002
0003
0004
0005
0006
0007 #include <cuda_runtime.h>
0008
0009 #include "OPTICKS_LOG.hh"
0010 #include "SEventConfig.hh"
0011 #include "SEvt.hh"
0012 #include "SSim.hh"
0013 #include "QSim.hh"
0014 #include "CSGFoundry.h"
0015 #include "CSGOptiX.h"
0016
0017 int main(int argc, char** argv)
0018 {
0019 OPTICKS_LOG(argc, argv);
0020
0021 SEventConfig::SetRGModeSimulate();
0022 SEventConfig::SetDebugLite();
0023
0024 SEvt* evt = SEvt::Create(SEvt::EGPU) ;
0025
0026 const char* Rock_Air = "Rock/perfectAbsorbSurface/perfectAbsorbSurface/Air" ;
0027 const char* Air_Water = "Air///Water" ;
0028 SSim* ssim = SSim::Load();
0029 ssim->addFake(Rock_Air, Air_Water);
0030
0031
0032 CSGFoundry* fdl = CSGFoundry::Load("$CFBASE_LOCAL", "CSGFoundry") ;
0033
0034 fdl->setOverrideSim(ssim);
0035
0036 fdl->setPrimBoundary( 0, Rock_Air );
0037 fdl->setPrimBoundary( 1, Air_Water );
0038
0039
0040
0041 ssim->save("$CFBASE_LOCAL/CSGFoundry/SSim" );
0042
0043 float4 ce = make_float4( 0.f, 0.f, 0.f, 100.f );
0044
0045 SEventConfig::SetMaxExtentDomain( ce.w );
0046 SEventConfig::SetMaxTimeDomain( 10.f );
0047
0048 CSGOptiX* cx = CSGOptiX::Create(fdl);
0049
0050 QSim* qs = cx->sim ;
0051
0052 if(!SEvt::HasInputPhoton(SEvt::EGPU)) SEvt::AddTorchGenstep();
0053
0054 int eventID = 0 ;
0055 bool end = true ;
0056 qs->simulate(eventID, end);
0057
0058 cudaDeviceSynchronize();
0059
0060 evt->save();
0061
0062
0063 return 0 ;
0064 }