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

Method step

SPlisHSPlasH/PCISPH/TimeStepPCISPH.cpp:81–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81void TimeStepPCISPH::step()
82{
83 Simulation *sim = Simulation::getCurrent();
84 TimeManager *tm = TimeManager::getCurrent();
85 const Real h = tm->getTimeStepSize();
86 const unsigned int nModels = sim->numberOfFluidModels();
87
88 for (unsigned int fluidModelIndex = 0; fluidModelIndex < nModels; fluidModelIndex++)
89 clearAccelerations(fluidModelIndex);
90
91 sim->performNeighborhoodSearch();
92
93#ifdef USE_PERFORMANCE_OPTIMIZATION
94 precomputeValues();
95#endif
96
97 if (sim->getBoundaryHandlingMethod() == BoundaryHandlingMethods::Bender2019)
98 computeVolumeAndBoundaryX();
99 else if (sim->getBoundaryHandlingMethod() == BoundaryHandlingMethods::Koschier2017)
100 computeDensityAndGradient();
101
102 for (unsigned int fluidModelIndex = 0; fluidModelIndex < nModels; fluidModelIndex++)
103 computeDensities(fluidModelIndex);
104
105 sim->computeNonPressureForces();
106
107 sim->updateTimeStepSize();
108
109 START_TIMING("pressureSolve");
110 pressureSolve();
111 STOP_TIMING_AVG;
112
113 for (unsigned int fluidModelIndex = 0; fluidModelIndex < nModels; fluidModelIndex++)
114 {
115 FluidModel *model = sim->getFluidModel(fluidModelIndex);
116 const int numParticles = (int)model->numActiveParticles();
117
118 #pragma omp parallel default(shared)
119 {
120 #pragma omp for schedule(static)
121 for (int i = 0; i < numParticles; i++)
122 {
123 if (model->getParticleState(i) == ParticleState::Active)
124 {
125 const Vector3r &accel = m_simulationData.getPressureAccel(fluidModelIndex, i);
126 Vector3r &x = model->getPosition(i);
127 Vector3r &v = model->getVelocity(i);
128 v += h * accel;
129 x += h * v;
130 }
131 }
132 }
133 }
134
135 sim->emitParticles();
136 sim->animateParticles();
137
138 // Compute new time

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