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

Method step

SPlisHSPlasH/WCSPH/TimeStepWCSPH.cpp:68–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68void TimeStepWCSPH::step()
69{
70 Simulation *sim = Simulation::getCurrent();
71 const unsigned int nModels = sim->numberOfFluidModels();
72 TimeManager *tm = TimeManager::getCurrent ();
73 const Real h = tm->getTimeStepSize();
74
75 sim->performNeighborhoodSearch();
76
77#ifdef USE_PERFORMANCE_OPTIMIZATION
78 precomputeValues();
79#endif
80
81 if (sim->getBoundaryHandlingMethod() == BoundaryHandlingMethods::Bender2019)
82 computeVolumeAndBoundaryX();
83 else if (sim->getBoundaryHandlingMethod() == BoundaryHandlingMethods::Koschier2017)
84 computeDensityAndGradient();
85
86 // Compute accelerations: a(t)
87 for (unsigned int fluidModelIndex = 0; fluidModelIndex < nModels; fluidModelIndex++)
88 {
89 clearAccelerations(fluidModelIndex);
90 computeDensities(fluidModelIndex);
91 }
92 sim->computeNonPressureForces();
93
94
95 for (unsigned int fluidModelIndex = 0; fluidModelIndex < nModels; fluidModelIndex++)
96 {
97 FluidModel *model = sim->getFluidModel(fluidModelIndex);
98 const Real density0 = model->getDensity0();
99 #pragma omp parallel default(shared)
100 {
101 #pragma omp for schedule(static)
102 for (int i = 0; i < (int)model->numActiveParticles(); i++)
103 {
104 Real &density = model->getDensity(i);
105 density = max(density, density0);
106 m_simulationData.getPressure(fluidModelIndex, i) = m_stiffness * (pow(density / density0, m_exponent) - static_cast<Real>(1.0));
107 }
108 }
109
110 computePressureAccels(fluidModelIndex);
111 }
112
113 sim->updateTimeStepSize();
114
115 for (unsigned int fluidModelIndex = 0; fluidModelIndex < nModels; fluidModelIndex++)
116 {
117 FluidModel *model = sim->getFluidModel(fluidModelIndex);
118 #pragma omp parallel default(shared)
119 {
120 #pragma omp for schedule(static)
121 for (int i = 0; i < (int)model->numActiveParticles(); i++)
122 {
123 if (model->getParticleState(i) == ParticleState::Active)
124 {
125 Vector3r &pos = model->getPosition(i);

Callers

nothing calls this directly

Calls 15

precomputeValuesFunction · 0.85
computeDensitiesFunction · 0.85
maxFunction · 0.85
numberOfFluidModelsMethod · 0.80
getFluidModelMethod · 0.80
getDensity0Method · 0.80
numActiveParticlesMethod · 0.80
updateTimeStepSizeMethod · 0.80
getVelocityMethod · 0.80

Tested by

no test coverage detected