|
5 | 5 |
|
6 | 6 | #include <AdePT/integration/AdePTGeant4Integration.hh>
|
7 | 7 |
|
| 8 | +#include <VecGeom/base/Stopwatch.h> |
8 | 9 | #include <VecGeom/management/BVHManager.h>
|
9 |
| -#include "VecGeom/management/GeoManager.h" |
| 10 | +#include <VecGeom/management/GeoManager.h> |
| 11 | +#ifdef ADEPT_USE_SURF |
| 12 | +#include <VecGeom/surfaces/BrepHelper.h> |
| 13 | +#endif |
10 | 14 |
|
11 | 15 | #include <G4RunManager.hh>
|
12 | 16 | #include <G4Threading.hh>
|
|
39 | 43 |
|
40 | 44 | /// Forward declarations
|
41 | 45 | namespace async_adept_impl {
|
| 46 | +void CopySurfaceModelToGPU(); |
42 | 47 | bool InitializeField(double);
|
43 | 48 | bool InitializeGeneralField(GeneralMagneticField &);
|
44 | 49 | void FreeGeneralField(GeneralMagneticField &);
|
@@ -200,12 +205,32 @@ bool AsyncAdePTTransport<IntegrationLayer>::InitializeGeometry(const vecgeom::cx
|
200 | 205 | std::cout << "CUDA Device heap limit: " << fCUDAHeapLimit << "\n";
|
201 | 206 | cudaDeviceSetLimit(cudaLimitMallocHeapSize, fCUDAHeapLimit);
|
202 | 207 | }
|
| 208 | + bool success = true; |
| 209 | +#ifdef ADEPT_USE_SURF |
| 210 | +#ifdef ADEPT_USE_SURF_SINGLE |
| 211 | + using SurfData = vgbrep::SurfData<float>; |
| 212 | + using BrepHelper = vgbrep::BrepHelper<float>; |
| 213 | +#else |
| 214 | + using SurfData = vgbrep::SurfData<double>; |
| 215 | + using BrepHelper = vgbrep::BrepHelper<double>; |
| 216 | +#endif |
| 217 | + vecgeom::Stopwatch timer; |
| 218 | + timer.Start(); |
| 219 | + if (!BrepHelper::Instance().Convert()) return 1; |
| 220 | + BrepHelper::Instance().PrintSurfData(); |
| 221 | + std::cout << "== Conversion to surface model done in " << timer.Stop() << " [s]\n"; |
| 222 | + // Upload only navigation table to the GPU |
| 223 | + cudaManager.SynchronizeNavigationTable(); |
| 224 | + async_adept_impl::CopySurfaceModelToGPU(); |
| 225 | +#else |
| 226 | + // Upload solid geometry to GPU. |
203 | 227 | cudaManager.LoadGeometry(world);
|
204 | 228 | auto world_dev = cudaManager.Synchronize();
|
| 229 | + success = world_dev != nullptr; |
205 | 230 | // Initialize BVH
|
206 | 231 | InitBVH();
|
207 |
| - |
208 |
| - return (world_dev != nullptr); |
| 232 | +#endif |
| 233 | + return success; |
209 | 234 | }
|
210 | 235 |
|
211 | 236 | template <typename IntegrationLayer>
|
|
0 commit comments