Commit 9979b34b authored by jouke's avatar jouke
Browse files

Turn of garbage collector when getTime is called on a SimulaVariable

object. Before this led to an error, now if it is called with t0, the
garbage collector is simply turned off, simplifying use.
parent c2b5b0c4
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -173,7 +173,10 @@ void SimulaVariable::getTime(const double & var, Time & t, Time tmin, Time tmax)
		addToDependencieGraph();
#endif
	//never collect garbage
	if(collectGarbage_) msg::error("SimulaVariable::getTime: historical data needed but garbage collection is on. Please turn it off for "+ getName());
	if(collectGarbage_) {
		garbageCollectionOff();
		if(t<table.begin()->first-MINTIMESTEP) msg::error("SimulaVariable::getTime: historical data needed but garbage collection is on. Please turn it off for "+ getName());
	}
	//assume that t is intelligent guess (seed) but check if it is within boundaries
	if(!evaluateTime(tmin)) tmin=startTime;
	//TODO could use midpoint between tmin and tmax if they are both within bounds