caching parameters for solving

This commit is contained in:
Val Erastov 2015-07-21 20:27:55 -07:00
parent 2cabcefa8b
commit 71eeeff10e
2 changed files with 12 additions and 1 deletions

View file

@ -2,6 +2,10 @@ TCAD.parametric = {};
/** @constructor */
TCAD.parametric.Param = function(id, value) {
this.reset(id, value);
};
TCAD.parametric.Param.prototype.reset = function(id, value) {
this.id = id;
this.value = value;
this.j = -1;

View file

@ -454,7 +454,14 @@ TCAD.TWO.ParametricManager.prototype.prepareForSubSystem = function(locked, subS
}
var _p = pdict[p.id];
if (_p === undefined) {
_p = new TCAD.parametric.Param(p.id, p.get());
if (p.__cachedParam__ === undefined) {
_p = new TCAD.parametric.Param(p.id, p.get());
p.__cachedParam__ = _p;
} else {
_p = p.__cachedParam__;
_p.reset(p.id, p.get());
}
_p._backingParam = p;
pdict[p.id] = _p;
}