MCPcopy Create free account
hub / github.com/OpenPathGuidingLibrary/openpgl / init_field

Function init_field

tools/openpgl_bench/openpgl_bench.cpp:304–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304void 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
350void validate_field(BenchParams &benchParams)
351{

Callers 1

mainFunction · 0.85

Calls 9

SetDebugArgFitRegionsMethod · 0.80
GetSizeSurfaceMethod · 0.80
InitMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
resetMethod · 0.45
UpdateMethod · 0.45
elapsedMethod · 0.45
StoreMethod · 0.45

Tested by

no test coverage detected