MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / generateFoamFiles

Function generateFoamFiles

Tools/FoamGenerator/main.cpp:704–795  ·  view source on GitHub ↗

Generate a foam file for each frame. */

Source from the content-addressed store, hash-verified

702/** Generate a foam file for each frame.
703 */
704void generateFoamFiles()
705{
706 currentFrame = startFrame;
707
708 // Initialize kernels
709 supportRadius = static_cast<Real>(4.0) * particleRadius;
710 FoamKernel::setRadius(supportRadius);
711 CubicKernel::setRadius(supportRadius);
712
713 invDt = static_cast<Real>(1.0) / timeStepSize;
714
715#ifdef _OPENMP
716 const int maxThreads = omp_get_max_threads();
717#else
718 const int maxThreads = 1;
719#endif
720
721
722 bool chk = true;
723 bool first = true;
724 bool pointSetAdded = false;
725 START_TIMING("total");
726 while (chk)
727 {
728 // Read current frame of fluid particles
729 LOG_INFO << "Reading frame: " << currentFrame;
730 chk = readCurrentFrame();
731
732 if (first)
733 {
734 // init foam particle vectors
735 fx.reserve(10 * x0.size());
736 fv.reserve(10 * x0.size());
737 flifetime.reserve(10 * x0.size());
738 first = false;
739
740 for (int i = 0; i < maxThreads; i++)
741 {
742 fxPerThread.reserve(10 * x0.size());
743 fvPerThread.reserve(10 * x0.size());
744 flifetimePerThread.reserve(10 * x0.size());
745 }
746 }
747
748 // init neighborhood search
749 if (neighborhoodSearch == NULL)
750 {
751 neighborhoodSearch = new CompactNSearch::NeighborhoodSearch(supportRadius, false);
752 neighborhoodSearch->set_radius(supportRadius);
753 // Fluid
754 neighborhoodSearch->add_point_set(&x0[0][0], x0.size(), true, true);
755 neighborhoodSearch->set_active(0u, 0u, true);
756 pointSetAdded = true;
757 }
758 else
759 neighborhoodSearch->resize_point_set(0, &x0[0][0], x0.size());
760
761 // find the fluid neighbors of each fluid particle

Callers 1

mainFunction · 0.85

Calls 7

readCurrentFrameFunction · 0.85
removeParticlesFunction · 0.85
advectFoamParticlesFunction · 0.85
generateFoamFunction · 0.85
writeCurrentFrameFunction · 0.70
reserveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected