Read the sequence of particle data files and determine for each frame the values * that are required to decide how many foam particles should be generated. * Finally, sum up the max values and compute the average wrt the number offrames. */
| 470 | * that are required to decide how many foam particles should be generated. |
| 471 | * Finally, sum up the max values and compute the average wrt the number offrames. */ |
| 472 | void queryValues(Real &vDiffAvgMax, Real & omegaDiffAvgMax, Real &curvatureAvgMax, Real &energyAvgMax) |
| 473 | { |
| 474 | currentFrame = startFrame; |
| 475 | numberOfFrames = 0; |
| 476 | |
| 477 | // Initialize neighborhood search |
| 478 | supportRadius = static_cast<Real>(4.0) * particleRadius; |
| 479 | |
| 480 | // Initialize kernel |
| 481 | FoamKernel::setRadius(supportRadius); |
| 482 | CubicKernel::setRadius(supportRadius); |
| 483 | |
| 484 | invDt = static_cast<Real>(1.0) / timeStepSize; |
| 485 | |
| 486 | bool chk = true; |
| 487 | bool pointSetAdded = false; |
| 488 | START_TIMING("total"); |
| 489 | while (chk) |
| 490 | { |
| 491 | LOG_INFO << "Reading frame: " << currentFrame; |
| 492 | chk = readCurrentFrame(); |
| 493 | if (!chk) |
| 494 | LOG_ERR << "Failed to read frame"; |
| 495 | |
| 496 | START_TIMING("iteration"); |
| 497 | if (neighborhoodSearch == nullptr) |
| 498 | { |
| 499 | neighborhoodSearch = new CompactNSearch::NeighborhoodSearch(supportRadius, false); |
| 500 | neighborhoodSearch->set_radius(supportRadius); |
| 501 | // Fluids |
| 502 | neighborhoodSearch->add_point_set(&x0[0][0], x0.size(), true, true); |
| 503 | } |
| 504 | else |
| 505 | neighborhoodSearch->resize_point_set(0, &x0[0][0], x0.size()); |
| 506 | |
| 507 | START_TIMING("neighborhoodSearch"); |
| 508 | neighborhoodSearch->find_neighbors(); |
| 509 | STOP_TIMING_AVG |
| 510 | |
| 511 | START_TIMING("determineValues"); |
| 512 | determineValues(); |
| 513 | STOP_TIMING_AVG |
| 514 | |
| 515 | STOP_TIMING_AVG |
| 516 | |
| 517 | numberOfFrames++; |
| 518 | |
| 519 | if (numberOfFrames % 10 == 0) |
| 520 | { |
| 521 | LOG_INFO << "v_diff - max.: " << max_v_diff << ", avg.: " << sum_v_diff / (Real)numberOfFrames; |
| 522 | LOG_INFO << "Curvature - max.: " << max_curvature << ", avg.: " << sum_curvature / (Real)numberOfFrames; |
| 523 | LOG_INFO << "Omega_diff - max.: " << max_omega_diff << ", avg.: " << sum_omega_diff / (Real)numberOfFrames; |
| 524 | LOG_INFO << "Energy - max.: " << max_energy << ", avg.: " << sum_energy / (Real)numberOfFrames; |
| 525 | } |
| 526 | |
| 527 | currentFrame++; |
| 528 | if (currentFrame > endFrame) |
| 529 | break; |
no test coverage detected