diff --git a/Solver/function.cpp b/Solver/function.cpp index b35868293d9fccc485562912948e85ff9a1f251f..77f3392fcbec7a5470655e84b9e4f6a95f9752e4 100644 --- a/Solver/function.cpp +++ b/Solver/function.cpp @@ -325,17 +325,19 @@ dataCacheMap::~dataCacheMap() void dataCacheMap::setNbEvaluationPoints(int nbEvaluationPoints) { - if (_nbEvaluationPoints == nbEvaluationPoints) + for(std::list<dataCacheMap*>::iterator it = _children.begin(); it != _children.end(); it++) { + (*it)->setNbEvaluationPoints(nbEvaluationPoints); + } + if (_nbEvaluationPoints == nbEvaluationPoints) { + for(std::set<dataCacheDouble*>::iterator it = _allDataCaches.begin(); it != _allDataCaches.end(); it++) + (*it)->_valid = false; return; + } _nbEvaluationPoints = nbEvaluationPoints; for(std::set<dataCacheDouble*>::iterator it = _allDataCaches.begin(); it != _allDataCaches.end(); it++){ (*it)->resize(nbEvaluationPoints); } - for(std::list<dataCacheMap*>::iterator it = _children.begin(); - it != _children.end(); it++) { - (*it)->setNbEvaluationPoints(nbEvaluationPoints); - } } // Some examples of functions @@ -356,14 +358,14 @@ void functionConstant::call(dataCacheMap *m, fullMatrix<double> &val) val(i, j)=_source(j, 0); } -functionConstant::functionConstant(std::vector<double> source) : function(source.size()) +functionConstant::functionConstant(std::vector<double> source) : function(source.size(), false) { _source = fullMatrix<double>(source.size(), 1); for (size_t i = 0; i < source.size(); i++) _source(i, 0) = source[i]; } -functionConstant::functionConstant(double source) : function(1) +functionConstant::functionConstant(double source) : function(1, false) { _source.resize(1, 1); _source(0, 0) = source; diff --git a/Solver/function.h b/Solver/function.h index cf760109e7b6734e7f97150f391cd706c1bf0714..b0763d90378bb903e59b03d3a394f496b644ddc3 100644 --- a/Solver/function.h +++ b/Solver/function.h @@ -164,6 +164,7 @@ class dataCacheDouble { void _eval(); void resize(int nrow); public: + inline function * getFunction() {return _function;} //set the value (without computing it by _eval) and invalidate the // dependencies this function is needed to be able to pass the // _value to functions like gemm or mult but you cannot keep the