| 302 | } |
| 303 | |
| 304 | void init_field(BenchParams &benchParams) |
| 305 | { |
| 306 | int nThreads = benchParams.num_threads; |
| 307 | |
| 308 | int num_threads = 0; |
| 309 | if (nThreads > 0) |
| 310 | { |
| 311 | num_threads = nThreads; |
| 312 | } |
| 313 | std::cout << "init_field: threads = " << num_threads << std::endl; |
| 314 | openpgl::cpp::Device device(benchParams.device_type, num_threads); |
| 315 | |
| 316 | openpgl::cpp::FieldConfig fieldSettings; |
| 317 | fieldSettings.Init(PGL_SPATIAL_STRUCTURE_KDTREE, PGL_DIRECTIONAL_DISTRIBUTION_PARALLAX_AWARE_VMM, true, 32000); |
| 318 | |
| 319 | fieldSettings.SetDebugArgFitRegions(true); |
| 320 | openpgl::cpp::Field *field = new openpgl::cpp::Field(&device, fieldSettings); |
| 321 | |
| 322 | std::vector<openpgl::cpp::SampleStorage *> sampleStorages; |
| 323 | for (int i = 0; i < benchParams.samples_file_names.size(); i++) |
| 324 | { |
| 325 | std::cout << "sampleStorage[" << i << "]: " << benchParams.samples_file_names[i]; |
| 326 | openpgl::cpp::SampleStorage *sampleStorage = new openpgl::cpp::SampleStorage(benchParams.samples_file_names[i]); |
| 327 | std::cout << "\t nSamples = " << sampleStorage->GetSizeSurface() << std::endl; |
| 328 | sampleStorages.push_back(sampleStorage); |
| 329 | } |
| 330 | Timer overallTimer; |
| 331 | overallTimer.reset(); |
| 332 | for (int i = 0; i < benchParams.samples_file_names.size(); i++) |
| 333 | { |
| 334 | Timer updateTimer; |
| 335 | updateTimer.reset(); |
| 336 | field->Update(*sampleStorages[i]); |
| 337 | std::cout << "Field::Update() stepTime: " << updateTimer.elapsed() * 1e-3f << "ms" << std::endl; |
| 338 | } |
| 339 | std::cout << "Field::Update() overallTime: " << overallTimer.elapsed() * 1e-3f << "ms" << std::endl; |
| 340 | field->Store(benchParams.field_file_name); |
| 341 | delete field; |
| 342 | |
| 343 | for (int n = 0; n < sampleStorages.size(); n++) |
| 344 | { |
| 345 | delete sampleStorages[n]; |
| 346 | sampleStorages[n] = nullptr; |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | void validate_field(BenchParams &benchParams) |
| 351 | { |
no test coverage detected