File: TimeStepper.hpp

package info (click to toggle)
yade 2019.01a-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 16,568 kB
  • sloc: cpp: 56,330; python: 30,148; ansic: 6,463; sh: 123; makefile: 56
file content (32 lines) | stat: -rw-r--r-- 1,254 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
/*************************************************************************
*  Copyright (C) 2004 by Olivier Galizzi                                 *
*  olivier.galizzi@imag.fr                                               *
*                                                                        *
*  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. *
*************************************************************************/

#pragma once

#include "Interaction.hpp"
#include "GlobalEngine.hpp"
#include "Scene.hpp"

class Body;

class TimeStepper: public GlobalEngine{
	public:
		virtual void computeTimeStep(Scene* ) { throw; };
		virtual bool isActivated() {return (active && (scene->iter % timeStepUpdateInterval == 0));};
		virtual void action() { computeTimeStep(scene);} ;
		void setActive(bool a, int nb=-1) {active = a; if (nb>0) {timeStepUpdateInterval = (unsigned int)nb;}}
		
		YADE_CLASS_BASE_DOC_ATTRS(
			TimeStepper,GlobalEngine,"Engine defining time-step (fundamental class)",
			((bool,active,true,,"is the engine active?"))
			((unsigned int,timeStepUpdateInterval,1,,"dt update interval")));
};

REGISTER_SERIALIZABLE(TimeStepper);