File: SimulationFlow.cpp

package info (click to toggle)
yade 2026.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,448 kB
  • sloc: cpp: 97,645; python: 52,173; sh: 677; makefile: 162
file content (37 lines) | stat: -rw-r--r-- 1,319 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*************************************************************************
*  Copyright (C) 2006 by Janek Kozicki                                   *
*  cosurgi@berlios.de                                                    *
*                                                                        *
*  This program is free software; it is licensed under the terms of the  *
*  GNU General Public License v2 or later. See file LICENSE for details. *
*************************************************************************/

#include "SimulationFlow.hpp"
#include "Omega.hpp"
#include "Scene.hpp"
#include <lib/base/Logging.hpp>

namespace yade { // Cannot have #include directive inside.

CREATE_LOGGER(SimulationFlow);

void SimulationFlow::singleAction()
{
	Scene* scene = Omega::instance().getScene().get();
	if (!scene) throw logic_error("SimulationFlow::singleAction: no Scene object?!");
	if (scene->subStepping) {
		LOG_INFO("Sub-stepping disabled when running simulation continuously.");
		scene->subStepping = false;
	}
	scene->moveToNextTimeStep();
	if (scene->stopAtIter > 0 && scene->iter == scene->stopAtIter) {
		scene->stopAtIter = -1;
		setTerminate(true);
	}
	if (scene->stopAtTime > 0 && scene->time >= scene->stopAtTime) {
		setTerminate(true);
		scene->stopAtTime = -1;
	}
};

} // namespace yade