Skip to content
Snippets Groups Projects
Commit e8c73978 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

dg : outsideValueBoundary as child dataCacheMap

parent a440719e
Branches
Tags
No related merge requests found
...@@ -71,14 +71,18 @@ dataCacheDouble &dataCacheMap::get(const function *f, dataCacheDouble *caller) ...@@ -71,14 +71,18 @@ dataCacheDouble &dataCacheMap::get(const function *f, dataCacheDouble *caller)
r = it->second; r = it->second;
for (std::set<dataCacheDouble*>::iterator dep = r->_iDependOn.begin(); dep != r->_iDependOn.end(); dep++) { for (std::set<dataCacheDouble*>::iterator dep = r->_iDependOn.begin(); dep != r->_iDependOn.end(); dep++) {
if (&(*dep)->_cacheMap == this) { if (&(*dep)->_cacheMap == this) {
throw;
r = NULL; r = NULL;
break; break;
} }
} }
} }
} }
if (r==NULL) if (r==NULL) {
if(_parent)
throw;
r = new dataCacheDouble(this, (function*)(f)); r = new dataCacheDouble(this, (function*)(f));
}
if (caller) if (caller)
r->addMeAsDependencyOf(caller); r->addMeAsDependencyOf(caller);
return *r; return *r;
......
...@@ -147,6 +147,7 @@ class dgDataCacheMap; ...@@ -147,6 +147,7 @@ class dgDataCacheMap;
// more explanation at the head of this file // more explanation at the head of this file
class dataCacheMap { class dataCacheMap {
friend class dataCacheDouble; friend class dataCacheDouble;
protected:
dataCacheMap *_parent; dataCacheMap *_parent;
std::list<dataCacheMap*> _children; std::list<dataCacheMap*> _children;
std::vector<dataCacheMap*> _secondaryCaches; std::vector<dataCacheMap*> _secondaryCaches;
...@@ -155,15 +156,18 @@ class dataCacheMap { ...@@ -155,15 +156,18 @@ class dataCacheMap {
std::set<dataCacheDouble*> _allDataCaches; std::set<dataCacheDouble*> _allDataCaches;
std::set<dataCacheDouble*> _toInvalidateOnElement; std::set<dataCacheDouble*> _toInvalidateOnElement;
MElement *_element;
protected: MElement *_element;
void addDataCacheDouble(dataCacheDouble *data, bool invalidatedOnElement){ void addDataCacheDouble(dataCacheDouble *data, bool invalidatedOnElement){
_allDataCaches.insert(data); _allDataCaches.insert(data);
if(invalidatedOnElement) if(invalidatedOnElement)
_toInvalidateOnElement.insert(data); _toInvalidateOnElement.insert(data);
} }
public: public:
void printList() {
for(std::set<dataCacheDouble*>::iterator it = _toInvalidateOnElement.begin(); it!= _toInvalidateOnElement.end(); it++)
printf("%p\n",*it);
}
virtual dgDataCacheMap *asDgDataCacheMap() { virtual dgDataCacheMap *asDgDataCacheMap() {
Msg::Error("I'm not a dgDataCacheMap\n"); Msg::Error("I'm not a dgDataCacheMap\n");
return NULL; return NULL;
...@@ -195,7 +199,7 @@ class dataCacheMap { ...@@ -195,7 +199,7 @@ class dataCacheMap {
_nbEvaluationPoints = 0; _nbEvaluationPoints = 0;
_parent=NULL; _parent=NULL;
} }
dataCacheMap(dataCacheMap *parent) { void setParent(dataCacheMap *parent) {
_parent = parent; _parent = parent;
_parent->_children.push_back(this); _parent->_children.push_back(this);
_nbEvaluationPoints = 0; _nbEvaluationPoints = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment