diff --git a/Solver/TESTCASES/Stommel.lua b/Solver/TESTCASES/Stommel.lua index e9537dd96803b987da67605521431aa35a2213e9..04fba32a3aa2e241aba8c45bf9ddb18a9e86f1e8 100644 --- a/Solver/TESTCASES/Stommel.lua +++ b/Solver/TESTCASES/Stommel.lua @@ -18,7 +18,7 @@ void coriolis (fullMatrix<double> &sol, fullMatrix<double> &xyz) { ]] if (Msg.getCommRank() == 0 ) then - cfile = io.popen("g++ -O3 -pipe -m32 -shared -o tmp.dylib -I ../../Numeric -I../../Common -I../../build/Common -x c++ - ","w"); + cfile = io.popen("g++-4.2 -O3 -pipe -m32 -shared -o tmp.dylib -I ../../Numeric -I../../Common -I../../build/Common -x c++ - ","w"); cfile:write("#include\"fullMatrix.h\"\nextern \"C\" {") cfile:write(CFunctions) cfile:write("}") diff --git a/Solver/dgAlgorithm.cpp b/Solver/dgAlgorithm.cpp index 6de8e415a0fb6494694692ba56a8a7094a9cf2de..1740a28e99f9f75e394cce376db84a70cae7b20a 100644 --- a/Solver/dgAlgorithm.cpp +++ b/Solver/dgAlgorithm.cpp @@ -82,8 +82,8 @@ void dgAlgorithm::computeElementaryTimeSteps ( //dofManager &dof, // the DOF man const int nbFields = claw.getNbFields(); dataCacheMap cacheMap; cacheMap.setNbEvaluationPoints(group.getNbIntegrationPoints()); - dataCacheDouble &sol = cacheMap.provideData("Solution",1,nbFields); - dataCacheDouble &UVW = cacheMap.provideData("UVW",1,3); + dataCacheDouble &sol = cacheMap.provideSolution(nbFields); + dataCacheDouble &UVW = cacheMap.provideParametricCoordinates(); UVW.set(group.getIntegrationPointsMatrix()); dataCacheElement &cacheElement = cacheMap.getElement(); // provided dataCache diff --git a/Solver/dgConservationLaw.cpp b/Solver/dgConservationLaw.cpp index 85f74c9f6003f332ea76f43e5264ec8fc07890e8..de184a8a2a32eb85745e31984303e2b4daadc128 100644 --- a/Solver/dgConservationLaw.cpp +++ b/Solver/dgConservationLaw.cpp @@ -11,7 +11,7 @@ class dgBoundaryConditionOutsideValue : public dgBoundaryCondition { public: term(dgConservationLaw *claw, dataCacheMap &cacheMapLeft,const std::string outsideValueFunctionName): dataCacheDouble(cacheMapLeft, 1, claw->getNbFields()), - solutionRight(cacheMapRight.provideData("Solution",1,claw->getNbFields())), + solutionRight(cacheMapRight.provideSolution(claw->getNbFields())), outsideValue(cacheMapLeft.get(outsideValueFunctionName,this)), _claw(claw) { @@ -51,7 +51,7 @@ class dgBoundaryConditionOutsideValue : public dgBoundaryCondition { public: maximumDiffusivity(dgConservationLaw *claw, dataCacheMap &cacheMapLeft,const std::string outsideValueFunctionName): dataCacheDouble(cacheMapLeft, 1, claw->getNbFields()), - solutionRight(cacheMapRight.provideData("Solution",1,claw->getNbFields())), + solutionRight(cacheMapRight.provideSolution(claw->getNbFields())), outsideValue(cacheMapLeft.get(outsideValueFunctionName,this)), _claw(claw) { diff --git a/Solver/dgDofContainer.cpp b/Solver/dgDofContainer.cpp index 6270552d010ee663891d8841b843f8d60ba0f5f9..645b42ec6de422c776977f78139474e9e2410f20 100644 --- a/Solver/dgDofContainer.cpp +++ b/Solver/dgDofContainer.cpp @@ -226,7 +226,7 @@ void dgDofContainer::L2Projection(std::string functionName){ dataCacheMap cacheMap; cacheMap.setNbEvaluationPoints(group.getNbIntegrationPoints()); dataCacheElement &cacheElement = cacheMap.getElement(); - cacheMap.provideData("UVW",1,3).set(group.getIntegrationPointsMatrix()); + cacheMap.provideParametricCoordinates().set(group.getIntegrationPointsMatrix()); dataCacheDouble &sourceTerm = cacheMap.get(functionName); fullMatrix<double> source; for (int iElement=0 ; iElement<group.getNbElements() ;++iElement) { diff --git a/Solver/dgFunctionIntegrator.cpp b/Solver/dgFunctionIntegrator.cpp index 58822d6b873ef84222603b7e044a155b49c31a76..f04677d184206d411e0cd165aaf1d206d6157ec4 100644 --- a/Solver/dgFunctionIntegrator.cpp +++ b/Solver/dgFunctionIntegrator.cpp @@ -11,8 +11,8 @@ dgFunctionIntegrator::dgFunctionIntegrator(std::string fName):_fName(fName){} void dgFunctionIntegrator::compute(dgDofContainer *sol,fullMatrix<double> &result){ int nbFields=sol->getNbFields(); dataCacheMap cacheMap; - dataCacheDouble &UVW=cacheMap.provideData("UVW", 1, 3); - dataCacheDouble &solutionQPe=cacheMap.provideData("Solution", 1, nbFields); + dataCacheDouble &UVW=cacheMap.provideParametricCoordinates(); + dataCacheDouble &solutionQPe=cacheMap.provideSolution(nbFields); dataCacheElement &cacheElement=cacheMap.getElement(); function *f=function::get(_fName); dataCacheDouble *F=f->newDataCache(&cacheMap); diff --git a/Solver/dgLimiter.cpp b/Solver/dgLimiter.cpp index 2bce19da120043de4576bd1d0bdc6ce05b677ebf..7a88ead065cf29407ee3775fc3d35dc29058071f 100644 --- a/Solver/dgLimiter.cpp +++ b/Solver/dgLimiter.cpp @@ -111,7 +111,7 @@ int dgSlopeLimiter::apply ( dgDofContainer *solution) dataCacheMap cacheMap; cacheMap.setNbEvaluationPoints(egroup->getNbNodes());//nbdofs for each element - dataCacheDouble &solutionE = cacheMap.provideData("Solution",1,nbFields); + dataCacheDouble &solutionE = cacheMap.provideSolution(nbFields); dataCacheElement &cacheElement = cacheMap.getElement(); dataCacheDouble *solutionEClipped = _claw->newClipToPhysics(cacheMap); if (solutionEClipped){ diff --git a/Solver/dgResidual.cpp b/Solver/dgResidual.cpp index 57005f39e7b191335f07fbfc9287513337fcb239..02cecb65bd58f96f0ac6096f4413165c01733efb 100644 --- a/Solver/dgResidual.cpp +++ b/Solver/dgResidual.cpp @@ -11,9 +11,9 @@ dgResidualVolume::dgResidualVolume(const dgConservationLaw &claw): _claw(claw), _nbFields(_claw.getNbFields()), _cacheElement(_cacheMap->getElement()), - _UVW(_cacheMap->provideData("UVW", 1, 3)), - _solutionQPe(_cacheMap->provideData("Solution", 1, _nbFields)), - _gradientSolutionQPe(_cacheMap->provideData("SolutionGradient", 3, _nbFields)), + _UVW(_cacheMap->provideParametricCoordinates()), + _solutionQPe(_cacheMap->provideSolution(_nbFields)), + _gradientSolutionQPe(_cacheMap->provideSolutionGradient(_nbFields)), _sourceTerm(_claw.newSourceTerm(*_cacheMap)), _convectiveFlux(_claw.newConvectiveFlux(*_cacheMap)), _diffusiveFlux(_claw.newDiffusiveFlux(*_cacheMap)) @@ -268,13 +268,13 @@ dgResidualInterface::dgResidualInterface (const dgConservationLaw &claw) : _nbFields(claw.getNbFields()), _cacheElementLeft(_cacheMapLeft->getElement()), _cacheElementRight(_cacheMapRight->getElement()), - _uvwLeft(_cacheMapLeft->provideData("UVW",1,3)), - _uvwRight(_cacheMapRight->provideData("UVW",1,3)), - _solutionQPLeft(_cacheMapLeft->provideData("Solution",1,_nbFields)), - _solutionQPRight(_cacheMapRight->provideData("Solution",1,_nbFields)), - _gradientSolutionLeft(_cacheMapLeft->provideData("SolutionGradient",3,_nbFields)), - _gradientSolutionRight(_cacheMapRight->provideData("SolutionGradient",3,_nbFields)), - _normals(_cacheMapLeft->provideData("Normals",1,1)), + _uvwLeft(_cacheMapLeft->provideParametricCoordinates()), + _uvwRight(_cacheMapRight->provideParametricCoordinates()), + _solutionQPLeft(_cacheMapLeft->provideSolution(_nbFields)), + _solutionQPRight(_cacheMapRight->provideSolution(_nbFields)), + _gradientSolutionLeft(_cacheMapLeft->provideSolutionGradient(_nbFields)), + _gradientSolutionRight(_cacheMapRight->provideSolutionGradient(_nbFields)), + _normals(_cacheMapLeft->provideNormals()), _riemannSolver(claw.newRiemannSolver(*_cacheMapLeft,*_cacheMapRight)), _diffusiveFluxLeft(claw.newDiffusiveFlux(*_cacheMapLeft)), _diffusiveFluxRight(claw.newDiffusiveFlux(*_cacheMapRight)), @@ -418,10 +418,10 @@ void dgResidualBoundary::compute1Group( cacheMapLeft.setNbEvaluationPoints(group.getNbIntegrationPoints()); const fullMatrix<double> &DPsiLeftDx = left.getDPsiDx(); // provided dataCache - dataCacheDouble &uvw=cacheMapLeft.provideData("UVW",1,3); - dataCacheDouble &solutionQPLeft = cacheMapLeft.provideData("Solution",1,nbFields); - dataCacheDouble &gradientSolutionLeft = cacheMapLeft.provideData("SolutionGradient",3,nbFields); - dataCacheDouble &normals = cacheMapLeft.provideData("Normals",1,1); + dataCacheDouble &uvw=cacheMapLeft.provideParametricCoordinates(); + dataCacheDouble &solutionQPLeft = cacheMapLeft.provideSolution(nbFields); + dataCacheDouble &gradientSolutionLeft = cacheMapLeft.provideSolutionGradient(nbFields); + dataCacheDouble &normals = cacheMapLeft.provideNormals(); dataCacheElement &cacheElementLeft = cacheMapLeft.getElement(); // required data // inviscid diff --git a/Solver/function.cpp b/Solver/function.cpp index 1bd3041b8a311f3982eea8f1066a64e8fdd0e58e..9d4ce365416b58d775ec25a2265308a95ecbc8b0 100644 --- a/Solver/function.cpp +++ b/Solver/function.cpp @@ -72,13 +72,27 @@ dataCacheDouble &dataCacheMap::get(const std::string &functionName, dataCache *c r->addMeAsDependencyOf(caller); return *r; } - -dataCacheDouble &dataCacheMap::provideData(std::string name,int nRowByPoints, int nCol) +dataCacheDouble &dataCacheMap::provideSolution(int nbFields) +{ + dataCacheDouble *r = new providedDataDouble(*this,1, nbFields); + _cacheDoubleMap["Solution"] = r; + return *r; +} +dataCacheDouble &dataCacheMap::provideSolutionGradient(int nbFields){ + dataCacheDouble *r = new providedDataDouble(*this,3, nbFields); + _cacheDoubleMap["SolutionGradient"] = r; + return *r; +} +dataCacheDouble &dataCacheMap::provideParametricCoordinates() +{ + dataCacheDouble *r = new providedDataDouble(*this,1, 3); + _cacheDoubleMap["UVW"] = r; + return *r; +} +dataCacheDouble &dataCacheMap::provideNormals() { - if (_cacheDoubleMap[name] != NULL) - throw; - dataCacheDouble *r = new providedDataDouble(*this,nRowByPoints, nCol); - _cacheDoubleMap[name] = r; + dataCacheDouble *r = new providedDataDouble(*this,1, 3); + _cacheDoubleMap["Normals"] = r; return *r; } diff --git a/Solver/function.h b/Solver/function.h index c7ea127f069f2c8cf69b8a80c8840d28bd661df9..f87ae98e78302c4213d58943c0bc8c9fbdad24a6 100644 --- a/Solver/function.h +++ b/Solver/function.h @@ -194,10 +194,13 @@ class dataCacheMap { //list of dgDofContainer whom gradient are needed std::map<dgDofContainer*,dataCacheDouble*> gradientFields; // end dg Part + dataCacheDouble &provideSolution(int nbFields); + dataCacheDouble &provideSolutionGradient(int nbFields); + dataCacheDouble &provideParametricCoordinates(); + dataCacheDouble &provideNormals(); dataCacheDouble &get(const std::string &functionName, dataCache *caller=0); dataCacheElement &getElement(dataCache *caller=0); - dataCacheDouble &provideData(std::string name, int nRowByPoints, int nCol); dataCacheMap(){ _cacheElement = new dataCacheElement(this); _nbEvaluationPoints = 0;