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

Method timeStep

Simulator/SimulatorBase.cpp:894–957  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

892}
893
894void SimulatorBase::timeStep()
895{
896 if (m_updateGUI)
897 {
898 m_gui->initSimulationParameterGUI();
899 m_updateGUI = false;
900 }
901
902 const Real stopAt = getValue<Real>(SimulatorBase::STOP_AT);
903 if (m_gui && (stopAt > 0.0) && (stopAt < TimeManager::getCurrent()->getTime()))
904 m_gui->stop();
905
906 const Real pauseAt = getValue<Real>(SimulatorBase::PAUSE_AT);
907 if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime()))
908 setValue(SimulatorBase::PAUSE, true);
909
910 if (getValue<bool>(SimulatorBase::PAUSE))
911 return;
912
913 // Simulation code
914 Simulation *sim = Simulation::getCurrent();
915 const bool sim2D = sim->is2DSimulation();
916 const unsigned int numSteps = getValue<unsigned int>(SimulatorBase::NUM_STEPS_PER_RENDER);
917 for (unsigned int i = 0; i < numSteps; i++)
918 {
919 START_TIMING("SimStep");
920 Simulation::getCurrent()->getTimeStep()->step();
921 STOP_TIMING_AVG;
922
923 m_boundarySimulator->timeStep();
924
925 step();
926
927 INCREASE_COUNTER("Time step size", TimeManager::getCurrent()->getTimeStepSize());
928
929 // Make sure that particles stay in xy-plane in a 2D simulation
930 if (sim2D)
931 {
932 for (unsigned int i = 0; i < sim->numberOfFluidModels(); i++)
933 {
934 FluidModel *model = sim->getFluidModel(i);
935 for (unsigned int i = 0; i < model->numActiveParticles(); i++)
936 {
937 model->getPosition(i)[2] = 0.0;
938 model->getVelocity(i)[2] = 0.0;
939 }
940 }
941 }
942
943#ifdef USE_DEBUG_TOOLS
944 Simulation::getCurrent()->getDebugTools()->step();
945#endif
946
947 if (m_timeStepCB)
948 m_timeStepCB();
949
950#ifdef USE_EMBEDDED_PYTHON
951 if (m_scriptObject)

Callers 1

timeStepNoGUIMethod · 0.45

Calls 14

getTimeMethod · 0.80
is2DSimulationMethod · 0.80
getTimeStepMethod · 0.80
numberOfFluidModelsMethod · 0.80
getFluidModelMethod · 0.80
numActiveParticlesMethod · 0.80
getVelocityMethod · 0.80
getDebugToolsMethod · 0.80
execStepFctMethod · 0.80
stepFunction · 0.50
stopMethod · 0.45

Tested by

no test coverage detected