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

Method updateTimeStepSize

SPlisHSPlasH/Simulation.cpp:395–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393}
394
395void Simulation::updateTimeStepSize()
396{
397 if (m_cflMethod == 1)
398 updateTimeStepSizeCFL();
399 else if (m_cflMethod == 2)
400 {
401 Real h = TimeManager::getCurrent()->getTimeStepSize();
402 updateTimeStepSizeCFL();
403 const unsigned int iterations = m_timeStep->getNumIterations();
404 if (iterations == 0) // check if the method requried iterations
405 return;
406 if (iterations > 10)
407 h *= static_cast<Real>(0.9);
408 else if (iterations < 5)
409 h *= static_cast<Real>(1.1);
410 h = min(h, TimeManager::getCurrent()->getTimeStepSize());
411 TimeManager::getCurrent()->setTimeStepSize(h);
412 }
413}
414
415void Simulation::updateTimeStepSizeCFL()
416{

Callers 7

stepMethod · 0.80
stepMethod · 0.80
stepMethod · 0.80
stepMethod · 0.80
stepMethod · 0.80
stepMethod · 0.80
stepMethod · 0.80

Calls 4

minFunction · 0.85
getTimeStepSizeMethod · 0.45
getNumIterationsMethod · 0.45
setTimeStepSizeMethod · 0.45

Tested by

no test coverage detected