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

remove dataCacheElement

parent b956130b
No related branches found
No related tags found
No related merge requests found
......@@ -85,7 +85,6 @@ void dgAlgorithm::computeElementaryTimeSteps ( //dofManager &dof, // the DOF man
dataCacheDouble &sol = cacheMap.provideSolution(nbFields);
dataCacheDouble &UVW = cacheMap.provideParametricCoordinates();
UVW.set(group.getIntegrationPointsMatrix());
dataCacheElement &cacheElement = cacheMap.getElement();
// provided dataCache
dataCacheDouble *maxConvectiveSpeed = claw.newMaxConvectiveSpeed(cacheMap);
dataCacheDouble *maximumDiffusivity = claw.newMaximumDiffusivity(cacheMap);
......@@ -100,8 +99,7 @@ void dgAlgorithm::computeElementaryTimeSteps ( //dofManager &dof, // the DOF man
DT.resize(group.getNbElements());
for (int iElement=0 ; iElement<group.getNbElements() ;++iElement) {
sol.setAsProxy(solution, iElement*nbFields, nbFields);
MElement *e = group.getElement(iElement);
cacheElement.set(e);
cacheMap.setElement(group.getElement(iElement));
const double L = group.getInnerRadius(iElement);
double spectralRadius = 0.0;
if (maximumDiffusivity){
......
......@@ -229,12 +229,11 @@ void dgDofContainer::L2Projection(const function *f){
fullMatrix<double> Source = fullMatrix<double> (group.getNbIntegrationPoints(),group.getNbElements() * _nbFields);
dataCacheMap cacheMap;
cacheMap.setNbEvaluationPoints(group.getNbIntegrationPoints());
dataCacheElement &cacheElement = cacheMap.getElement();
cacheMap.provideParametricCoordinates().set(group.getIntegrationPointsMatrix());
dataCacheDouble &sourceTerm = cacheMap.get(f);
fullMatrix<double> source;
for (int iElement=0 ; iElement<group.getNbElements() ;++iElement) {
cacheElement.set(group.getElement(iElement));
cacheMap.setElement(group.getElement(iElement));
source.setAsProxy(Source, iElement*_nbFields, _nbFields);
for (int iPt =0; iPt< group.getNbIntegrationPoints(); iPt++) {
const double detJ = group.getDetJ (iElement, iPt);
......
......@@ -13,7 +13,6 @@ void dgFunctionIntegrator::compute(dgDofContainer *sol,fullMatrix<double> &resul
dataCacheMap cacheMap;
dataCacheDouble &UVW=cacheMap.provideParametricCoordinates();
dataCacheDouble &solutionQPe=cacheMap.provideSolution(nbFields);
dataCacheElement &cacheElement=cacheMap.getElement();
dataCacheDouble &F=cacheMap.get(_f);
int nbRowResult=result.size1();
result.scale(0.0);
......@@ -26,7 +25,7 @@ void dgFunctionIntegrator::compute(dgDofContainer *sol,fullMatrix<double> &resul
group.getCollocationMatrix().mult(solProxy , solutionQP);
fullMatrix<double> IPMatrix = group.getIntegrationPointsMatrix();
for (int iElement=0 ; iElement<group.getNbElements() ;++iElement) {
cacheElement.set(group.getElement(iElement));
cacheMap.setElement(group.getElement(iElement));
solutionQPe.setAsProxy(solutionQP, iElement*nbFields, nbFields );
for (int iPt =0; iPt< group.getNbIntegrationPoints(); iPt++) {
const double detJ = group.getDetJ (iElement, iPt);
......
......@@ -115,7 +115,6 @@ int dgSlopeLimiter::apply ( dgDofContainer *solution)
dataCacheMap cacheMap;
cacheMap.setNbEvaluationPoints(egroup->getNbNodes());//nbdofs for each element
dataCacheDouble &solutionE = cacheMap.provideSolution(nbFields);
dataCacheElement &cacheElement = cacheMap.getElement();
dataCacheDouble *solutionEClipped = _claw->newClipToPhysics(cacheMap);
if (solutionEClipped){
for (int iElement=0 ; iElement<egroup->getNbElements() ;++iElement) {
......
......@@ -10,7 +10,6 @@ dgResidualVolume::dgResidualVolume(const dgConservationLaw &claw):
_cacheMap(new dataCacheMap),
_claw(claw),
_nbFields(_claw.getNbFields()),
_cacheElement(_cacheMap->getElement()),
_UVW(_cacheMap->provideParametricCoordinates()),
_solutionQPe(_cacheMap->provideSolution(_nbFields)),
_gradientSolutionQPe(_cacheMap->provideSolutionGradient(_nbFields)),
......@@ -62,7 +61,7 @@ void dgResidualVolume::compute1Group(dgGroupOfElements &group, fullMatrix<double
gradSolProxy.setAsShapeProxy(_gradientSolutionQPe.set(),group.getNbIntegrationPoints()*3, _nbFields);
dPsiDx.mult(dofs, gradSolProxy);
}
_cacheElement.set(group.getElement(iElement));
_cacheMap->setElement(group.getElement(iElement));
if(_convectiveFlux || _diffusiveFlux) {
// ----- 2.3.3 --- compute fluxes in UVW coordinates
for (int iUVW=0;iUVW<group.getDimUVW();iUVW++) {
......@@ -156,7 +155,7 @@ void dgResidualVolume::compute1GroupWithJacobian(dgGroupOfElements &group, fullM
gradSolProxy.setAsShapeProxy(_gradientSolutionQPe.set(),group.getNbIntegrationPoints()*3, _nbFields);
dPsiDx.mult(dofs, gradSolProxy);
}
_cacheElement.set(group.getElement(iElement));
_cacheMap->setElement(group.getElement(iElement));
if(_convectiveFlux || _diffusiveFlux) {
// ----- 2.3.3 --- compute fluxes in UVW coordinates
for (int iUVW=0;iUVW<group.getDimUVW();iUVW++) {
......@@ -321,7 +320,7 @@ void dgResidualInterface::compute1Group ( //dofManager &dof, // the DOF manager
for (int iFace=0 ; iFace < nbFaces ; ++iFace) {
for (int i=0; i<nbConnections; i++) {
// B1 ) adjust the proxies for this element
caches[i].getElement().set(connections[i]->getElement(iFace));
caches[i].setElement(connections[i]->getElement(iFace));
caches[i].getParametricCoordinates(NULL).setAsProxy(connections[i]->getIntegrationPointsOnElement(iFace));
caches[i].getSolution(NULL).setAsProxy(solutionQP, (iFace*nbConnections+i)*_nbFields, _nbFields);
caches[i].getNormals(NULL).setAsProxy(connections[i]->getNormals(), iFace*group.getNbIntegrationPoints(), group.getNbIntegrationPoints());
......
......@@ -16,7 +16,6 @@ class dgResidualVolume {
dataCacheMap *_cacheMap;
const dgConservationLaw &_claw;
int _nbFields;
dataCacheElement &_cacheElement;
dataCacheDouble &_UVW, &_solutionQPe, &_gradientSolutionQPe;
dataCacheDouble *_sourceTerm, *_convectiveFlux, *_diffusiveFlux;
public:
......
......@@ -35,7 +35,6 @@ class function::data : public dataCacheDouble {
{
_function = f;
_m = m;
_m->getElement(this);
_dependencies.resize ( _function->dep.size());
_depM.resize (_function->dep.size());
for (int i=0;i<_function->dep.size();i++)
......@@ -72,13 +71,6 @@ void dataCache::addMeAsDependencyOf (dataCache *newDep)
//dataCacheMap members
dataCacheElement &dataCacheMap::getElement(dataCache *caller)
{
if(caller)
_cacheElement.addMeAsDependencyOf(caller);
return _cacheElement;
}
static dataCacheDouble &returnDataCacheDouble(dataCacheDouble *data, dataCache *caller)
{
if(data==NULL) throw;
......@@ -175,7 +167,7 @@ class functionCoordinates : public function {
const fullMatrix<double> &uvw = m->getParametricCoordinates(NULL)();
for(int i = 0; i < uvw.size1(); i++){
SPoint3 p;
m->getElement(NULL)()->pnt(uvw(i, 0), uvw(i, 1), uvw(i, 2), p);
m->getElement()->pnt(uvw(i, 0), uvw(i, 1), uvw(i, 2), p);
xyz(i, 0) = p.x();
xyz(i, 1) = p.y();
xyz(i, 2) = p.z();
......
......@@ -145,20 +145,6 @@ class function {
dataCacheDouble *newDataCache(dataCacheMap *m);
};
// A special node in the dependency tree for which all the leafs
// depend on the given element
class dataCacheElement : public dataCache {
private:
MElement *_element;
public:
void set(MElement *ele){
_invalidateDependencies();
_element=ele;
};
inline MElement *operator () () { return _element; }
dataCacheElement(dataCacheMap *map):dataCache(map){}
};
// more explanation at the head of this file
class dataCacheMap {
friend class dataCache;
......@@ -176,18 +162,22 @@ class dataCacheMap {
public:
providedDataDouble(dataCacheMap &map, int nRowByPoints, int ncol):dataCacheDouble(map,nRowByPoints,ncol) {
_valid=true;
map._toInvalidateOnElement.erase(this);
}
};
std::set<dataCache*> _toDelete;
std::set<dataCacheDouble*> _toResize;
std::set<dataCacheDouble*> _toInvalidateOnElement;
MElement *_element;
dataCacheElement _cacheElement;
protected:
void addDataCache(dataCache *data){
_toDelete.insert(data);
}
void addDataCacheDouble(dataCacheDouble *data){
_toResize.insert(data);
_toInvalidateOnElement.insert(data);
}
public:
dataCacheDouble *_solution, *_solutionGradient, *_parametricCoordinates, *_normals;
......@@ -201,9 +191,14 @@ class dataCacheMap {
dataCacheDouble &provideNormals();
dataCacheDouble &get(const function *f, dataCache *caller=0);
dataCacheElement &getElement(dataCache *caller=0);
dataCacheMap():_cacheElement(this){
_toDelete.erase(&_cacheElement);
inline void setElement(MElement *element) {
_element=element;
for(std::set<dataCacheDouble*>::iterator it = _toInvalidateOnElement.begin(); it!= _toInvalidateOnElement.end(); it++) {
(*it)->_valid=false;
}
}
inline MElement *getElement() {return _element;}
dataCacheMap(){
_normals = _solution = _solutionGradient = _parametricCoordinates = 0;
_nbEvaluationPoints = 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment