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