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

function : replce provideData by specific method (provideSolution,...), this...

function : replce provideData by specific method (provideSolution,...), this is the first step to remove all the getName and refer to functions by pointer and not by string (and later merge dataCacheDouble and function in order to simplify fnction writing)
parent 13397f66
No related branches found
No related tags found
No related merge requests found
......@@ -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("}")
......
......@@ -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
......
......@@ -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)
{
......
......@@ -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) {
......
......@@ -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);
......
......@@ -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){
......
......@@ -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
......
......@@ -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;
}
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment