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

Method step

SPlisHSPlasH/ICSPH/TimeStepICSPH.cpp:99–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99void TimeStepICSPH::step()
100{
101 Simulation *sim = Simulation::getCurrent();
102 TimeManager *tm = TimeManager::getCurrent ();
103 const Real h = tm->getTimeStepSize();
104 const unsigned int nModels = sim->numberOfFluidModels();
105
106 //////////////////////////////////////////////////////////////////////////
107 // search the neighbors for all particles
108 //////////////////////////////////////////////////////////////////////////
109 sim->performNeighborhoodSearch();
110
111#ifdef USE_PERFORMANCE_OPTIMIZATION
112 //////////////////////////////////////////////////////////////////////////
113 // precompute the values V_j * grad W_ij for all neighbors
114 //////////////////////////////////////////////////////////////////////////
115 START_TIMING("precomputeValues")
116 precomputeValues();
117 STOP_TIMING_AVG
118#endif
119
120 //////////////////////////////////////////////////////////////////////////
121 // compute volume/density maps boundary contribution
122 //////////////////////////////////////////////////////////////////////////
123 if (sim->getBoundaryHandlingMethod() == BoundaryHandlingMethods::Bender2019)
124 computeVolumeAndBoundaryX();
125 else if (sim->getBoundaryHandlingMethod() == BoundaryHandlingMethods::Koschier2017)
126 computeDensityAndGradient();
127
128 //////////////////////////////////////////////////////////////////////////
129 // compute densities
130 //////////////////////////////////////////////////////////////////////////
131 for (unsigned int fluidModelIndex = 0; fluidModelIndex < nModels; fluidModelIndex++)
132 computeDensities(fluidModelIndex);
133
134 //////////////////////////////////////////////////////////////////////////
135 // Reset accelerations and add gravity
136 //////////////////////////////////////////////////////////////////////////
137 for (unsigned int fluidModelIndex = 0; fluidModelIndex < nModels; fluidModelIndex++)
138 clearAccelerations(fluidModelIndex);
139
140 //////////////////////////////////////////////////////////////////////////
141 // Compute all nonpressure forces like viscosity, vorticity, ...
142 //////////////////////////////////////////////////////////////////////////
143 sim->computeNonPressureForces();
144
145 //////////////////////////////////////////////////////////////////////////
146 // Update the time step size, e.g. by using a CFL condition
147 //////////////////////////////////////////////////////////////////////////
148 sim->updateTimeStepSize();
149
150 //////////////////////////////////////////////////////////////////////////
151 // compute new velocities only considering non-pressure forces
152 //////////////////////////////////////////////////////////////////////////
153 for (unsigned int m = 0; m < nModels; m++)
154 {
155 FluidModel *fm = sim->getFluidModel(m);
156 const unsigned int numParticles = fm->numActiveParticles();

Callers

nothing calls this directly

Calls 15

precomputeValuesFunction · 0.85
computeDensitiesFunction · 0.85
numberOfFluidModelsMethod · 0.80
updateTimeStepSizeMethod · 0.80
getFluidModelMethod · 0.80
numActiveParticlesMethod · 0.80
getVelocityMethod · 0.80
animateParticlesMethod · 0.80
getTimeMethod · 0.80

Tested by

no test coverage detected